@emilgroup/document-sdk 1.2.0 → 1.6.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 (53) hide show
  1. package/.openapi-generator/FILES +3 -0
  2. package/README.md +5 -22
  3. package/api/document-templates-api.ts +28 -18
  4. package/api/documents-api.ts +0 -4
  5. package/api/layouts-api.ts +0 -4
  6. package/api/product-documents-api.ts +116 -4
  7. package/api/search-keywords-api.ts +0 -4
  8. package/api/searchable-document-owners-api.ts +0 -4
  9. package/api/searchable-documents-api.ts +0 -4
  10. package/api.ts +0 -4
  11. package/base.ts +59 -93
  12. package/common.ts +0 -1
  13. package/configuration.ts +0 -8
  14. package/dist/api/document-templates-api.d.ts +20 -11
  15. package/dist/api/document-templates-api.js +23 -21
  16. package/dist/api/documents-api.js +7 -11
  17. package/dist/api/layouts-api.js +5 -9
  18. package/dist/api/product-documents-api.d.ts +65 -0
  19. package/dist/api/product-documents-api.js +102 -8
  20. package/dist/api/search-keywords-api.js +1 -5
  21. package/dist/api/searchable-document-owners-api.js +1 -5
  22. package/dist/api/searchable-documents-api.js +1 -5
  23. package/dist/base.d.ts +5 -9
  24. package/dist/base.js +40 -136
  25. package/dist/common.d.ts +0 -1
  26. package/dist/common.js +1 -2
  27. package/dist/configuration.d.ts +0 -7
  28. package/dist/models/create-doc-template-request-dto.d.ts +6 -0
  29. package/dist/models/doc-template-class.d.ts +6 -0
  30. package/dist/models/get-product-document-download-url-response-class.d.ts +24 -0
  31. package/dist/models/get-product-document-download-url-response-class.js +15 -0
  32. package/dist/models/grpc-create-doc-template-request-dto.d.ts +55 -0
  33. package/dist/models/grpc-create-doc-template-request-dto.js +15 -0
  34. package/dist/models/grpc-update-doc-template-request-dto.d.ts +61 -0
  35. package/dist/models/grpc-update-doc-template-request-dto.js +15 -0
  36. package/dist/models/index.d.ts +3 -0
  37. package/dist/models/index.js +3 -0
  38. package/dist/models/list-doc-template-request-dto.d.ts +6 -0
  39. package/dist/models/product-document-class.d.ts +17 -0
  40. package/dist/models/product-document-class.js +11 -1
  41. package/dist/models/update-doc-template-request-dto.d.ts +6 -0
  42. package/dist/models/upload-product-document-request-dto.d.ts +6 -0
  43. package/models/create-doc-template-request-dto.ts +6 -0
  44. package/models/doc-template-class.ts +6 -0
  45. package/models/get-product-document-download-url-response-class.ts +30 -0
  46. package/models/grpc-create-doc-template-request-dto.ts +61 -0
  47. package/models/grpc-update-doc-template-request-dto.ts +67 -0
  48. package/models/index.ts +3 -0
  49. package/models/list-doc-template-request-dto.ts +6 -0
  50. package/models/product-document-class.ts +18 -0
  51. package/models/update-doc-template-request-dto.ts +6 -0
  52. package/models/upload-product-document-request-dto.ts +6 -0
  53. package/package.json +3 -5
package/base.ts CHANGED
@@ -14,20 +14,13 @@
14
14
 
15
15
 
16
16
  import { Configuration } from "./configuration";
17
+ import { defaultStorage } from "./common";
17
18
  // Some imports not used depending on template conditions
18
19
  // @ts-ignore
19
20
  import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
20
- import * as fs from 'fs';
21
- import * as path from 'path';
22
- import * as os from 'os';
23
21
 
24
- export const BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
25
- const CONFIG_DIRECTORY = '.emil';
26
- const CONFIG_FILENAME = 'credentials';
27
- const KEY_USERNAME = 'emil_username';
28
- const KEY_PASSWORD = 'emil_password';
29
22
 
30
- const filePath = os.homedir() + path.sep + CONFIG_DIRECTORY + path.sep + CONFIG_FILENAME;
23
+ export const BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
31
24
  /**
32
25
  *
33
26
  * @export
@@ -67,7 +60,13 @@ export interface RequestArgs {
67
60
  options: AxiosRequestConfig;
68
61
  }
69
62
 
63
+ interface TokenData {
64
+ accessToken?: string;
65
+ username?: string;
66
+ }
67
+
70
68
  const NETWORK_ERROR_MESSAGE = "Network Error";
69
+ const TOKEN_DATA = 'APP_TOKEN';
71
70
 
72
71
  /**
73
72
  *
@@ -75,75 +74,31 @@ const NETWORK_ERROR_MESSAGE = "Network Error";
75
74
  * @class BaseAPI
76
75
  */
77
76
  export class BaseAPI {
78
- protected configuration: Configuration;
79
- private username?: string;
80
- private password?: string;
77
+ protected configuration: Configuration | undefined;
78
+ private tokenData?: TokenData;
79
+
80
+ constructor(configuration?: Configuration,
81
+ protected basePath: string = BASE_PATH,
82
+ protected axios: AxiosInstance = globalAxios) {
83
+
84
+ this.loadTokenData();
81
85
 
82
- constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
83
86
  if (configuration) {
84
87
  this.configuration = configuration;
85
88
  this.basePath = configuration.basePath || this.basePath;
86
89
  } else {
90
+ const { accessToken, username } = this.tokenData;
91
+
87
92
  this.configuration = new Configuration({
88
93
  basePath: this.basePath,
94
+ accessToken: accessToken ? `Bearer ${accessToken}` : '',
95
+ username,
89
96
  });
90
97
  }
91
98
 
92
99
  this.attachInterceptor(axios);
93
100
  }
94
101
 
95
- async initialize(env: Environment = Environment.Production) {
96
- this.configuration.basePath = env;
97
-
98
- await this.loadCredentials();
99
-
100
- if (this.username) {
101
- await this.authorize(this.username, this.password);
102
- this.password = null; // to avoid keeping password loaded in memory.
103
- }
104
- }
105
-
106
- private async loadCredentials() {
107
- try {
108
- await this.readConfigFile();
109
- } catch (error) {
110
- console.warn(`No credentials file found. Check that ${filePath} exists.`);
111
- }
112
-
113
- this.readEnvVariables();
114
-
115
- if (!this.username) {
116
- console.info(`No credentials found in credentials file or environment variables. Either provide some or use
117
- authorize() function.`);
118
- }
119
- }
120
-
121
- private async readConfigFile() {
122
- const file = await fs.promises.readFile(filePath, 'utf-8');
123
-
124
- const lines = file.split(os.EOL)
125
- .filter(Boolean);
126
-
127
- lines.forEach((line: string) => {
128
- if (line.startsWith(KEY_USERNAME)) {
129
- this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
130
- } else if (line.startsWith(KEY_PASSWORD)) {
131
- this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
132
- }
133
- });
134
- }
135
-
136
- private readEnvVariables(): boolean {
137
- if (process.env.EMIL_USERNAME) {
138
- this.username = process.env.EMIL_USERNAME;
139
- this.password = process.env.EMIL_PASSWORD || '';
140
-
141
- return true;
142
- }
143
-
144
- return false;
145
- }
146
-
147
102
  selectEnvironment(env: Environment) {
148
103
  this.configuration.basePath = env;
149
104
  }
@@ -163,18 +118,21 @@ export class BaseAPI {
163
118
  const response = await globalAxios.request<LoginClass>(options);
164
119
 
165
120
  const { data: { accessToken } } = response;
121
+
166
122
  this.configuration.username = username;
167
123
  this.configuration.accessToken = `Bearer ${accessToken}`;
124
+ this.tokenData.username = username;
125
+ this.tokenData.accessToken = accessToken;
168
126
 
169
- const refreshToken = this.extractRefreshToken(response)
170
- this.configuration.refreshToken = refreshToken;
127
+ this.storeTokenData({
128
+ ...this.tokenData
129
+ });
171
130
  }
172
131
 
173
132
  async refreshTokenInternal(): Promise<string> {
174
- const { username, refreshToken } = this.configuration;
175
-
133
+ const { username } = this.configuration;
176
134
 
177
- if (!username || !refreshToken) {
135
+ if (!username) {
178
136
  return '';
179
137
  }
180
138
 
@@ -183,7 +141,6 @@ export class BaseAPI {
183
141
  url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
184
142
  headers: {
185
143
  'Content-Type': 'application/json',
186
- Cookie: refreshToken,
187
144
  },
188
145
  data: { username: username },
189
146
  withCredentials: true,
@@ -194,18 +151,22 @@ export class BaseAPI {
194
151
  return accessToken;
195
152
  }
196
153
 
197
- private extractRefreshToken(response: AxiosResponse): string {
198
- if (response.headers && response.headers['set-cookie']
199
- && response.headers['set-cookie'].length > 0) {
200
-
201
- return `${response.headers['set-cookie'][0].split(';')[0]};`;
154
+ private storeTokenData(tokenData?: TokenData) {
155
+ if (typeof window !== 'undefined') {
156
+ defaultStorage().set<TokenData>(TOKEN_DATA, tokenData);
202
157
  }
158
+ }
203
159
 
204
- return '';
160
+ public loadTokenData() {
161
+ if (typeof window !== 'undefined') {
162
+ this.tokenData = defaultStorage().get<TokenData>(TOKEN_DATA) || {};
163
+ } else {
164
+ this.tokenData = {};
165
+ }
205
166
  }
206
167
 
207
- getConfiguration(): Configuration {
208
- return this.configuration;
168
+ public cleanTokenData() {
169
+ this.storeTokenData(null);
209
170
  }
210
171
 
211
172
  private attachInterceptor(axios: AxiosInstance) {
@@ -215,19 +176,25 @@ export class BaseAPI {
215
176
  },
216
177
  async (err) => {
217
178
  let originalConfig = err.config;
218
- if (err.response) {
179
+ if (err.response && !(err.response instanceof XMLHttpRequest)) { // sometimes buggy and is of type request
219
180
  // Access Token was expired
220
- if (err.response.status === 401 && !originalConfig._retry) {
181
+ if ((err.response.status === 401 || err.response.status === 403)
182
+ && !originalConfig._retry) {
221
183
  originalConfig._retry = true;
222
184
  try {
223
- const tokenString = await this.refreshTokenInternal();
185
+ let tokenString = await this.refreshTokenInternal();
224
186
  const accessToken = `Bearer ${tokenString}`;
225
187
 
226
- originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
188
+ delete originalConfig.headers['Authorization']
189
+
190
+ originalConfig.headers['Authorization'] = accessToken;
227
191
 
228
192
  this.configuration.accessToken = accessToken;
193
+ this.tokenData.accessToken = tokenString;
194
+
195
+ this.storeTokenData(this.tokenData);
229
196
 
230
- return axios.request(originalConfig);
197
+ return axios(originalConfig);
231
198
  } catch (_error) {
232
199
  if (_error.response && _error.response.data) {
233
200
  return Promise.reject(_error.response.data);
@@ -235,23 +202,22 @@ export class BaseAPI {
235
202
  return Promise.reject(_error);
236
203
  }
237
204
  }
238
- if (err.response.status === 403 && err.response.data) {
239
- return Promise.reject(err.response.data);
240
- }
241
- } else if(err.message === NETWORK_ERROR_MESSAGE
242
- && err.isAxiosError
205
+ } else if (err.message === NETWORK_ERROR_MESSAGE
243
206
  && originalConfig.headers.hasOwnProperty('Authorization')
244
207
  && _retry_count < 4
245
- ){
208
+ ) {
246
209
  _retry_count++;
247
210
  try {
248
- const tokenString = await this.refreshTokenInternal();
211
+ let tokenString = await this.refreshTokenInternal();
249
212
  const accessToken = `Bearer ${tokenString}`;
250
213
 
251
214
  _retry = true;
252
- originalConfig.headers['Authorization'] = accessToken;
215
+ originalConfig.headers['Authorization'] = accessToken;
253
216
 
254
217
  this.configuration.accessToken = accessToken;
218
+ this.tokenData.accessToken = tokenString;
219
+
220
+ this.storeTokenData(this.tokenData);
255
221
 
256
222
  return axios.request({
257
223
  ...originalConfig,
@@ -261,7 +227,7 @@ export class BaseAPI {
261
227
  return Promise.reject(_error.response.data);
262
228
  }
263
229
  return Promise.reject(_error);
264
- }
230
+ }
265
231
  }
266
232
  return Promise.reject(err);
267
233
  }
package/common.ts CHANGED
@@ -16,7 +16,6 @@
16
16
  import { Configuration } from "./configuration";
17
17
  import { RequiredError, RequestArgs } from "./base";
18
18
  import { AxiosInstance, AxiosResponse } from 'axios';
19
- import { URL, URLSearchParams } from 'url';
20
19
  /**
21
20
  *
22
21
  * @export
package/configuration.ts CHANGED
@@ -74,14 +74,6 @@ export class Configuration {
74
74
  */
75
75
  formDataCtor?: new () => any;
76
76
 
77
- /**
78
- * parameter for automatically refreshing access token for oauth2 security
79
- *
80
- * @type {string}
81
- * @memberof Configuration
82
- */
83
- refreshToken?: string;
84
-
85
77
  constructor(param: ConfigurationParameters = {}) {
86
78
  this.apiKey = param.apiKey;
87
79
  this.username = param.username;
@@ -47,7 +47,7 @@ export declare const DocumentTemplatesApiAxiosParamCreator: (configuration?: Con
47
47
  * @summary Retrieve the document template
48
48
  * @param {number} id
49
49
  * @param {string} [authorization] Bearer Token
50
- * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
50
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
51
51
  * @param {*} [options] Override http request option.
52
52
  * @throws {RequiredError}
53
53
  */
@@ -57,14 +57,15 @@ export declare const DocumentTemplatesApiAxiosParamCreator: (configuration?: Con
57
57
  * @summary List document templates
58
58
  * @param {string} [authorization] Bearer Token
59
59
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
60
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
60
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
61
61
  * @param {string} [filter] Filter response by productSlug, slug and name.
62
+ * @param {string} [search] Search document templates by name | slug
62
63
  * @param {string} [order] Order response by createdAt.
63
64
  * @param {string} [expand] Expand response by bodyTemplate.
64
65
  * @param {*} [options] Override http request option.
65
66
  * @throws {RequiredError}
66
67
  */
67
- listDocTemplates: (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, order?: string, expand?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
68
+ listDocTemplates: (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
68
69
  /**
69
70
  * Updates the specified document template by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
70
71
  * @summary Update the document template
@@ -104,7 +105,7 @@ export declare const DocumentTemplatesApiFp: (configuration?: Configuration) =>
104
105
  * @summary Retrieve the document template
105
106
  * @param {number} id
106
107
  * @param {string} [authorization] Bearer Token
107
- * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
108
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
108
109
  * @param {*} [options] Override http request option.
109
110
  * @throws {RequiredError}
110
111
  */
@@ -114,14 +115,15 @@ export declare const DocumentTemplatesApiFp: (configuration?: Configuration) =>
114
115
  * @summary List document templates
115
116
  * @param {string} [authorization] Bearer Token
116
117
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
117
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
118
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
118
119
  * @param {string} [filter] Filter response by productSlug, slug and name.
120
+ * @param {string} [search] Search document templates by name | slug
119
121
  * @param {string} [order] Order response by createdAt.
120
122
  * @param {string} [expand] Expand response by bodyTemplate.
121
123
  * @param {*} [options] Override http request option.
122
124
  * @throws {RequiredError}
123
125
  */
124
- listDocTemplates(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, order?: string, expand?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListDocTemplatesResponseClass>>;
126
+ listDocTemplates(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListDocTemplatesResponseClass>>;
125
127
  /**
126
128
  * Updates the specified document template by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
127
129
  * @summary Update the document template
@@ -161,7 +163,7 @@ export declare const DocumentTemplatesApiFactory: (configuration?: Configuration
161
163
  * @summary Retrieve the document template
162
164
  * @param {number} id
163
165
  * @param {string} [authorization] Bearer Token
164
- * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
166
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
165
167
  * @param {*} [options] Override http request option.
166
168
  * @throws {RequiredError}
167
169
  */
@@ -171,14 +173,15 @@ export declare const DocumentTemplatesApiFactory: (configuration?: Configuration
171
173
  * @summary List document templates
172
174
  * @param {string} [authorization] Bearer Token
173
175
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
174
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
176
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
175
177
  * @param {string} [filter] Filter response by productSlug, slug and name.
178
+ * @param {string} [search] Search document templates by name | slug
176
179
  * @param {string} [order] Order response by createdAt.
177
180
  * @param {string} [expand] Expand response by bodyTemplate.
178
181
  * @param {*} [options] Override http request option.
179
182
  * @throws {RequiredError}
180
183
  */
181
- listDocTemplates(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, order?: string, expand?: string, options?: any): AxiosPromise<ListDocTemplatesResponseClass>;
184
+ listDocTemplates(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, options?: any): AxiosPromise<ListDocTemplatesResponseClass>;
182
185
  /**
183
186
  * Updates the specified document template by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
184
187
  * @summary Update the document template
@@ -247,7 +250,7 @@ export interface DocumentTemplatesApiGetDocTemplateRequest {
247
250
  */
248
251
  readonly authorization?: string;
249
252
  /**
250
- * Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
253
+ * Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
251
254
  * @type {string}
252
255
  * @memberof DocumentTemplatesApiGetDocTemplate
253
256
  */
@@ -272,7 +275,7 @@ export interface DocumentTemplatesApiListDocTemplatesRequest {
272
275
  */
273
276
  readonly pageSize?: number;
274
277
  /**
275
- * A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
278
+ * A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
276
279
  * @type {string}
277
280
  * @memberof DocumentTemplatesApiListDocTemplates
278
281
  */
@@ -283,6 +286,12 @@ export interface DocumentTemplatesApiListDocTemplatesRequest {
283
286
  * @memberof DocumentTemplatesApiListDocTemplates
284
287
  */
285
288
  readonly filter?: string;
289
+ /**
290
+ * Search document templates by name | slug
291
+ * @type {string}
292
+ * @memberof DocumentTemplatesApiListDocTemplates
293
+ */
294
+ readonly search?: string;
286
295
  /**
287
296
  * Order response by createdAt.
288
297
  * @type {string}
@@ -85,10 +85,6 @@ var axios_1 = __importDefault(require("axios"));
85
85
  var common_1 = require("../common");
86
86
  // @ts-ignore
87
87
  var base_1 = require("../base");
88
- // URLSearchParams not necessarily used
89
- // @ts-ignore
90
- var url_1 = require("url");
91
- var FormData = require('form-data');
92
88
  /**
93
89
  * DocumentTemplatesApi - axios parameter creator
94
90
  * @export
@@ -114,7 +110,7 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
114
110
  // verify required parameter 'createDocTemplateRequestDto' is not null or undefined
115
111
  (0, common_1.assertParamExists)('createDocTemplate', 'createDocTemplateRequestDto', createDocTemplateRequestDto);
116
112
  localVarPath = "/documentservice/v1/doc-templates";
117
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
113
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
118
114
  if (configuration) {
119
115
  baseOptions = configuration.baseOptions;
120
116
  baseAccessToken = configuration.accessToken;
@@ -164,7 +160,7 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
164
160
  (0, common_1.assertParamExists)('deleteDocTemplate', 'id', id);
165
161
  localVarPath = "/documentservice/v1/doc-templates/{id}"
166
162
  .replace("{".concat("id", "}"), encodeURIComponent(String(id)));
167
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
163
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
168
164
  if (configuration) {
169
165
  baseOptions = configuration.baseOptions;
170
166
  baseAccessToken = configuration.accessToken;
@@ -198,7 +194,7 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
198
194
  * @summary Retrieve the document template
199
195
  * @param {number} id
200
196
  * @param {string} [authorization] Bearer Token
201
- * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
197
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
202
198
  * @param {*} [options] Override http request option.
203
199
  * @throws {RequiredError}
204
200
  */
@@ -213,7 +209,7 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
213
209
  (0, common_1.assertParamExists)('getDocTemplate', 'id', id);
214
210
  localVarPath = "/documentservice/v1/doc-templates/{id}"
215
211
  .replace("{".concat("id", "}"), encodeURIComponent(String(id)));
216
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
212
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
217
213
  if (configuration) {
218
214
  baseOptions = configuration.baseOptions;
219
215
  baseAccessToken = configuration.accessToken;
@@ -250,14 +246,15 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
250
246
  * @summary List document templates
251
247
  * @param {string} [authorization] Bearer Token
252
248
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
253
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
249
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
254
250
  * @param {string} [filter] Filter response by productSlug, slug and name.
251
+ * @param {string} [search] Search document templates by name | slug
255
252
  * @param {string} [order] Order response by createdAt.
256
253
  * @param {string} [expand] Expand response by bodyTemplate.
257
254
  * @param {*} [options] Override http request option.
258
255
  * @throws {RequiredError}
259
256
  */
260
- listDocTemplates: function (authorization, pageSize, pageToken, filter, order, expand, options) {
257
+ listDocTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, options) {
261
258
  if (options === void 0) { options = {}; }
262
259
  return __awaiter(_this, void 0, void 0, function () {
263
260
  var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
@@ -265,7 +262,7 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
265
262
  switch (_a.label) {
266
263
  case 0:
267
264
  localVarPath = "/documentservice/v1/doc-templates";
268
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
265
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
269
266
  if (configuration) {
270
267
  baseOptions = configuration.baseOptions;
271
268
  baseAccessToken = configuration.accessToken;
@@ -289,6 +286,9 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
289
286
  if (filter !== undefined) {
290
287
  localVarQueryParameter['filter'] = filter;
291
288
  }
289
+ if (search !== undefined) {
290
+ localVarQueryParameter['search'] = search;
291
+ }
292
292
  if (order !== undefined) {
293
293
  localVarQueryParameter['order'] = order;
294
294
  }
@@ -331,7 +331,7 @@ var DocumentTemplatesApiAxiosParamCreator = function (configuration) {
331
331
  (0, common_1.assertParamExists)('updateDocTemplate', 'updateDocTemplateRequestDto', updateDocTemplateRequestDto);
332
332
  localVarPath = "/documentservice/v1/doc-templates/{id}"
333
333
  .replace("{".concat("id", "}"), encodeURIComponent(String(id)));
334
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
334
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
335
335
  if (configuration) {
336
336
  baseOptions = configuration.baseOptions;
337
337
  baseAccessToken = configuration.accessToken;
@@ -419,7 +419,7 @@ var DocumentTemplatesApiFp = function (configuration) {
419
419
  * @summary Retrieve the document template
420
420
  * @param {number} id
421
421
  * @param {string} [authorization] Bearer Token
422
- * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
422
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
423
423
  * @param {*} [options] Override http request option.
424
424
  * @throws {RequiredError}
425
425
  */
@@ -441,19 +441,20 @@ var DocumentTemplatesApiFp = function (configuration) {
441
441
  * @summary List document templates
442
442
  * @param {string} [authorization] Bearer Token
443
443
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
444
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
444
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
445
445
  * @param {string} [filter] Filter response by productSlug, slug and name.
446
+ * @param {string} [search] Search document templates by name | slug
446
447
  * @param {string} [order] Order response by createdAt.
447
448
  * @param {string} [expand] Expand response by bodyTemplate.
448
449
  * @param {*} [options] Override http request option.
449
450
  * @throws {RequiredError}
450
451
  */
451
- listDocTemplates: function (authorization, pageSize, pageToken, filter, order, expand, options) {
452
+ listDocTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, options) {
452
453
  return __awaiter(this, void 0, void 0, function () {
453
454
  var localVarAxiosArgs;
454
455
  return __generator(this, function (_a) {
455
456
  switch (_a.label) {
456
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.listDocTemplates(authorization, pageSize, pageToken, filter, order, expand, options)];
457
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.listDocTemplates(authorization, pageSize, pageToken, filter, search, order, expand, options)];
457
458
  case 1:
458
459
  localVarAxiosArgs = _a.sent();
459
460
  return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
@@ -520,7 +521,7 @@ var DocumentTemplatesApiFactory = function (configuration, basePath, axios) {
520
521
  * @summary Retrieve the document template
521
522
  * @param {number} id
522
523
  * @param {string} [authorization] Bearer Token
523
- * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
524
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
524
525
  * @param {*} [options] Override http request option.
525
526
  * @throws {RequiredError}
526
527
  */
@@ -532,15 +533,16 @@ var DocumentTemplatesApiFactory = function (configuration, basePath, axios) {
532
533
  * @summary List document templates
533
534
  * @param {string} [authorization] Bearer Token
534
535
  * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
535
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
536
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
536
537
  * @param {string} [filter] Filter response by productSlug, slug and name.
538
+ * @param {string} [search] Search document templates by name | slug
537
539
  * @param {string} [order] Order response by createdAt.
538
540
  * @param {string} [expand] Expand response by bodyTemplate.
539
541
  * @param {*} [options] Override http request option.
540
542
  * @throws {RequiredError}
541
543
  */
542
- listDocTemplates: function (authorization, pageSize, pageToken, filter, order, expand, options) {
543
- return localVarFp.listDocTemplates(authorization, pageSize, pageToken, filter, order, expand, options).then(function (request) { return request(axios, basePath); });
544
+ listDocTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, options) {
545
+ return localVarFp.listDocTemplates(authorization, pageSize, pageToken, filter, search, order, expand, options).then(function (request) { return request(axios, basePath); });
544
546
  },
545
547
  /**
546
548
  * Updates the specified document template by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
@@ -615,7 +617,7 @@ var DocumentTemplatesApi = /** @class */ (function (_super) {
615
617
  DocumentTemplatesApi.prototype.listDocTemplates = function (requestParameters, options) {
616
618
  var _this = this;
617
619
  if (requestParameters === void 0) { requestParameters = {}; }
618
- return (0, exports.DocumentTemplatesApiFp)(this.configuration).listDocTemplates(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.order, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
620
+ return (0, exports.DocumentTemplatesApiFp)(this.configuration).listDocTemplates(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
619
621
  };
620
622
  /**
621
623
  * Updates the specified document template by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
@@ -85,10 +85,6 @@ var axios_1 = __importDefault(require("axios"));
85
85
  var common_1 = require("../common");
86
86
  // @ts-ignore
87
87
  var base_1 = require("../base");
88
- // URLSearchParams not necessarily used
89
- // @ts-ignore
90
- var url_1 = require("url");
91
- var FormData = require('form-data');
92
88
  /**
93
89
  * DocumentsApi - axios parameter creator
94
90
  * @export
@@ -114,7 +110,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
114
110
  // verify required parameter 'createDocumentRequestDto' is not null or undefined
115
111
  (0, common_1.assertParamExists)('createDocument', 'createDocumentRequestDto', createDocumentRequestDto);
116
112
  localVarPath = "/documentservice/v1/documents";
117
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
113
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
118
114
  if (configuration) {
119
115
  baseOptions = configuration.baseOptions;
120
116
  baseAccessToken = configuration.accessToken;
@@ -163,7 +159,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
163
159
  // verify required parameter 'createPresignedPostRequestDto' is not null or undefined
164
160
  (0, common_1.assertParamExists)('createPresignedPost', 'createPresignedPostRequestDto', createPresignedPostRequestDto);
165
161
  localVarPath = "/documentservice/v1/documents/pre-signed-post";
166
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
162
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
167
163
  if (configuration) {
168
164
  baseOptions = configuration.baseOptions;
169
165
  baseAccessToken = configuration.accessToken;
@@ -213,7 +209,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
213
209
  (0, common_1.assertParamExists)('deleteDocument', 'code', code);
214
210
  localVarPath = "/documentservice/v1/documents/{code}"
215
211
  .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
216
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
212
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
217
213
  if (configuration) {
218
214
  baseOptions = configuration.baseOptions;
219
215
  baseAccessToken = configuration.accessToken;
@@ -261,7 +257,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
261
257
  (0, common_1.assertParamExists)('getDocumentDownloadUrl', 'code', code);
262
258
  localVarPath = "/documentservice/v1/documents/{code}/download-url"
263
259
  .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
264
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
260
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
265
261
  if (configuration) {
266
262
  baseOptions = configuration.baseOptions;
267
263
  baseAccessToken = configuration.accessToken;
@@ -308,7 +304,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
308
304
  // verify required parameter 's3Key' is not null or undefined
309
305
  (0, common_1.assertParamExists)('getSignedS3keyUrl', 's3Key', s3Key);
310
306
  localVarPath = "/documentservice/v1/documents/signed-s3-url";
311
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
307
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
312
308
  if (configuration) {
313
309
  baseOptions = configuration.baseOptions;
314
310
  baseAccessToken = configuration.accessToken;
@@ -361,7 +357,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
361
357
  switch (_a.label) {
362
358
  case 0:
363
359
  localVarPath = "/documentservice/v1/documents";
364
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
360
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
365
361
  if (configuration) {
366
362
  baseOptions = configuration.baseOptions;
367
363
  baseAccessToken = configuration.accessToken;
@@ -430,7 +426,7 @@ var DocumentsApiAxiosParamCreator = function (configuration) {
430
426
  (0, common_1.assertParamExists)('updateDocument', 'updateDocumentRequestDto', updateDocumentRequestDto);
431
427
  localVarPath = "/documentservice/v1/documents/{code}"
432
428
  .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
433
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
429
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
434
430
  if (configuration) {
435
431
  baseOptions = configuration.baseOptions;
436
432
  baseAccessToken = configuration.accessToken;