export type CreateApiAccountsAccountIdSpacesSpaceIdProjectsArgs = {'X-PhraseApp-OTP'?: string | undefined, account_id: string, space_id: string, body: {id: string}}; export type CreateApiAccountsAccountIdSpacesSpaceIdProjectsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add Project to Space * * POST /accounts/{account_id}/spaces/{space_id}/projects */ export const createApiAccountsAccountIdSpacesSpaceIdProjects = async (args: CreateApiAccountsAccountIdSpacesSpaceIdProjectsArgs, options?: CreateApiAccountsAccountIdSpacesSpaceIdProjectsOptions) => { const {baseUrl = "https://eu.phrase.com/control-hub", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-PhraseApp-OTP'] != null) headers.set("X-PhraseApp-OTP", String(args['X-PhraseApp-OTP'])) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.account_id))}/spaces/${encodeURIComponent(String(args.space_id))}/projects${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 };