export type CreateApiV1beta1ProjectsProjectFreightFreightNameOrAliasApproveArgs = {project: string, 'freight-name-or-alias': string, stage: string}; export type CreateApiV1beta1ProjectsProjectFreightFreightNameOrAliasApproveOptions = {baseUrl: string, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approve Freight for promotion to a Stage * * POST /v1beta1/projects/{project}/freight/{freight-name-or-alias}/approve */ export const createApiV1beta1ProjectsProjectFreightFreightNameOrAliasApprove = async (args: CreateApiV1beta1ProjectsProjectFreightFreightNameOrAliasApproveArgs, options: CreateApiV1beta1ProjectsProjectFreightFreightNameOrAliasApproveOptions) => { const {baseUrl, fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.stage != null) query.append("stage", String(args.stage)) if (BearerAuth !== undefined) headers.set("Authorization", BearerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1beta1/projects/${encodeURIComponent(String(args.project))}/freight/${encodeURIComponent(String(args['freight-name-or-alias']))}/approve${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 };