@giveitsmaller/contracts 0.1.0 → 0.1.2

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 (207) hide show
  1. package/dist/asyncapi/ErrorCode.d.ts +18 -0
  2. package/dist/asyncapi/ErrorCode.js +19 -0
  3. package/dist/asyncapi/MergeOutputType.d.ts +8 -0
  4. package/dist/asyncapi/MergeOutputType.js +9 -0
  5. package/{asyncapi/NotificationsOperationsQueue.ts → dist/asyncapi/NotificationsOperationsQueue.d.ts} +2 -2
  6. package/dist/asyncapi/NotificationsOperationsQueue.js +1 -0
  7. package/dist/asyncapi/OperationMetrics.d.ts +11 -0
  8. package/dist/asyncapi/OperationMetrics.js +1 -0
  9. package/dist/asyncapi/OperationProgress.d.ts +12 -0
  10. package/dist/asyncapi/OperationProgress.js +1 -0
  11. package/dist/asyncapi/OperationRequest.d.ts +21 -0
  12. package/dist/asyncapi/OperationRequest.js +1 -0
  13. package/dist/asyncapi/OperationResult.d.ts +20 -0
  14. package/dist/asyncapi/OperationResult.js +1 -0
  15. package/dist/asyncapi/OperationType.d.ts +9 -0
  16. package/dist/asyncapi/OperationType.js +10 -0
  17. package/dist/asyncapi/ProgressStatus.d.ts +7 -0
  18. package/dist/asyncapi/ProgressStatus.js +8 -0
  19. package/dist/asyncapi/ResultStatus.d.ts +5 -0
  20. package/dist/asyncapi/ResultStatus.js +6 -0
  21. package/dist/asyncapi/SourceEntry.d.ts +8 -0
  22. package/dist/asyncapi/SourceEntry.js +1 -0
  23. package/dist/asyncapi/index.d.ts +11 -0
  24. package/dist/asyncapi/index.js +5 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.js +4 -0
  27. package/dist/openapi/index.d.ts +2 -0
  28. package/dist/openapi/index.js +4 -0
  29. package/dist/openapi/models/CallbackEventType.d.ts +32 -0
  30. package/{openapi/models/CallbackEventType.ts → dist/openapi/models/CallbackEventType.js} +13 -23
  31. package/dist/openapi/models/ContactRequest.d.ts +60 -0
  32. package/{openapi/models/ContactRequest.ts → dist/openapi/models/ContactRequest.js} +14 -71
  33. package/dist/openapi/models/ContactSubject.d.ts +34 -0
  34. package/{openapi/models/ContactSubject.ts → dist/openapi/models/ContactSubject.js} +13 -23
  35. package/dist/openapi/models/ContactValidationErrorResponse.d.ts +35 -0
  36. package/{openapi/models/ContactValidationErrorResponse.ts → dist/openapi/models/ContactValidationErrorResponse.js} +9 -33
  37. package/dist/openapi/models/ErrorEnvelope.d.ts +45 -0
  38. package/{openapi/models/ErrorEnvelope.ts → dist/openapi/models/ErrorEnvelope.js} +12 -44
  39. package/{openapi/models/ExportConfig.ts → dist/openapi/models/ExportConfig.d.ts} +12 -57
  40. package/dist/openapi/models/ExportConfig.js +59 -0
  41. package/{openapi/models/JobDefinition.ts → dist/openapi/models/JobDefinition.d.ts} +9 -33
  42. package/dist/openapi/models/JobDefinition.js +31 -0
  43. package/dist/openapi/models/JobDownload.d.ts +45 -0
  44. package/dist/openapi/models/JobDownload.js +52 -0
  45. package/{openapi/models/JobInput.ts → dist/openapi/models/JobInput.d.ts} +13 -49
  46. package/dist/openapi/models/JobInput.js +47 -0
  47. package/dist/openapi/models/JobResponse.d.ts +58 -0
  48. package/dist/openapi/models/JobResponse.js +61 -0
  49. package/{openapi/models/JobSource.ts → dist/openapi/models/JobSource.d.ts} +9 -45
  50. package/dist/openapi/models/JobSource.js +45 -0
  51. package/dist/openapi/models/JobStatus.d.ts +34 -0
  52. package/{openapi/models/JobStatus.ts → dist/openapi/models/JobStatus.js} +13 -23
  53. package/dist/openapi/models/JobType.d.ts +32 -0
  54. package/{openapi/models/JobType.ts → dist/openapi/models/JobType.js} +13 -23
  55. package/dist/openapi/models/LivenessResponse.d.ts +32 -0
  56. package/{openapi/models/LivenessResponse.ts → dist/openapi/models/LivenessResponse.js} +9 -32
  57. package/dist/openapi/models/MetadataResponse.d.ts +139 -0
  58. package/dist/openapi/models/MetadataResponse.js +85 -0
  59. package/dist/openapi/models/MetadataResponseDimensions.d.ts +38 -0
  60. package/{openapi/models/MetadataResponseDimensions.ts → dist/openapi/models/MetadataResponseDimensions.js} +7 -37
  61. package/dist/openapi/models/MetadataResponseExif.d.ts +51 -0
  62. package/{openapi/models/MetadataResponseExif.ts → dist/openapi/models/MetadataResponseExif.js} +8 -57
  63. package/dist/openapi/models/MetadataResponseExifGps.d.ts +38 -0
  64. package/{openapi/models/MetadataResponseExifGps.ts → dist/openapi/models/MetadataResponseExifGps.js} +7 -37
  65. package/dist/openapi/models/MetadataSuccessEnvelope.d.ts +46 -0
  66. package/{openapi/models/MetadataSuccessEnvelope.ts → dist/openapi/models/MetadataSuccessEnvelope.js} +13 -52
  67. package/dist/openapi/models/MimeGroupSchema.d.ts +49 -0
  68. package/{openapi/models/MimeGroupSchema.ts → dist/openapi/models/MimeGroupSchema.js} +13 -53
  69. package/dist/openapi/models/MultipartCompleteRequest.d.ts +41 -0
  70. package/dist/openapi/models/MultipartCompleteRequest.js +48 -0
  71. package/dist/openapi/models/MultipartCompleteRequestPartsInner.d.ts +38 -0
  72. package/{openapi/models/MultipartCompleteRequestPartsInner.ts → dist/openapi/models/MultipartCompleteRequestPartsInner.js} +11 -39
  73. package/dist/openapi/models/MultipartInitiateResponse.d.ts +78 -0
  74. package/dist/openapi/models/MultipartInitiateResponse.js +68 -0
  75. package/dist/openapi/models/MultipartInitiateSuccessEnvelope.d.ts +46 -0
  76. package/{openapi/models/MultipartInitiateSuccessEnvelope.ts → dist/openapi/models/MultipartInitiateSuccessEnvelope.js} +13 -52
  77. package/{openapi/models/OperationDefinition.ts → dist/openapi/models/OperationDefinition.d.ts} +14 -57
  78. package/dist/openapi/models/OperationDefinition.js +46 -0
  79. package/dist/openapi/models/OperationDownload.d.ts +56 -0
  80. package/{openapi/models/OperationDownload.ts → dist/openapi/models/OperationDownload.js} +17 -60
  81. package/dist/openapi/models/OperationInputModel.d.ts +28 -0
  82. package/{openapi/models/OperationInputModel.ts → dist/openapi/models/OperationInputModel.js} +13 -23
  83. package/dist/openapi/models/OperationResponse.d.ts +59 -0
  84. package/dist/openapi/models/OperationResponse.js +58 -0
  85. package/dist/openapi/models/OperationResult.d.ts +52 -0
  86. package/{openapi/models/OperationResult.ts → dist/openapi/models/OperationResult.js} +12 -60
  87. package/dist/openapi/models/OperationResultMetrics.d.ts +38 -0
  88. package/{openapi/models/OperationResultMetrics.ts → dist/openapi/models/OperationResultMetrics.js} +7 -37
  89. package/dist/openapi/models/OperationSchemaDefinition.d.ts +96 -0
  90. package/dist/openapi/models/OperationSchemaDefinition.js +67 -0
  91. package/dist/openapi/models/OperationStatus.d.ts +34 -0
  92. package/{openapi/models/OperationStatus.ts → dist/openapi/models/OperationStatus.js} +13 -23
  93. package/dist/openapi/models/OperationType.d.ts +36 -0
  94. package/{openapi/models/OperationType.ts → dist/openapi/models/OperationType.js} +13 -23
  95. package/{openapi/models/OperationsSchemaResponse.ts → dist/openapi/models/OperationsSchemaResponse.d.ts} +13 -55
  96. package/dist/openapi/models/OperationsSchemaResponse.js +49 -0
  97. package/{openapi/models/OptionSchema.ts → dist/openapi/models/OptionSchema.d.ts} +24 -76
  98. package/dist/openapi/models/OptionSchema.js +76 -0
  99. package/dist/openapi/models/PresignedUrlPart.d.ts +46 -0
  100. package/{openapi/models/PresignedUrlPart.ts → dist/openapi/models/PresignedUrlPart.js} +13 -48
  101. package/dist/openapi/models/ReadinessResponse.d.ts +38 -0
  102. package/{openapi/models/ReadinessResponse.ts → dist/openapi/models/ReadinessResponse.js} +7 -37
  103. package/dist/openapi/models/ResponseEnvelope.d.ts +36 -0
  104. package/{openapi/models/ResponseEnvelope.ts → dist/openapi/models/ResponseEnvelope.js} +9 -36
  105. package/dist/openapi/models/RetryResponse.d.ts +51 -0
  106. package/{openapi/models/RetryResponse.ts → dist/openapi/models/RetryResponse.js} +14 -51
  107. package/dist/openapi/models/RetrySuccessEnvelope.d.ts +46 -0
  108. package/{openapi/models/RetrySuccessEnvelope.ts → dist/openapi/models/RetrySuccessEnvelope.js} +13 -52
  109. package/dist/openapi/models/SseEventType.d.ts +40 -0
  110. package/{openapi/models/SseEventType.ts → dist/openapi/models/SseEventType.js} +13 -23
  111. package/{openapi/models/SseJobCompletedData.ts → dist/openapi/models/SseJobCompletedData.d.ts} +12 -55
  112. package/dist/openapi/models/SseJobCompletedData.js +57 -0
  113. package/dist/openapi/models/SseJobFailedData.d.ts +51 -0
  114. package/{openapi/models/SseJobFailedData.ts → dist/openapi/models/SseJobFailedData.js} +14 -51
  115. package/dist/openapi/models/SseOperationCompletedData.d.ts +78 -0
  116. package/dist/openapi/models/SseOperationCompletedData.js +75 -0
  117. package/dist/openapi/models/SseOperationFailedData.d.ts +70 -0
  118. package/dist/openapi/models/SseOperationFailedData.js +70 -0
  119. package/dist/openapi/models/SseOperationProgressData.d.ts +51 -0
  120. package/{openapi/models/SseOperationProgressData.ts → dist/openapi/models/SseOperationProgressData.js} +16 -63
  121. package/dist/openapi/models/SseWorkflowTerminalData.d.ts +49 -0
  122. package/{openapi/models/SseWorkflowTerminalData.ts → dist/openapi/models/SseWorkflowTerminalData.js} +12 -46
  123. package/dist/openapi/models/UploadResponse.d.ts +50 -0
  124. package/{openapi/models/UploadResponse.ts → dist/openapi/models/UploadResponse.js} +15 -53
  125. package/dist/openapi/models/UploadSuccessEnvelope.d.ts +46 -0
  126. package/{openapi/models/UploadSuccessEnvelope.ts → dist/openapi/models/UploadSuccessEnvelope.js} +13 -52
  127. package/dist/openapi/models/ValidationErrorEnvelope.d.ts +54 -0
  128. package/dist/openapi/models/ValidationErrorEnvelope.js +58 -0
  129. package/dist/openapi/models/ValidationErrorEnvelopeDetailsInner.d.ts +50 -0
  130. package/{openapi/models/ValidationErrorEnvelopeDetailsInner.ts → dist/openapi/models/ValidationErrorEnvelopeDetailsInner.js} +9 -50
  131. package/dist/openapi/models/WebhookOperationContext.d.ts +40 -0
  132. package/{openapi/models/WebhookOperationContext.ts → dist/openapi/models/WebhookOperationContext.js} +11 -41
  133. package/dist/openapi/models/WebhookPayload.d.ts +66 -0
  134. package/dist/openapi/models/WebhookPayload.js +60 -0
  135. package/dist/openapi/models/WorkflowCreateRequest.d.ts +76 -0
  136. package/dist/openapi/models/WorkflowCreateRequest.js +55 -0
  137. package/dist/openapi/models/WorkflowCreateResponse.d.ts +58 -0
  138. package/dist/openapi/models/WorkflowCreateResponse.js +54 -0
  139. package/dist/openapi/models/WorkflowCreateSuccessEnvelope.d.ts +46 -0
  140. package/{openapi/models/WorkflowCreateSuccessEnvelope.ts → dist/openapi/models/WorkflowCreateSuccessEnvelope.js} +13 -52
  141. package/dist/openapi/models/WorkflowDownloadResponse.d.ts +33 -0
  142. package/{openapi/models/WorkflowDownloadResponse.ts → dist/openapi/models/WorkflowDownloadResponse.js} +12 -42
  143. package/dist/openapi/models/WorkflowDownloadSuccessEnvelope.d.ts +46 -0
  144. package/{openapi/models/WorkflowDownloadSuccessEnvelope.ts → dist/openapi/models/WorkflowDownloadSuccessEnvelope.js} +13 -52
  145. package/{openapi/models/WorkflowEdge.ts → dist/openapi/models/WorkflowEdge.d.ts} +8 -45
  146. package/dist/openapi/models/WorkflowEdge.js +47 -0
  147. package/dist/openapi/models/WorkflowStatus.d.ts +34 -0
  148. package/{openapi/models/WorkflowStatus.ts → dist/openapi/models/WorkflowStatus.js} +13 -23
  149. package/dist/openapi/models/WorkflowStatusResponse.d.ts +46 -0
  150. package/dist/openapi/models/WorkflowStatusResponse.js +53 -0
  151. package/dist/openapi/models/WorkflowStatusSuccessEnvelope.d.ts +46 -0
  152. package/{openapi/models/WorkflowStatusSuccessEnvelope.ts → dist/openapi/models/WorkflowStatusSuccessEnvelope.js} +13 -52
  153. package/dist/openapi/models/index.d.ts +62 -0
  154. package/dist/openapi/models/index.js +64 -0
  155. package/dist/openapi/runtime.d.ts +184 -0
  156. package/{openapi/runtime.ts → dist/openapi/runtime.js} +107 -206
  157. package/dist/operations/archive.d.ts +12 -0
  158. package/dist/operations/archive.js +11 -0
  159. package/dist/operations/compress.d.ts +154 -0
  160. package/dist/operations/compress.js +112 -0
  161. package/dist/operations/convert.d.ts +58 -0
  162. package/dist/operations/convert.js +46 -0
  163. package/dist/operations/index.d.ts +5 -0
  164. package/dist/operations/index.js +6 -0
  165. package/dist/operations/merge.d.ts +79 -0
  166. package/dist/operations/merge.js +46 -0
  167. package/dist/operations/thumbnail.d.ts +55 -0
  168. package/dist/operations/thumbnail.js +42 -0
  169. package/package.json +29 -11
  170. package/asyncapi/ErrorCode.ts +0 -19
  171. package/asyncapi/MergeOutputType.ts +0 -9
  172. package/asyncapi/OperationMetrics.ts +0 -12
  173. package/asyncapi/OperationProgress.ts +0 -12
  174. package/asyncapi/OperationRequest.ts +0 -21
  175. package/asyncapi/OperationResult.ts +0 -20
  176. package/asyncapi/OperationType.ts +0 -10
  177. package/asyncapi/ProgressStatus.ts +0 -8
  178. package/asyncapi/README.md +0 -16
  179. package/asyncapi/ResultStatus.ts +0 -6
  180. package/asyncapi/SourceEntry.ts +0 -9
  181. package/asyncapi/index.ts +0 -11
  182. package/index.ts +0 -5
  183. package/openapi/.openapi-generator-ignore +0 -26
  184. package/openapi/README.md +0 -17
  185. package/openapi/index.ts +0 -4
  186. package/openapi/models/JobDownload.ts +0 -92
  187. package/openapi/models/JobResponse.ts +0 -119
  188. package/openapi/models/MetadataResponse.ts +0 -223
  189. package/openapi/models/MultipartCompleteRequest.ts +0 -85
  190. package/openapi/models/MultipartInitiateResponse.ts +0 -137
  191. package/openapi/models/OperationResponse.ts +0 -124
  192. package/openapi/models/OperationSchemaDefinition.ts +0 -163
  193. package/openapi/models/SseOperationCompletedData.ts +0 -143
  194. package/openapi/models/SseOperationFailedData.ts +0 -129
  195. package/openapi/models/ValidationErrorEnvelope.ts +0 -104
  196. package/openapi/models/WebhookPayload.ts +0 -132
  197. package/openapi/models/WorkflowCreateRequest.ts +0 -143
  198. package/openapi/models/WorkflowCreateResponse.ts +0 -114
  199. package/openapi/models/WorkflowStatusResponse.ts +0 -101
  200. package/openapi/models/index.ts +0 -64
  201. package/operations/README.md +0 -17
  202. package/operations/archive.ts +0 -16
  203. package/operations/compress.ts +0 -177
  204. package/operations/convert.ts +0 -69
  205. package/operations/index.ts +0 -7
  206. package/operations/merge.ts +0 -95
  207. package/operations/thumbnail.ts +0 -66
@@ -2,118 +2,88 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  * GISL Compression API
5
- * REST API for the GISL (Give It Smaller) file compression and processing service. **Architecture:** - Upload files to get a `file_id` - Create workflows referencing uploaded files with operations (compress, thumbnail, watermark, merge, archive, convert) - Poll status, stream SSE events, or receive webhook callbacks - Download results per operation output **Response envelope:** All mutation and query endpoints return `{ success: true, data: {...} }` on success and `{ success: false, error: \"...\", details: [...] }` on failure. Exceptions: `GET /api/operations/schema` returns raw JSON (CDN-cacheable), health probes return flat objects, and `POST /api/contact` returns 204 with no body.
5
+ * REST API for the GISL (Give It Smaller) file compression and processing service. **Architecture:** - Upload files to get a `file_id` - Create workflows referencing uploaded files with operations (compress, thumbnail, watermark, merge, archive, convert) - Poll status, stream SSE events, or receive webhook callbacks - Download results per operation output **Response envelope:** All mutation and query endpoints return `{ success: true, data: {...} }` on success and `{ success: false, error: \"...\", details: [...] }` on failure. Exceptions: `GET /api/operations/schema` returns raw JSON (CDN-cacheable), health probes return flat objects, and `POST /api/contact` returns 204 with no body.
6
6
  *
7
7
  * The version of the OpenAPI document: 2.0.0
8
- *
8
+ *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
-
15
-
16
14
  export const BASE_PATH = "http://localhost:8080".replace(/\/+$/, "");
17
-
18
- export interface ConfigurationParameters {
19
- basePath?: string; // override base path
20
- fetchApi?: FetchAPI; // override for fetch implementation
21
- middleware?: Middleware[]; // middleware to apply before/after fetch requests
22
- queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
23
- username?: string; // parameter for basic security
24
- password?: string; // parameter for basic security
25
- apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
26
- accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
27
- headers?: HTTPHeaders; //header params we want to use on every request
28
- credentials?: RequestCredentials; //value for the credentials param we want to use on each request
29
- }
30
-
31
15
  export class Configuration {
32
- constructor(private configuration: ConfigurationParameters = {}) {}
33
-
34
- set config(configuration: Configuration) {
16
+ configuration;
17
+ constructor(configuration = {}) {
18
+ this.configuration = configuration;
19
+ }
20
+ set config(configuration) {
35
21
  this.configuration = configuration;
36
22
  }
37
-
38
- get basePath(): string {
23
+ get basePath() {
39
24
  return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
40
25
  }
41
-
42
- get fetchApi(): FetchAPI | undefined {
26
+ get fetchApi() {
43
27
  return this.configuration.fetchApi;
44
28
  }
45
-
46
- get middleware(): Middleware[] {
29
+ get middleware() {
47
30
  return this.configuration.middleware || [];
48
31
  }
49
-
50
- get queryParamsStringify(): (params: HTTPQuery) => string {
32
+ get queryParamsStringify() {
51
33
  return this.configuration.queryParamsStringify || querystring;
52
34
  }
53
-
54
- get username(): string | undefined {
35
+ get username() {
55
36
  return this.configuration.username;
56
37
  }
57
-
58
- get password(): string | undefined {
38
+ get password() {
59
39
  return this.configuration.password;
60
40
  }
61
-
62
- get apiKey(): ((name: string) => string | Promise<string>) | undefined {
41
+ get apiKey() {
63
42
  const apiKey = this.configuration.apiKey;
64
43
  if (apiKey) {
65
44
  return typeof apiKey === 'function' ? apiKey : () => apiKey;
66
45
  }
67
46
  return undefined;
68
47
  }
69
-
70
- get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
48
+ get accessToken() {
71
49
  const accessToken = this.configuration.accessToken;
72
50
  if (accessToken) {
73
51
  return typeof accessToken === 'function' ? accessToken : async () => accessToken;
74
52
  }
75
53
  return undefined;
76
54
  }
77
-
78
- get headers(): HTTPHeaders | undefined {
55
+ get headers() {
79
56
  return this.configuration.headers;
80
57
  }
81
-
82
- get credentials(): RequestCredentials | undefined {
58
+ get credentials() {
83
59
  return this.configuration.credentials;
84
60
  }
85
61
  }
86
-
87
62
  export const DefaultConfig = new Configuration();
88
-
89
63
  /**
90
64
  * This is the base class for all generated API classes.
91
65
  */
92
66
  export class BaseAPI {
93
-
94
- private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
95
- private middleware: Middleware[];
96
-
97
- constructor(protected configuration = DefaultConfig) {
67
+ configuration;
68
+ static jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
69
+ middleware;
70
+ constructor(configuration = DefaultConfig) {
71
+ this.configuration = configuration;
98
72
  this.middleware = configuration.middleware;
99
73
  }
100
-
101
- withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
102
- const next = this.clone<T>();
74
+ withMiddleware(...middlewares) {
75
+ const next = this.clone();
103
76
  next.middleware = next.middleware.concat(...middlewares);
104
77
  return next;
105
78
  }
106
-
107
- withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
79
+ withPreMiddleware(...preMiddlewares) {
108
80
  const middlewares = preMiddlewares.map((pre) => ({ pre }));
109
- return this.withMiddleware<T>(...middlewares);
81
+ return this.withMiddleware(...middlewares);
110
82
  }
111
-
112
- withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
83
+ withPostMiddleware(...postMiddlewares) {
113
84
  const middlewares = postMiddlewares.map((post) => ({ post }));
114
- return this.withMiddleware<T>(...middlewares);
85
+ return this.withMiddleware(...middlewares);
115
86
  }
116
-
117
87
  /**
118
88
  * Check if the given MIME is a JSON MIME.
119
89
  * JSON MIME examples:
@@ -124,14 +94,13 @@ export class BaseAPI {
124
94
  * @param mime - MIME (Multipurpose Internet Mail Extensions)
125
95
  * @return True if the given MIME is JSON, false otherwise.
126
96
  */
127
- protected isJsonMime(mime: string | null | undefined): boolean {
97
+ isJsonMime(mime) {
128
98
  if (!mime) {
129
99
  return false;
130
100
  }
131
101
  return BaseAPI.jsonRegex.test(mime);
132
102
  }
133
-
134
- protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response> {
103
+ async request(context, initOverrides) {
135
104
  const { url, init } = await this.createFetchParams(context, initOverrides);
136
105
  const response = await this.fetchApi(url, init);
137
106
  if (response && (response.status >= 200 && response.status < 300)) {
@@ -139,8 +108,7 @@ export class BaseAPI {
139
108
  }
140
109
  throw new ResponseError(response, 'Response returned an error code');
141
110
  }
142
-
143
- private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
111
+ async createFetchParams(context, initOverrides) {
144
112
  let url = this.configuration.basePath + context.path;
145
113
  if (context.query !== undefined && Object.keys(context.query).length !== 0) {
146
114
  // only add the querystring to the URL if there are query parameters.
@@ -148,50 +116,43 @@ export class BaseAPI {
148
116
  // do not handle correctly sometimes.
149
117
  url += '?' + this.configuration.queryParamsStringify(context.query);
150
118
  }
151
-
152
119
  const headers = Object.assign({}, this.configuration.headers, context.headers);
153
120
  Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
154
-
155
- const initOverrideFn =
156
- typeof initOverrides === "function"
157
- ? initOverrides
158
- : async () => initOverrides;
159
-
121
+ const initOverrideFn = typeof initOverrides === "function"
122
+ ? initOverrides
123
+ : async () => initOverrides;
160
124
  const initParams = {
161
125
  method: context.method,
162
126
  headers,
163
127
  body: context.body,
164
128
  credentials: this.configuration.credentials,
165
129
  };
166
-
167
- const overriddenInit: RequestInit = {
130
+ const overriddenInit = {
168
131
  ...initParams,
169
132
  ...(await initOverrideFn({
170
133
  init: initParams,
171
134
  context,
172
135
  }))
173
136
  };
174
-
175
- let body: any;
137
+ let body;
176
138
  if (isFormData(overriddenInit.body)
177
139
  || (overriddenInit.body instanceof URLSearchParams)
178
140
  || isBlob(overriddenInit.body)) {
179
- body = overriddenInit.body;
180
- } else if (this.isJsonMime(headers['Content-Type'])) {
181
- body = JSON.stringify(overriddenInit.body);
182
- } else {
183
- body = overriddenInit.body;
141
+ body = overriddenInit.body;
142
+ }
143
+ else if (this.isJsonMime(headers['Content-Type'])) {
144
+ body = JSON.stringify(overriddenInit.body);
184
145
  }
185
-
186
- const init: RequestInit = {
146
+ else {
147
+ body = overriddenInit.body;
148
+ }
149
+ const init = {
187
150
  ...overriddenInit,
188
151
  body
189
152
  };
190
-
191
153
  return { url, init };
192
154
  }
193
-
194
- private fetchApi = async (url: string, init: RequestInit) => {
155
+ fetchApi = async (url, init) => {
195
156
  let fetchParams = { url, init };
196
157
  for (const middleware of this.middleware) {
197
158
  if (middleware.pre) {
@@ -201,10 +162,11 @@ export class BaseAPI {
201
162
  }) || fetchParams;
202
163
  }
203
164
  }
204
- let response: Response | undefined = undefined;
165
+ let response = undefined;
205
166
  try {
206
167
  response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
207
- } catch (e) {
168
+ }
169
+ catch (e) {
208
170
  for (const middleware of this.middleware) {
209
171
  if (middleware.onError) {
210
172
  response = await middleware.onError({
@@ -217,11 +179,12 @@ export class BaseAPI {
217
179
  }
218
180
  }
219
181
  if (response === undefined) {
220
- if (e instanceof Error) {
221
- throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
222
- } else {
223
- throw e;
224
- }
182
+ if (e instanceof Error) {
183
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
184
+ }
185
+ else {
186
+ throw e;
187
+ }
225
188
  }
226
189
  }
227
190
  for (const middleware of this.middleware) {
@@ -235,89 +198,62 @@ export class BaseAPI {
235
198
  }
236
199
  }
237
200
  return response;
238
- }
239
-
201
+ };
240
202
  /**
241
203
  * Create a shallow clone of `this` by constructing a new instance
242
204
  * and then shallow cloning data members.
243
205
  */
244
- private clone<T extends BaseAPI>(this: T): T {
245
- const constructor = this.constructor as any;
206
+ clone() {
207
+ const constructor = this.constructor;
246
208
  const next = new constructor(this.configuration);
247
209
  next.middleware = this.middleware.slice();
248
210
  return next;
249
211
  }
250
- };
251
-
252
- function isBlob(value: any): value is Blob {
212
+ }
213
+ ;
214
+ function isBlob(value) {
253
215
  return typeof Blob !== 'undefined' && value instanceof Blob;
254
216
  }
255
-
256
- function isFormData(value: any): value is FormData {
217
+ function isFormData(value) {
257
218
  return typeof FormData !== "undefined" && value instanceof FormData;
258
219
  }
259
-
260
220
  export class ResponseError extends Error {
261
- override name: "ResponseError" = "ResponseError";
262
- constructor(public response: Response, msg?: string) {
221
+ response;
222
+ name = "ResponseError";
223
+ constructor(response, msg) {
263
224
  super(msg);
225
+ this.response = response;
264
226
  }
265
227
  }
266
-
267
228
  export class FetchError extends Error {
268
- override name: "FetchError" = "FetchError";
269
- constructor(public cause: Error, msg?: string) {
229
+ cause;
230
+ name = "FetchError";
231
+ constructor(cause, msg) {
270
232
  super(msg);
233
+ this.cause = cause;
271
234
  }
272
235
  }
273
-
274
236
  export class RequiredError extends Error {
275
- override name: "RequiredError" = "RequiredError";
276
- constructor(public field: string, msg?: string) {
237
+ field;
238
+ name = "RequiredError";
239
+ constructor(field, msg) {
277
240
  super(msg);
241
+ this.field = field;
278
242
  }
279
243
  }
280
-
281
244
  export const COLLECTION_FORMATS = {
282
245
  csv: ",",
283
246
  ssv: " ",
284
247
  tsv: "\t",
285
248
  pipes: "|",
286
249
  };
287
-
288
- export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
289
-
290
- export type Json = any;
291
- export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
292
- export type HTTPHeaders = { [key: string]: string };
293
- export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery };
294
- export type HTTPBody = Json | FormData | URLSearchParams;
295
- export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody };
296
- export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
297
-
298
- export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
299
-
300
- export interface FetchParams {
301
- url: string;
302
- init: RequestInit;
303
- }
304
-
305
- export interface RequestOpts {
306
- path: string;
307
- method: HTTPMethod;
308
- headers: HTTPHeaders;
309
- query?: HTTPQuery;
310
- body?: HTTPBody;
311
- }
312
-
313
- export function querystring(params: HTTPQuery, prefix: string = ''): string {
250
+ export function querystring(params, prefix = '') {
314
251
  return Object.keys(params)
315
252
  .map(key => querystringSingleKey(key, params[key], prefix))
316
253
  .filter(part => part.length > 0)
317
254
  .join('&');
318
255
  }
319
-
320
- function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string {
256
+ function querystringSingleKey(key, value, keyPrefix = '') {
321
257
  const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
322
258
  if (value instanceof Array) {
323
259
  const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
@@ -332,25 +268,22 @@ function querystringSingleKey(key: string, value: string | number | null | undef
332
268
  return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
333
269
  }
334
270
  if (value instanceof Object) {
335
- return querystring(value as HTTPQuery, fullKey);
271
+ return querystring(value, fullKey);
336
272
  }
337
273
  return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
338
274
  }
339
-
340
- export function exists(json: any, key: string) {
275
+ export function exists(json, key) {
341
276
  const value = json[key];
342
277
  return value !== null && value !== undefined;
343
278
  }
344
-
345
- export function mapValues(data: any, fn: (item: any) => any) {
346
- const result: { [key: string]: any } = {};
279
+ export function mapValues(data, fn) {
280
+ const result = {};
347
281
  for (const key of Object.keys(data)) {
348
282
  result[key] = fn(data[key]);
349
283
  }
350
284
  return result;
351
285
  }
352
-
353
- export function canConsumeForm(consumes: Consume[]): boolean {
286
+ export function canConsumeForm(consumes) {
354
287
  for (const consume of consumes) {
355
288
  if ('multipart/form-data' === consume.contentType) {
356
289
  return true;
@@ -358,75 +291,43 @@ export function canConsumeForm(consumes: Consume[]): boolean {
358
291
  }
359
292
  return false;
360
293
  }
361
-
362
- export interface Consume {
363
- contentType: string;
364
- }
365
-
366
- export interface RequestContext {
367
- fetch: FetchAPI;
368
- url: string;
369
- init: RequestInit;
370
- }
371
-
372
- export interface ResponseContext {
373
- fetch: FetchAPI;
374
- url: string;
375
- init: RequestInit;
376
- response: Response;
377
- }
378
-
379
- export interface ErrorContext {
380
- fetch: FetchAPI;
381
- url: string;
382
- init: RequestInit;
383
- error: unknown;
384
- response?: Response;
385
- }
386
-
387
- export interface Middleware {
388
- pre?(context: RequestContext): Promise<FetchParams | void>;
389
- post?(context: ResponseContext): Promise<Response | void>;
390
- onError?(context: ErrorContext): Promise<Response | void>;
391
- }
392
-
393
- export interface ApiResponse<T> {
394
- raw: Response;
395
- value(): Promise<T>;
396
- }
397
-
398
- export interface ResponseTransformer<T> {
399
- (json: any): T;
400
- }
401
-
402
- export class JSONApiResponse<T> {
403
- constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
404
-
405
- async value(): Promise<T> {
294
+ export class JSONApiResponse {
295
+ raw;
296
+ transformer;
297
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
298
+ this.raw = raw;
299
+ this.transformer = transformer;
300
+ }
301
+ async value() {
406
302
  return this.transformer(await this.raw.json());
407
303
  }
408
304
  }
409
-
410
305
  export class VoidApiResponse {
411
- constructor(public raw: Response) {}
412
-
413
- async value(): Promise<void> {
306
+ raw;
307
+ constructor(raw) {
308
+ this.raw = raw;
309
+ }
310
+ async value() {
414
311
  return undefined;
415
312
  }
416
313
  }
417
-
418
314
  export class BlobApiResponse {
419
- constructor(public raw: Response) {}
420
-
421
- async value(): Promise<Blob> {
315
+ raw;
316
+ constructor(raw) {
317
+ this.raw = raw;
318
+ }
319
+ async value() {
422
320
  return await this.raw.blob();
423
- };
321
+ }
322
+ ;
424
323
  }
425
-
426
324
  export class TextApiResponse {
427
- constructor(public raw: Response) {}
428
-
429
- async value(): Promise<string> {
325
+ raw;
326
+ constructor(raw) {
327
+ this.raw = raw;
328
+ }
329
+ async value() {
430
330
  return await this.raw.text();
431
- };
331
+ }
332
+ ;
432
333
  }
@@ -0,0 +1,12 @@
1
+ export declare enum ArchiveFormat {
2
+ Zip = "zip",
3
+ TarGz = "tar.gz"
4
+ }
5
+ export declare enum ArchiveFolderStructure {
6
+ Flat = "flat",
7
+ ByJob = "by_job"
8
+ }
9
+ export interface ArchiveOptions {
10
+ format?: ArchiveFormat;
11
+ folder_structure?: ArchiveFolderStructure;
12
+ }
@@ -0,0 +1,11 @@
1
+ // Auto-generated from archive.yaml -- do not edit
2
+ export var ArchiveFormat;
3
+ (function (ArchiveFormat) {
4
+ ArchiveFormat["Zip"] = "zip";
5
+ ArchiveFormat["TarGz"] = "tar.gz";
6
+ })(ArchiveFormat || (ArchiveFormat = {}));
7
+ export var ArchiveFolderStructure;
8
+ (function (ArchiveFolderStructure) {
9
+ ArchiveFolderStructure["Flat"] = "flat";
10
+ ArchiveFolderStructure["ByJob"] = "by_job";
11
+ })(ArchiveFolderStructure || (ArchiveFolderStructure = {}));
@@ -0,0 +1,154 @@
1
+ export declare enum CompressImageMode {
2
+ Lossy = "lossy",
3
+ Lossless = "lossless",
4
+ Auto = "auto"
5
+ }
6
+ export declare enum CompressImageFit {
7
+ Max = "max",
8
+ Crop = "crop",
9
+ Scale = "scale"
10
+ }
11
+ export declare enum CompressImageMetadata {
12
+ All = "all",
13
+ None = "none",
14
+ Copyright = "copyright",
15
+ Sensitive = "sensitive"
16
+ }
17
+ export declare enum CompressImageIccProfile {
18
+ Preserve = "preserve",
19
+ Strip = "strip",
20
+ Srgb = "srgb"
21
+ }
22
+ export declare enum CompressImageOutputFormat {
23
+ Original = "original",
24
+ Auto = "auto",
25
+ Smallest = "smallest",
26
+ Jpeg = "jpeg",
27
+ Png = "png",
28
+ Webp = "webp",
29
+ Avif = "avif"
30
+ }
31
+ export interface CompressImageOptions {
32
+ mode?: CompressImageMode;
33
+ quality?: number;
34
+ width?: number;
35
+ height?: number;
36
+ fit?: CompressImageFit;
37
+ metadata?: CompressImageMetadata;
38
+ icc_profile?: CompressImageIccProfile;
39
+ auto_orient?: boolean;
40
+ progressive?: boolean;
41
+ output_format?: CompressImageOutputFormat;
42
+ }
43
+ export declare enum CompressAudioBitrate {
44
+ _64 = 64,
45
+ _96 = 96,
46
+ _128 = 128,
47
+ _192 = 192,
48
+ _256 = 256,
49
+ _320 = 320
50
+ }
51
+ export declare enum CompressAudioSampleRate {
52
+ _22050 = 22050,
53
+ _44100 = 44100,
54
+ _48000 = 48000
55
+ }
56
+ export interface CompressAudioOptions {
57
+ bitrate?: CompressAudioBitrate;
58
+ channels?: number;
59
+ sample_rate?: CompressAudioSampleRate;
60
+ normalize?: boolean;
61
+ trim_start?: number;
62
+ trim_end?: number;
63
+ }
64
+ export declare enum CompressVideoCodec {
65
+ H264 = "h264",
66
+ H265 = "h265",
67
+ Vp9 = "vp9",
68
+ Av1 = "av1"
69
+ }
70
+ export declare enum CompressVideoEncodingMode {
71
+ Crf = "crf",
72
+ TargetSize = "target_size"
73
+ }
74
+ export declare enum CompressVideoPreset {
75
+ Ultrafast = "ultrafast",
76
+ Superfast = "superfast",
77
+ Veryfast = "veryfast",
78
+ Faster = "faster",
79
+ Fast = "fast",
80
+ Medium = "medium",
81
+ Slow = "slow",
82
+ Slower = "slower",
83
+ Veryslow = "veryslow"
84
+ }
85
+ export declare enum CompressVideoFit {
86
+ Max = "max",
87
+ Crop = "crop",
88
+ Scale = "scale",
89
+ Pad = "pad"
90
+ }
91
+ export declare enum CompressVideoAudioCodec {
92
+ Aac = "aac",
93
+ Opus = "opus",
94
+ Vorbis = "vorbis",
95
+ Copy = "copy"
96
+ }
97
+ export declare enum CompressVideoAudioBitrate {
98
+ _64 = 64,
99
+ _96 = 96,
100
+ _128 = 128,
101
+ _192 = 192,
102
+ _256 = 256,
103
+ _320 = 320
104
+ }
105
+ export interface CompressVideoOptions {
106
+ codec?: CompressVideoCodec;
107
+ encoding_mode?: CompressVideoEncodingMode;
108
+ crf?: number;
109
+ target_size_bytes?: number;
110
+ preset?: CompressVideoPreset;
111
+ width?: number;
112
+ height?: number;
113
+ fit?: CompressVideoFit;
114
+ fps?: number;
115
+ faststart?: boolean;
116
+ audio_codec?: CompressVideoAudioCodec;
117
+ audio_bitrate?: CompressVideoAudioBitrate;
118
+ trim_start?: number;
119
+ trim_end?: number;
120
+ }
121
+ export declare enum CompressDocumentPdfProfile {
122
+ Web = "web",
123
+ Print = "print",
124
+ Archive = "archive",
125
+ Max = "max"
126
+ }
127
+ export declare enum CompressDocumentPdfColorspace {
128
+ Unchanged = "unchanged",
129
+ Rgb = "rgb",
130
+ Cmyk = "cmyk",
131
+ Grayscale = "grayscale"
132
+ }
133
+ export interface CompressDocumentPdfOptions {
134
+ profile?: CompressDocumentPdfProfile;
135
+ colorspace?: CompressDocumentPdfColorspace;
136
+ pages?: string;
137
+ flatten_forms?: boolean;
138
+ }
139
+ export interface CompressDocumentOfficeOptions {
140
+ image_quality?: number;
141
+ strip_macros?: boolean;
142
+ strip_hidden_data?: boolean;
143
+ strip_unused_fonts?: boolean;
144
+ }
145
+ export interface CompressDocumentOdfOptions {
146
+ image_quality?: number;
147
+ strip_metadata?: boolean;
148
+ strip_unused_styles?: boolean;
149
+ }
150
+ export interface CompressDocumentEpubOptions {
151
+ image_quality?: number;
152
+ font_subsetting?: boolean;
153
+ strip_unused_css?: boolean;
154
+ }