export type TeamV2CreationModel = {name: string, parent_team?: string | undefined, initials?: string | undefined, color?: string | undefined}; export type CreateApiApiV2TeamsArgs = {body: Array}; export type CreateApiApiV2TeamsOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Teams Api * * POST /api/v2/teams */ export const createApiApiV2Teams = async (args: CreateApiApiV2TeamsArgs, options?: CreateApiApiV2TeamsOptions) => { const {baseUrl = "https://public-api.linearb.io", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyHeader !== undefined) headers.set("x-api-key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/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 };