@kanmon/sdk 2.0.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 (137) hide show
  1. package/README.md +2 -0
  2. package/package.json +45 -0
  3. package/src/index.ts +65 -0
  4. package/src/openapi/.openapi-generator/FILES +130 -0
  5. package/src/openapi/.openapi-generator/VERSION +1 -0
  6. package/src/openapi/.openapi-generator-ignore +30 -0
  7. package/src/openapi/apis/BankAccountsApi.ts +503 -0
  8. package/src/openapi/apis/BusinessesApi.ts +614 -0
  9. package/src/openapi/apis/ConnectTokensApi.ts +133 -0
  10. package/src/openapi/apis/DocumentsApi.ts +150 -0
  11. package/src/openapi/apis/DrawRequestsApi.ts +258 -0
  12. package/src/openapi/apis/EmbeddedSessionsApi.ts +141 -0
  13. package/src/openapi/apis/InvoicesApi.ts +272 -0
  14. package/src/openapi/apis/IssuedProductsApi.ts +251 -0
  15. package/src/openapi/apis/OffersApi.ts +251 -0
  16. package/src/openapi/apis/PaymentsApi.ts +268 -0
  17. package/src/openapi/apis/PrequalificationsApi.ts +141 -0
  18. package/src/openapi/apis/UsersApi.ts +622 -0
  19. package/src/openapi/apis/baseapi.ts +37 -0
  20. package/src/openapi/apis/exception.ts +15 -0
  21. package/src/openapi/auth/auth.ts +79 -0
  22. package/src/openapi/configuration.ts +82 -0
  23. package/src/openapi/http/http.ts +247 -0
  24. package/src/openapi/http/isomorphic-fetch.ts +32 -0
  25. package/src/openapi/index.ts +12 -0
  26. package/src/openapi/middleware.ts +66 -0
  27. package/src/openapi/models/ActivityLog.ts +98 -0
  28. package/src/openapi/models/Address.ts +140 -0
  29. package/src/openapi/models/BadRequestException.ts +63 -0
  30. package/src/openapi/models/BankAccountAlreadyExistException.ts +63 -0
  31. package/src/openapi/models/BankAccountNotFoundException.ts +63 -0
  32. package/src/openapi/models/BankStatementsInvalidException.ts +63 -0
  33. package/src/openapi/models/Business.ts +126 -0
  34. package/src/openapi/models/BusinessAddress.ts +143 -0
  35. package/src/openapi/models/BusinessAlreadyExistsException.ts +63 -0
  36. package/src/openapi/models/BusinessBankAccount.ts +126 -0
  37. package/src/openapi/models/BusinessDocument.ts +98 -0
  38. package/src/openapi/models/BusinessDocumentType.ts +17 -0
  39. package/src/openapi/models/BusinessHasNoInvoiceFinancingProductException.ts +63 -0
  40. package/src/openapi/models/BusinessHasNoPrimaryOwnerException.ts +63 -0
  41. package/src/openapi/models/BusinessNotFoundException.ts +63 -0
  42. package/src/openapi/models/BusinessPlaidBankAccountNotFoundException.ts +63 -0
  43. package/src/openapi/models/BusinessPrequalification.ts +116 -0
  44. package/src/openapi/models/CheckingAccountRequiredException.ts +63 -0
  45. package/src/openapi/models/ConnectToken.ts +38 -0
  46. package/src/openapi/models/CreateBusinessBankAccountRequestBody.ts +116 -0
  47. package/src/openapi/models/CreateBusinessDocumentsResponse.ts +39 -0
  48. package/src/openapi/models/CreateBusinessRequestBody.ts +99 -0
  49. package/src/openapi/models/CreateConnectTokenRequestBody.ts +48 -0
  50. package/src/openapi/models/CreateEmbeddedSession409Response.ts +65 -0
  51. package/src/openapi/models/CreateSessionTokenRequestBody.ts +56 -0
  52. package/src/openapi/models/CreateSessionTokenRequestBodyData.ts +56 -0
  53. package/src/openapi/models/CreateUser409Response.ts +66 -0
  54. package/src/openapi/models/CreateUserRequestBody.ts +125 -0
  55. package/src/openapi/models/DrawRequest.ts +138 -0
  56. package/src/openapi/models/DrawRequestNotFoundException.ts +63 -0
  57. package/src/openapi/models/DrawRequestState.ts +21 -0
  58. package/src/openapi/models/EmbeddedSession.ts +38 -0
  59. package/src/openapi/models/FixedDateInvoiceRepaymentWindow.ts +50 -0
  60. package/src/openapi/models/FixedDurationInvoiceRepaymentWindow.ts +50 -0
  61. package/src/openapi/models/ForbiddenException.ts +63 -0
  62. package/src/openapi/models/GetActivityLogsResponse.ts +50 -0
  63. package/src/openapi/models/GetBusinessBankAccountsResponse.ts +50 -0
  64. package/src/openapi/models/GetBusinessesResponse.ts +50 -0
  65. package/src/openapi/models/GetDrawRequestsResponse.ts +50 -0
  66. package/src/openapi/models/GetInvoice404Response.ts +65 -0
  67. package/src/openapi/models/GetInvoicesResponse.ts +50 -0
  68. package/src/openapi/models/GetIssuedProductsResponse.ts +50 -0
  69. package/src/openapi/models/GetOffersResponse.ts +50 -0
  70. package/src/openapi/models/GetPaymentScheduleResponse.ts +50 -0
  71. package/src/openapi/models/GetPrequalificationsResponse.ts +50 -0
  72. package/src/openapi/models/GetUsersResponse.ts +50 -0
  73. package/src/openapi/models/InternalServerErrorException.ts +63 -0
  74. package/src/openapi/models/InvalidInvoiceDueDateException.ts +63 -0
  75. package/src/openapi/models/Invoice.ts +281 -0
  76. package/src/openapi/models/InvoiceFinancingOfferTerms.ts +61 -0
  77. package/src/openapi/models/InvoiceFinancingServicingData.ts +71 -0
  78. package/src/openapi/models/InvoiceFlowSessionTokenData.ts +51 -0
  79. package/src/openapi/models/InvoiceFlowWithInvoiceFileSessionTokenData.ts +51 -0
  80. package/src/openapi/models/InvoiceNotFoundException.ts +63 -0
  81. package/src/openapi/models/InvoicePaymentPlan.ts +58 -0
  82. package/src/openapi/models/InvoicePayorAddress.ts +143 -0
  83. package/src/openapi/models/InvoiceRepaymentSchedule.ts +39 -0
  84. package/src/openapi/models/InvoiceRepaymentScheduleItem.ts +68 -0
  85. package/src/openapi/models/InvoiceStatus.ts +22 -0
  86. package/src/openapi/models/IssuedProduct.ts +115 -0
  87. package/src/openapi/models/IssuedProductNotFoundException.ts +63 -0
  88. package/src/openapi/models/IssuedProductServicingData.ts +234 -0
  89. package/src/openapi/models/LineOfCreditOfferTerms.ts +80 -0
  90. package/src/openapi/models/LineOfCreditServicingData.ts +90 -0
  91. package/src/openapi/models/McaOfferTerms.ts +96 -0
  92. package/src/openapi/models/McaServicingData.ts +116 -0
  93. package/src/openapi/models/MergeUsersRequestBody.ts +68 -0
  94. package/src/openapi/models/MergeUsersResponseBody.ts +39 -0
  95. package/src/openapi/models/MultipleDurationInvoiceRepaymentWindow.ts +48 -0
  96. package/src/openapi/models/ObjectSerializer.ts +643 -0
  97. package/src/openapi/models/Offer.ts +106 -0
  98. package/src/openapi/models/OfferAlreadySelectedException.ts +63 -0
  99. package/src/openapi/models/OfferNotFoundException.ts +63 -0
  100. package/src/openapi/models/OfferNotLockedException.ts +63 -0
  101. package/src/openapi/models/OfferTerms.ts +184 -0
  102. package/src/openapi/models/PaginationResult.ts +58 -0
  103. package/src/openapi/models/PaymentOrder.ts +198 -0
  104. package/src/openapi/models/PaymentOrderNotFoundException.ts +63 -0
  105. package/src/openapi/models/PaymentOrderStatus.ts +19 -0
  106. package/src/openapi/models/PaymentPlanRepaymentSchedule.ts +39 -0
  107. package/src/openapi/models/PaymentPlanRepaymentScheduleItem.ts +48 -0
  108. package/src/openapi/models/PaymentScheduleItem.ts +56 -0
  109. package/src/openapi/models/PaymentScheduleItemPaymentOrder.ts +201 -0
  110. package/src/openapi/models/PlaidAssetReportsInvalidException.ts +63 -0
  111. package/src/openapi/models/PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException.ts +63 -0
  112. package/src/openapi/models/PrimaryBusinessOwnerAlreadyExistsForBusinessException.ts +63 -0
  113. package/src/openapi/models/PrimaryBusinessOwnerAlreadyExistsWithEmailException.ts +63 -0
  114. package/src/openapi/models/PrimaryBusinessOwnerNotFoundException.ts +63 -0
  115. package/src/openapi/models/SessionInvoice.ts +165 -0
  116. package/src/openapi/models/SessionInvoiceWithInvoiceFile.ts +175 -0
  117. package/src/openapi/models/SomeOffersHaveExpiredException.ts +63 -0
  118. package/src/openapi/models/TermLoanOfferTerms.ts +90 -0
  119. package/src/openapi/models/TermLoanServicingData.ts +100 -0
  120. package/src/openapi/models/UnmergeableBusinessException.ts +63 -0
  121. package/src/openapi/models/UpdateBusinessAccountRequestBody.ts +68 -0
  122. package/src/openapi/models/UpdateBusinessRequestBody.ts +99 -0
  123. package/src/openapi/models/UpdateUser409Response.ts +65 -0
  124. package/src/openapi/models/UpdateUserRequestBody.ts +95 -0
  125. package/src/openapi/models/User.ts +152 -0
  126. package/src/openapi/models/UserAddress.ts +143 -0
  127. package/src/openapi/models/UserAlreadyExistsWithEmailException.ts +63 -0
  128. package/src/openapi/models/UserAlreadyExistsWithPlatformUserIdException.ts +63 -0
  129. package/src/openapi/models/UserNotFoundException.ts +63 -0
  130. package/src/openapi/models/all.ts +102 -0
  131. package/src/openapi/rxjsStub.ts +27 -0
  132. package/src/openapi/servers.ts +58 -0
  133. package/src/openapi/types/ObjectParamAPI.ts +1403 -0
  134. package/src/openapi/types/ObservableAPI.ts +1348 -0
  135. package/src/openapi/types/PromiseAPI.ts +995 -0
  136. package/src/openapi/util.ts +37 -0
  137. package/tsconfig.json +32 -0
@@ -0,0 +1,614 @@
1
+ // TODO: better import syntax?
2
+ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
3
+ import {Configuration} from '../configuration';
4
+ import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
5
+ import FormData from "form-data";
6
+ import { URLSearchParams } from 'url';
7
+ import {ObjectSerializer} from '../models/ObjectSerializer';
8
+ import {ApiException} from './exception';
9
+ import {canConsumeForm, isCodeInRange} from '../util';
10
+ import {SecurityAuthentication} from '../auth/auth';
11
+
12
+
13
+ import { BadRequestException } from '../models/BadRequestException';
14
+ import { Business } from '../models/Business';
15
+ import { BusinessAlreadyExistsException } from '../models/BusinessAlreadyExistsException';
16
+ import { BusinessNotFoundException } from '../models/BusinessNotFoundException';
17
+ import { CreateBusinessRequestBody } from '../models/CreateBusinessRequestBody';
18
+ import { ForbiddenException } from '../models/ForbiddenException';
19
+ import { GetActivityLogsResponse } from '../models/GetActivityLogsResponse';
20
+ import { GetBusinessesResponse } from '../models/GetBusinessesResponse';
21
+ import { InternalServerErrorException } from '../models/InternalServerErrorException';
22
+ import { UpdateBusinessRequestBody } from '../models/UpdateBusinessRequestBody';
23
+
24
+ /**
25
+ * no description
26
+ */
27
+ export class BusinessesApiRequestFactory extends BaseAPIRequestFactory {
28
+
29
+ /**
30
+ * Create a business
31
+ * @param createBusinessRequestBody
32
+ */
33
+ public async createBusiness(createBusinessRequestBody: CreateBusinessRequestBody, _options?: Configuration): Promise<RequestContext> {
34
+ let _config = _options || this.configuration;
35
+
36
+ // verify required parameter 'createBusinessRequestBody' is not null or undefined
37
+ if (createBusinessRequestBody === null || createBusinessRequestBody === undefined) {
38
+ throw new RequiredError("BusinessesApi", "createBusiness", "createBusinessRequestBody");
39
+ }
40
+
41
+
42
+ // Path Params
43
+ const localVarPath = '/api/platform/v2/businesses';
44
+
45
+ // Make Request Context
46
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
47
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
48
+
49
+
50
+ // Body Params
51
+ const contentType = ObjectSerializer.getPreferredMediaType([
52
+ "application/json"
53
+ ]);
54
+ requestContext.setHeaderParam("Content-Type", contentType);
55
+ const serializedBody = ObjectSerializer.stringify(
56
+ ObjectSerializer.serialize(createBusinessRequestBody, "CreateBusinessRequestBody", ""),
57
+ contentType
58
+ );
59
+ requestContext.setBody(serializedBody);
60
+
61
+ let authMethod: SecurityAuthentication | undefined;
62
+ // Apply auth methods
63
+ authMethod = _config.authMethods["Authorization"]
64
+ if (authMethod?.applySecurityAuthentication) {
65
+ await authMethod?.applySecurityAuthentication(requestContext);
66
+ }
67
+
68
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
69
+ if (defaultAuth?.applySecurityAuthentication) {
70
+ await defaultAuth?.applySecurityAuthentication(requestContext);
71
+ }
72
+
73
+ return requestContext;
74
+ }
75
+
76
+ /**
77
+ * Fetch a business
78
+ * @param id Either the Kanmon business UUID or your platform’s business ID, depending on &#x60;idType&#x60;.
79
+ * @param idType Which ID type to query the business by. Defaults to &#x60;KANMON&#x60;. Use &#x60;PLATFORM&#x60; if you want to query by your platform’s ID.
80
+ */
81
+ public async getBusiness(id: any, idType?: 'KANMON' | 'PLATFORM', _options?: Configuration): Promise<RequestContext> {
82
+ let _config = _options || this.configuration;
83
+
84
+ // verify required parameter 'id' is not null or undefined
85
+ if (id === null || id === undefined) {
86
+ throw new RequiredError("BusinessesApi", "getBusiness", "id");
87
+ }
88
+
89
+
90
+
91
+ // Path Params
92
+ const localVarPath = '/api/platform/v2/businesses/{id}'
93
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
94
+
95
+ // Make Request Context
96
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
97
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
98
+
99
+ // Query Params
100
+ if (idType !== undefined) {
101
+ requestContext.setQueryParam("idType", ObjectSerializer.serialize(idType, "'KANMON' | 'PLATFORM'", ""));
102
+ }
103
+
104
+
105
+ let authMethod: SecurityAuthentication | undefined;
106
+ // Apply auth methods
107
+ authMethod = _config.authMethods["Authorization"]
108
+ if (authMethod?.applySecurityAuthentication) {
109
+ await authMethod?.applySecurityAuthentication(requestContext);
110
+ }
111
+
112
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
113
+ if (defaultAuth?.applySecurityAuthentication) {
114
+ await defaultAuth?.applySecurityAuthentication(requestContext);
115
+ }
116
+
117
+ return requestContext;
118
+ }
119
+
120
+ /**
121
+ * Fetch activity logs for a business
122
+ * @param id Either the Kanmon business UUID or your platform’s business ID, depending on &#x60;idType&#x60;.
123
+ * @param idType Which ID type to query the business by. Defaults to &#x60;KANMON&#x60;. Use &#x60;PLATFORM&#x60; if you want to query by your platform’s ID.
124
+ * @param offset The number of records to skip when performing pagination. Defaults to &#x60;0&#x60;.
125
+ * @param limit The number of records to limit when performing pagination. Defaults to &#x60;100&#x60;, which is the max.
126
+ * @param createdAtStart Filter for records where &#x60;createdAt&#x60; is greater than or equal to this value. ISO 8601 format.
127
+ * @param createdAtEnd Filter for records where &#x60;createdAt&#x60; is less than or equal to this value. ISO 8601 format.
128
+ */
129
+ public async getBusinessActivityLog(id: any, idType?: 'KANMON' | 'PLATFORM', offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
130
+ let _config = _options || this.configuration;
131
+
132
+ // verify required parameter 'id' is not null or undefined
133
+ if (id === null || id === undefined) {
134
+ throw new RequiredError("BusinessesApi", "getBusinessActivityLog", "id");
135
+ }
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+ // Path Params
144
+ const localVarPath = '/api/platform/v2/businesses/{id}/activity-logs'
145
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
146
+
147
+ // Make Request Context
148
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
149
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
150
+
151
+ // Query Params
152
+ if (idType !== undefined) {
153
+ requestContext.setQueryParam("idType", ObjectSerializer.serialize(idType, "'KANMON' | 'PLATFORM'", ""));
154
+ }
155
+
156
+ // Query Params
157
+ if (offset !== undefined) {
158
+ requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
159
+ }
160
+
161
+ // Query Params
162
+ if (limit !== undefined) {
163
+ requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
164
+ }
165
+
166
+ // Query Params
167
+ if (createdAtStart !== undefined) {
168
+ requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
169
+ }
170
+
171
+ // Query Params
172
+ if (createdAtEnd !== undefined) {
173
+ requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
174
+ }
175
+
176
+
177
+ let authMethod: SecurityAuthentication | undefined;
178
+ // Apply auth methods
179
+ authMethod = _config.authMethods["Authorization"]
180
+ if (authMethod?.applySecurityAuthentication) {
181
+ await authMethod?.applySecurityAuthentication(requestContext);
182
+ }
183
+
184
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
185
+ if (defaultAuth?.applySecurityAuthentication) {
186
+ await defaultAuth?.applySecurityAuthentication(requestContext);
187
+ }
188
+
189
+ return requestContext;
190
+ }
191
+
192
+ /**
193
+ * Fetch businesses
194
+ * @param ids A comma delimited list of Kanmon’s unique IDs for businesses.
195
+ * @param platformBusinessIds A comma delimited list of your platform’s unique IDs for businesses.
196
+ * @param offset The number of records to skip when performing pagination. Defaults to &#x60;0&#x60;.
197
+ * @param limit The number of records to limit when performing pagination. Defaults to &#x60;100&#x60;, which is the max.
198
+ * @param createdAtStart Filter for records where &#x60;createdAt&#x60; is greater than or equal to this value. ISO 8601 format.
199
+ * @param createdAtEnd Filter for records where &#x60;createdAt&#x60; is less than or equal to this value. ISO 8601 format.
200
+ */
201
+ public async getBusinesses(ids?: string, platformBusinessIds?: string, offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
202
+ let _config = _options || this.configuration;
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ // Path Params
211
+ const localVarPath = '/api/platform/v2/businesses';
212
+
213
+ // Make Request Context
214
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
215
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
216
+
217
+ // Query Params
218
+ if (ids !== undefined) {
219
+ requestContext.setQueryParam("ids", ObjectSerializer.serialize(ids, "string", ""));
220
+ }
221
+
222
+ // Query Params
223
+ if (platformBusinessIds !== undefined) {
224
+ requestContext.setQueryParam("platformBusinessIds", ObjectSerializer.serialize(platformBusinessIds, "string", ""));
225
+ }
226
+
227
+ // Query Params
228
+ if (offset !== undefined) {
229
+ requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
230
+ }
231
+
232
+ // Query Params
233
+ if (limit !== undefined) {
234
+ requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
235
+ }
236
+
237
+ // Query Params
238
+ if (createdAtStart !== undefined) {
239
+ requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
240
+ }
241
+
242
+ // Query Params
243
+ if (createdAtEnd !== undefined) {
244
+ requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
245
+ }
246
+
247
+
248
+ let authMethod: SecurityAuthentication | undefined;
249
+ // Apply auth methods
250
+ authMethod = _config.authMethods["Authorization"]
251
+ if (authMethod?.applySecurityAuthentication) {
252
+ await authMethod?.applySecurityAuthentication(requestContext);
253
+ }
254
+
255
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
256
+ if (defaultAuth?.applySecurityAuthentication) {
257
+ await defaultAuth?.applySecurityAuthentication(requestContext);
258
+ }
259
+
260
+ return requestContext;
261
+ }
262
+
263
+ /**
264
+ * Update a business
265
+ * @param id Either the Kanmon business UUID or your platform’s business ID, depending on &#x60;idType&#x60;.
266
+ * @param updateBusinessRequestBody
267
+ * @param idType Which ID type to query the business by. Defaults to &#x60;KANMON&#x60;. Use &#x60;PLATFORM&#x60; if you want to query by your platform’s ID.
268
+ */
269
+ public async updateBusiness(id: any, updateBusinessRequestBody: UpdateBusinessRequestBody, idType?: 'KANMON' | 'PLATFORM', _options?: Configuration): Promise<RequestContext> {
270
+ let _config = _options || this.configuration;
271
+
272
+ // verify required parameter 'id' is not null or undefined
273
+ if (id === null || id === undefined) {
274
+ throw new RequiredError("BusinessesApi", "updateBusiness", "id");
275
+ }
276
+
277
+
278
+ // verify required parameter 'updateBusinessRequestBody' is not null or undefined
279
+ if (updateBusinessRequestBody === null || updateBusinessRequestBody === undefined) {
280
+ throw new RequiredError("BusinessesApi", "updateBusiness", "updateBusinessRequestBody");
281
+ }
282
+
283
+
284
+
285
+ // Path Params
286
+ const localVarPath = '/api/platform/v2/businesses/{id}'
287
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
288
+
289
+ // Make Request Context
290
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
291
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
292
+
293
+ // Query Params
294
+ if (idType !== undefined) {
295
+ requestContext.setQueryParam("idType", ObjectSerializer.serialize(idType, "'KANMON' | 'PLATFORM'", ""));
296
+ }
297
+
298
+
299
+ // Body Params
300
+ const contentType = ObjectSerializer.getPreferredMediaType([
301
+ "application/json"
302
+ ]);
303
+ requestContext.setHeaderParam("Content-Type", contentType);
304
+ const serializedBody = ObjectSerializer.stringify(
305
+ ObjectSerializer.serialize(updateBusinessRequestBody, "UpdateBusinessRequestBody", ""),
306
+ contentType
307
+ );
308
+ requestContext.setBody(serializedBody);
309
+
310
+ let authMethod: SecurityAuthentication | undefined;
311
+ // Apply auth methods
312
+ authMethod = _config.authMethods["Authorization"]
313
+ if (authMethod?.applySecurityAuthentication) {
314
+ await authMethod?.applySecurityAuthentication(requestContext);
315
+ }
316
+
317
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
318
+ if (defaultAuth?.applySecurityAuthentication) {
319
+ await defaultAuth?.applySecurityAuthentication(requestContext);
320
+ }
321
+
322
+ return requestContext;
323
+ }
324
+
325
+ }
326
+
327
+ export class BusinessesApiResponseProcessor {
328
+
329
+ /**
330
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
331
+ * to the expected objects
332
+ *
333
+ * @params response Response returned by the server for a request to createBusiness
334
+ * @throws ApiException if the response code was not in [200, 299]
335
+ */
336
+ public async createBusinessWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Business >> {
337
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
338
+ if (isCodeInRange("201", response.httpStatusCode)) {
339
+ const body: Business = ObjectSerializer.deserialize(
340
+ ObjectSerializer.parse(await response.body.text(), contentType),
341
+ "Business", ""
342
+ ) as Business;
343
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
344
+ }
345
+ if (isCodeInRange("400", response.httpStatusCode)) {
346
+ const body: BadRequestException = ObjectSerializer.deserialize(
347
+ ObjectSerializer.parse(await response.body.text(), contentType),
348
+ "BadRequestException", ""
349
+ ) as BadRequestException;
350
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
351
+ }
352
+ if (isCodeInRange("403", response.httpStatusCode)) {
353
+ const body: ForbiddenException = ObjectSerializer.deserialize(
354
+ ObjectSerializer.parse(await response.body.text(), contentType),
355
+ "ForbiddenException", ""
356
+ ) as ForbiddenException;
357
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
358
+ }
359
+ if (isCodeInRange("409", response.httpStatusCode)) {
360
+ const body: BusinessAlreadyExistsException = ObjectSerializer.deserialize(
361
+ ObjectSerializer.parse(await response.body.text(), contentType),
362
+ "BusinessAlreadyExistsException", ""
363
+ ) as BusinessAlreadyExistsException;
364
+ throw new ApiException<BusinessAlreadyExistsException>(response.httpStatusCode, "BusinessAlreadyExistsException", body, response.headers);
365
+ }
366
+ if (isCodeInRange("500", response.httpStatusCode)) {
367
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
368
+ ObjectSerializer.parse(await response.body.text(), contentType),
369
+ "InternalServerErrorException", ""
370
+ ) as InternalServerErrorException;
371
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
372
+ }
373
+
374
+ // Work around for missing responses in specification, e.g. for petstore.yaml
375
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
376
+ const body: Business = ObjectSerializer.deserialize(
377
+ ObjectSerializer.parse(await response.body.text(), contentType),
378
+ "Business", ""
379
+ ) as Business;
380
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
381
+ }
382
+
383
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
384
+ }
385
+
386
+ /**
387
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
388
+ * to the expected objects
389
+ *
390
+ * @params response Response returned by the server for a request to getBusiness
391
+ * @throws ApiException if the response code was not in [200, 299]
392
+ */
393
+ public async getBusinessWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Business >> {
394
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
395
+ if (isCodeInRange("200", response.httpStatusCode)) {
396
+ const body: Business = ObjectSerializer.deserialize(
397
+ ObjectSerializer.parse(await response.body.text(), contentType),
398
+ "Business", ""
399
+ ) as Business;
400
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
401
+ }
402
+ if (isCodeInRange("400", response.httpStatusCode)) {
403
+ const body: BadRequestException = ObjectSerializer.deserialize(
404
+ ObjectSerializer.parse(await response.body.text(), contentType),
405
+ "BadRequestException", ""
406
+ ) as BadRequestException;
407
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
408
+ }
409
+ if (isCodeInRange("403", response.httpStatusCode)) {
410
+ const body: ForbiddenException = ObjectSerializer.deserialize(
411
+ ObjectSerializer.parse(await response.body.text(), contentType),
412
+ "ForbiddenException", ""
413
+ ) as ForbiddenException;
414
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
415
+ }
416
+ if (isCodeInRange("404", response.httpStatusCode)) {
417
+ const body: BusinessNotFoundException = ObjectSerializer.deserialize(
418
+ ObjectSerializer.parse(await response.body.text(), contentType),
419
+ "BusinessNotFoundException", ""
420
+ ) as BusinessNotFoundException;
421
+ throw new ApiException<BusinessNotFoundException>(response.httpStatusCode, "BusinessNotFoundException", body, response.headers);
422
+ }
423
+ if (isCodeInRange("500", response.httpStatusCode)) {
424
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
425
+ ObjectSerializer.parse(await response.body.text(), contentType),
426
+ "InternalServerErrorException", ""
427
+ ) as InternalServerErrorException;
428
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
429
+ }
430
+
431
+ // Work around for missing responses in specification, e.g. for petstore.yaml
432
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
433
+ const body: Business = ObjectSerializer.deserialize(
434
+ ObjectSerializer.parse(await response.body.text(), contentType),
435
+ "Business", ""
436
+ ) as Business;
437
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
438
+ }
439
+
440
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
441
+ }
442
+
443
+ /**
444
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
445
+ * to the expected objects
446
+ *
447
+ * @params response Response returned by the server for a request to getBusinessActivityLog
448
+ * @throws ApiException if the response code was not in [200, 299]
449
+ */
450
+ public async getBusinessActivityLogWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetActivityLogsResponse >> {
451
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
452
+ if (isCodeInRange("200", response.httpStatusCode)) {
453
+ const body: GetActivityLogsResponse = ObjectSerializer.deserialize(
454
+ ObjectSerializer.parse(await response.body.text(), contentType),
455
+ "GetActivityLogsResponse", ""
456
+ ) as GetActivityLogsResponse;
457
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
458
+ }
459
+ if (isCodeInRange("400", response.httpStatusCode)) {
460
+ const body: BadRequestException = ObjectSerializer.deserialize(
461
+ ObjectSerializer.parse(await response.body.text(), contentType),
462
+ "BadRequestException", ""
463
+ ) as BadRequestException;
464
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
465
+ }
466
+ if (isCodeInRange("403", response.httpStatusCode)) {
467
+ const body: ForbiddenException = ObjectSerializer.deserialize(
468
+ ObjectSerializer.parse(await response.body.text(), contentType),
469
+ "ForbiddenException", ""
470
+ ) as ForbiddenException;
471
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
472
+ }
473
+ if (isCodeInRange("404", response.httpStatusCode)) {
474
+ const body: BusinessNotFoundException = ObjectSerializer.deserialize(
475
+ ObjectSerializer.parse(await response.body.text(), contentType),
476
+ "BusinessNotFoundException", ""
477
+ ) as BusinessNotFoundException;
478
+ throw new ApiException<BusinessNotFoundException>(response.httpStatusCode, "BusinessNotFoundException", body, response.headers);
479
+ }
480
+ if (isCodeInRange("500", response.httpStatusCode)) {
481
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
482
+ ObjectSerializer.parse(await response.body.text(), contentType),
483
+ "InternalServerErrorException", ""
484
+ ) as InternalServerErrorException;
485
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
486
+ }
487
+
488
+ // Work around for missing responses in specification, e.g. for petstore.yaml
489
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
490
+ const body: GetActivityLogsResponse = ObjectSerializer.deserialize(
491
+ ObjectSerializer.parse(await response.body.text(), contentType),
492
+ "GetActivityLogsResponse", ""
493
+ ) as GetActivityLogsResponse;
494
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
495
+ }
496
+
497
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
498
+ }
499
+
500
+ /**
501
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
502
+ * to the expected objects
503
+ *
504
+ * @params response Response returned by the server for a request to getBusinesses
505
+ * @throws ApiException if the response code was not in [200, 299]
506
+ */
507
+ public async getBusinessesWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetBusinessesResponse >> {
508
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
509
+ if (isCodeInRange("200", response.httpStatusCode)) {
510
+ const body: GetBusinessesResponse = ObjectSerializer.deserialize(
511
+ ObjectSerializer.parse(await response.body.text(), contentType),
512
+ "GetBusinessesResponse", ""
513
+ ) as GetBusinessesResponse;
514
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
515
+ }
516
+ if (isCodeInRange("400", response.httpStatusCode)) {
517
+ const body: BadRequestException = ObjectSerializer.deserialize(
518
+ ObjectSerializer.parse(await response.body.text(), contentType),
519
+ "BadRequestException", ""
520
+ ) as BadRequestException;
521
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
522
+ }
523
+ if (isCodeInRange("403", response.httpStatusCode)) {
524
+ const body: ForbiddenException = ObjectSerializer.deserialize(
525
+ ObjectSerializer.parse(await response.body.text(), contentType),
526
+ "ForbiddenException", ""
527
+ ) as ForbiddenException;
528
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
529
+ }
530
+ if (isCodeInRange("500", response.httpStatusCode)) {
531
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
532
+ ObjectSerializer.parse(await response.body.text(), contentType),
533
+ "InternalServerErrorException", ""
534
+ ) as InternalServerErrorException;
535
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
536
+ }
537
+
538
+ // Work around for missing responses in specification, e.g. for petstore.yaml
539
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
540
+ const body: GetBusinessesResponse = ObjectSerializer.deserialize(
541
+ ObjectSerializer.parse(await response.body.text(), contentType),
542
+ "GetBusinessesResponse", ""
543
+ ) as GetBusinessesResponse;
544
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
545
+ }
546
+
547
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
548
+ }
549
+
550
+ /**
551
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
552
+ * to the expected objects
553
+ *
554
+ * @params response Response returned by the server for a request to updateBusiness
555
+ * @throws ApiException if the response code was not in [200, 299]
556
+ */
557
+ public async updateBusinessWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Business >> {
558
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
559
+ if (isCodeInRange("200", response.httpStatusCode)) {
560
+ const body: Business = ObjectSerializer.deserialize(
561
+ ObjectSerializer.parse(await response.body.text(), contentType),
562
+ "Business", ""
563
+ ) as Business;
564
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
565
+ }
566
+ if (isCodeInRange("400", response.httpStatusCode)) {
567
+ const body: BadRequestException = ObjectSerializer.deserialize(
568
+ ObjectSerializer.parse(await response.body.text(), contentType),
569
+ "BadRequestException", ""
570
+ ) as BadRequestException;
571
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
572
+ }
573
+ if (isCodeInRange("403", response.httpStatusCode)) {
574
+ const body: ForbiddenException = ObjectSerializer.deserialize(
575
+ ObjectSerializer.parse(await response.body.text(), contentType),
576
+ "ForbiddenException", ""
577
+ ) as ForbiddenException;
578
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
579
+ }
580
+ if (isCodeInRange("404", response.httpStatusCode)) {
581
+ const body: BusinessNotFoundException = ObjectSerializer.deserialize(
582
+ ObjectSerializer.parse(await response.body.text(), contentType),
583
+ "BusinessNotFoundException", ""
584
+ ) as BusinessNotFoundException;
585
+ throw new ApiException<BusinessNotFoundException>(response.httpStatusCode, "BusinessNotFoundException", body, response.headers);
586
+ }
587
+ if (isCodeInRange("409", response.httpStatusCode)) {
588
+ const body: BusinessAlreadyExistsException = ObjectSerializer.deserialize(
589
+ ObjectSerializer.parse(await response.body.text(), contentType),
590
+ "BusinessAlreadyExistsException", ""
591
+ ) as BusinessAlreadyExistsException;
592
+ throw new ApiException<BusinessAlreadyExistsException>(response.httpStatusCode, "BusinessAlreadyExistsException", body, response.headers);
593
+ }
594
+ if (isCodeInRange("500", response.httpStatusCode)) {
595
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
596
+ ObjectSerializer.parse(await response.body.text(), contentType),
597
+ "InternalServerErrorException", ""
598
+ ) as InternalServerErrorException;
599
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
600
+ }
601
+
602
+ // Work around for missing responses in specification, e.g. for petstore.yaml
603
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
604
+ const body: Business = ObjectSerializer.deserialize(
605
+ ObjectSerializer.parse(await response.body.text(), contentType),
606
+ "Business", ""
607
+ ) as Business;
608
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
609
+ }
610
+
611
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
612
+ }
613
+
614
+ }