export type CreateApiApiProjectsProjectIdReleasesDeployArgs = {projectId: string, body: {releaseId: string, environmentId: string, comment?: (string | null) | undefined}}; export type CreateApiApiProjectsProjectIdReleasesDeployOptions = {baseUrl: string, personalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deploy a release * * POST /api/projects/{projectId}/releases/deploy * * Also accepts auth: internalAuth */ export const createApiApiProjectsProjectIdReleasesDeploy = async (args: CreateApiApiProjectsProjectIdReleasesDeployArgs, options: CreateApiApiProjectsProjectIdReleasesDeployOptions) => { const {baseUrl, 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(/\/+$/, '')}/api/projects/${encodeURIComponent(String(args.projectId))}/releases/deploy${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 };