export type CreateApiV3TeamsTeamIdSystemAccountsArgs = {body: {id?: string | undefined}}; export type CreateApiV3TeamsTeamIdSystemAccountsOptions = {baseUrl?: string | undefined, personalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add System Account to a Team * * POST /v3/teams/{teamId}/system-accounts * * Also accepts auth: systemAccountAccessToken, konnectAccessToken, serviceAccessToken */ export const createApiV3TeamsTeamIdSystemAccounts = async (args: CreateApiV3TeamsTeamIdSystemAccountsArgs, options?: CreateApiV3TeamsTeamIdSystemAccountsOptions) => { const {baseUrl = "https://global.api.konghq.com", fetch: fetchFn = fetch, personalAccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (personalAccessToken !== undefined) headers.set('authorization', `Bearer ${personalAccessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/teams/${encodeURIComponent(String(args.teamId))}/system-accounts${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 };