@smartbooks-ai/api-client 0.0.5 → 0.0.7

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 (161) hide show
  1. package/package.json +15 -16
  2. package/src/.openapi-generator/FILES +0 -56
  3. package/src/.openapi-generator/VERSION +0 -1
  4. package/src/.openapi-generator-ignore +0 -23
  5. package/src/dist/esm/index.d.ts +0 -1
  6. package/src/dist/esm/index.js +0 -1
  7. package/src/dist/esm/src/apis/AiApi.d.ts +0 -289
  8. package/src/dist/esm/src/apis/AiApi.js +0 -452
  9. package/src/dist/esm/src/apis/AnalyticsApi.d.ts +0 -242
  10. package/src/dist/esm/src/apis/AnalyticsApi.js +0 -391
  11. package/src/dist/esm/src/apis/AsyncOperationsApi.d.ts +0 -48
  12. package/src/dist/esm/src/apis/AsyncOperationsApi.js +0 -53
  13. package/src/dist/esm/src/apis/BusinessModelModulesApi.d.ts +0 -182
  14. package/src/dist/esm/src/apis/BusinessModelModulesApi.js +0 -285
  15. package/src/dist/esm/src/apis/ColorPalettesApi.d.ts +0 -62
  16. package/src/dist/esm/src/apis/ColorPalettesApi.js +0 -78
  17. package/src/dist/esm/src/apis/CommentsApi.d.ts +0 -94
  18. package/src/dist/esm/src/apis/CommentsApi.js +0 -134
  19. package/src/dist/esm/src/apis/CompaniesApi.d.ts +0 -88
  20. package/src/dist/esm/src/apis/CompaniesApi.js +0 -118
  21. package/src/dist/esm/src/apis/CompanyManagementApi.d.ts +0 -90
  22. package/src/dist/esm/src/apis/CompanyManagementApi.js +0 -123
  23. package/src/dist/esm/src/apis/ConnectionParametersApi.d.ts +0 -98
  24. package/src/dist/esm/src/apis/ConnectionParametersApi.js +0 -151
  25. package/src/dist/esm/src/apis/ConnectionTypesApi.d.ts +0 -90
  26. package/src/dist/esm/src/apis/ConnectionTypesApi.js +0 -124
  27. package/src/dist/esm/src/apis/ConnectionsApi.d.ts +0 -156
  28. package/src/dist/esm/src/apis/ConnectionsApi.js +0 -236
  29. package/src/dist/esm/src/apis/ConnectionsAuthorizationApi.d.ts +0 -74
  30. package/src/dist/esm/src/apis/ConnectionsAuthorizationApi.js +0 -108
  31. package/src/dist/esm/src/apis/ConnectionsClientCredentialsApi.d.ts +0 -72
  32. package/src/dist/esm/src/apis/ConnectionsClientCredentialsApi.js +0 -100
  33. package/src/dist/esm/src/apis/ConsolidationApi.d.ts +0 -192
  34. package/src/dist/esm/src/apis/ConsolidationApi.js +0 -297
  35. package/src/dist/esm/src/apis/CostCenterApi.d.ts +0 -130
  36. package/src/dist/esm/src/apis/CostCenterApi.js +0 -188
  37. package/src/dist/esm/src/apis/DashboardsApi.d.ts +0 -306
  38. package/src/dist/esm/src/apis/DashboardsApi.js +0 -515
  39. package/src/dist/esm/src/apis/DataSynchronizationApi.d.ts +0 -92
  40. package/src/dist/esm/src/apis/DataSynchronizationApi.js +0 -127
  41. package/src/dist/esm/src/apis/ExplanationApi.d.ts +0 -110
  42. package/src/dist/esm/src/apis/ExplanationApi.js +0 -227
  43. package/src/dist/esm/src/apis/FormatsApi.d.ts +0 -46
  44. package/src/dist/esm/src/apis/FormatsApi.js +0 -48
  45. package/src/dist/esm/src/apis/FormulasApi.d.ts +0 -62
  46. package/src/dist/esm/src/apis/FormulasApi.js +0 -81
  47. package/src/dist/esm/src/apis/FuturesApi.d.ts +0 -136
  48. package/src/dist/esm/src/apis/FuturesApi.js +0 -204
  49. package/src/dist/esm/src/apis/IdentityLinkingApi.d.ts +0 -46
  50. package/src/dist/esm/src/apis/IdentityLinkingApi.js +0 -49
  51. package/src/dist/esm/src/apis/InputApi.d.ts +0 -55
  52. package/src/dist/esm/src/apis/InputApi.js +0 -57
  53. package/src/dist/esm/src/apis/IntercompanyMatchingApi.d.ts +0 -174
  54. package/src/dist/esm/src/apis/IntercompanyMatchingApi.js +0 -260
  55. package/src/dist/esm/src/apis/InvitationsApi.d.ts +0 -156
  56. package/src/dist/esm/src/apis/InvitationsApi.js +0 -235
  57. package/src/dist/esm/src/apis/MaintenanceApi.d.ts +0 -182
  58. package/src/dist/esm/src/apis/MaintenanceApi.js +0 -278
  59. package/src/dist/esm/src/apis/ManualInputApi.d.ts +0 -204
  60. package/src/dist/esm/src/apis/ManualInputApi.js +0 -328
  61. package/src/dist/esm/src/apis/ModulesApi.d.ts +0 -88
  62. package/src/dist/esm/src/apis/ModulesApi.js +0 -112
  63. package/src/dist/esm/src/apis/NodePurposesApi.d.ts +0 -68
  64. package/src/dist/esm/src/apis/NodePurposesApi.js +0 -86
  65. package/src/dist/esm/src/apis/ProfileApi.d.ts +0 -85
  66. package/src/dist/esm/src/apis/ProfileApi.js +0 -114
  67. package/src/dist/esm/src/apis/RelationsApi.d.ts +0 -46
  68. package/src/dist/esm/src/apis/RelationsApi.js +0 -48
  69. package/src/dist/esm/src/apis/ReportGroupsApi.d.ts +0 -72
  70. package/src/dist/esm/src/apis/ReportGroupsApi.js +0 -92
  71. package/src/dist/esm/src/apis/ReportingApi.d.ts +0 -267
  72. package/src/dist/esm/src/apis/ReportingApi.js +0 -379
  73. package/src/dist/esm/src/apis/ReportingPeriodsApi.d.ts +0 -46
  74. package/src/dist/esm/src/apis/ReportingPeriodsApi.js +0 -48
  75. package/src/dist/esm/src/apis/SourceAccountsApi.d.ts +0 -46
  76. package/src/dist/esm/src/apis/SourceAccountsApi.js +0 -48
  77. package/src/dist/esm/src/apis/StructureApi.d.ts +0 -134
  78. package/src/dist/esm/src/apis/StructureApi.js +0 -163
  79. package/src/dist/esm/src/apis/StructureDefinitionApi.d.ts +0 -164
  80. package/src/dist/esm/src/apis/StructureDefinitionApi.js +0 -259
  81. package/src/dist/esm/src/apis/StructureImprovementApi.d.ts +0 -70
  82. package/src/dist/esm/src/apis/StructureImprovementApi.js +0 -91
  83. package/src/dist/esm/src/apis/TemplatesApi.d.ts +0 -120
  84. package/src/dist/esm/src/apis/TemplatesApi.js +0 -178
  85. package/src/dist/esm/src/apis/TemplatesGenerationApi.d.ts +0 -66
  86. package/src/dist/esm/src/apis/TemplatesGenerationApi.js +0 -85
  87. package/src/dist/esm/src/apis/TenantIntercompanySettingsApi.d.ts +0 -90
  88. package/src/dist/esm/src/apis/TenantIntercompanySettingsApi.js +0 -123
  89. package/src/dist/esm/src/apis/TenantsApi.d.ts +0 -124
  90. package/src/dist/esm/src/apis/TenantsApi.js +0 -180
  91. package/src/dist/esm/src/apis/TransactionDetailsApi.d.ts +0 -50
  92. package/src/dist/esm/src/apis/TransactionDetailsApi.js +0 -57
  93. package/src/dist/esm/src/apis/UsersApi.d.ts +0 -114
  94. package/src/dist/esm/src/apis/UsersApi.js +0 -165
  95. package/src/dist/esm/src/apis/WebhooksApi.d.ts +0 -68
  96. package/src/dist/esm/src/apis/WebhooksApi.js +0 -86
  97. package/src/dist/esm/src/apis/WizardApi.d.ts +0 -74
  98. package/src/dist/esm/src/apis/WizardApi.js +0 -101
  99. package/src/dist/esm/src/apis/index.d.ts +0 -46
  100. package/src/dist/esm/src/apis/index.js +0 -48
  101. package/src/dist/esm/src/index.d.ts +0 -3
  102. package/src/dist/esm/src/index.js +0 -5
  103. package/src/dist/esm/src/models/index.d.ts +0 -15406
  104. package/src/dist/esm/src/models/index.js +0 -1279
  105. package/src/dist/esm/src/runtime.d.ts +0 -181
  106. package/src/dist/esm/src/runtime.js +0 -326
  107. package/src/index.ts +0 -1
  108. package/src/package.json +0 -24
  109. package/src/src/apis/AiApi.ts +0 -1043
  110. package/src/src/apis/AnalyticsApi.ts +0 -925
  111. package/src/src/apis/AsyncOperationsApi.ts +0 -112
  112. package/src/src/apis/BusinessModelModulesApi.ts +0 -649
  113. package/src/src/apis/ColorPalettesApi.ts +0 -148
  114. package/src/src/apis/CommentsApi.ts +0 -308
  115. package/src/src/apis/CompaniesApi.ts +0 -260
  116. package/src/src/apis/CompanyManagementApi.ts +0 -270
  117. package/src/src/apis/ConnectionParametersApi.ts +0 -339
  118. package/src/src/apis/ConnectionTypesApi.ts +0 -280
  119. package/src/src/apis/ConnectionsApi.ts +0 -533
  120. package/src/src/apis/ConnectionsAuthorizationApi.ts +0 -241
  121. package/src/src/apis/ConnectionsClientCredentialsApi.ts +0 -224
  122. package/src/src/apis/ConsolidationApi.ts +0 -682
  123. package/src/src/apis/CostCenterApi.ts +0 -428
  124. package/src/src/apis/DashboardsApi.ts +0 -1179
  125. package/src/src/apis/DataSynchronizationApi.ts +0 -288
  126. package/src/src/apis/ExplanationApi.ts +0 -504
  127. package/src/src/apis/FormatsApi.ts +0 -96
  128. package/src/src/apis/FormulasApi.ts +0 -154
  129. package/src/src/apis/FuturesApi.ts +0 -463
  130. package/src/src/apis/IdentityLinkingApi.ts +0 -101
  131. package/src/src/apis/InputApi.ts +0 -126
  132. package/src/src/apis/IntercompanyMatchingApi.ts +0 -588
  133. package/src/src/apis/InvitationsApi.ts +0 -523
  134. package/src/src/apis/MaintenanceApi.ts +0 -597
  135. package/src/src/apis/ManualInputApi.ts +0 -771
  136. package/src/src/apis/ModulesApi.ts +0 -246
  137. package/src/src/apis/NodePurposesApi.ts +0 -184
  138. package/src/src/apis/ProfileApi.ts +0 -203
  139. package/src/src/apis/RelationsApi.ts +0 -99
  140. package/src/src/apis/ReportGroupsApi.ts +0 -205
  141. package/src/src/apis/ReportingApi.ts +0 -851
  142. package/src/src/apis/ReportingPeriodsApi.ts +0 -99
  143. package/src/src/apis/SourceAccountsApi.ts +0 -102
  144. package/src/src/apis/StructureApi.ts +0 -334
  145. package/src/src/apis/StructureDefinitionApi.ts +0 -601
  146. package/src/src/apis/StructureImprovementApi.ts +0 -214
  147. package/src/src/apis/TemplatesApi.ts +0 -334
  148. package/src/src/apis/TemplatesGenerationApi.ts +0 -187
  149. package/src/src/apis/TenantIntercompanySettingsApi.ts +0 -286
  150. package/src/src/apis/TenantsApi.ts +0 -374
  151. package/src/src/apis/TransactionDetailsApi.ts +0 -127
  152. package/src/src/apis/UsersApi.ts +0 -356
  153. package/src/src/apis/WebhooksApi.ts +0 -193
  154. package/src/src/apis/WizardApi.ts +0 -230
  155. package/src/src/apis/index.ts +0 -48
  156. package/src/src/index.ts +0 -5
  157. package/src/src/models/index.ts +0 -15625
  158. package/src/src/runtime.ts +0 -469
  159. package/src/tsconfig.esm.json +0 -7
  160. package/src/tsconfig.json +0 -11
  161. package/tsconfig.json +0 -11
@@ -1,181 +0,0 @@
1
- /**
2
- * Smartbooks Restful API
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 0.0.1
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
- export declare const BASE_PATH: string;
13
- export interface ConfigurationParameters {
14
- basePath?: string;
15
- fetchApi?: FetchAPI;
16
- middleware?: Middleware[];
17
- queryParamsStringify?: (params: HTTPQuery) => string;
18
- username?: string;
19
- password?: string;
20
- apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>);
21
- accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
22
- headers?: HTTPHeaders;
23
- credentials?: RequestCredentials;
24
- }
25
- export declare class Configuration {
26
- private configuration;
27
- constructor(configuration?: ConfigurationParameters);
28
- set config(configuration: Configuration);
29
- get basePath(): string;
30
- get fetchApi(): FetchAPI | undefined;
31
- get middleware(): Middleware[];
32
- get queryParamsStringify(): (params: HTTPQuery) => string;
33
- get username(): string | undefined;
34
- get password(): string | undefined;
35
- get apiKey(): ((name: string) => string | Promise<string>) | undefined;
36
- get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
37
- get headers(): HTTPHeaders | undefined;
38
- get credentials(): RequestCredentials | undefined;
39
- }
40
- export declare const DefaultConfig: Configuration;
41
- /**
42
- * This is the base class for all generated API classes.
43
- */
44
- export declare class BaseAPI {
45
- protected configuration: Configuration;
46
- private static readonly jsonRegex;
47
- private middleware;
48
- constructor(configuration?: Configuration);
49
- withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
50
- withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
51
- withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
52
- /**
53
- * Check if the given MIME is a JSON MIME.
54
- * JSON MIME examples:
55
- * application/json
56
- * application/json; charset=UTF8
57
- * APPLICATION/JSON
58
- * application/vnd.company+json
59
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
60
- * @return True if the given MIME is JSON, false otherwise.
61
- */
62
- protected isJsonMime(mime: string | null | undefined): boolean;
63
- protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
64
- private createFetchParams;
65
- private fetchApi;
66
- /**
67
- * Create a shallow clone of `this` by constructing a new instance
68
- * and then shallow cloning data members.
69
- */
70
- private clone;
71
- }
72
- export declare class ResponseError extends Error {
73
- response: Response;
74
- name: 'ResponseError';
75
- constructor(response: Response, msg?: string);
76
- }
77
- export declare class FetchError extends Error {
78
- cause: Error;
79
- name: 'FetchError';
80
- constructor(cause: Error, msg?: string);
81
- }
82
- export declare class RequiredError extends Error {
83
- field: string;
84
- name: 'RequiredError';
85
- constructor(field: string, msg?: string);
86
- }
87
- export declare const COLLECTION_FORMATS: {
88
- csv: string;
89
- ssv: string;
90
- tsv: string;
91
- pipes: string;
92
- };
93
- export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
94
- export type Json = any;
95
- export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
96
- export type HTTPHeaders = {
97
- [key: string]: string;
98
- };
99
- export type HTTPQuery = {
100
- [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
101
- };
102
- export type HTTPBody = Json | FormData | URLSearchParams;
103
- export type HTTPRequestInit = {
104
- headers?: HTTPHeaders;
105
- method: HTTPMethod;
106
- credentials?: RequestCredentials;
107
- body?: HTTPBody;
108
- };
109
- export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
110
- export type InitOverrideFunction = (requestContext: {
111
- init: HTTPRequestInit;
112
- context: RequestOpts;
113
- }) => Promise<RequestInit>;
114
- export interface FetchParams {
115
- url: string;
116
- init: RequestInit;
117
- }
118
- export interface RequestOpts {
119
- path: string;
120
- method: HTTPMethod;
121
- headers: HTTPHeaders;
122
- query?: HTTPQuery;
123
- body?: HTTPBody;
124
- }
125
- export declare function querystring(params: HTTPQuery, prefix?: string): string;
126
- export declare function exists(json: any, key: string): boolean;
127
- export declare function canConsumeForm(consumes: Consume[]): boolean;
128
- export interface Consume {
129
- contentType: string;
130
- }
131
- export interface RequestContext {
132
- fetch: FetchAPI;
133
- url: string;
134
- init: RequestInit;
135
- }
136
- export interface ResponseContext {
137
- fetch: FetchAPI;
138
- url: string;
139
- init: RequestInit;
140
- response: Response;
141
- }
142
- export interface ErrorContext {
143
- fetch: FetchAPI;
144
- url: string;
145
- init: RequestInit;
146
- error: unknown;
147
- response?: Response;
148
- }
149
- export interface Middleware {
150
- pre?(context: RequestContext): Promise<FetchParams | void>;
151
- post?(context: ResponseContext): Promise<Response | void>;
152
- onError?(context: ErrorContext): Promise<Response | void>;
153
- }
154
- export interface ApiResponse<T> {
155
- raw: Response;
156
- value(): Promise<T>;
157
- }
158
- export interface ResponseTransformer<T> {
159
- (json: any): T;
160
- }
161
- export declare class JSONApiResponse<T> {
162
- raw: Response;
163
- private transformer;
164
- constructor(raw: Response, transformer?: ResponseTransformer<T>);
165
- value(): Promise<T>;
166
- }
167
- export declare class VoidApiResponse {
168
- raw: Response;
169
- constructor(raw: Response);
170
- value(): Promise<void>;
171
- }
172
- export declare class BlobApiResponse {
173
- raw: Response;
174
- constructor(raw: Response);
175
- value(): Promise<Blob>;
176
- }
177
- export declare class TextApiResponse {
178
- raw: Response;
179
- constructor(raw: Response);
180
- value(): Promise<string>;
181
- }
@@ -1,326 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Smartbooks Restful API
5
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- *
7
- * The version of the OpenAPI document: 0.0.1
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- export const BASE_PATH = 'https://app.smartbooks.ai'.replace(/\/+$/, '');
24
- export class Configuration {
25
- constructor(configuration = {}) {
26
- this.configuration = configuration;
27
- }
28
- set config(configuration) {
29
- this.configuration = configuration;
30
- }
31
- get basePath() {
32
- return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
33
- }
34
- get fetchApi() {
35
- return this.configuration.fetchApi;
36
- }
37
- get middleware() {
38
- return this.configuration.middleware || [];
39
- }
40
- get queryParamsStringify() {
41
- return this.configuration.queryParamsStringify || querystring;
42
- }
43
- get username() {
44
- return this.configuration.username;
45
- }
46
- get password() {
47
- return this.configuration.password;
48
- }
49
- get apiKey() {
50
- const apiKey = this.configuration.apiKey;
51
- if (apiKey) {
52
- return typeof apiKey === 'function' ? apiKey : () => apiKey;
53
- }
54
- return undefined;
55
- }
56
- get accessToken() {
57
- const accessToken = this.configuration.accessToken;
58
- if (accessToken) {
59
- return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
60
- }
61
- return undefined;
62
- }
63
- get headers() {
64
- return this.configuration.headers;
65
- }
66
- get credentials() {
67
- return this.configuration.credentials;
68
- }
69
- }
70
- export const DefaultConfig = new Configuration();
71
- /**
72
- * This is the base class for all generated API classes.
73
- */
74
- export class BaseAPI {
75
- constructor(configuration = DefaultConfig) {
76
- this.configuration = configuration;
77
- this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
78
- let fetchParams = { url, init };
79
- for (const middleware of this.middleware) {
80
- if (middleware.pre) {
81
- fetchParams =
82
- (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
83
- }
84
- }
85
- let response = undefined;
86
- try {
87
- response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
88
- }
89
- catch (e) {
90
- for (const middleware of this.middleware) {
91
- if (middleware.onError) {
92
- response =
93
- (yield middleware.onError({
94
- fetch: this.fetchApi,
95
- url: fetchParams.url,
96
- init: fetchParams.init,
97
- error: e,
98
- response: response ? response.clone() : undefined,
99
- })) || response;
100
- }
101
- }
102
- if (response === undefined) {
103
- if (e instanceof Error) {
104
- throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
105
- }
106
- else {
107
- throw e;
108
- }
109
- }
110
- }
111
- for (const middleware of this.middleware) {
112
- if (middleware.post) {
113
- response =
114
- (yield middleware.post({
115
- fetch: this.fetchApi,
116
- url: fetchParams.url,
117
- init: fetchParams.init,
118
- response: response.clone(),
119
- })) || response;
120
- }
121
- }
122
- return response;
123
- });
124
- this.middleware = configuration.middleware;
125
- }
126
- withMiddleware(...middlewares) {
127
- const next = this.clone();
128
- next.middleware = next.middleware.concat(...middlewares);
129
- return next;
130
- }
131
- withPreMiddleware(...preMiddlewares) {
132
- const middlewares = preMiddlewares.map((pre) => ({ pre }));
133
- return this.withMiddleware(...middlewares);
134
- }
135
- withPostMiddleware(...postMiddlewares) {
136
- const middlewares = postMiddlewares.map((post) => ({ post }));
137
- return this.withMiddleware(...middlewares);
138
- }
139
- /**
140
- * Check if the given MIME is a JSON MIME.
141
- * JSON MIME examples:
142
- * application/json
143
- * application/json; charset=UTF8
144
- * APPLICATION/JSON
145
- * application/vnd.company+json
146
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
147
- * @return True if the given MIME is JSON, false otherwise.
148
- */
149
- isJsonMime(mime) {
150
- if (!mime) {
151
- return false;
152
- }
153
- return BaseAPI.jsonRegex.test(mime);
154
- }
155
- request(context, initOverrides) {
156
- return __awaiter(this, void 0, void 0, function* () {
157
- const { url, init } = yield this.createFetchParams(context, initOverrides);
158
- const response = yield this.fetchApi(url, init);
159
- if (response && response.status >= 200 && response.status < 300) {
160
- return response;
161
- }
162
- throw new ResponseError(response, 'Response returned an error code');
163
- });
164
- }
165
- createFetchParams(context, initOverrides) {
166
- return __awaiter(this, void 0, void 0, function* () {
167
- let url = this.configuration.basePath + context.path;
168
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
169
- // only add the querystring to the URL if there are query parameters.
170
- // this is done to avoid urls ending with a "?" character which buggy webservers
171
- // do not handle correctly sometimes.
172
- url += '?' + this.configuration.queryParamsStringify(context.query);
173
- }
174
- const headers = Object.assign({}, this.configuration.headers, context.headers);
175
- Object.keys(headers).forEach((key) => (headers[key] === undefined ? delete headers[key] : {}));
176
- const initOverrideFn = typeof initOverrides === 'function' ? initOverrides : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
177
- const initParams = {
178
- method: context.method,
179
- headers,
180
- body: context.body,
181
- credentials: this.configuration.credentials,
182
- };
183
- const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
184
- init: initParams,
185
- context,
186
- })));
187
- let body;
188
- if (isFormData(overriddenInit.body) ||
189
- overriddenInit.body instanceof URLSearchParams ||
190
- isBlob(overriddenInit.body)) {
191
- body = overriddenInit.body;
192
- }
193
- else if (this.isJsonMime(headers['Content-Type'])) {
194
- body = JSON.stringify(overriddenInit.body);
195
- }
196
- else {
197
- body = overriddenInit.body;
198
- }
199
- const init = Object.assign(Object.assign({}, overriddenInit), { body });
200
- return { url, init };
201
- });
202
- }
203
- /**
204
- * Create a shallow clone of `this` by constructing a new instance
205
- * and then shallow cloning data members.
206
- */
207
- clone() {
208
- const constructor = this.constructor;
209
- const next = new constructor(this.configuration);
210
- next.middleware = this.middleware.slice();
211
- return next;
212
- }
213
- }
214
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
215
- function isBlob(value) {
216
- return typeof Blob !== 'undefined' && value instanceof Blob;
217
- }
218
- function isFormData(value) {
219
- return typeof FormData !== 'undefined' && value instanceof FormData;
220
- }
221
- export class ResponseError extends Error {
222
- constructor(response, msg) {
223
- super(msg);
224
- this.response = response;
225
- this.name = 'ResponseError';
226
- }
227
- }
228
- export class FetchError extends Error {
229
- constructor(cause, msg) {
230
- super(msg);
231
- this.cause = cause;
232
- this.name = 'FetchError';
233
- }
234
- }
235
- export class RequiredError extends Error {
236
- constructor(field, msg) {
237
- super(msg);
238
- this.field = field;
239
- this.name = 'RequiredError';
240
- }
241
- }
242
- export const COLLECTION_FORMATS = {
243
- csv: ',',
244
- ssv: ' ',
245
- tsv: '\t',
246
- pipes: '|',
247
- };
248
- export function querystring(params, prefix = '') {
249
- return Object.keys(params)
250
- .map((key) => querystringSingleKey(key, params[key], prefix))
251
- .filter((part) => part.length > 0)
252
- .join('&');
253
- }
254
- function querystringSingleKey(key, value, keyPrefix = '') {
255
- const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
256
- if (value instanceof Array) {
257
- const multiValue = value
258
- .map((singleValue) => encodeURIComponent(String(singleValue)))
259
- .join(`&${encodeURIComponent(fullKey)}=`);
260
- return `${encodeURIComponent(fullKey)}=${multiValue}`;
261
- }
262
- if (value instanceof Set) {
263
- const valueAsArray = Array.from(value);
264
- return querystringSingleKey(key, valueAsArray, keyPrefix);
265
- }
266
- if (value instanceof Date) {
267
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
268
- }
269
- if (value instanceof Object) {
270
- return querystring(value, fullKey);
271
- }
272
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
273
- }
274
- export function exists(json, key) {
275
- const value = json[key];
276
- return value !== null && value !== undefined;
277
- }
278
- export function canConsumeForm(consumes) {
279
- for (const consume of consumes) {
280
- if ('multipart/form-data' === consume.contentType) {
281
- return true;
282
- }
283
- }
284
- return false;
285
- }
286
- export class JSONApiResponse {
287
- constructor(raw, transformer = (jsonValue) => jsonValue) {
288
- this.raw = raw;
289
- this.transformer = transformer;
290
- }
291
- value() {
292
- return __awaiter(this, void 0, void 0, function* () {
293
- return this.transformer(yield this.raw.json());
294
- });
295
- }
296
- }
297
- export class VoidApiResponse {
298
- constructor(raw) {
299
- this.raw = raw;
300
- }
301
- value() {
302
- return __awaiter(this, void 0, void 0, function* () {
303
- return undefined;
304
- });
305
- }
306
- }
307
- export class BlobApiResponse {
308
- constructor(raw) {
309
- this.raw = raw;
310
- }
311
- value() {
312
- return __awaiter(this, void 0, void 0, function* () {
313
- return yield this.raw.blob();
314
- });
315
- }
316
- }
317
- export class TextApiResponse {
318
- constructor(raw) {
319
- this.raw = raw;
320
- }
321
- value() {
322
- return __awaiter(this, void 0, void 0, function* () {
323
- return yield this.raw.text();
324
- });
325
- }
326
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src/index';
package/src/package.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "name": "@smartbooks-ai/api-client",
3
- "version": "0.0.0",
4
- "description": "OpenAPI client for @smartbooks-ai/api-client",
5
- "author": "OpenAPI-Generator",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
9
- },
10
- "main": "./dist/index.js",
11
- "typings": "./dist/index.d.ts",
12
- "module": "./dist/esm/index.js",
13
- "sideEffects": false,
14
- "scripts": {
15
- "build": "tsc && tsc -p tsconfig.esm.json",
16
- "prepare": "npm run build"
17
- },
18
- "devDependencies": {
19
- "typescript": "^4.0 || ^5.0"
20
- },
21
- "publishConfig": {
22
- "registry": ""
23
- }
24
- }