@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,79 @@
1
+ import { RequestContext } from "../http/http";
2
+
3
+ /**
4
+ * Interface authentication schemes.
5
+ */
6
+ export interface SecurityAuthentication {
7
+ /*
8
+ * @return returns the name of the security authentication as specified in OAI
9
+ */
10
+ getName(): string;
11
+
12
+ /**
13
+ * Applies the authentication scheme to the request context
14
+ *
15
+ * @params context the request context which should use this authentication scheme
16
+ */
17
+ applySecurityAuthentication(context: RequestContext): void | Promise<void>;
18
+ }
19
+
20
+ export interface TokenProvider {
21
+ getToken(): Promise<string> | string;
22
+ }
23
+
24
+ /**
25
+ * Applies apiKey authentication to the request context.
26
+ */
27
+ export class AuthorizationAuthentication implements SecurityAuthentication {
28
+ /**
29
+ * Configures this api key authentication with the necessary properties
30
+ *
31
+ * @param apiKey: The api key to be used for every request
32
+ */
33
+ public constructor(private apiKey: string) {}
34
+
35
+ public getName(): string {
36
+ return "Authorization";
37
+ }
38
+
39
+ public applySecurityAuthentication(context: RequestContext) {
40
+ context.setHeaderParam("Authorization", this.apiKey);
41
+ }
42
+ }
43
+
44
+
45
+ export type AuthMethods = {
46
+ "default"?: SecurityAuthentication,
47
+ "Authorization"?: SecurityAuthentication
48
+ }
49
+
50
+ export type ApiKeyConfiguration = string;
51
+ export type HttpBasicConfiguration = { "username": string, "password": string };
52
+ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
53
+ export type OAuth2Configuration = { accessToken: string };
54
+
55
+ export type AuthMethodsConfiguration = {
56
+ "default"?: SecurityAuthentication,
57
+ "Authorization"?: ApiKeyConfiguration
58
+ }
59
+
60
+ /**
61
+ * Creates the authentication methods from a swagger description.
62
+ *
63
+ */
64
+ export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods {
65
+ let authMethods: AuthMethods = {}
66
+
67
+ if (!config) {
68
+ return authMethods;
69
+ }
70
+ authMethods["default"] = config["default"]
71
+
72
+ if (config["Authorization"]) {
73
+ authMethods["Authorization"] = new AuthorizationAuthentication(
74
+ config["Authorization"]
75
+ );
76
+ }
77
+
78
+ return authMethods;
79
+ }
@@ -0,0 +1,82 @@
1
+ import { HttpLibrary } from "./http/http";
2
+ import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware";
3
+ import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch";
4
+ import { BaseServerConfiguration, server1 } from "./servers";
5
+ import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth";
6
+
7
+ export interface Configuration {
8
+ readonly baseServer: BaseServerConfiguration;
9
+ readonly httpApi: HttpLibrary;
10
+ readonly middleware: Middleware[];
11
+ readonly authMethods: AuthMethods;
12
+ }
13
+
14
+
15
+ /**
16
+ * Interface with which a configuration object can be configured.
17
+ */
18
+ export interface ConfigurationParameters {
19
+ /**
20
+ * Default server to use - a list of available servers (according to the
21
+ * OpenAPI yaml definition) is included in the `servers` const in `./servers`. You can also
22
+ * create your own server with the `ServerConfiguration` class from the same
23
+ * file.
24
+ */
25
+ baseServer?: BaseServerConfiguration;
26
+ /**
27
+ * HTTP library to use e.g. IsomorphicFetch. This can usually be skipped as
28
+ * all generators come with a default library.
29
+ * If available, additional libraries can be imported from `./http/*`
30
+ */
31
+ httpApi?: HttpLibrary;
32
+
33
+ /**
34
+ * The middlewares which will be applied to requests and responses. You can
35
+ * add any number of middleware components to modify requests before they
36
+ * are sent or before they are deserialized by implementing the `Middleware`
37
+ * interface defined in `./middleware`
38
+ */
39
+ middleware?: Middleware[];
40
+ /**
41
+ * Configures middleware functions that return promises instead of
42
+ * Observables (which are used by `middleware`). Otherwise allows for the
43
+ * same functionality as `middleware`, i.e., modifying requests before they
44
+ * are sent and before they are deserialized.
45
+ */
46
+ promiseMiddleware?: PromiseMiddleware[];
47
+ /**
48
+ * Configuration for the available authentication methods (e.g., api keys)
49
+ * according to the OpenAPI yaml definition. For the definition, please refer to
50
+ * `./auth/auth`
51
+ */
52
+ authMethods?: AuthMethodsConfiguration
53
+ }
54
+
55
+ /**
56
+ * Provide your `ConfigurationParameters` to this function to get a `Configuration`
57
+ * object that can be used to configure your APIs (in the constructor or
58
+ * for each request individually).
59
+ *
60
+ * If a property is not included in conf, a default is used:
61
+ * - baseServer: server1
62
+ * - httpApi: IsomorphicFetchHttpLibrary
63
+ * - middleware: []
64
+ * - promiseMiddleware: []
65
+ * - authMethods: {}
66
+ *
67
+ * @param conf partial configuration
68
+ */
69
+ export function createConfiguration(conf: ConfigurationParameters = {}): Configuration {
70
+ const configuration: Configuration = {
71
+ baseServer: conf.baseServer !== undefined ? conf.baseServer : server1,
72
+ httpApi: conf.httpApi || new DefaultHttpLibrary(),
73
+ middleware: conf.middleware || [],
74
+ authMethods: configureAuthMethods(conf.authMethods)
75
+ };
76
+ if (conf.promiseMiddleware) {
77
+ conf.promiseMiddleware.forEach(
78
+ m => configuration.middleware.push(new PromiseMiddlewareWrapper(m))
79
+ );
80
+ }
81
+ return configuration;
82
+ }
@@ -0,0 +1,247 @@
1
+ // TODO: evaluate if we can easily get rid of this library
2
+ import FormData from "form-data";
3
+ import { URL, URLSearchParams } from 'url';
4
+ import * as http from 'http';
5
+ import * as https from 'https';
6
+ import { Observable, from } from '../rxjsStub';
7
+
8
+ export * from './isomorphic-fetch';
9
+
10
+ /**
11
+ * Represents an HTTP method.
12
+ */
13
+ export enum HttpMethod {
14
+ GET = "GET",
15
+ HEAD = "HEAD",
16
+ POST = "POST",
17
+ PUT = "PUT",
18
+ DELETE = "DELETE",
19
+ CONNECT = "CONNECT",
20
+ OPTIONS = "OPTIONS",
21
+ TRACE = "TRACE",
22
+ PATCH = "PATCH"
23
+ }
24
+
25
+ /**
26
+ * Represents an HTTP file which will be transferred from or to a server.
27
+ */
28
+ export type HttpFile = {
29
+ data: Buffer,
30
+ name: string
31
+ };
32
+
33
+ export class HttpException extends Error {
34
+ public constructor(msg: string) {
35
+ super(msg);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Represents the body of an outgoing HTTP request.
41
+ */
42
+ export type RequestBody = undefined | string | FormData | URLSearchParams;
43
+
44
+ function ensureAbsoluteUrl(url: string) {
45
+ if (url.startsWith("http://") || url.startsWith("https://")) {
46
+ return url;
47
+ }
48
+ throw new Error("You need to define an absolute base url for the server.");
49
+ }
50
+
51
+ /**
52
+ * Represents an HTTP request context
53
+ */
54
+ export class RequestContext {
55
+ private headers: { [key: string]: string } = {};
56
+ private body: RequestBody = undefined;
57
+ private url: URL;
58
+ private agent: http.Agent | https.Agent | undefined = undefined;
59
+
60
+ /**
61
+ * Creates the request context using a http method and request resource url
62
+ *
63
+ * @param url url of the requested resource
64
+ * @param httpMethod http method
65
+ */
66
+ public constructor(url: string, private httpMethod: HttpMethod) {
67
+ this.url = new URL(ensureAbsoluteUrl(url));
68
+ }
69
+
70
+ /*
71
+ * Returns the url set in the constructor including the query string
72
+ *
73
+ */
74
+ public getUrl(): string {
75
+ return this.url.toString().endsWith("/") ?
76
+ this.url.toString().slice(0, -1)
77
+ : this.url.toString();
78
+ }
79
+
80
+ /**
81
+ * Replaces the url set in the constructor with this url.
82
+ *
83
+ */
84
+ public setUrl(url: string) {
85
+ this.url = new URL(ensureAbsoluteUrl(url));
86
+ }
87
+
88
+ /**
89
+ * Sets the body of the http request either as a string or FormData
90
+ *
91
+ * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE
92
+ * request is discouraged.
93
+ * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1
94
+ *
95
+ * @param body the body of the request
96
+ */
97
+ public setBody(body: RequestBody) {
98
+ this.body = body;
99
+ }
100
+
101
+ public getHttpMethod(): HttpMethod {
102
+ return this.httpMethod;
103
+ }
104
+
105
+ public getHeaders(): { [key: string]: string } {
106
+ return this.headers;
107
+ }
108
+
109
+ public getBody(): RequestBody {
110
+ return this.body;
111
+ }
112
+
113
+ public setQueryParam(name: string, value: string) {
114
+ this.url.searchParams.set(name, value);
115
+ }
116
+
117
+ /**
118
+ * Sets a cookie with the name and value. NO check for duplicate cookies is performed
119
+ *
120
+ */
121
+ public addCookie(name: string, value: string): void {
122
+ if (!this.headers["Cookie"]) {
123
+ this.headers["Cookie"] = "";
124
+ }
125
+ this.headers["Cookie"] += name + "=" + value + "; ";
126
+ }
127
+
128
+ public setHeaderParam(key: string, value: string): void {
129
+ this.headers[key] = value;
130
+ }
131
+
132
+ public setAgent(agent: http.Agent | https.Agent) {
133
+ this.agent = agent;
134
+ }
135
+
136
+ public getAgent(): http.Agent | https.Agent | undefined {
137
+ return this.agent;
138
+ }
139
+ }
140
+
141
+ export interface ResponseBody {
142
+ text(): Promise<string>;
143
+ binary(): Promise<Buffer>;
144
+ }
145
+
146
+ /**
147
+ * Helper class to generate a `ResponseBody` from binary data
148
+ */
149
+ export class SelfDecodingBody implements ResponseBody {
150
+ constructor(private dataSource: Promise<Buffer>) {}
151
+
152
+ binary(): Promise<Buffer> {
153
+ return this.dataSource;
154
+ }
155
+
156
+ async text(): Promise<string> {
157
+ const data: Buffer = await this.dataSource;
158
+ return data.toString();
159
+ }
160
+ }
161
+
162
+ export class ResponseContext {
163
+ public constructor(
164
+ public httpStatusCode: number,
165
+ public headers: { [key: string]: string },
166
+ public body: ResponseBody
167
+ ) {}
168
+
169
+ /**
170
+ * Parse header value in the form `value; param1="value1"`
171
+ *
172
+ * E.g. for Content-Type or Content-Disposition
173
+ * Parameter names are converted to lower case
174
+ * The first parameter is returned with the key `""`
175
+ */
176
+ public getParsedHeader(headerName: string): { [parameter: string]: string } {
177
+ const result: { [parameter: string]: string } = {};
178
+ if (!this.headers[headerName]) {
179
+ return result;
180
+ }
181
+
182
+ const parameters = this.headers[headerName].split(";");
183
+ for (const parameter of parameters) {
184
+ let [key, value] = parameter.split("=", 2);
185
+ key = key.toLowerCase().trim();
186
+ if (value === undefined) {
187
+ result[""] = key;
188
+ } else {
189
+ value = value.trim();
190
+ if (value.startsWith('"') && value.endsWith('"')) {
191
+ value = value.substring(1, value.length - 1);
192
+ }
193
+ result[key] = value;
194
+ }
195
+ }
196
+ return result;
197
+ }
198
+
199
+ public async getBodyAsFile(): Promise<HttpFile> {
200
+ const data = await this.body.binary();
201
+ const fileName = this.getParsedHeader("content-disposition")["filename"] || "";
202
+ return { data, name: fileName };
203
+ }
204
+
205
+ /**
206
+ * Use a heuristic to get a body of unknown data structure.
207
+ * Return as string if possible, otherwise as binary.
208
+ */
209
+ public getBodyAsAny(): Promise<string | Buffer | undefined> {
210
+ try {
211
+ return this.body.text();
212
+ } catch {}
213
+
214
+ try {
215
+ return this.body.binary();
216
+ } catch {}
217
+
218
+ return Promise.resolve(undefined);
219
+ }
220
+ }
221
+
222
+ export interface HttpLibrary {
223
+ send(request: RequestContext): Observable<ResponseContext>;
224
+ }
225
+
226
+ export interface PromiseHttpLibrary {
227
+ send(request: RequestContext): Promise<ResponseContext>;
228
+ }
229
+
230
+ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary {
231
+ return {
232
+ send(request: RequestContext): Observable<ResponseContext> {
233
+ return from(promiseHttpLibrary.send(request));
234
+ }
235
+ }
236
+ }
237
+
238
+ export class HttpInfo<T> extends ResponseContext {
239
+ public constructor(
240
+ public httpStatusCode: number,
241
+ public headers: { [key: string]: string },
242
+ public body: ResponseBody,
243
+ public data: T,
244
+ ) {
245
+ super(httpStatusCode, headers, body);
246
+ }
247
+ }
@@ -0,0 +1,32 @@
1
+ import {HttpLibrary, RequestContext, ResponseContext} from './http';
2
+ import { from, Observable } from '../rxjsStub';
3
+ import fetch from "node-fetch";
4
+
5
+ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
6
+
7
+ public send(request: RequestContext): Observable<ResponseContext> {
8
+ let method = request.getHttpMethod().toString();
9
+ let body = request.getBody();
10
+
11
+ const resultPromise = fetch(request.getUrl(), {
12
+ method: method,
13
+ body: body as any,
14
+ headers: request.getHeaders(),
15
+ agent: request.getAgent(),
16
+ }).then((resp: any) => {
17
+ const headers: { [name: string]: string } = {};
18
+ resp.headers.forEach((value: string, name: string) => {
19
+ headers[name] = value;
20
+ });
21
+
22
+ const body = {
23
+ text: () => resp.text(),
24
+ binary: () => resp.buffer()
25
+ };
26
+ return new ResponseContext(resp.status, headers, body);
27
+ });
28
+
29
+ return from<Promise<ResponseContext>>(resultPromise);
30
+
31
+ }
32
+ }
@@ -0,0 +1,12 @@
1
+ export * from "./http/http";
2
+ export * from "./auth/auth";
3
+ export * from "./models/all";
4
+ export { createConfiguration } from "./configuration"
5
+ export { Configuration } from "./configuration"
6
+ export * from "./apis/exception";
7
+ export * from "./servers";
8
+ export { RequiredError } from "./apis/baseapi";
9
+
10
+ export { PromiseMiddleware as Middleware } from './middleware';
11
+ export { BankAccountsApiCreateBusinessBankAccountRequest, BankAccountsApiGetBusinessBankAccountRequest, BankAccountsApiGetBusinessBankAccountsRequest, BankAccountsApiUpdateBusinessBankAccountRequest, ObjectBankAccountsApi as BankAccountsApi, BusinessesApiCreateBusinessRequest, BusinessesApiGetBusinessRequest, BusinessesApiGetBusinessActivityLogRequest, BusinessesApiGetBusinessesRequest, BusinessesApiUpdateBusinessRequest, ObjectBusinessesApi as BusinessesApi, ConnectTokensApiConnectTokenRequest, ObjectConnectTokensApi as ConnectTokensApi, DocumentsApiCreateBusinessDocumentRequest, ObjectDocumentsApi as DocumentsApi, DrawRequestsApiGetDrawRequestRequest, DrawRequestsApiGetDrawRequestsRequest, ObjectDrawRequestsApi as DrawRequestsApi, EmbeddedSessionsApiCreateEmbeddedSessionRequest, ObjectEmbeddedSessionsApi as EmbeddedSessionsApi, InvoicesApiGetInvoiceRequest, InvoicesApiGetInvoicesRequest, ObjectInvoicesApi as InvoicesApi, IssuedProductsApiGetAllIssuedProductsRequest, IssuedProductsApiGetIssuedProductByIdRequest, ObjectIssuedProductsApi as IssuedProductsApi, OffersApiGetAllOffersRequest, OffersApiGetOfferByIdRequest, ObjectOffersApi as OffersApi, PaymentsApiGetPaymentByIdRequest, PaymentsApiGetPaymentScheduleForAIssuedProductRequest, ObjectPaymentsApi as PaymentsApi, PrequalificationsApiGetPrequalifiedBusinessesRequest, ObjectPrequalificationsApi as PrequalificationsApi, UsersApiCreateUserRequest, UsersApiGetUserRequest, UsersApiGetUsersRequest, UsersApiMergeUserIntoBusinesRequest, UsersApiUpdateUserRequest, ObjectUsersApi as UsersApi } from './types/ObjectParamAPI';
12
+
@@ -0,0 +1,66 @@
1
+ import {RequestContext, ResponseContext} from './http/http';
2
+ import { Observable, from } from './rxjsStub';
3
+
4
+ /**
5
+ * Defines the contract for a middleware intercepting requests before
6
+ * they are sent (but after the RequestContext was created)
7
+ * and before the ResponseContext is unwrapped.
8
+ *
9
+ */
10
+ export interface Middleware {
11
+ /**
12
+ * Modifies the request before the request is sent.
13
+ *
14
+ * @param context RequestContext of a request which is about to be sent to the server
15
+ * @returns an observable of the updated request context
16
+ *
17
+ */
18
+ pre(context: RequestContext): Observable<RequestContext>;
19
+ /**
20
+ * Modifies the returned response before it is deserialized.
21
+ *
22
+ * @param context ResponseContext of a sent request
23
+ * @returns an observable of the modified response context
24
+ */
25
+ post(context: ResponseContext): Observable<ResponseContext>;
26
+ }
27
+
28
+ export class PromiseMiddlewareWrapper implements Middleware {
29
+
30
+ public constructor(private middleware: PromiseMiddleware) {
31
+
32
+ }
33
+
34
+ pre(context: RequestContext): Observable<RequestContext> {
35
+ return from(this.middleware.pre(context));
36
+ }
37
+
38
+ post(context: ResponseContext): Observable<ResponseContext> {
39
+ return from(this.middleware.post(context));
40
+ }
41
+
42
+ }
43
+
44
+ /**
45
+ * Defines the contract for a middleware intercepting requests before
46
+ * they are sent (but after the RequestContext was created)
47
+ * and before the ResponseContext is unwrapped.
48
+ *
49
+ */
50
+ export interface PromiseMiddleware {
51
+ /**
52
+ * Modifies the request before the request is sent.
53
+ *
54
+ * @param context RequestContext of a request which is about to be sent to the server
55
+ * @returns an observable of the updated request context
56
+ *
57
+ */
58
+ pre(context: RequestContext): Promise<RequestContext>;
59
+ /**
60
+ * Modifies the returned response before it is deserialized.
61
+ *
62
+ * @param context ResponseContext of a sent request
63
+ * @returns an observable of the modified response context
64
+ */
65
+ post(context: ResponseContext): Promise<ResponseContext>;
66
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Kanmon Public V2 API
3
+ * Kanmon\'s public api. Contains all of the endpoints for both capital providers and platforms
4
+ *
5
+ * OpenAPI spec version: 2.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import { HttpFile } from '../http/http';
14
+
15
+ export class ActivityLog {
16
+ /**
17
+ * The UUID representing the activity log item in Kanmon.
18
+ */
19
+ 'id': string;
20
+ /**
21
+ * The UUID representing the business in Kanmon.
22
+ */
23
+ 'businessId': string;
24
+ /**
25
+ * Your platform’s unique business ID for the user.
26
+ */
27
+ 'platformBusinessId': string | null;
28
+ /**
29
+ * Event details and schema: https://kanmon.dev/docs/types-webhooks
30
+ */
31
+ 'payload': any;
32
+ /**
33
+ * A description of the log event type.
34
+ */
35
+ 'eventType': string;
36
+ /**
37
+ * Creation UTC ISO 8601 timestamp of the business.
38
+ */
39
+ 'createdAt': string;
40
+ /**
41
+ * Last updated UTC ISO 8601 timestamp of the business.
42
+ */
43
+ 'updatedAt': string;
44
+
45
+ static readonly discriminator: string | undefined = undefined;
46
+
47
+ static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
48
+ {
49
+ "name": "id",
50
+ "baseName": "id",
51
+ "type": "string",
52
+ "format": ""
53
+ },
54
+ {
55
+ "name": "businessId",
56
+ "baseName": "businessId",
57
+ "type": "string",
58
+ "format": ""
59
+ },
60
+ {
61
+ "name": "platformBusinessId",
62
+ "baseName": "platformBusinessId",
63
+ "type": "string",
64
+ "format": ""
65
+ },
66
+ {
67
+ "name": "payload",
68
+ "baseName": "payload",
69
+ "type": "any",
70
+ "format": ""
71
+ },
72
+ {
73
+ "name": "eventType",
74
+ "baseName": "eventType",
75
+ "type": "string",
76
+ "format": ""
77
+ },
78
+ {
79
+ "name": "createdAt",
80
+ "baseName": "createdAt",
81
+ "type": "string",
82
+ "format": ""
83
+ },
84
+ {
85
+ "name": "updatedAt",
86
+ "baseName": "updatedAt",
87
+ "type": "string",
88
+ "format": ""
89
+ } ];
90
+
91
+ static getAttributeTypeMap() {
92
+ return ActivityLog.attributeTypeMap;
93
+ }
94
+
95
+ public constructor() {
96
+ }
97
+ }
98
+