export type Permissions = 'all' | 'iam.tenant.create' | 'iam.tenant.read' | 'iam.tenant.update' | 'iam.tenant.delete' | 'iam.secret.create' | 'iam.secret.read' | 'iam.key.create' | 'iam.key.read' | 'iam.key.delete' | 'iam.account.create' | 'iam.account.read' | 'iam.account.update' | 'iam.account.delete' | 'iam.token.create' | 'iam.token.update' | 'iam.token.delete' | 'iam.token.introspect' | 'tenant.all' | 'tenant.membership.create' | 'tenant.membership.update' | 'tenant.membership.delete' | 'tenant.profile.read' | 'tenant.profile.update' | 'tenant.profile.delete' | 'tenant.roles.read' | 'tenant.roles.create' | 'tenant.roles.update' | 'tenant.roles.delete' | 'tenant.flows.read' | 'tenant.flows.create' | 'tenant.flows.update' | 'tenant.flows.delete'; export type Role = {id?: string | undefined, name?: string | undefined, permissions?: Array | undefined, scope?: string | undefined, createdAt?: string | undefined, updatedAt?: string | undefined, isGlobal?: boolean | undefined, description?: string | undefined}; export type UserBody = {username?: string | undefined, roles?: Array | undefined}; export type CreateApiApiV1TenantsIdUsersArgs = {id: string, body: UserBody}; export type CreateApiApiV1TenantsIdUsersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add a user to the tenant * * POST /api/v1/tenants/{id}/users */ export const createApiApiV1TenantsIdUsers = async (args: CreateApiApiV1TenantsIdUsersArgs, options?: CreateApiApiV1TenantsIdUsersOptions) => { const {baseUrl = "https://iam.example.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/tenants/${encodeURIComponent(String(args.id))}/users${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 };