@financeable/aggregation 0.2.0 → 0.2.1

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 (82) hide show
  1. package/FUNCTIONS.md +0 -4
  2. package/README.md +945 -28
  3. package/docs/sdks/applications/README.md +0 -8
  4. package/jsr.json +1 -1
  5. package/lib/config.d.ts +3 -3
  6. package/lib/config.js +3 -3
  7. package/models/components/applicationresourcebulksubmission.d.ts +0 -6
  8. package/models/components/applicationresourcebulksubmission.d.ts.map +1 -1
  9. package/models/components/applicationresourcebulksubmission.js +0 -6
  10. package/models/components/applicationresourcebulksubmission.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/lib/config.ts +3 -3
  13. package/src/models/components/applicationresourcebulksubmission.ts +0 -12
  14. package/financeable-typescript/.devcontainer/README.md +0 -30
  15. package/financeable-typescript/FUNCTIONS.md +0 -205
  16. package/financeable-typescript/README.md +0 -895
  17. package/financeable-typescript/RUNTIMES.md +0 -22
  18. package/financeable-typescript/docs/sdks/applications/README.md +0 -427
  19. package/financeable-typescript/docs/sdks/financeable/README.md +0 -5
  20. package/financeable-typescript/src/core.ts +0 -13
  21. package/financeable-typescript/src/funcs/applicationsCreate.ts +0 -124
  22. package/financeable-typescript/src/funcs/applicationsGet.ts +0 -128
  23. package/financeable-typescript/src/funcs/applicationsList.ts +0 -126
  24. package/financeable-typescript/src/hooks/hooks.ts +0 -129
  25. package/financeable-typescript/src/hooks/index.ts +0 -6
  26. package/financeable-typescript/src/hooks/types.ts +0 -109
  27. package/financeable-typescript/src/index.ts +0 -7
  28. package/financeable-typescript/src/lib/base64.ts +0 -37
  29. package/financeable-typescript/src/lib/config.ts +0 -59
  30. package/financeable-typescript/src/lib/dlv.ts +0 -53
  31. package/financeable-typescript/src/lib/encodings.ts +0 -449
  32. package/financeable-typescript/src/lib/env.ts +0 -37
  33. package/financeable-typescript/src/lib/files.ts +0 -40
  34. package/financeable-typescript/src/lib/http.ts +0 -323
  35. package/financeable-typescript/src/lib/is-plain-object.ts +0 -43
  36. package/financeable-typescript/src/lib/logger.ts +0 -9
  37. package/financeable-typescript/src/lib/matchers.ts +0 -322
  38. package/financeable-typescript/src/lib/primitives.ts +0 -122
  39. package/financeable-typescript/src/lib/retries.ts +0 -219
  40. package/financeable-typescript/src/lib/schemas.ts +0 -86
  41. package/financeable-typescript/src/lib/sdks.ts +0 -392
  42. package/financeable-typescript/src/lib/security.ts +0 -227
  43. package/financeable-typescript/src/lib/url.ts +0 -33
  44. package/financeable-typescript/src/models/components/addressattributes.ts +0 -148
  45. package/financeable-typescript/src/models/components/apierrorlinks.ts +0 -65
  46. package/financeable-typescript/src/models/components/applicationattributes.ts +0 -128
  47. package/financeable-typescript/src/models/components/applicationattributescreate.ts +0 -90
  48. package/financeable-typescript/src/models/components/applicationresourcebulksubmission.ts +0 -1000
  49. package/financeable-typescript/src/models/components/applicationstatus.ts +0 -39
  50. package/financeable-typescript/src/models/components/applicationtype.ts +0 -33
  51. package/financeable-typescript/src/models/components/assetattributes.ts +0 -400
  52. package/financeable-typescript/src/models/components/customerattributes.ts +0 -171
  53. package/financeable-typescript/src/models/components/customertitle.ts +0 -35
  54. package/financeable-typescript/src/models/components/errorsource.ts +0 -79
  55. package/financeable-typescript/src/models/components/forbiddenerror.ts +0 -207
  56. package/financeable-typescript/src/models/components/frequencytype.ts +0 -40
  57. package/financeable-typescript/src/models/components/index.ts +0 -20
  58. package/financeable-typescript/src/models/components/links.ts +0 -72
  59. package/financeable-typescript/src/models/components/loandetailsattributes.ts +0 -187
  60. package/financeable-typescript/src/models/components/repaymentstructure.ts +0 -40
  61. package/financeable-typescript/src/models/errors/apierror.ts +0 -27
  62. package/financeable-typescript/src/models/errors/createapplication.ts +0 -76
  63. package/financeable-typescript/src/models/errors/getapplication.ts +0 -76
  64. package/financeable-typescript/src/models/errors/getapplications.ts +0 -76
  65. package/financeable-typescript/src/models/errors/httpclienterrors.ts +0 -62
  66. package/financeable-typescript/src/models/errors/index.ts +0 -10
  67. package/financeable-typescript/src/models/errors/sdkvalidationerror.ts +0 -97
  68. package/financeable-typescript/src/models/operations/createapplication.ts +0 -1649
  69. package/financeable-typescript/src/models/operations/getapplication.ts +0 -1829
  70. package/financeable-typescript/src/models/operations/getapplications.ts +0 -1790
  71. package/financeable-typescript/src/models/operations/index.ts +0 -7
  72. package/financeable-typescript/src/sdk/applications.ts +0 -55
  73. package/financeable-typescript/src/sdk/index.ts +0 -5
  74. package/financeable-typescript/src/sdk/sdk.ts +0 -13
  75. package/financeable-typescript/src/types/blobs.ts +0 -31
  76. package/financeable-typescript/src/types/constdatetime.ts +0 -15
  77. package/financeable-typescript/src/types/enums.ts +0 -16
  78. package/financeable-typescript/src/types/fp.ts +0 -50
  79. package/financeable-typescript/src/types/index.ts +0 -11
  80. package/financeable-typescript/src/types/operations.ts +0 -105
  81. package/financeable-typescript/src/types/rfcdate.ts +0 -54
  82. package/financeable-typescript/src/types/streams.ts +0 -21
@@ -1,22 +0,0 @@
1
- # Supported JavaScript runtimes
2
-
3
- This SDK is intended to be used in JavaScript runtimes that support the following features:
4
-
5
- * [Web Fetch API][web-fetch]
6
- * [Web Streams API][web-streams] and in particular `ReadableStream`
7
- * [Async iterables][async-iter] using `Symbol.asyncIterator`
8
-
9
- [web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
10
- [web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
11
- [async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
12
-
13
- Runtime environments that are explicitly supported are:
14
-
15
- - Evergreen browsers which include: Chrome, Safari, Edge, Firefox
16
- - Node.js active and maintenance LTS releases
17
- - Currently, this is v18 and v20
18
- - Bun v1 and above
19
- - Deno v1.39
20
- - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
21
-
22
- [deno-file-streaming]: https://github.com/denoland/deno/issues/11018
@@ -1,427 +0,0 @@
1
- # Applications
2
- (*applications*)
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [create](#create) - Create an application in the Financeable platform.
9
- * [list](#list) - Retrieve a list of applications
10
- * [get](#get) - Retrieve an application by its ID
11
-
12
- ## create
13
-
14
- Create an application in the Financeable platform.
15
-
16
- ### Example Usage
17
-
18
- ```typescript
19
- import { Financeable } from "@financeable/aggregation";
20
-
21
- const financeable = new Financeable();
22
-
23
- async function run() {
24
- const result = await financeable.applications.create({
25
- data: {
26
- type: "applications",
27
- attributes: {
28
- purpose: "Purchase of a motor vehicle",
29
- applicationType: "consumer",
30
- },
31
- relationships: {
32
- loanDetails: {
33
- data: {
34
- type: "loan-details",
35
- attributes: {
36
- repayments: 12,
37
- repaymentFrequency: "monthly",
38
- repaymentStructure: "group-payments",
39
- loanAmount: "10280.95",
40
- purpose: "Purchase of a motor vehicle",
41
- term: 48,
42
- balloon: 5,
43
- deposit: "2500",
44
- originationFee: 200,
45
- rate: "0.15",
46
- rateAdjustment: "-0.01",
47
- },
48
- },
49
- },
50
- customers: {
51
- data: [
52
- {
53
- id: "<id>",
54
- type: "customers",
55
- attributes: {
56
- title: "Mr",
57
- firstName: "John",
58
- lastName: "Smith",
59
- dateOfBirth: "01-01-1990",
60
- idExpiryDate: "01-01-2025",
61
- idType: "licence",
62
- idNumber: "12345678",
63
- },
64
- relationships: {
65
- addresses: {
66
- data: [
67
- {
68
- id: "<id>",
69
- type: "addresses",
70
- attributes: {
71
- addressType: "residential",
72
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
73
- city: "Sydney",
74
- postCode: "2000",
75
- streetAddress: "42 Wallaby Way",
76
- addressLine2: "",
77
- streetNumber: "42",
78
- streetType: "Way",
79
- street: "Wallaby",
80
- state: "NSW",
81
- country: "Australia",
82
- status: "current",
83
- monthsAt: 24,
84
- yearsAt: 2,
85
- },
86
- },
87
- ],
88
- },
89
- },
90
- },
91
- ],
92
- },
93
- asset: {
94
- data: {
95
- id: "<id>",
96
- type: "asset",
97
- attributes: {
98
- ageOfAsset: 3,
99
- ageOfAssetAtEnd: 8,
100
- condition: "USED",
101
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
102
- purpose: "VEHICLE",
103
- assetValue: "35000.00",
104
- make: "Toyota",
105
- assetModel: "Camry",
106
- registrationNumber: "ABC123",
107
- registrationState: "VIC",
108
- vin: "1HGCM82633A123456",
109
- supplierName: "Mr and Mrs Smith",
110
- supplierABN: "12345678901",
111
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
112
- supplierPhone: "0412345678",
113
- supplierContactName: "John Smith",
114
- supplierEmail: "john.smith@mrandmrssmith.com.au",
115
- privateSale: false,
116
- typeOfSale: "DEALER",
117
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
118
- netAssetValue: "32000.00",
119
- isLuxury: false,
120
- additionalFees: "995.00",
121
- additionalTaxes: "0.00",
122
- },
123
- },
124
- },
125
- },
126
- },
127
- });
128
-
129
- // Handle the result
130
- console.log(result);
131
- }
132
-
133
- run();
134
- ```
135
-
136
- ### Standalone function
137
-
138
- The standalone function version of this method:
139
-
140
- ```typescript
141
- import { FinanceableCore } from "@financeable/aggregation/core.js";
142
- import { applicationsCreate } from "@financeable/aggregation/funcs/applicationsCreate.js";
143
-
144
- // Use `FinanceableCore` for best tree-shaking performance.
145
- // You can create one instance of it to use across an application.
146
- const financeable = new FinanceableCore();
147
-
148
- async function run() {
149
- const res = await applicationsCreate(financeable, {
150
- data: {
151
- type: "applications",
152
- attributes: {
153
- purpose: "Purchase of a motor vehicle",
154
- applicationType: "consumer",
155
- },
156
- relationships: {
157
- loanDetails: {
158
- data: {
159
- type: "loan-details",
160
- attributes: {
161
- repayments: 12,
162
- repaymentFrequency: "monthly",
163
- repaymentStructure: "group-payments",
164
- loanAmount: "10280.95",
165
- purpose: "Purchase of a motor vehicle",
166
- term: 48,
167
- balloon: 5,
168
- deposit: "2500",
169
- originationFee: 200,
170
- rate: "0.15",
171
- rateAdjustment: "-0.01",
172
- },
173
- },
174
- },
175
- customers: {
176
- data: [
177
- {
178
- id: "<id>",
179
- type: "customers",
180
- attributes: {
181
- title: "Mr",
182
- firstName: "John",
183
- lastName: "Smith",
184
- dateOfBirth: "01-01-1990",
185
- idExpiryDate: "01-01-2025",
186
- idType: "licence",
187
- idNumber: "12345678",
188
- },
189
- relationships: {
190
- addresses: {
191
- data: [
192
- {
193
- id: "<id>",
194
- type: "addresses",
195
- attributes: {
196
- addressType: "residential",
197
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
198
- city: "Sydney",
199
- postCode: "2000",
200
- streetAddress: "42 Wallaby Way",
201
- addressLine2: "",
202
- streetNumber: "42",
203
- streetType: "Way",
204
- street: "Wallaby",
205
- state: "NSW",
206
- country: "Australia",
207
- status: "current",
208
- monthsAt: 24,
209
- yearsAt: 2,
210
- },
211
- },
212
- ],
213
- },
214
- },
215
- },
216
- ],
217
- },
218
- asset: {
219
- data: {
220
- id: "<id>",
221
- type: "asset",
222
- attributes: {
223
- ageOfAsset: 3,
224
- ageOfAssetAtEnd: 8,
225
- condition: "USED",
226
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
227
- purpose: "VEHICLE",
228
- assetValue: "35000.00",
229
- make: "Toyota",
230
- assetModel: "Camry",
231
- registrationNumber: "ABC123",
232
- registrationState: "VIC",
233
- vin: "1HGCM82633A123456",
234
- supplierName: "Mr and Mrs Smith",
235
- supplierABN: "12345678901",
236
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
237
- supplierPhone: "0412345678",
238
- supplierContactName: "John Smith",
239
- supplierEmail: "john.smith@mrandmrssmith.com.au",
240
- privateSale: false,
241
- typeOfSale: "DEALER",
242
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
243
- netAssetValue: "32000.00",
244
- isLuxury: false,
245
- additionalFees: "995.00",
246
- additionalTaxes: "0.00",
247
- },
248
- },
249
- },
250
- },
251
- },
252
- });
253
-
254
- if (!res.ok) {
255
- throw res.error;
256
- }
257
-
258
- const { value: result } = res;
259
-
260
- // Handle the result
261
- console.log(result);
262
- }
263
-
264
- run();
265
- ```
266
-
267
- ### Parameters
268
-
269
- | Parameter | Type | Required | Description |
270
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
271
- | `request` | [components.ApplicationResourceBulkSubmission](../../models/components/applicationresourcebulksubmission.md) | :heavy_check_mark: | The request object to use for the request. |
272
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
273
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
274
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
275
-
276
- ### Response
277
-
278
- **Promise\<[operations.CreateApplicationResponseBody](../../models/operations/createapplicationresponsebody.md)\>**
279
-
280
- ### Errors
281
-
282
- | Error Type | Status Code | Content Type |
283
- | ------------------------------------ | ------------------------------------ | ------------------------------------ |
284
- | errors.CreateApplicationResponseBody | 403 | application/json |
285
- | errors.APIError | 4XX, 5XX | \*/\* |
286
-
287
- ## list
288
-
289
- Retrieve a list of applications
290
-
291
- ### Example Usage
292
-
293
- ```typescript
294
- import { Financeable } from "@financeable/aggregation";
295
-
296
- const financeable = new Financeable();
297
-
298
- async function run() {
299
- const result = await financeable.applications.list({});
300
-
301
- // Handle the result
302
- console.log(result);
303
- }
304
-
305
- run();
306
- ```
307
-
308
- ### Standalone function
309
-
310
- The standalone function version of this method:
311
-
312
- ```typescript
313
- import { FinanceableCore } from "@financeable/aggregation/core.js";
314
- import { applicationsList } from "@financeable/aggregation/funcs/applicationsList.js";
315
-
316
- // Use `FinanceableCore` for best tree-shaking performance.
317
- // You can create one instance of it to use across an application.
318
- const financeable = new FinanceableCore();
319
-
320
- async function run() {
321
- const res = await applicationsList(financeable, {});
322
-
323
- if (!res.ok) {
324
- throw res.error;
325
- }
326
-
327
- const { value: result } = res;
328
-
329
- // Handle the result
330
- console.log(result);
331
- }
332
-
333
- run();
334
- ```
335
-
336
- ### Parameters
337
-
338
- | Parameter | Type | Required | Description |
339
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
340
- | `request` | [operations.GetApplicationsRequest](../../models/operations/getapplicationsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
341
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
342
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
343
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
344
-
345
- ### Response
346
-
347
- **Promise\<[operations.GetApplicationsResponseBody](../../models/operations/getapplicationsresponsebody.md)\>**
348
-
349
- ### Errors
350
-
351
- | Error Type | Status Code | Content Type |
352
- | ---------------------------------- | ---------------------------------- | ---------------------------------- |
353
- | errors.GetApplicationsResponseBody | 403 | application/json |
354
- | errors.APIError | 4XX, 5XX | \*/\* |
355
-
356
- ## get
357
-
358
- Retrieve an application by its ID
359
-
360
- ### Example Usage
361
-
362
- ```typescript
363
- import { Financeable } from "@financeable/aggregation";
364
-
365
- const financeable = new Financeable();
366
-
367
- async function run() {
368
- const result = await financeable.applications.get({
369
- id: "<id>",
370
- });
371
-
372
- // Handle the result
373
- console.log(result);
374
- }
375
-
376
- run();
377
- ```
378
-
379
- ### Standalone function
380
-
381
- The standalone function version of this method:
382
-
383
- ```typescript
384
- import { FinanceableCore } from "@financeable/aggregation/core.js";
385
- import { applicationsGet } from "@financeable/aggregation/funcs/applicationsGet.js";
386
-
387
- // Use `FinanceableCore` for best tree-shaking performance.
388
- // You can create one instance of it to use across an application.
389
- const financeable = new FinanceableCore();
390
-
391
- async function run() {
392
- const res = await applicationsGet(financeable, {
393
- id: "<id>",
394
- });
395
-
396
- if (!res.ok) {
397
- throw res.error;
398
- }
399
-
400
- const { value: result } = res;
401
-
402
- // Handle the result
403
- console.log(result);
404
- }
405
-
406
- run();
407
- ```
408
-
409
- ### Parameters
410
-
411
- | Parameter | Type | Required | Description |
412
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
413
- | `request` | [operations.GetApplicationRequest](../../models/operations/getapplicationrequest.md) | :heavy_check_mark: | The request object to use for the request. |
414
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
415
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
416
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
417
-
418
- ### Response
419
-
420
- **Promise\<[operations.GetApplicationResponseBody](../../models/operations/getapplicationresponsebody.md)\>**
421
-
422
- ### Errors
423
-
424
- | Error Type | Status Code | Content Type |
425
- | --------------------------------- | --------------------------------- | --------------------------------- |
426
- | errors.GetApplicationResponseBody | 403 | application/json |
427
- | errors.APIError | 4XX, 5XX | \*/\* |
@@ -1,5 +0,0 @@
1
- # Financeable SDK
2
-
3
- ## Overview
4
-
5
- ### Available Operations
@@ -1,13 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { ClientSDK } from "./lib/sdks.js";
6
-
7
- /**
8
- * A minimal client to use when calling standalone SDK functions. Typically, an
9
- * instance of this class would be instantiated once at the start of an
10
- * application and passed around through some dependency injection mechanism to
11
- * parts of an application that need to make SDK calls.
12
- */
13
- export class FinanceableCore extends ClientSDK {}
@@ -1,124 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { FinanceableCore } from "../core.js";
6
- import { encodeJSON } from "../lib/encodings.js";
7
- import * as M from "../lib/matchers.js";
8
- import { safeParse } from "../lib/schemas.js";
9
- import { RequestOptions } from "../lib/sdks.js";
10
- import { pathToFunc } from "../lib/url.js";
11
- import * as components from "../models/components/index.js";
12
- import { APIError } from "../models/errors/apierror.js";
13
- import {
14
- ConnectionError,
15
- InvalidRequestError,
16
- RequestAbortedError,
17
- RequestTimeoutError,
18
- UnexpectedClientError,
19
- } from "../models/errors/httpclienterrors.js";
20
- import * as errors from "../models/errors/index.js";
21
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
- import * as operations from "../models/operations/index.js";
23
- import { Result } from "../types/fp.js";
24
-
25
- /**
26
- * Create an application in the Financeable platform.
27
- */
28
- export async function applicationsCreate(
29
- client: FinanceableCore,
30
- request: components.ApplicationResourceBulkSubmission,
31
- options?: RequestOptions,
32
- ): Promise<
33
- Result<
34
- operations.CreateApplicationResponseBody,
35
- | errors.CreateApplicationResponseBody
36
- | APIError
37
- | SDKValidationError
38
- | UnexpectedClientError
39
- | InvalidRequestError
40
- | RequestAbortedError
41
- | RequestTimeoutError
42
- | ConnectionError
43
- >
44
- > {
45
- const parsed = safeParse(
46
- request,
47
- (value) =>
48
- components.ApplicationResourceBulkSubmission$outboundSchema.parse(value),
49
- "Input validation failed",
50
- );
51
- if (!parsed.ok) {
52
- return parsed;
53
- }
54
- const payload = parsed.value;
55
- const body = encodeJSON("body", payload, { explode: true });
56
-
57
- const path = pathToFunc("/applications")();
58
-
59
- const headers = new Headers({
60
- "Content-Type": "application/json",
61
- Accept: "application/json",
62
- });
63
-
64
- const context = {
65
- operationID: "createApplication",
66
- oAuth2Scopes: [],
67
-
68
- resolvedSecurity: null,
69
-
70
- securitySource: null,
71
- retryConfig: options?.retries
72
- || client._options.retryConfig
73
- || { strategy: "none" },
74
- retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
75
- };
76
-
77
- const requestRes = client._createRequest(context, {
78
- method: "POST",
79
- path: path,
80
- headers: headers,
81
- body: body,
82
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
83
- }, options);
84
- if (!requestRes.ok) {
85
- return requestRes;
86
- }
87
- const req = requestRes.value;
88
-
89
- const doResult = await client._do(req, {
90
- context,
91
- errorCodes: ["403", "4XX", "5XX"],
92
- retryConfig: context.retryConfig,
93
- retryCodes: context.retryCodes,
94
- });
95
- if (!doResult.ok) {
96
- return doResult;
97
- }
98
- const response = doResult.value;
99
-
100
- const responseFields = {
101
- HttpMeta: { Response: response, Request: req },
102
- };
103
-
104
- const [result] = await M.match<
105
- operations.CreateApplicationResponseBody,
106
- | errors.CreateApplicationResponseBody
107
- | APIError
108
- | SDKValidationError
109
- | UnexpectedClientError
110
- | InvalidRequestError
111
- | RequestAbortedError
112
- | RequestTimeoutError
113
- | ConnectionError
114
- >(
115
- M.json(201, operations.CreateApplicationResponseBody$inboundSchema),
116
- M.jsonErr(403, errors.CreateApplicationResponseBody$inboundSchema),
117
- M.fail(["4XX", "5XX"]),
118
- )(response, { extraFields: responseFields });
119
- if (!result.ok) {
120
- return result;
121
- }
122
-
123
- return result;
124
- }