export type DeploymentStatusReport = {deploymentKey: string, appVersion: string, clientUniqueId?: string | undefined, label?: string | undefined, status?: ('DeploymentSucceeded' | 'DeploymentFailed') | undefined, previousDeploymentKey?: string | undefined, previousLabelOrAppVersion?: string | undefined}; export type CreateApiV01PublicCodepushReportStatusDeployArgs = {body: DeploymentStatusReport}; export type CreateApiV01PublicCodepushReportStatusDeployOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Report deployment status (v0.1 API) * * POST /v0.1/public/codepush/report_status/deploy */ export const createApiV01PublicCodepushReportStatusDeploy = async (args: CreateApiV01PublicCodepushReportStatusDeployArgs, options: CreateApiV01PublicCodepushReportStatusDeployOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v0.1/public/codepush/report_status/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 };