export type UpdateMembershipBodyDto = {roleSlug: string}; export type PatchApiV1OrgsWorkosOrgIdMembershipsMembershipIdArgs = {workosOrgId: string, membershipId: string, body: UpdateMembershipBodyDto}; export type PatchApiV1OrgsWorkosOrgIdMembershipsMembershipIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Change a member role. Blocked for non-owners on owner-targets and on the sole owner. * * PATCH /v1/orgs/{workosOrgId}/memberships/{membershipId} */ export const patchApiV1OrgsWorkosOrgIdMembershipsMembershipId = async (args: PatchApiV1OrgsWorkosOrgIdMembershipsMembershipIdArgs, options: PatchApiV1OrgsWorkosOrgIdMembershipsMembershipIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/orgs/${encodeURIComponent(String(args.workosOrgId))}/memberships/${encodeURIComponent(String(args.membershipId))}${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 };