export type CreateApiV1TeamsArgs = {body: {name: string, description?: string | undefined, email: string}}; export type CreateApiV1TeamsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create team * * POST /v1/teams */ export const createApiV1Teams = async (args: CreateApiV1TeamsArgs, options?: CreateApiV1TeamsOptions) => { const {baseUrl = "https://placeholder/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/teams${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 };