Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/gitlab

src/get-current-user.ts

18 lines · 792 B · TypeScript
import type { GitlabAuthInput } from './types.ts'
export { getCurrentUser } from './core.ts'
import { getCurrentUser } from './core.ts'

/**
 * Verify which GitLab identity the selected OAuth integration or PAT resolves to.
 *
 * @param params.integrationName - Saved OAuth integration; defaults to `gitlab`.
 * @param params.secretName - PAT secret name; when set, uses the PAT lane.
 * @returns User id, username, name, and profile URL.
 * @example
 * import getGitlabCurrentUser from 'kody:@kody/gitlab/get-current-user'
 * const user = await getGitlabCurrentUser()
 * // => { auth: { mode: 'oauth', integrationName: 'gitlab', ... }, username: 'example', id: 1 }
 */
export default async function getGitlabCurrentUser(params: GitlabAuthInput = {}) {
	return await getCurrentUser(params)
}