@agility/content-fetch 2.0.2-rc-1 → 2.0.2-rc-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/dist/api-client.d.ts +3 -0
- package/dist/browser.js +65 -14
- package/dist/methods/getPageByPath.d.ts +2 -2
- package/dist/node.js +65 -14
- package/package.json +1 -1
package/dist/api-client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { SitemapNestedRequestParams } from './methods/getSitemapNested';
|
|
|
3
3
|
import { ContentItemRequestParams } from './methods/getContentItem';
|
|
4
4
|
import { ContentListRequestParams } from './methods/getContentList';
|
|
5
5
|
import { PageRequestParams } from './methods/getPage';
|
|
6
|
+
import { PageByPathRequestParams } from './methods/getPageByPath';
|
|
6
7
|
import { GalleryRequestParams } from './methods/getGallery';
|
|
7
8
|
import { UrlRedirectionsRequestParams } from './methods/getUrlRedirections';
|
|
8
9
|
import { SyncContentRequestParams } from './methods/getSyncContent';
|
|
@@ -18,6 +19,7 @@ export interface ApiClientInstance {
|
|
|
18
19
|
getContentItem(params: ContentItemRequestParams): Promise<any>;
|
|
19
20
|
getContentList(params: ContentListRequestParams): Promise<any>;
|
|
20
21
|
getPage(params: PageRequestParams): Promise<any>;
|
|
22
|
+
getPageByPath(params: PageByPathRequestParams): Promise<any>;
|
|
21
23
|
getGallery(params: GalleryRequestParams): Promise<any>;
|
|
22
24
|
getUrlRedirections(params: UrlRedirectionsRequestParams): Promise<any>;
|
|
23
25
|
getSyncContent(params: SyncContentRequestParams): Promise<any>;
|
|
@@ -31,6 +33,7 @@ declare class ApiClient {
|
|
|
31
33
|
getContentList(params: ContentListRequestParams): Promise<any>;
|
|
32
34
|
getGallery(params: GalleryRequestParams): Promise<any>;
|
|
33
35
|
getPage(params: PageRequestParams): Promise<any>;
|
|
36
|
+
getPageByPath(params: PageByPathRequestParams): Promise<any>;
|
|
34
37
|
getSitemapFlat(params: SitemapFlatRequestParams): Promise<any>;
|
|
35
38
|
getSitemapNested(params: SitemapNestedRequestParams): Promise<any>;
|
|
36
39
|
getUrlRedirections(params: UrlRedirectionsRequestParams): Promise<any>;
|
package/dist/browser.js
CHANGED
|
@@ -259,10 +259,58 @@
|
|
|
259
259
|
};
|
|
260
260
|
var getPage_default = getPage;
|
|
261
261
|
|
|
262
|
-
// src/methods/
|
|
263
|
-
function
|
|
262
|
+
// src/methods/getPageByPath.ts
|
|
263
|
+
function getPageByPath(requestParams) {
|
|
264
264
|
validateRequestParams6(requestParams);
|
|
265
|
+
const { channelName, pagePath } = requestParams;
|
|
265
266
|
requestParams = { ...defaultParams4, ...requestParams };
|
|
267
|
+
const req = {
|
|
268
|
+
url: `/page/${channelName}?path=${pagePath}?contentLinkDepth=${requestParams.contentLinkDepth}&expandAllContentLinks=${requestParams.expandAllContentLinks}`,
|
|
269
|
+
method: "get",
|
|
270
|
+
baseURL: buildRequestUrlPath(
|
|
271
|
+
this.config,
|
|
272
|
+
requestParams.locale || requestParams.languageCode
|
|
273
|
+
),
|
|
274
|
+
headers: buildAuthHeader(this.config),
|
|
275
|
+
params: {}
|
|
276
|
+
};
|
|
277
|
+
return this.makeRequest(req);
|
|
278
|
+
}
|
|
279
|
+
function validateRequestParams6(requestParams) {
|
|
280
|
+
if (!requestParams.languageCode && !requestParams.locale) {
|
|
281
|
+
throw new TypeError2(
|
|
282
|
+
"You must include a locale in your request params.",
|
|
283
|
+
validateRequestParams6
|
|
284
|
+
);
|
|
285
|
+
} else if (!requestParams.pagePath) {
|
|
286
|
+
throw new TypeError2(
|
|
287
|
+
"You must include a page path in your request params.",
|
|
288
|
+
validateRequestParams6
|
|
289
|
+
);
|
|
290
|
+
} else if (!requestParams.channelName) {
|
|
291
|
+
throw new TypeError2(
|
|
292
|
+
"You must include a channel name in your request params.",
|
|
293
|
+
validateRequestParams6
|
|
294
|
+
);
|
|
295
|
+
} else if (requestParams.expandAllContentLinks && typeof requestParams.expandAllContentLinks !== "boolean") {
|
|
296
|
+
throw new TypeError2(
|
|
297
|
+
"ExpandAllContentLinks parameter must be a value of true or false",
|
|
298
|
+
validateRequestParams6
|
|
299
|
+
);
|
|
300
|
+
} else {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
var defaultParams4 = {
|
|
305
|
+
contentLinkDepth: 2,
|
|
306
|
+
expandAllContentLinks: true
|
|
307
|
+
};
|
|
308
|
+
var getPageByPath_default = getPageByPath;
|
|
309
|
+
|
|
310
|
+
// src/methods/getGallery.ts
|
|
311
|
+
function getGallery(requestParams) {
|
|
312
|
+
validateRequestParams7(requestParams);
|
|
313
|
+
requestParams = { ...defaultParams5, ...requestParams };
|
|
266
314
|
const req = {
|
|
267
315
|
url: `/${requestParams.galleryID}`,
|
|
268
316
|
method: "get",
|
|
@@ -272,21 +320,21 @@
|
|
|
272
320
|
};
|
|
273
321
|
return this.makeRequest(req);
|
|
274
322
|
}
|
|
275
|
-
function
|
|
323
|
+
function validateRequestParams7(requestParams) {
|
|
276
324
|
if (!requestParams.galleryID) {
|
|
277
|
-
throw new TypeError2("You must include a galleryID number in your request params.",
|
|
325
|
+
throw new TypeError2("You must include a galleryID number in your request params.", validateRequestParams7);
|
|
278
326
|
} else {
|
|
279
327
|
return;
|
|
280
328
|
}
|
|
281
329
|
}
|
|
282
|
-
var
|
|
330
|
+
var defaultParams5 = {
|
|
283
331
|
contentLinkDepth: 1
|
|
284
332
|
};
|
|
285
333
|
var getGallery_default = getGallery;
|
|
286
334
|
|
|
287
335
|
// src/methods/getUrlRedirections.ts
|
|
288
336
|
function getUrlRedirections(requestParams) {
|
|
289
|
-
|
|
337
|
+
validateRequestParams8(requestParams);
|
|
290
338
|
let url = "";
|
|
291
339
|
if (requestParams.lastAccessDate) {
|
|
292
340
|
if (!requestParams.lastAccessDate.toISOString) {
|
|
@@ -317,12 +365,12 @@
|
|
|
317
365
|
});
|
|
318
366
|
return promise;
|
|
319
367
|
}
|
|
320
|
-
function
|
|
368
|
+
function validateRequestParams8(requestParams) {
|
|
321
369
|
if (requestParams.lastAccessDate) {
|
|
322
370
|
if (!requestParams.lastAccessDate.toISOString) {
|
|
323
371
|
let dt = new Date(requestParams.lastAccessDate);
|
|
324
372
|
if (isNaN(dt.getTime())) {
|
|
325
|
-
throw new TypeError2("You must include a valid Datetime for the lastAccessDate.",
|
|
373
|
+
throw new TypeError2("You must include a valid Datetime for the lastAccessDate.", validateRequestParams8);
|
|
326
374
|
}
|
|
327
375
|
}
|
|
328
376
|
} else {
|
|
@@ -333,7 +381,7 @@
|
|
|
333
381
|
|
|
334
382
|
// src/methods/getSyncContent.ts
|
|
335
383
|
function getSyncContent(requestParams) {
|
|
336
|
-
|
|
384
|
+
validateRequestParams9(requestParams);
|
|
337
385
|
const req = {
|
|
338
386
|
url: `/sync/items?pageSize=${requestParams.pageSize}&syncToken=${requestParams.syncToken}`,
|
|
339
387
|
method: "get",
|
|
@@ -343,11 +391,11 @@
|
|
|
343
391
|
};
|
|
344
392
|
return this.makeRequest(req);
|
|
345
393
|
}
|
|
346
|
-
function
|
|
394
|
+
function validateRequestParams9(requestParams) {
|
|
347
395
|
if (!requestParams.languageCode && !requestParams.locale) {
|
|
348
|
-
throw new TypeError2("You must include a locale in your request params.",
|
|
396
|
+
throw new TypeError2("You must include a locale in your request params.", validateRequestParams9);
|
|
349
397
|
} else if (requestParams.syncToken == void 0 || requestParams.syncToken == null) {
|
|
350
|
-
throw new TypeError2("You must include a syncToken value your request params. Use zero (0) to start a new sync.",
|
|
398
|
+
throw new TypeError2("You must include a syncToken value your request params. Use zero (0) to start a new sync.", validateRequestParams9);
|
|
351
399
|
} else {
|
|
352
400
|
return;
|
|
353
401
|
}
|
|
@@ -356,7 +404,7 @@
|
|
|
356
404
|
|
|
357
405
|
// src/methods/getSyncPages.ts
|
|
358
406
|
function getSyncPages(requestParams) {
|
|
359
|
-
|
|
407
|
+
validateRequestParams10(requestParams);
|
|
360
408
|
const req = {
|
|
361
409
|
url: `/sync/pages?pageSize=${requestParams.pageSize}&syncToken=${requestParams.syncToken}`,
|
|
362
410
|
method: "get",
|
|
@@ -366,7 +414,7 @@
|
|
|
366
414
|
};
|
|
367
415
|
return this.makeRequest(req);
|
|
368
416
|
}
|
|
369
|
-
function
|
|
417
|
+
function validateRequestParams10(requestParams) {
|
|
370
418
|
if (!requestParams.languageCode && !requestParams.locale) {
|
|
371
419
|
throw new TypeError("You must include a locale in your request params.");
|
|
372
420
|
} else if (requestParams.syncToken == void 0 || requestParams.syncToken == null) {
|
|
@@ -483,6 +531,9 @@
|
|
|
483
531
|
async getPage(params) {
|
|
484
532
|
return getPage_default.call(this, params);
|
|
485
533
|
}
|
|
534
|
+
async getPageByPath(params) {
|
|
535
|
+
return getPageByPath_default.call(this, params);
|
|
536
|
+
}
|
|
486
537
|
async getSitemapFlat(params) {
|
|
487
538
|
return getSitemapFlat_default.call(this, params);
|
|
488
539
|
}
|
|
@@ -38,5 +38,5 @@ export interface PageByPathRequestParams {
|
|
|
38
38
|
contentLinkDepth?: number;
|
|
39
39
|
languageCode?: string;
|
|
40
40
|
}
|
|
41
|
-
declare function
|
|
42
|
-
export default
|
|
41
|
+
declare function getPageByPath(this: ApiClientInstance, requestParams: PageByPathRequestParams): Promise<Page>;
|
|
42
|
+
export default getPageByPath;
|
package/dist/node.js
CHANGED
|
@@ -277,10 +277,58 @@ var defaultParams3 = {
|
|
|
277
277
|
};
|
|
278
278
|
var getPage_default = getPage;
|
|
279
279
|
|
|
280
|
-
// src/methods/
|
|
281
|
-
function
|
|
280
|
+
// src/methods/getPageByPath.ts
|
|
281
|
+
function getPageByPath(requestParams) {
|
|
282
282
|
validateRequestParams6(requestParams);
|
|
283
|
+
const { channelName, pagePath } = requestParams;
|
|
283
284
|
requestParams = { ...defaultParams4, ...requestParams };
|
|
285
|
+
const req = {
|
|
286
|
+
url: `/page/${channelName}?path=${pagePath}?contentLinkDepth=${requestParams.contentLinkDepth}&expandAllContentLinks=${requestParams.expandAllContentLinks}`,
|
|
287
|
+
method: "get",
|
|
288
|
+
baseURL: buildRequestUrlPath(
|
|
289
|
+
this.config,
|
|
290
|
+
requestParams.locale || requestParams.languageCode
|
|
291
|
+
),
|
|
292
|
+
headers: buildAuthHeader(this.config),
|
|
293
|
+
params: {}
|
|
294
|
+
};
|
|
295
|
+
return this.makeRequest(req);
|
|
296
|
+
}
|
|
297
|
+
function validateRequestParams6(requestParams) {
|
|
298
|
+
if (!requestParams.languageCode && !requestParams.locale) {
|
|
299
|
+
throw new TypeError2(
|
|
300
|
+
"You must include a locale in your request params.",
|
|
301
|
+
validateRequestParams6
|
|
302
|
+
);
|
|
303
|
+
} else if (!requestParams.pagePath) {
|
|
304
|
+
throw new TypeError2(
|
|
305
|
+
"You must include a page path in your request params.",
|
|
306
|
+
validateRequestParams6
|
|
307
|
+
);
|
|
308
|
+
} else if (!requestParams.channelName) {
|
|
309
|
+
throw new TypeError2(
|
|
310
|
+
"You must include a channel name in your request params.",
|
|
311
|
+
validateRequestParams6
|
|
312
|
+
);
|
|
313
|
+
} else if (requestParams.expandAllContentLinks && typeof requestParams.expandAllContentLinks !== "boolean") {
|
|
314
|
+
throw new TypeError2(
|
|
315
|
+
"ExpandAllContentLinks parameter must be a value of true or false",
|
|
316
|
+
validateRequestParams6
|
|
317
|
+
);
|
|
318
|
+
} else {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
var defaultParams4 = {
|
|
323
|
+
contentLinkDepth: 2,
|
|
324
|
+
expandAllContentLinks: true
|
|
325
|
+
};
|
|
326
|
+
var getPageByPath_default = getPageByPath;
|
|
327
|
+
|
|
328
|
+
// src/methods/getGallery.ts
|
|
329
|
+
function getGallery(requestParams) {
|
|
330
|
+
validateRequestParams7(requestParams);
|
|
331
|
+
requestParams = { ...defaultParams5, ...requestParams };
|
|
284
332
|
const req = {
|
|
285
333
|
url: `/${requestParams.galleryID}`,
|
|
286
334
|
method: "get",
|
|
@@ -290,21 +338,21 @@ function getGallery(requestParams) {
|
|
|
290
338
|
};
|
|
291
339
|
return this.makeRequest(req);
|
|
292
340
|
}
|
|
293
|
-
function
|
|
341
|
+
function validateRequestParams7(requestParams) {
|
|
294
342
|
if (!requestParams.galleryID) {
|
|
295
|
-
throw new TypeError2("You must include a galleryID number in your request params.",
|
|
343
|
+
throw new TypeError2("You must include a galleryID number in your request params.", validateRequestParams7);
|
|
296
344
|
} else {
|
|
297
345
|
return;
|
|
298
346
|
}
|
|
299
347
|
}
|
|
300
|
-
var
|
|
348
|
+
var defaultParams5 = {
|
|
301
349
|
contentLinkDepth: 1
|
|
302
350
|
};
|
|
303
351
|
var getGallery_default = getGallery;
|
|
304
352
|
|
|
305
353
|
// src/methods/getUrlRedirections.ts
|
|
306
354
|
function getUrlRedirections(requestParams) {
|
|
307
|
-
|
|
355
|
+
validateRequestParams8(requestParams);
|
|
308
356
|
let url = "";
|
|
309
357
|
if (requestParams.lastAccessDate) {
|
|
310
358
|
if (!requestParams.lastAccessDate.toISOString) {
|
|
@@ -335,12 +383,12 @@ function getUrlRedirections(requestParams) {
|
|
|
335
383
|
});
|
|
336
384
|
return promise;
|
|
337
385
|
}
|
|
338
|
-
function
|
|
386
|
+
function validateRequestParams8(requestParams) {
|
|
339
387
|
if (requestParams.lastAccessDate) {
|
|
340
388
|
if (!requestParams.lastAccessDate.toISOString) {
|
|
341
389
|
let dt = new Date(requestParams.lastAccessDate);
|
|
342
390
|
if (isNaN(dt.getTime())) {
|
|
343
|
-
throw new TypeError2("You must include a valid Datetime for the lastAccessDate.",
|
|
391
|
+
throw new TypeError2("You must include a valid Datetime for the lastAccessDate.", validateRequestParams8);
|
|
344
392
|
}
|
|
345
393
|
}
|
|
346
394
|
} else {
|
|
@@ -351,7 +399,7 @@ var getUrlRedirections_default = getUrlRedirections;
|
|
|
351
399
|
|
|
352
400
|
// src/methods/getSyncContent.ts
|
|
353
401
|
function getSyncContent(requestParams) {
|
|
354
|
-
|
|
402
|
+
validateRequestParams9(requestParams);
|
|
355
403
|
const req = {
|
|
356
404
|
url: `/sync/items?pageSize=${requestParams.pageSize}&syncToken=${requestParams.syncToken}`,
|
|
357
405
|
method: "get",
|
|
@@ -361,11 +409,11 @@ function getSyncContent(requestParams) {
|
|
|
361
409
|
};
|
|
362
410
|
return this.makeRequest(req);
|
|
363
411
|
}
|
|
364
|
-
function
|
|
412
|
+
function validateRequestParams9(requestParams) {
|
|
365
413
|
if (!requestParams.languageCode && !requestParams.locale) {
|
|
366
|
-
throw new TypeError2("You must include a locale in your request params.",
|
|
414
|
+
throw new TypeError2("You must include a locale in your request params.", validateRequestParams9);
|
|
367
415
|
} else if (requestParams.syncToken == void 0 || requestParams.syncToken == null) {
|
|
368
|
-
throw new TypeError2("You must include a syncToken value your request params. Use zero (0) to start a new sync.",
|
|
416
|
+
throw new TypeError2("You must include a syncToken value your request params. Use zero (0) to start a new sync.", validateRequestParams9);
|
|
369
417
|
} else {
|
|
370
418
|
return;
|
|
371
419
|
}
|
|
@@ -374,7 +422,7 @@ var getSyncContent_default = getSyncContent;
|
|
|
374
422
|
|
|
375
423
|
// src/methods/getSyncPages.ts
|
|
376
424
|
function getSyncPages(requestParams) {
|
|
377
|
-
|
|
425
|
+
validateRequestParams10(requestParams);
|
|
378
426
|
const req = {
|
|
379
427
|
url: `/sync/pages?pageSize=${requestParams.pageSize}&syncToken=${requestParams.syncToken}`,
|
|
380
428
|
method: "get",
|
|
@@ -384,7 +432,7 @@ function getSyncPages(requestParams) {
|
|
|
384
432
|
};
|
|
385
433
|
return this.makeRequest(req);
|
|
386
434
|
}
|
|
387
|
-
function
|
|
435
|
+
function validateRequestParams10(requestParams) {
|
|
388
436
|
if (!requestParams.languageCode && !requestParams.locale) {
|
|
389
437
|
throw new TypeError("You must include a locale in your request params.");
|
|
390
438
|
} else if (requestParams.syncToken == void 0 || requestParams.syncToken == null) {
|
|
@@ -501,6 +549,9 @@ var ApiClient = class {
|
|
|
501
549
|
async getPage(params) {
|
|
502
550
|
return getPage_default.call(this, params);
|
|
503
551
|
}
|
|
552
|
+
async getPageByPath(params) {
|
|
553
|
+
return getPageByPath_default.call(this, params);
|
|
554
|
+
}
|
|
504
555
|
async getSitemapFlat(params) {
|
|
505
556
|
return getSitemapFlat_default.call(this, params);
|
|
506
557
|
}
|