export type CreateApiApiV3InvitationsCodeAcceptArgs = {code: string}; export type CreateApiApiV3InvitationsCodeAcceptOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Accept a team invitation * * POST /api/v3/invitations/{code}/accept */ export const createApiApiV3InvitationsCodeAccept = async (args: CreateApiApiV3InvitationsCodeAcceptArgs, options?: CreateApiApiV3InvitationsCodeAcceptOptions) => { const {baseUrl = "https://codemagic.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("x-auth-token", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v3/invitations/${encodeURIComponent(String(args.code))}/accept${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };