export type IdentityEntityAliasRequest = {canonical_id?: string | undefined, custom_metadata?: Record | undefined, entity_id?: string | undefined, id?: string | undefined, mount_accessor?: string | undefined, name?: string | undefined}; export type CreateApiIdentityEntityAliasArgs = {body: IdentityEntityAliasRequest}; export type CreateApiIdentityEntityAliasOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create a new alias. * * POST /identity/entity-alias */ export const createApiIdentityEntityAlias = async (args: CreateApiIdentityEntityAliasArgs, options: CreateApiIdentityEntityAliasOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/identity/entity-alias${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 };