export type SetRoleRequest = {role: string}; export type PatchApiV1OrgMembersIdRoleArgs = {id: string, body: SetRoleRequest}; export type PatchApiV1OrgMembersIdRoleOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Change a member's role. * * PATCH /v1/org/members/{id}/role */ export const patchApiV1OrgMembersIdRole = async (args: PatchApiV1OrgMembersIdRoleArgs, options?: PatchApiV1OrgMembersIdRoleOptions) => { const {baseUrl = "https://api.smolmachines.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/org/members/${encodeURIComponent(String(args.id))}/role${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };