export type UpdateApiV4UploadsUploadIdArgs = {'Content-Range': string, uploadId: string, 'Content-Type': string}; export type UpdateApiV4UploadsUploadIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Chunked upload of data * * PUT /v4/uploads/{uploadId} * * Also accepts auth: oauth2_authorization_code */ export const updateApiV4UploadsUploadId = async (args: UpdateApiV4UploadsUploadIdArgs, options?: UpdateApiV4UploadsUploadIdOptions) => { const {baseUrl = "https://platform.climate.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Range'] != null) headers.set("Content-Range", String(args['Content-Range'])) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v4/uploads/${encodeURIComponent(String(args.uploadId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };