export type TokenCreateOrphanRequest = {display_name?: string | undefined, entity_alias?: string | undefined, explicit_max_ttl?: string | undefined, id?: string | undefined, metadata?: Record | undefined, no_default_policy?: boolean | undefined, no_parent?: boolean | undefined, num_uses?: number | undefined, period?: string | undefined, policies?: Array | undefined, renewable?: boolean | undefined, role_name?: string | undefined, ttl?: string | undefined, type?: string | undefined}; export type CreateApiAuthTokenCreateOrphanArgs = {body: TokenCreateOrphanRequest}; export type CreateApiAuthTokenCreateOrphanOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * The token create path is used to create new orphan tokens. * * POST /auth/token/create-orphan */ export const createApiAuthTokenCreateOrphan = async (args: CreateApiAuthTokenCreateOrphanArgs, options: CreateApiAuthTokenCreateOrphanOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/auth/token/create-orphan${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };