@liqhtworks/sophon-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/.github/workflows/publish.yml +56 -0
  2. package/.openapi-generator/FILES +73 -0
  3. package/.openapi-generator/VERSION +1 -0
  4. package/.openapi-generator-ignore +23 -0
  5. package/LICENSE +12 -0
  6. package/README.md +164 -0
  7. package/dist/apis/DownloadsApi.d.ts +63 -0
  8. package/dist/apis/DownloadsApi.js +58 -0
  9. package/dist/apis/HealthApi.d.ts +92 -0
  10. package/dist/apis/HealthApi.js +85 -0
  11. package/dist/apis/JobsApi.d.ts +225 -0
  12. package/dist/apis/JobsApi.js +245 -0
  13. package/dist/apis/UploadsApi.d.ts +228 -0
  14. package/dist/apis/UploadsApi.js +255 -0
  15. package/dist/apis/WebhooksApi.d.ts +138 -0
  16. package/dist/apis/WebhooksApi.js +152 -0
  17. package/dist/apis/index.d.ts +5 -0
  18. package/dist/apis/index.js +23 -0
  19. package/dist/esm/apis/DownloadsApi.d.ts +63 -0
  20. package/dist/esm/apis/DownloadsApi.js +54 -0
  21. package/dist/esm/apis/HealthApi.d.ts +92 -0
  22. package/dist/esm/apis/HealthApi.js +81 -0
  23. package/dist/esm/apis/JobsApi.d.ts +225 -0
  24. package/dist/esm/apis/JobsApi.js +241 -0
  25. package/dist/esm/apis/UploadsApi.d.ts +228 -0
  26. package/dist/esm/apis/UploadsApi.js +251 -0
  27. package/dist/esm/apis/WebhooksApi.d.ts +138 -0
  28. package/dist/esm/apis/WebhooksApi.js +148 -0
  29. package/dist/esm/apis/index.d.ts +5 -0
  30. package/dist/esm/apis/index.js +7 -0
  31. package/dist/esm/helpers/index.d.ts +3 -0
  32. package/dist/esm/helpers/index.js +3 -0
  33. package/dist/esm/helpers/jobs.d.ts +48 -0
  34. package/dist/esm/helpers/jobs.js +61 -0
  35. package/dist/esm/helpers/uploads.d.ts +71 -0
  36. package/dist/esm/helpers/uploads.js +146 -0
  37. package/dist/esm/helpers/webhooks.d.ts +23 -0
  38. package/dist/esm/helpers/webhooks.js +84 -0
  39. package/dist/esm/index.d.ts +4 -0
  40. package/dist/esm/index.js +6 -0
  41. package/dist/esm/models/CompleteUploadResponse.d.ts +57 -0
  42. package/dist/esm/models/CompleteUploadResponse.js +63 -0
  43. package/dist/esm/models/CreateJobOutputOptions.d.ts +55 -0
  44. package/dist/esm/models/CreateJobOutputOptions.js +46 -0
  45. package/dist/esm/models/CreateJobRequest.d.ts +61 -0
  46. package/dist/esm/models/CreateJobRequest.js +56 -0
  47. package/dist/esm/models/CreateUploadRequest.d.ts +44 -0
  48. package/dist/esm/models/CreateUploadRequest.js +51 -0
  49. package/dist/esm/models/CreateUploadResponse.d.ts +52 -0
  50. package/dist/esm/models/CreateUploadResponse.js +55 -0
  51. package/dist/esm/models/CreateWebhookRequest.d.ts +40 -0
  52. package/dist/esm/models/CreateWebhookRequest.js +45 -0
  53. package/dist/esm/models/ErrorBody.d.ts +72 -0
  54. package/dist/esm/models/ErrorBody.js +74 -0
  55. package/dist/esm/models/ErrorEnvelope.d.ts +33 -0
  56. package/dist/esm/models/ErrorEnvelope.js +44 -0
  57. package/dist/esm/models/JobOutputInfo.d.ts +95 -0
  58. package/dist/esm/models/JobOutputInfo.js +72 -0
  59. package/dist/esm/models/JobProfile.d.ts +49 -0
  60. package/dist/esm/models/JobProfile.js +69 -0
  61. package/dist/esm/models/JobProgress.d.ts +75 -0
  62. package/dist/esm/models/JobProgress.js +60 -0
  63. package/dist/esm/models/JobResponse.d.ts +134 -0
  64. package/dist/esm/models/JobResponse.js +94 -0
  65. package/dist/esm/models/JobSourceInfo.d.ts +62 -0
  66. package/dist/esm/models/JobSourceInfo.js +53 -0
  67. package/dist/esm/models/JobSourceType.d.ts +24 -0
  68. package/dist/esm/models/JobSourceType.js +44 -0
  69. package/dist/esm/models/JobStatus.d.ts +31 -0
  70. package/dist/esm/models/JobStatus.js +51 -0
  71. package/dist/esm/models/ListJobsResponse.d.ts +45 -0
  72. package/dist/esm/models/ListJobsResponse.js +50 -0
  73. package/dist/esm/models/OutputContainer.d.ts +27 -0
  74. package/dist/esm/models/OutputContainer.js +47 -0
  75. package/dist/esm/models/ReadyResponse.d.ts +38 -0
  76. package/dist/esm/models/ReadyResponse.js +45 -0
  77. package/dist/esm/models/UploadJobSource.d.ts +39 -0
  78. package/dist/esm/models/UploadJobSource.js +48 -0
  79. package/dist/esm/models/UploadPartResponse.d.ts +38 -0
  80. package/dist/esm/models/UploadPartResponse.js +47 -0
  81. package/dist/esm/models/UploadStatusResponse.d.ts +96 -0
  82. package/dist/esm/models/UploadStatusResponse.js +80 -0
  83. package/dist/esm/models/WebhookDeliveryPayload.d.ts +85 -0
  84. package/dist/esm/models/WebhookDeliveryPayload.js +83 -0
  85. package/dist/esm/models/WebhookListItem.d.ts +50 -0
  86. package/dist/esm/models/WebhookListItem.js +55 -0
  87. package/dist/esm/models/WebhookListResponse.d.ts +33 -0
  88. package/dist/esm/models/WebhookListResponse.js +44 -0
  89. package/dist/esm/models/WebhookResponse.d.ts +58 -0
  90. package/dist/esm/models/WebhookResponse.js +59 -0
  91. package/dist/esm/models/index.d.ts +25 -0
  92. package/dist/esm/models/index.js +27 -0
  93. package/dist/esm/runtime.d.ts +184 -0
  94. package/dist/esm/runtime.js +348 -0
  95. package/dist/helpers/index.d.ts +3 -0
  96. package/dist/helpers/index.js +19 -0
  97. package/dist/helpers/jobs.d.ts +48 -0
  98. package/dist/helpers/jobs.js +67 -0
  99. package/dist/helpers/uploads.d.ts +71 -0
  100. package/dist/helpers/uploads.js +149 -0
  101. package/dist/helpers/webhooks.d.ts +23 -0
  102. package/dist/helpers/webhooks.js +89 -0
  103. package/dist/index.d.ts +4 -0
  104. package/dist/index.js +22 -0
  105. package/dist/models/CompleteUploadResponse.d.ts +57 -0
  106. package/dist/models/CompleteUploadResponse.js +71 -0
  107. package/dist/models/CreateJobOutputOptions.d.ts +55 -0
  108. package/dist/models/CreateJobOutputOptions.js +53 -0
  109. package/dist/models/CreateJobRequest.d.ts +61 -0
  110. package/dist/models/CreateJobRequest.js +63 -0
  111. package/dist/models/CreateUploadRequest.d.ts +44 -0
  112. package/dist/models/CreateUploadRequest.js +58 -0
  113. package/dist/models/CreateUploadResponse.d.ts +52 -0
  114. package/dist/models/CreateUploadResponse.js +62 -0
  115. package/dist/models/CreateWebhookRequest.d.ts +40 -0
  116. package/dist/models/CreateWebhookRequest.js +52 -0
  117. package/dist/models/ErrorBody.d.ts +72 -0
  118. package/dist/models/ErrorBody.js +82 -0
  119. package/dist/models/ErrorEnvelope.d.ts +33 -0
  120. package/dist/models/ErrorEnvelope.js +51 -0
  121. package/dist/models/JobOutputInfo.d.ts +95 -0
  122. package/dist/models/JobOutputInfo.js +80 -0
  123. package/dist/models/JobProfile.d.ts +49 -0
  124. package/dist/models/JobProfile.js +77 -0
  125. package/dist/models/JobProgress.d.ts +75 -0
  126. package/dist/models/JobProgress.js +67 -0
  127. package/dist/models/JobResponse.d.ts +134 -0
  128. package/dist/models/JobResponse.js +101 -0
  129. package/dist/models/JobSourceInfo.d.ts +62 -0
  130. package/dist/models/JobSourceInfo.js +60 -0
  131. package/dist/models/JobSourceType.d.ts +24 -0
  132. package/dist/models/JobSourceType.js +52 -0
  133. package/dist/models/JobStatus.d.ts +31 -0
  134. package/dist/models/JobStatus.js +59 -0
  135. package/dist/models/ListJobsResponse.d.ts +45 -0
  136. package/dist/models/ListJobsResponse.js +57 -0
  137. package/dist/models/OutputContainer.d.ts +27 -0
  138. package/dist/models/OutputContainer.js +55 -0
  139. package/dist/models/ReadyResponse.d.ts +38 -0
  140. package/dist/models/ReadyResponse.js +52 -0
  141. package/dist/models/UploadJobSource.d.ts +39 -0
  142. package/dist/models/UploadJobSource.js +55 -0
  143. package/dist/models/UploadPartResponse.d.ts +38 -0
  144. package/dist/models/UploadPartResponse.js +54 -0
  145. package/dist/models/UploadStatusResponse.d.ts +96 -0
  146. package/dist/models/UploadStatusResponse.js +88 -0
  147. package/dist/models/WebhookDeliveryPayload.d.ts +85 -0
  148. package/dist/models/WebhookDeliveryPayload.js +91 -0
  149. package/dist/models/WebhookListItem.d.ts +50 -0
  150. package/dist/models/WebhookListItem.js +62 -0
  151. package/dist/models/WebhookListResponse.d.ts +33 -0
  152. package/dist/models/WebhookListResponse.js +51 -0
  153. package/dist/models/WebhookResponse.d.ts +58 -0
  154. package/dist/models/WebhookResponse.js +66 -0
  155. package/dist/models/index.d.ts +25 -0
  156. package/dist/models/index.js +43 -0
  157. package/dist/runtime.d.ts +184 -0
  158. package/dist/runtime.js +364 -0
  159. package/docs/CompleteUploadResponse.md +40 -0
  160. package/docs/CreateJobOutputOptions.md +39 -0
  161. package/docs/CreateJobRequest.md +42 -0
  162. package/docs/CreateUploadRequest.md +38 -0
  163. package/docs/CreateUploadResponse.md +40 -0
  164. package/docs/CreateWebhookRequest.md +36 -0
  165. package/docs/DownloadsApi.md +78 -0
  166. package/docs/ErrorBody.md +40 -0
  167. package/docs/ErrorEnvelope.md +34 -0
  168. package/docs/HealthApi.md +129 -0
  169. package/docs/JobOutputInfo.md +50 -0
  170. package/docs/JobProfile.md +33 -0
  171. package/docs/JobProgress.md +48 -0
  172. package/docs/JobResponse.md +62 -0
  173. package/docs/JobSourceInfo.md +44 -0
  174. package/docs/JobSourceType.md +33 -0
  175. package/docs/JobStatus.md +33 -0
  176. package/docs/JobsApi.md +407 -0
  177. package/docs/ListJobsResponse.md +38 -0
  178. package/docs/OutputContainer.md +33 -0
  179. package/docs/ReadyResponse.md +36 -0
  180. package/docs/UploadJobSource.md +37 -0
  181. package/docs/UploadPartResponse.md +36 -0
  182. package/docs/UploadStatusResponse.md +50 -0
  183. package/docs/UploadsApi.md +415 -0
  184. package/docs/WebhookDeliveryPayload.md +45 -0
  185. package/docs/WebhookEventsApi.md +91 -0
  186. package/docs/WebhookListItem.md +40 -0
  187. package/docs/WebhookListResponse.md +34 -0
  188. package/docs/WebhookResponse.md +42 -0
  189. package/docs/WebhooksApi.md +235 -0
  190. package/package.json +24 -0
  191. package/src/apis/DownloadsApi.ts +114 -0
  192. package/src/apis/HealthApi.ts +160 -0
  193. package/src/apis/JobsApi.ts +491 -0
  194. package/src/apis/UploadsApi.ts +522 -0
  195. package/src/apis/WebhooksApi.ts +298 -0
  196. package/src/apis/index.ts +7 -0
  197. package/src/helpers/index.ts +3 -0
  198. package/src/helpers/jobs.ts +112 -0
  199. package/src/helpers/uploads.ts +243 -0
  200. package/src/helpers/webhooks.ts +134 -0
  201. package/src/index.ts +7 -0
  202. package/src/models/CompleteUploadResponse.ts +102 -0
  203. package/src/models/CreateJobOutputOptions.ts +101 -0
  204. package/src/models/CreateJobRequest.ts +123 -0
  205. package/src/models/CreateUploadRequest.ts +84 -0
  206. package/src/models/CreateUploadResponse.ts +95 -0
  207. package/src/models/CreateWebhookRequest.ts +76 -0
  208. package/src/models/ErrorBody.ts +116 -0
  209. package/src/models/ErrorEnvelope.ts +74 -0
  210. package/src/models/JobOutputInfo.ts +149 -0
  211. package/src/models/JobProfile.ts +76 -0
  212. package/src/models/JobProgress.ts +133 -0
  213. package/src/models/JobResponse.ts +236 -0
  214. package/src/models/JobSourceInfo.ts +106 -0
  215. package/src/models/JobSourceType.ts +51 -0
  216. package/src/models/JobStatus.ts +58 -0
  217. package/src/models/ListJobsResponse.ts +91 -0
  218. package/src/models/OutputContainer.ts +54 -0
  219. package/src/models/ReadyResponse.ts +74 -0
  220. package/src/models/UploadJobSource.ts +85 -0
  221. package/src/models/UploadPartResponse.ts +75 -0
  222. package/src/models/UploadStatusResponse.ts +153 -0
  223. package/src/models/WebhookDeliveryPayload.ts +134 -0
  224. package/src/models/WebhookListItem.ts +93 -0
  225. package/src/models/WebhookListResponse.ts +74 -0
  226. package/src/models/WebhookResponse.ts +104 -0
  227. package/src/models/index.ts +27 -0
  228. package/src/runtime.ts +450 -0
  229. package/tsconfig.esm.json +7 -0
  230. package/tsconfig.json +20 -0
@@ -0,0 +1,491 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * SOPHON Encoding API
5
+ * REST API for submitting, monitoring, and retrieving SOPHON encoding jobs. Authentication is via Bearer API key or session cookie. All POST endpoints require an Idempotency-Key header. List endpoints use opaque cursor-based pagination.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ CreateJobRequest,
19
+ ErrorEnvelope,
20
+ JobResponse,
21
+ JobStatus,
22
+ ListJobsResponse,
23
+ } from '../models/index';
24
+ import {
25
+ CreateJobRequestFromJSON,
26
+ CreateJobRequestToJSON,
27
+ ErrorEnvelopeFromJSON,
28
+ ErrorEnvelopeToJSON,
29
+ JobResponseFromJSON,
30
+ JobResponseToJSON,
31
+ JobStatusFromJSON,
32
+ JobStatusToJSON,
33
+ ListJobsResponseFromJSON,
34
+ ListJobsResponseToJSON,
35
+ } from '../models/index';
36
+
37
+ export interface CancelJobRequest {
38
+ id: string;
39
+ }
40
+
41
+ export interface CreateJobOperationRequest {
42
+ idempotencyKey: string;
43
+ createJobRequest: CreateJobRequest;
44
+ }
45
+
46
+ export interface GetJobRequest {
47
+ id: string;
48
+ }
49
+
50
+ export interface GetJobOutputRequest {
51
+ id: string;
52
+ }
53
+
54
+ export interface ListJobsRequest {
55
+ status?: JobStatus;
56
+ limit?: number;
57
+ cursor?: string;
58
+ }
59
+
60
+ /**
61
+ * JobsApi - interface
62
+ *
63
+ * @export
64
+ * @interface JobsApiInterface
65
+ */
66
+ export interface JobsApiInterface {
67
+ /**
68
+ * Creates request options for cancelJob without sending the request
69
+ * @param {string} id
70
+ * @throws {RequiredError}
71
+ * @memberof JobsApiInterface
72
+ */
73
+ cancelJobRequestOpts(requestParameters: CancelJobRequest): Promise<runtime.RequestOpts>;
74
+
75
+ /**
76
+ * Cancels a job in a non-terminal state (queued, probing, encoding, muxing, uploading_output). Returns 409 if the job is already completed, failed, or canceled.
77
+ * @summary Cancel a job
78
+ * @param {string} id
79
+ * @param {*} [options] Override http request option.
80
+ * @throws {RequiredError}
81
+ * @memberof JobsApiInterface
82
+ */
83
+ cancelJobRaw(requestParameters: CancelJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobResponse>>;
84
+
85
+ /**
86
+ * Cancels a job in a non-terminal state (queued, probing, encoding, muxing, uploading_output). Returns 409 if the job is already completed, failed, or canceled.
87
+ * Cancel a job
88
+ */
89
+ cancelJob(requestParameters: CancelJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobResponse>;
90
+
91
+ /**
92
+ * Creates request options for createJob without sending the request
93
+ * @param {string} idempotencyKey Client-generated UUID or string for exactly-once semantics. Required on all POST endpoints. Replaying the same key with the same request body returns the original response without side effects.
94
+ * @param {CreateJobRequest} createJobRequest
95
+ * @throws {RequiredError}
96
+ * @memberof JobsApiInterface
97
+ */
98
+ createJobRequestOpts(requestParameters: CreateJobOperationRequest): Promise<runtime.RequestOpts>;
99
+
100
+ /**
101
+ * Creates a queued encoding job from a completed upload source. The `profile` field accepts explicit coffee profiles or `sophon-auto`, and `output.target_height` can request aspect-preserving downscale.
102
+ * @summary Submit an encoding job
103
+ * @param {string} idempotencyKey Client-generated UUID or string for exactly-once semantics. Required on all POST endpoints. Replaying the same key with the same request body returns the original response without side effects.
104
+ * @param {CreateJobRequest} createJobRequest
105
+ * @param {*} [options] Override http request option.
106
+ * @throws {RequiredError}
107
+ * @memberof JobsApiInterface
108
+ */
109
+ createJobRaw(requestParameters: CreateJobOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobResponse>>;
110
+
111
+ /**
112
+ * Creates a queued encoding job from a completed upload source. The `profile` field accepts explicit coffee profiles or `sophon-auto`, and `output.target_height` can request aspect-preserving downscale.
113
+ * Submit an encoding job
114
+ */
115
+ createJob(requestParameters: CreateJobOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobResponse>;
116
+
117
+ /**
118
+ * Creates request options for getJob without sending the request
119
+ * @param {string} id
120
+ * @throws {RequiredError}
121
+ * @memberof JobsApiInterface
122
+ */
123
+ getJobRequestOpts(requestParameters: GetJobRequest): Promise<runtime.RequestOpts>;
124
+
125
+ /**
126
+ * Returns current job state, progress, source metadata, resolved adaptive profile information, and output availability for one job.
127
+ * @summary Get a single job by ID
128
+ * @param {string} id
129
+ * @param {*} [options] Override http request option.
130
+ * @throws {RequiredError}
131
+ * @memberof JobsApiInterface
132
+ */
133
+ getJobRaw(requestParameters: GetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobResponse>>;
134
+
135
+ /**
136
+ * Returns current job state, progress, source metadata, resolved adaptive profile information, and output availability for one job.
137
+ * Get a single job by ID
138
+ */
139
+ getJob(requestParameters: GetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobResponse>;
140
+
141
+ /**
142
+ * Creates request options for getJobOutput without sending the request
143
+ * @param {string} id
144
+ * @throws {RequiredError}
145
+ * @memberof JobsApiInterface
146
+ */
147
+ getJobOutputRequestOpts(requestParameters: GetJobOutputRequest): Promise<runtime.RequestOpts>;
148
+
149
+ /**
150
+ * Returns a 302 redirect to a signed download URL for the job\'s output file. The signed URL is valid for 24 hours.
151
+ * @summary Get the encoded output file
152
+ * @param {string} id
153
+ * @param {*} [options] Override http request option.
154
+ * @throws {RequiredError}
155
+ * @memberof JobsApiInterface
156
+ */
157
+ getJobOutputRaw(requestParameters: GetJobOutputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
158
+
159
+ /**
160
+ * Returns a 302 redirect to a signed download URL for the job\'s output file. The signed URL is valid for 24 hours.
161
+ * Get the encoded output file
162
+ */
163
+ getJobOutput(requestParameters: GetJobOutputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
164
+
165
+ /**
166
+ * Creates request options for listJobs without sending the request
167
+ * @param {JobStatus} [status] Filter by job status.
168
+ * @param {number} [limit] Maximum number of items to return per page.
169
+ * @param {string} [cursor] Opaque pagination cursor returned in a previous response\&#39;s &#x60;next_cursor&#x60; field.
170
+ * @throws {RequiredError}
171
+ * @memberof JobsApiInterface
172
+ */
173
+ listJobsRequestOpts(requestParameters: ListJobsRequest): Promise<runtime.RequestOpts>;
174
+
175
+ /**
176
+ * Returns jobs for the authenticated organization ordered by creation time, with optional status filtering and opaque cursor pagination.
177
+ * @summary List jobs with cursor pagination
178
+ * @param {JobStatus} [status] Filter by job status.
179
+ * @param {number} [limit] Maximum number of items to return per page.
180
+ * @param {string} [cursor] Opaque pagination cursor returned in a previous response\&#39;s &#x60;next_cursor&#x60; field.
181
+ * @param {*} [options] Override http request option.
182
+ * @throws {RequiredError}
183
+ * @memberof JobsApiInterface
184
+ */
185
+ listJobsRaw(requestParameters: ListJobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListJobsResponse>>;
186
+
187
+ /**
188
+ * Returns jobs for the authenticated organization ordered by creation time, with optional status filtering and opaque cursor pagination.
189
+ * List jobs with cursor pagination
190
+ */
191
+ listJobs(requestParameters: ListJobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListJobsResponse>;
192
+
193
+ }
194
+
195
+ /**
196
+ *
197
+ */
198
+ export class JobsApi extends runtime.BaseAPI implements JobsApiInterface {
199
+
200
+ /**
201
+ * Creates request options for cancelJob without sending the request
202
+ */
203
+ async cancelJobRequestOpts(requestParameters: CancelJobRequest): Promise<runtime.RequestOpts> {
204
+ if (requestParameters['id'] == null) {
205
+ throw new runtime.RequiredError(
206
+ 'id',
207
+ 'Required parameter "id" was null or undefined when calling cancelJob().'
208
+ );
209
+ }
210
+
211
+ const queryParameters: any = {};
212
+
213
+ const headerParameters: runtime.HTTPHeaders = {};
214
+
215
+ if (this.configuration && this.configuration.accessToken) {
216
+ const token = this.configuration.accessToken;
217
+ const tokenString = await token("bearerApiKey", []);
218
+
219
+ if (tokenString) {
220
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
221
+ }
222
+ }
223
+
224
+ let urlPath = `/v1/jobs/{id}`;
225
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
226
+
227
+ return {
228
+ path: urlPath,
229
+ method: 'DELETE',
230
+ headers: headerParameters,
231
+ query: queryParameters,
232
+ };
233
+ }
234
+
235
+ /**
236
+ * Cancels a job in a non-terminal state (queued, probing, encoding, muxing, uploading_output). Returns 409 if the job is already completed, failed, or canceled.
237
+ * Cancel a job
238
+ */
239
+ async cancelJobRaw(requestParameters: CancelJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobResponse>> {
240
+ const requestOptions = await this.cancelJobRequestOpts(requestParameters);
241
+ const response = await this.request(requestOptions, initOverrides);
242
+
243
+ return new runtime.JSONApiResponse(response, (jsonValue) => JobResponseFromJSON(jsonValue));
244
+ }
245
+
246
+ /**
247
+ * Cancels a job in a non-terminal state (queued, probing, encoding, muxing, uploading_output). Returns 409 if the job is already completed, failed, or canceled.
248
+ * Cancel a job
249
+ */
250
+ async cancelJob(requestParameters: CancelJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobResponse> {
251
+ const response = await this.cancelJobRaw(requestParameters, initOverrides);
252
+ return await response.value();
253
+ }
254
+
255
+ /**
256
+ * Creates request options for createJob without sending the request
257
+ */
258
+ async createJobRequestOpts(requestParameters: CreateJobOperationRequest): Promise<runtime.RequestOpts> {
259
+ if (requestParameters['idempotencyKey'] == null) {
260
+ throw new runtime.RequiredError(
261
+ 'idempotencyKey',
262
+ 'Required parameter "idempotencyKey" was null or undefined when calling createJob().'
263
+ );
264
+ }
265
+
266
+ if (requestParameters['createJobRequest'] == null) {
267
+ throw new runtime.RequiredError(
268
+ 'createJobRequest',
269
+ 'Required parameter "createJobRequest" was null or undefined when calling createJob().'
270
+ );
271
+ }
272
+
273
+ const queryParameters: any = {};
274
+
275
+ const headerParameters: runtime.HTTPHeaders = {};
276
+
277
+ headerParameters['Content-Type'] = 'application/json';
278
+
279
+ if (requestParameters['idempotencyKey'] != null) {
280
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
281
+ }
282
+
283
+ if (this.configuration && this.configuration.accessToken) {
284
+ const token = this.configuration.accessToken;
285
+ const tokenString = await token("bearerApiKey", []);
286
+
287
+ if (tokenString) {
288
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
289
+ }
290
+ }
291
+
292
+ let urlPath = `/v1/jobs`;
293
+
294
+ return {
295
+ path: urlPath,
296
+ method: 'POST',
297
+ headers: headerParameters,
298
+ query: queryParameters,
299
+ body: CreateJobRequestToJSON(requestParameters['createJobRequest']),
300
+ };
301
+ }
302
+
303
+ /**
304
+ * Creates a queued encoding job from a completed upload source. The `profile` field accepts explicit coffee profiles or `sophon-auto`, and `output.target_height` can request aspect-preserving downscale.
305
+ * Submit an encoding job
306
+ */
307
+ async createJobRaw(requestParameters: CreateJobOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobResponse>> {
308
+ const requestOptions = await this.createJobRequestOpts(requestParameters);
309
+ const response = await this.request(requestOptions, initOverrides);
310
+
311
+ return new runtime.JSONApiResponse(response, (jsonValue) => JobResponseFromJSON(jsonValue));
312
+ }
313
+
314
+ /**
315
+ * Creates a queued encoding job from a completed upload source. The `profile` field accepts explicit coffee profiles or `sophon-auto`, and `output.target_height` can request aspect-preserving downscale.
316
+ * Submit an encoding job
317
+ */
318
+ async createJob(requestParameters: CreateJobOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobResponse> {
319
+ const response = await this.createJobRaw(requestParameters, initOverrides);
320
+ return await response.value();
321
+ }
322
+
323
+ /**
324
+ * Creates request options for getJob without sending the request
325
+ */
326
+ async getJobRequestOpts(requestParameters: GetJobRequest): Promise<runtime.RequestOpts> {
327
+ if (requestParameters['id'] == null) {
328
+ throw new runtime.RequiredError(
329
+ 'id',
330
+ 'Required parameter "id" was null or undefined when calling getJob().'
331
+ );
332
+ }
333
+
334
+ const queryParameters: any = {};
335
+
336
+ const headerParameters: runtime.HTTPHeaders = {};
337
+
338
+ if (this.configuration && this.configuration.accessToken) {
339
+ const token = this.configuration.accessToken;
340
+ const tokenString = await token("bearerApiKey", []);
341
+
342
+ if (tokenString) {
343
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
344
+ }
345
+ }
346
+
347
+ let urlPath = `/v1/jobs/{id}`;
348
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
349
+
350
+ return {
351
+ path: urlPath,
352
+ method: 'GET',
353
+ headers: headerParameters,
354
+ query: queryParameters,
355
+ };
356
+ }
357
+
358
+ /**
359
+ * Returns current job state, progress, source metadata, resolved adaptive profile information, and output availability for one job.
360
+ * Get a single job by ID
361
+ */
362
+ async getJobRaw(requestParameters: GetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobResponse>> {
363
+ const requestOptions = await this.getJobRequestOpts(requestParameters);
364
+ const response = await this.request(requestOptions, initOverrides);
365
+
366
+ return new runtime.JSONApiResponse(response, (jsonValue) => JobResponseFromJSON(jsonValue));
367
+ }
368
+
369
+ /**
370
+ * Returns current job state, progress, source metadata, resolved adaptive profile information, and output availability for one job.
371
+ * Get a single job by ID
372
+ */
373
+ async getJob(requestParameters: GetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobResponse> {
374
+ const response = await this.getJobRaw(requestParameters, initOverrides);
375
+ return await response.value();
376
+ }
377
+
378
+ /**
379
+ * Creates request options for getJobOutput without sending the request
380
+ */
381
+ async getJobOutputRequestOpts(requestParameters: GetJobOutputRequest): Promise<runtime.RequestOpts> {
382
+ if (requestParameters['id'] == null) {
383
+ throw new runtime.RequiredError(
384
+ 'id',
385
+ 'Required parameter "id" was null or undefined when calling getJobOutput().'
386
+ );
387
+ }
388
+
389
+ const queryParameters: any = {};
390
+
391
+ const headerParameters: runtime.HTTPHeaders = {};
392
+
393
+ if (this.configuration && this.configuration.accessToken) {
394
+ const token = this.configuration.accessToken;
395
+ const tokenString = await token("bearerApiKey", []);
396
+
397
+ if (tokenString) {
398
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
399
+ }
400
+ }
401
+
402
+ let urlPath = `/v1/jobs/{id}/output`;
403
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
404
+
405
+ return {
406
+ path: urlPath,
407
+ method: 'GET',
408
+ headers: headerParameters,
409
+ query: queryParameters,
410
+ };
411
+ }
412
+
413
+ /**
414
+ * Returns a 302 redirect to a signed download URL for the job\'s output file. The signed URL is valid for 24 hours.
415
+ * Get the encoded output file
416
+ */
417
+ async getJobOutputRaw(requestParameters: GetJobOutputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
418
+ const requestOptions = await this.getJobOutputRequestOpts(requestParameters);
419
+ const response = await this.request(requestOptions, initOverrides);
420
+
421
+ return new runtime.VoidApiResponse(response);
422
+ }
423
+
424
+ /**
425
+ * Returns a 302 redirect to a signed download URL for the job\'s output file. The signed URL is valid for 24 hours.
426
+ * Get the encoded output file
427
+ */
428
+ async getJobOutput(requestParameters: GetJobOutputRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
429
+ await this.getJobOutputRaw(requestParameters, initOverrides);
430
+ }
431
+
432
+ /**
433
+ * Creates request options for listJobs without sending the request
434
+ */
435
+ async listJobsRequestOpts(requestParameters: ListJobsRequest): Promise<runtime.RequestOpts> {
436
+ const queryParameters: any = {};
437
+
438
+ if (requestParameters['status'] != null) {
439
+ queryParameters['status'] = requestParameters['status'];
440
+ }
441
+
442
+ if (requestParameters['limit'] != null) {
443
+ queryParameters['limit'] = requestParameters['limit'];
444
+ }
445
+
446
+ if (requestParameters['cursor'] != null) {
447
+ queryParameters['cursor'] = requestParameters['cursor'];
448
+ }
449
+
450
+ const headerParameters: runtime.HTTPHeaders = {};
451
+
452
+ if (this.configuration && this.configuration.accessToken) {
453
+ const token = this.configuration.accessToken;
454
+ const tokenString = await token("bearerApiKey", []);
455
+
456
+ if (tokenString) {
457
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
458
+ }
459
+ }
460
+
461
+ let urlPath = `/v1/jobs`;
462
+
463
+ return {
464
+ path: urlPath,
465
+ method: 'GET',
466
+ headers: headerParameters,
467
+ query: queryParameters,
468
+ };
469
+ }
470
+
471
+ /**
472
+ * Returns jobs for the authenticated organization ordered by creation time, with optional status filtering and opaque cursor pagination.
473
+ * List jobs with cursor pagination
474
+ */
475
+ async listJobsRaw(requestParameters: ListJobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListJobsResponse>> {
476
+ const requestOptions = await this.listJobsRequestOpts(requestParameters);
477
+ const response = await this.request(requestOptions, initOverrides);
478
+
479
+ return new runtime.JSONApiResponse(response, (jsonValue) => ListJobsResponseFromJSON(jsonValue));
480
+ }
481
+
482
+ /**
483
+ * Returns jobs for the authenticated organization ordered by creation time, with optional status filtering and opaque cursor pagination.
484
+ * List jobs with cursor pagination
485
+ */
486
+ async listJobs(requestParameters: ListJobsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListJobsResponse> {
487
+ const response = await this.listJobsRaw(requestParameters, initOverrides);
488
+ return await response.value();
489
+ }
490
+
491
+ }