export type CreateApihttpLocalhost8000ProjectIdProjectTokensArgs = {project_id: string}; export type CreateApihttpLocalhost8000ProjectIdProjectTokensOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new project token. * * POST http://localhost:8000/{project_id}/project-tokens/ */ export const createApihttpLocalhost8000ProjectIdProjectTokens = async (args: CreateApihttpLocalhost8000ProjectIdProjectTokensArgs, options?: CreateApihttpLocalhost8000ProjectIdProjectTokensOptions) => { const {baseUrl = "http://localhost:8000", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}http://localhost:8000/${encodeURIComponent(String(args.project_id))}/project-tokens/${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 };