@constructor-io/constructorio-node 4.6.0 → 4.6.2

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.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
7
7
  "scripts": {
8
8
  "verify-node-version": "chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",
9
9
  "version": "npm run verify-node-version && npm run docs && git add ./docs/*",
10
- "check-lisc": "license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT'",
10
+ "check-license": "license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'",
11
11
  "lint": "eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",
12
12
  "test:parallel": "mkdir -p test && cp -rf src/* test && mocha --parallel ./spec/*",
13
13
  "test": "mkdir -p test && cp -rf src/* test && mocha ./spec/*",
@@ -3312,6 +3312,170 @@ class Catalog {
3312
3312
  return helpers.throwHttpErrorFromResponse(new Error(), response);
3313
3313
  });
3314
3314
  }
3315
+
3316
+ /**
3317
+ * Retrieve metadata searchabilities
3318
+ *
3319
+ * @function retrieveSearchabilities
3320
+ * @param {object} [parameters] - Additional parameters for retrieving metadata searchabilities
3321
+ * @param {string} [parameters.name] - Name of metadata searchability. Providing this field would filter the results based on name
3322
+ * @param {number} [parameters.page] - The page number of the results. Can't be used together with 'offset'
3323
+ * @param {number} [parameters.offset] - The number of results to skip from the beginning. Can't be used together with 'page'
3324
+ * @param {number} [parameters.numResultsPerPage] - The number of searchability configurations to return. Defaults to 100
3325
+ * @param {object} [parameters.filters] - Filters the results based on name, exactSearchable or fuzzySearchable
3326
+ * @param {boolean} [parameters.searchable] - Retrieve only results which are either exactSearchable or fuzzySearchable
3327
+ * @param {string} [parameters.sortBy] - The criteria by which searchability configurations should be sorted. Defaults to no sorting. Valid criteria is name
3328
+ * @param {string} [parameters.sortOrder] - Either descending or ascending. The sort order by which searchability configurations should be sorted. Only valid in conjunction with sortBy
3329
+ * @param {string} [parameters.section] - The section in which the searchability is defined. Default value is Products
3330
+ * @param {object} [networkParameters] - Parameters relevant to the network request
3331
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
3332
+ * @returns {Promise}
3333
+ * @see https://docs.constructor.io/rest_api/searchabilities/#retrieve-searchabilities
3334
+ * @example
3335
+ * constructorio.catalog.retrieveSearchabilities({
3336
+ * page: 2,
3337
+ * numResultsPerPage: 50,
3338
+ * filters: { exactSearchable: true }
3339
+ * });
3340
+ */
3341
+ retrieveSearchabilities(parameters = {}, networkParameters = {}) {
3342
+ let requestUrl;
3343
+ const { fetch } = this.options;
3344
+ const controller = new AbortController();
3345
+ const { signal } = controller;
3346
+ const { name, page, offset, numResultsPerPage, filters, searchable, sortBy, sortOrder, section = 'Products' } = parameters;
3347
+ const additionalQueryParams = {};
3348
+
3349
+ if (!helpers.isNil(page)) {
3350
+ additionalQueryParams.page = page;
3351
+ }
3352
+
3353
+ if (!helpers.isNil(offset)) {
3354
+ additionalQueryParams.offset = offset;
3355
+ }
3356
+
3357
+ if (!helpers.isNil(numResultsPerPage)) {
3358
+ additionalQueryParams.num_results_per_page = numResultsPerPage;
3359
+ }
3360
+
3361
+ if (filters) {
3362
+ additionalQueryParams.filters = toSnakeCaseKeys(filters);
3363
+ }
3364
+
3365
+ if (searchable) {
3366
+ additionalQueryParams.searchable = searchable;
3367
+ }
3368
+
3369
+ if (sortBy) {
3370
+ additionalQueryParams.sort_by = sortBy;
3371
+ }
3372
+
3373
+ if (sortOrder) {
3374
+ additionalQueryParams.sort_order = sortOrder;
3375
+ }
3376
+
3377
+ if (sortOrder) {
3378
+ additionalQueryParams.sort_order = sortOrder;
3379
+ }
3380
+
3381
+ if (section) {
3382
+ additionalQueryParams.section = section;
3383
+ }
3384
+
3385
+ if (name) {
3386
+ if (additionalQueryParams.filters) {
3387
+ additionalQueryParams.filters.name = name;
3388
+ } else {
3389
+ additionalQueryParams.filters = { name };
3390
+ }
3391
+ }
3392
+
3393
+ try {
3394
+ requestUrl = createCatalogUrl('searchabilities', this.options, additionalQueryParams);
3395
+ } catch (e) {
3396
+ return Promise.reject(e);
3397
+ }
3398
+
3399
+ // Handle network timeout if specified
3400
+ helpers.applyNetworkTimeout(this.options, networkParameters, controller);
3401
+
3402
+ return fetch(requestUrl, {
3403
+ method: 'GET',
3404
+ headers: {
3405
+ 'Content-Type': 'application/json',
3406
+ ...helpers.createAuthHeader(this.options),
3407
+ },
3408
+ signal,
3409
+ }).then((response) => {
3410
+ if (response.ok) {
3411
+ return response.json();
3412
+ }
3413
+
3414
+ return helpers.throwHttpErrorFromResponse(new Error(), response);
3415
+ });
3416
+ }
3417
+
3418
+ /**
3419
+ * Patch metadata searchabilities
3420
+ *
3421
+ * @function patchSearchabilities
3422
+ * @param {object} parameters - Additional parameters for patching metadata searchabilities
3423
+ * @param {object[]} parameters.searchabilities - Array of searchabilities. Additional information about the searchabilities schema can be found [here]{@link https://docs.constructor.io/rest_api/searchabilities/#patch-searchabilities}
3424
+ * @param {string} [parameters.section] - The section in which the searchability is defined. Default value is Products
3425
+ * @param {object} [networkParameters] - Parameters relevant to the network request
3426
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
3427
+ * @returns {Promise}
3428
+ * @see https://docs.constructor.io/rest_api/searchabilities/#patch-searchabilities
3429
+ * @example
3430
+ * constructorio.catalog.patchSearchabilities({
3431
+ * searchabilities: [
3432
+ * {
3433
+ * name: 'style_id',
3434
+ * exactSearchable: true,
3435
+ * },
3436
+ * {
3437
+ * name: 'keywords',
3438
+ * fuzzySearchable: true,
3439
+ * },
3440
+ * ],
3441
+ * });
3442
+ */
3443
+ patchSearchabilities(parameters = {}, networkParameters = {}) {
3444
+ let requestUrl;
3445
+ const { fetch } = this.options;
3446
+ const controller = new AbortController();
3447
+ const { signal } = controller;
3448
+ const { searchabilities: searchabilitiesRaw, section = 'Products' } = parameters;
3449
+ const searchabilities = searchabilitiesRaw?.map((config) => toSnakeCaseKeys(config));
3450
+ const additionalQueryParams = {
3451
+ section,
3452
+ };
3453
+
3454
+ try {
3455
+ requestUrl = createCatalogUrl('searchabilities', this.options, additionalQueryParams);
3456
+ } catch (e) {
3457
+ return Promise.reject(e);
3458
+ }
3459
+
3460
+ // Handle network timeout if specified
3461
+ helpers.applyNetworkTimeout(this.options, networkParameters, controller);
3462
+
3463
+ return fetch(requestUrl, {
3464
+ method: 'PATCH',
3465
+ body: JSON.stringify({ searchabilities }),
3466
+ headers: {
3467
+ 'Content-Type': 'application/json',
3468
+ ...helpers.createAuthHeader(this.options),
3469
+ },
3470
+ signal,
3471
+ }).then((response) => {
3472
+ if (response.ok) {
3473
+ return response.json();
3474
+ }
3475
+
3476
+ return helpers.throwHttpErrorFromResponse(new Error(), response);
3477
+ });
3478
+ }
3315
3479
  }
3316
3480
 
3317
3481
  module.exports = Catalog;
@@ -10,94 +10,305 @@ import {
10
10
  RedirectRuleResponse,
11
11
  OneWaySynonymRelation,
12
12
  SynonymGroup,
13
+ SearchabilityConfiguration,
14
+ SearchabilityConfigurationResponse,
13
15
  } from '.';
14
16
 
15
17
  export default Catalog;
16
18
 
19
+ export interface CreateOrReplaceItemsParameters {
20
+ items: Item[];
21
+ force?: boolean;
22
+ notificationEmail?: string;
23
+ section?: string;
24
+ }
25
+
26
+ export interface UpdateItemsParameters extends CreateOrReplaceItemsParameters {
27
+ onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
28
+ }
29
+
30
+ export interface DeleteItemsParameters {
31
+ items: Pick<Item, 'id'>[];
32
+ section?: string;
33
+ notificationEmail?: string;
34
+ }
35
+
36
+ export interface RetrieveItemsParameters {
37
+ ids?: string[];
38
+ section?: string;
39
+ numResultsPerPage?: number;
40
+ page?: number;
41
+ }
42
+
43
+ export interface CreateOrReplaceVariationsParameters {
44
+ variations: Variation[];
45
+ force?: boolean;
46
+ notificationEmail?: string;
47
+ section?: string;
48
+ }
49
+
50
+ export interface UpdateVariationsParameters
51
+ extends CreateOrReplaceVariationsParameters {
52
+ onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
53
+ }
54
+
55
+ export interface DeleteVariationsParameters {
56
+ variations: Pick<Variation, 'id'>[];
57
+ force?: boolean;
58
+ notificationEmail?: string;
59
+ section?: string;
60
+ }
61
+
62
+ export interface RetrieveVariationsParameters {
63
+ section?: string;
64
+ ids?: string[];
65
+ itemId?: string;
66
+ numResultsPerPage?: number;
67
+ page?: number;
68
+ }
69
+
70
+ export interface AddItemGroupParameters {
71
+ id: string;
72
+ name: string;
73
+ parent_id?: string;
74
+ data?: Record<string, any>;
75
+ }
76
+
77
+ export interface AddItemGroupsParameters {
78
+ item_groups: ItemGroup[];
79
+ }
80
+
81
+ export interface GetItemGroupParameters {
82
+ id: string;
83
+ }
84
+
85
+ export interface AddOrUpdateItemGroupsParameters
86
+ extends AddItemGroupsParameters {}
87
+
88
+ export interface AddOneWaySynonymParameters {
89
+ phrase: string;
90
+ child_phrases: string[];
91
+ }
92
+
93
+ export interface ModifyOneWaySynonymParameters
94
+ extends AddOneWaySynonymParameters {}
95
+
96
+ export interface GetOneWaySynonymParameters {
97
+ phrase: string;
98
+ }
99
+
100
+ export interface GetOneWaySynonymsParameters {
101
+ num_results_per_page?: number;
102
+ page?: number;
103
+ }
104
+
105
+ export interface RemoveOneWaySynonymParameters {
106
+ phrase: string;
107
+ }
108
+
109
+ export interface AddSynonymGroupParameters {
110
+ synonyms: string[];
111
+ }
112
+
113
+ export interface ModifySynonymGroupParameters {
114
+ synonyms: string[];
115
+ }
116
+
117
+ export interface GetSynonymGroupParameters {
118
+ id: number;
119
+ }
120
+
121
+ export interface GetSynonymGroupsParameters {
122
+ phrase?: string;
123
+ num_results_per_page?: number;
124
+ page?: number;
125
+ }
126
+
127
+ export interface RemoveSynonymGroupParameters {
128
+ id: number;
129
+ }
130
+
131
+ export interface AddRedirectRuleParameters {
132
+ url: string;
133
+ matches: RedirectRuleMatchObject[];
134
+ start_time?: string;
135
+ end_time?: string;
136
+ user_segments?: string[];
137
+ metadata?: Record<string, any>;
138
+ }
139
+
140
+ export interface UpdateRedirectRuleParameters
141
+ extends AddRedirectRuleParameters {
142
+ id: string;
143
+ }
144
+
145
+ export interface ModifyRedirectRuleParameters
146
+ extends AddRedirectRuleParameters {
147
+ id: string;
148
+ }
149
+
150
+ export interface GetRedirectRuleParameters {
151
+ id: string;
152
+ }
153
+
154
+ export interface GetRedirectRulesParameters {
155
+ num_results_per_page?: number;
156
+ page?: number;
157
+ query?: string;
158
+ status?: string;
159
+ }
160
+
161
+ export interface RemoveRedirectRuleParameters {
162
+ id: string;
163
+ }
164
+
165
+ export interface ReplaceCatalogParameters {
166
+ section: string;
167
+ notification_email?: string;
168
+ force?: boolean;
169
+ items?: File;
170
+ variations?: File;
171
+ item_groups?: File;
172
+ }
173
+
174
+ export interface UpdateCatalogParameters extends ReplaceCatalogParameters {}
175
+
176
+ export interface PatchCatalogParameters {
177
+ section: string;
178
+ notification_email?: string;
179
+ force?: boolean;
180
+ onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
181
+ items?: File;
182
+ variations?: File;
183
+ item_groups?: File;
184
+ }
185
+
186
+ export interface ReplaceCatalogUsingTarArchiveParameters {
187
+ section: string;
188
+ notification_email?: string;
189
+ force?: boolean;
190
+ tarArchive?: File;
191
+ }
192
+
193
+ export interface UpdateCatalogUsingTarArchiveParameters
194
+ extends ReplaceCatalogUsingTarArchiveParameters {}
195
+
196
+ export interface PatchCatalogUsingTarArchiveParameters
197
+ extends ReplaceCatalogUsingTarArchiveParameters {
198
+ onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
199
+ }
200
+
201
+ export interface GetFacetConfigurationsParameters {
202
+ page?: number;
203
+ num_results_per_page?: number;
204
+ section?: string;
205
+ }
206
+
207
+ export interface GetFacetConfigurationParameters {
208
+ name?: string;
209
+ section?: string;
210
+ }
211
+
212
+ export interface ModifyFacetConfigurationsParameters {
213
+ facetConfigurations: FacetConfiguration[];
214
+ }
215
+
216
+ export interface RemoveFacetConfigurationParameters {
217
+ name: string;
218
+ section?: string;
219
+ }
220
+
221
+ export type AddFacetOptionConfigurationParameters = FacetOptionConfiguration & {
222
+ facetGroupName: string;
223
+ section?: string;
224
+ };
225
+
226
+ export interface AddOrModifyFacetOptionConfigurationsParameters {
227
+ facetGroupName: string;
228
+ facetOptionConfigurations: FacetOptionConfiguration[];
229
+ section?: string;
230
+ }
231
+
232
+ export interface GetFacetOptionConfigurationsParameters {
233
+ facetGroupName: string;
234
+ page?: number;
235
+ num_results_per_page?: number;
236
+ section?: string;
237
+ }
238
+
239
+ export interface GetFacetOptionConfigurationParameters {
240
+ facetGroupName: string;
241
+ value: string;
242
+ section?: string;
243
+ }
244
+
245
+ export type ReplaceFacetOptionConfigurationParameters = {
246
+ facetGroupName: string;
247
+ section?: string;
248
+ } & FacetOptionConfiguration;
249
+
250
+ export type ModifyFacetOptionConfigurationParameters = ReplaceFacetOptionConfigurationParameters
251
+
252
+ export interface RemoveFacetOptionConfiguration extends GetFacetOptionConfigurationParameters {}
253
+
254
+ export interface RetrieveSearchabilitiesParameters {
255
+ name?: string;
256
+ page?: number;
257
+ offset?: number;
258
+ numResultsPerPage?: number;
259
+ filters?: Record<string, any>;
260
+ searchable?: boolean;
261
+ sortBy?: string;
262
+ sortOrder?: string;
263
+ section?: string;
264
+ }
265
+
266
+ export interface PatchSearchabilitiesParameters {
267
+ searchabilities: SearchabilityConfiguration[],
268
+ }
269
+
17
270
  declare class Catalog {
18
271
  constructor(options: ConstructorClientOptions);
19
272
 
20
273
  options: ConstructorClientOptions;
21
274
 
22
275
  createOrReplaceItems(
23
- parameters: {
24
- items: Item[];
25
- force?: boolean;
26
- notificationEmail?: string;
27
- section?: string;
28
- },
276
+ parameters: CreateOrReplaceItemsParameters,
29
277
  networkParameters?: NetworkParameters
30
278
  ): Promise<void>;
31
279
 
32
280
  updateItems(
33
- parameters: {
34
- items: Item[];
35
- force?: boolean;
36
- notificationEmail?: string;
37
- section?: string;
38
- onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
39
- },
281
+ parameters: UpdateItemsParameters,
40
282
  networkParameters?: NetworkParameters
41
283
  ): Promise<void>;
42
284
 
43
285
  deleteItems(
44
- parameters: {
45
- items: Pick<Item, 'id'>[];
46
- section?: string;
47
- notificationEmail?: string;
48
- },
286
+ parameters: DeleteItemsParameters,
49
287
  networkParameters?: NetworkParameters
50
288
  ): Promise<void>;
51
289
 
52
290
  retrieveItems(
53
- parameters: {
54
- ids?: string[];
55
- section?: string;
56
- numResultsPerPage?: number;
57
- page?: number;
58
- },
291
+ parameters: RetrieveItemsParameters,
59
292
  networkParameters?: NetworkParameters
60
293
  ): Promise<{ items: Item[]; total_count: number; [key: string]: any }>;
61
294
 
62
295
  createOrReplaceVariations(
63
- parameters: {
64
- variations: Variation[];
65
- force?: boolean;
66
- notificationEmail?: string;
67
- section?: string;
68
- },
296
+ parameters: CreateOrReplaceVariationsParameters,
69
297
  networkParameters?: NetworkParameters
70
298
  ): Promise<void>;
71
299
 
72
300
  updateVariations(
73
- parameters: {
74
- variations: Variation[];
75
- force?: boolean;
76
- notificationEmail?: string;
77
- section?: string;
78
- onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
79
- },
301
+ parameters: UpdateVariationsParameters,
80
302
  networkParameters?: NetworkParameters
81
303
  ): Promise<void>;
82
304
 
83
305
  deleteVariations(
84
- parameters: {
85
- variations: Pick<Variation, 'id'>[];
86
- force?: boolean;
87
- notificationEmail?: string;
88
- section?: string;
89
- },
306
+ parameters: DeleteVariationsParameters,
90
307
  networkParameters?: NetworkParameters
91
308
  ): Promise<void>;
92
309
 
93
310
  retrieveVariations(
94
- parameters: {
95
- section?: string;
96
- ids?: string[];
97
- itemId?: string;
98
- numResultsPerPage?: number;
99
- page?: number;
100
- },
311
+ parameters: RetrieveVariationsParameters,
101
312
  networkParameters?: NetworkParameters
102
313
  ): Promise<{
103
314
  variations: Variation[];
@@ -106,26 +317,17 @@ declare class Catalog {
106
317
  }>;
107
318
 
108
319
  addItemGroup(
109
- parameters: {
110
- id: string;
111
- name: string;
112
- parent_id?: string;
113
- data?: Record<string, any>;
114
- },
320
+ parameters: AddItemGroupParameters,
115
321
  networkParameters?: NetworkParameters
116
322
  ): Promise<void>;
117
323
 
118
324
  addItemGroups(
119
- parameters: {
120
- item_groups: ItemGroup[];
121
- },
325
+ parameters: AddItemGroupsParameters,
122
326
  networkParameters?: NetworkParameters
123
327
  ): Promise<void>;
124
328
 
125
329
  getItemGroup(
126
- parameters: {
127
- id: string;
128
- },
330
+ parameters: GetItemGroupParameters,
129
331
  networkParameters?: NetworkParameters
130
332
  ): Promise<{
131
333
  item_groups: ItemGroup[];
@@ -140,9 +342,7 @@ declare class Catalog {
140
342
  }>;
141
343
 
142
344
  addOrUpdateItemGroups(
143
- parameters: {
144
- item_groups: ItemGroup[];
145
- },
345
+ parameters: AddOrUpdateItemGroupsParameters,
146
346
  networkParameters?: NetworkParameters
147
347
  ): Promise<{
148
348
  item_groups: {
@@ -171,35 +371,24 @@ declare class Catalog {
171
371
  ): Promise<{ message: string }>;
172
372
 
173
373
  addOneWaySynonym(
174
- parameters: {
175
- phrase: string;
176
- child_phrases: string[];
177
- },
374
+ parameters: AddOneWaySynonymParameters,
178
375
  networkParameters?: NetworkParameters
179
376
  ): Promise<void>;
180
377
 
181
378
  modifyOneWaySynonym(
182
- parameters: {
183
- phrase: string;
184
- child_phrases: string[];
185
- },
379
+ parameters: ModifyOneWaySynonymParameters,
186
380
  networkParameters?: NetworkParameters
187
381
  ): Promise<void>;
188
382
 
189
383
  getOneWaySynonym(
190
- parameters: {
191
- phrase: string;
192
- },
384
+ parameters: GetOneWaySynonymParameters,
193
385
  networkParameters?: NetworkParameters
194
386
  ): Promise<{
195
387
  one_way_synonym_relations: OneWaySynonymRelation[];
196
388
  }>;
197
389
 
198
390
  getOneWaySynonyms(
199
- parameters?: {
200
- num_results_per_page?: number;
201
- page?: number;
202
- },
391
+ parameters?: GetOneWaySynonymsParameters,
203
392
  networkParameters?: NetworkParameters
204
393
  ): Promise<{
205
394
  one_way_synonym_relations: OneWaySynonymRelation[];
@@ -207,33 +396,24 @@ declare class Catalog {
207
396
  }>;
208
397
 
209
398
  removeOneWaySynonym(
210
- parameters: {
211
- phrase: string;
212
- },
399
+ parameters: RemoveOneWaySynonymParameters,
213
400
  networkParameters?: NetworkParameters
214
401
  ): Promise<void>;
215
402
 
216
403
  removeOneWaySynonyms(networkParameters?: NetworkParameters): Promise<void>;
217
404
 
218
405
  addSynonymGroup(
219
- parameters: {
220
- synonyms: string[];
221
- },
406
+ parameters: AddSynonymGroupParameters,
222
407
  networkParameters?: NetworkParameters
223
408
  ): Promise<{ group_id: number; [key: string]: any }>;
224
409
 
225
410
  modifySynonymGroup(
226
- parameters: {
227
- id: number;
228
- synonyms: string[];
229
- },
411
+ parameters: ModifySynonymGroupParameters,
230
412
  networkParameters?: NetworkParameters
231
413
  ): Promise<void>;
232
414
 
233
415
  getSynonymGroup(
234
- parameters: {
235
- id: number;
236
- },
416
+ parameters: GetSynonymGroupParameters,
237
417
  networkParameters?: NetworkParameters
238
418
  ): Promise<{
239
419
  synonym_groups: SynonymGroup[];
@@ -242,11 +422,7 @@ declare class Catalog {
242
422
  }>;
243
423
 
244
424
  getSynonymGroups(
245
- parameters?: {
246
- phrase?: string;
247
- num_results_per_page?: number;
248
- page?: number;
249
- },
425
+ parameters?: GetSynonymGroupsParameters,
250
426
  networkParameters?: NetworkParameters
251
427
  ): Promise<{
252
428
  synonym_groups: SynonymGroup[];
@@ -255,66 +431,34 @@ declare class Catalog {
255
431
  }>;
256
432
 
257
433
  removeSynonymGroup(
258
- parameters: {
259
- id: number;
260
- },
434
+ parameters:RemoveSynonymGroupParameters,
261
435
  networkParameters?: NetworkParameters
262
436
  ): Promise<void>;
263
437
 
264
438
  removeSynonymGroups(networkParameters?: NetworkParameters): Promise<void>;
265
439
 
266
440
  addRedirectRule(
267
- parameters: {
268
- url: string;
269
- matches: RedirectRuleMatchObject[];
270
- start_time?: string;
271
- end_time?: string;
272
- user_segments?: string[];
273
- metadata?: Record<string, any>;
274
- },
441
+ parameters: AddRedirectRuleParameters,
275
442
  networkParameters?: NetworkParameters
276
443
  ): Promise<RedirectRuleResponse>;
277
444
 
278
445
  updateRedirectRule(
279
- parameters: {
280
- id: string;
281
- url: string;
282
- matches: RedirectRuleMatchObject[];
283
- start_time?: string;
284
- end_time?: string;
285
- user_segments?: string[];
286
- metadata?: Record<string, any>;
287
- },
446
+ parameters: UpdateRedirectRuleParameters,
288
447
  networkParameters?: NetworkParameters
289
448
  ): Promise<RedirectRuleResponse>;
290
449
 
291
450
  modifyRedirectRule(
292
- parameters: {
293
- id: string;
294
- url: string;
295
- matches: RedirectRuleMatchObject[];
296
- start_time?: string;
297
- end_time?: string;
298
- user_segments?: string[];
299
- metadata?: Record<string, any>;
300
- },
451
+ parameters: ModifyRedirectRuleParameters,
301
452
  networkParameters?: NetworkParameters
302
453
  ): Promise<RedirectRuleResponse>;
303
454
 
304
455
  getRedirectRule(
305
- parameters: {
306
- id: string;
307
- },
456
+ parameters: GetRedirectRuleParameters,
308
457
  networkParameters?: NetworkParameters
309
458
  ): Promise<RedirectRuleResponse>;
310
459
 
311
460
  getRedirectRules(
312
- parameters?: {
313
- num_results_per_page?: number;
314
- page?: number;
315
- query?: string;
316
- status?: string;
317
- },
461
+ parameters?: GetRedirectRulesParameters,
318
462
  networkParameters?: NetworkParameters
319
463
  ): Promise<{
320
464
  redirect_rules: RedirectRuleResponse[];
@@ -323,21 +467,12 @@ declare class Catalog {
323
467
  }>;
324
468
 
325
469
  removeRedirectRule(
326
- parameters: {
327
- id: string;
328
- },
470
+ parameters: RemoveRedirectRuleParameters,
329
471
  networkParameters?: NetworkParameters
330
472
  ): Promise<RedirectRuleResponse>;
331
473
 
332
474
  replaceCatalog(
333
- parameters: {
334
- section: string;
335
- notification_email?: string;
336
- force?: boolean;
337
- items?: File;
338
- variations?: File;
339
- item_groups?: File;
340
- },
475
+ parameters: ReplaceCatalogParameters,
341
476
  networkParameters?: NetworkParameters
342
477
  ): Promise<{
343
478
  task_id: string;
@@ -346,14 +481,7 @@ declare class Catalog {
346
481
  }>;
347
482
 
348
483
  updateCatalog(
349
- parameters: {
350
- section: string;
351
- notification_email?: string;
352
- force?: boolean;
353
- items?: File;
354
- variations?: File;
355
- item_groups?: File;
356
- },
484
+ parameters: UpdateCatalogParameters,
357
485
  networkParameters?: NetworkParameters
358
486
  ): Promise<{
359
487
  task_id: string;
@@ -362,15 +490,7 @@ declare class Catalog {
362
490
  }>;
363
491
 
364
492
  patchCatalog(
365
- parameters: {
366
- section: string;
367
- notification_email?: string;
368
- force?: boolean;
369
- onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
370
- items?: File;
371
- variations?: File;
372
- item_groups?: File;
373
- },
493
+ parameters: PatchCatalogParameters,
374
494
  networkParameters?: NetworkParameters
375
495
  ): Promise<{
376
496
  task_id: string;
@@ -379,12 +499,7 @@ declare class Catalog {
379
499
  }>;
380
500
 
381
501
  replaceCatalogUsingTarArchive(
382
- parameters: {
383
- section: string;
384
- notification_email?: string;
385
- force?: boolean;
386
- tarArchive?: File;
387
- },
502
+ parameters: ReplaceCatalogUsingTarArchiveParameters,
388
503
  networkParameters?: NetworkParameters
389
504
  ): Promise<{
390
505
  task_id: string;
@@ -393,12 +508,7 @@ declare class Catalog {
393
508
  }>;
394
509
 
395
510
  updateCatalogUsingTarArchive(
396
- parameters: {
397
- section: string;
398
- notification_email?: string;
399
- force?: boolean;
400
- tarArchive?: File;
401
- },
511
+ parameters: UpdateCatalogUsingTarArchiveParameters,
402
512
  networkParameters?: NetworkParameters
403
513
  ): Promise<{
404
514
  task_id: string;
@@ -407,12 +517,7 @@ declare class Catalog {
407
517
  }>;
408
518
 
409
519
  patchCatalogUsingTarArchive(
410
- parameters: {
411
- section: string;
412
- notification_email?: string;
413
- force?: boolean;
414
- tarArchive?: File;
415
- },
520
+ parameters: PatchCatalogUsingTarArchiveParameters,
416
521
  networkParameters?: NetworkParameters
417
522
  ): Promise<{
418
523
  task_id: string;
@@ -426,11 +531,7 @@ declare class Catalog {
426
531
  ): Promise<FacetConfiguration>;
427
532
 
428
533
  getFacetConfigurations(
429
- parameters: {
430
- page?: number;
431
- num_results_per_page?: number;
432
- section?: string;
433
- },
534
+ parameters: GetFacetConfigurationsParameters,
434
535
  networkParameters?: NetworkParameters
435
536
  ): Promise<{
436
537
  facets: FacetConfiguration[];
@@ -439,17 +540,12 @@ declare class Catalog {
439
540
  }>;
440
541
 
441
542
  getFacetConfiguration(
442
- parameters: {
443
- name?: string;
444
- section?: string;
445
- },
543
+ parameters: GetFacetConfigurationParameters,
446
544
  networkParameters?: NetworkParameters
447
545
  ): Promise<FacetConfiguration>;
448
546
 
449
547
  modifyFacetConfigurations(
450
- parameters?: {
451
- facetConfigurations: FacetConfiguration[];
452
- },
548
+ parameters?: ModifyFacetConfigurationsParameters,
453
549
  networkParameters?: NetworkParameters
454
550
  ): Promise<FacetConfiguration[]>;
455
551
 
@@ -464,37 +560,22 @@ declare class Catalog {
464
560
  ): Promise<FacetConfiguration>;
465
561
 
466
562
  removeFacetConfiguration(
467
- parameters?: {
468
- name: string;
469
- section?: string;
470
- },
563
+ parameters?: RemoveFacetConfigurationParameters,
471
564
  networkParameters?: NetworkParameters
472
565
  ): Promise<FacetConfiguration>;
473
566
 
474
567
  addFacetOptionConfiguration(
475
- parameters: FacetOptionConfiguration & {
476
- facetGroupName: string;
477
- section?: string;
478
- },
568
+ parameters: AddFacetOptionConfigurationParameters,
479
569
  networkParameters?: NetworkParameters
480
570
  ): Promise<FacetOptionConfiguration>;
481
571
 
482
572
  addOrModifyFacetOptionConfigurations(
483
- parameters: {
484
- facetGroupName: string;
485
- facetOptionConfigurations: FacetOptionConfiguration[];
486
- section?: string;
487
- },
573
+ parameters: AddOrModifyFacetOptionConfigurationsParameters,
488
574
  networkParameters?: NetworkParameters
489
575
  ): Promise<FacetOptionConfiguration[]>;
490
576
 
491
577
  getFacetOptionConfigurations(
492
- parameters: {
493
- facetGroupName: string;
494
- page?: number;
495
- num_results_per_page?: number;
496
- section?: string;
497
- },
578
+ parameters: GetFacetOptionConfigurationsParameters,
498
579
  networkParameters?: NetworkParameters
499
580
  ): Promise<{
500
581
  facet_options: FacetOptionConfiguration[];
@@ -503,36 +584,37 @@ declare class Catalog {
503
584
  }>;
504
585
 
505
586
  getFacetOptionConfiguration(
506
- parameters: {
507
- facetGroupName: string;
508
- value: string;
509
- section?: string;
510
- },
587
+ parameters: GetFacetOptionConfigurationParameters,
511
588
  networkParameters?: NetworkParameters
512
589
  ): Promise<FacetOptionConfiguration>;
513
590
 
514
591
  replaceFacetOptionConfiguration(
515
- parameters: {
516
- facetGroupName: string;
517
- section?: string;
518
- } & FacetOptionConfiguration,
592
+ parameters: ReplaceFacetOptionConfigurationParameters,
519
593
  networkParameters?: NetworkParameters
520
594
  ): Promise<FacetOptionConfiguration>;
521
595
 
522
596
  modifyFacetOptionConfiguration(
523
- parameters?: {
524
- facetGroupName: string;
525
- section?: string;
526
- } & FacetOptionConfiguration,
597
+ parameters?: ModifyFacetOptionConfigurationParameters,
527
598
  networkParameters?: NetworkParameters
528
599
  ): Promise<FacetOptionConfiguration>;
529
600
 
530
601
  removeFacetOptionConfiguration(
531
- parameters: {
532
- facetGroupName: string;
533
- value: string;
534
- section?: string;
535
- },
602
+ parameters: RemoveFacetOptionConfiguration,
536
603
  networkParameters?: NetworkParameters
537
604
  ): Promise<FacetOptionConfiguration>;
605
+
606
+ retrieveSearchabilities(
607
+ parameters?: RetrieveSearchabilitiesParameters,
608
+ networkParameters?: NetworkParameters
609
+ ): Promise<{
610
+ searchabilities: SearchabilityConfigurationResponse[];
611
+ total_count: number;
612
+ }>;
613
+
614
+ patchSearchabilities(
615
+ parameters: PatchSearchabilitiesParameters,
616
+ networkParameters?: NetworkParameters
617
+ ): Promise<{
618
+ searchabilities: SearchabilityConfigurationResponse[];
619
+ }>;
538
620
  }
@@ -298,3 +298,23 @@ export type FilterExpressionRange = {
298
298
  };
299
299
 
300
300
  export type FilterExpressionRangeValue = ['-inf' | number, 'inf' | number];
301
+
302
+ export interface SearchabilityConfigurationResponse {
303
+ name: string;
304
+ fuzzy_searchable: boolean,
305
+ exact_searchable: boolean,
306
+ type: string,
307
+ displayable: boolean,
308
+ hidden: boolean,
309
+ created_at: string,
310
+ updated_at: string
311
+ }
312
+
313
+ export interface SearchabilityConfiguration {
314
+ name: string;
315
+ fuzzySearchable?: boolean,
316
+ exactSearchable?: boolean,
317
+ type?: string,
318
+ displayable?: boolean,
319
+ hidden?: boolean,
320
+ }
@@ -7,6 +7,7 @@ import {
7
7
  OneWaySynonymRelation,
8
8
  RedirectRuleResponse,
9
9
  Variation,
10
+ SearchabilityConfigurationResponse,
10
11
  } from '..';
11
12
 
12
13
  expectAssignable<Item>({
@@ -107,3 +108,14 @@ expectAssignable<FacetOptionConfiguration>({
107
108
  data: null,
108
109
  hidden: false,
109
110
  });
111
+
112
+ expectAssignable<SearchabilityConfigurationResponse>({
113
+ name: 'groups',
114
+ fuzzy_searchable: false,
115
+ exact_searchable: false,
116
+ type: 'string',
117
+ displayable: true,
118
+ hidden: false,
119
+ created_at: '2019-04-12T18:15:30',
120
+ updated_at: '2019-04-12T18:15:30',
121
+ });