@datocms/cma-client 1.0.1 → 1.1.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.
@@ -13,6 +13,63 @@ var __extends = (this && this.__extends) || (function () {
13
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
14
  };
15
15
  })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var __generator = (this && this.__generator) || function (thisArg, body) {
28
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
29
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
30
+ function verb(n) { return function (v) { return step([n, v]); }; }
31
+ function step(op) {
32
+ if (f) throw new TypeError("Generator is already executing.");
33
+ while (_) try {
34
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
35
+ if (y = 0, t) op = [op[0] & 2, t.value];
36
+ switch (op[0]) {
37
+ case 0: case 1: t = op; break;
38
+ case 4: _.label++; return { value: op[1], done: false };
39
+ case 5: _.label++; y = op[1]; op = [0]; continue;
40
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
41
+ default:
42
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
43
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
44
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
45
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
46
+ if (t[2]) _.ops.pop();
47
+ _.trys.pop(); continue;
48
+ }
49
+ op = body.call(thisArg, _);
50
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
51
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
52
+ }
53
+ };
54
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
55
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
56
+ var m = o[Symbol.asyncIterator], i;
57
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
58
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
59
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
60
+ };
61
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
62
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
63
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
64
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
65
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
66
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
67
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
68
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
69
+ function fulfill(value) { resume("next", value); }
70
+ function reject(value) { resume("throw", value); }
71
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
72
+ };
16
73
  import * as Utils from '@datocms/rest-client-utils';
17
74
  import BaseResource from '../../BaseResource';
18
75
  var SearchResult = /** @class */ (function (_super) {
@@ -42,6 +99,65 @@ var SearchResult = /** @class */ (function (_super) {
42
99
  queryParams: queryParams,
43
100
  });
44
101
  };
102
+ /**
103
+ * Async iterator to auto-paginate over elements returned by list()
104
+ *
105
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
106
+ */
107
+ SearchResult.prototype.listPagedIterator = function (queryParams, iteratorOptions) {
108
+ return __asyncGenerator(this, arguments, function listPagedIterator_1() {
109
+ var _a, _b, element, e_1_1;
110
+ var e_1, _c;
111
+ return __generator(this, function (_d) {
112
+ switch (_d.label) {
113
+ case 0:
114
+ _d.trys.push([0, 7, 8, 13]);
115
+ _a = __asyncValues(this.rawListPagedIterator(queryParams, iteratorOptions));
116
+ _d.label = 1;
117
+ case 1: return [4 /*yield*/, __await(_a.next())];
118
+ case 2:
119
+ if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6];
120
+ element = _b.value;
121
+ return [4 /*yield*/, __await(Utils.deserializeJsonEntity(element))];
122
+ case 3: return [4 /*yield*/, _d.sent()];
123
+ case 4:
124
+ _d.sent();
125
+ _d.label = 5;
126
+ case 5: return [3 /*break*/, 1];
127
+ case 6: return [3 /*break*/, 13];
128
+ case 7:
129
+ e_1_1 = _d.sent();
130
+ e_1 = { error: e_1_1 };
131
+ return [3 /*break*/, 13];
132
+ case 8:
133
+ _d.trys.push([8, , 11, 12]);
134
+ if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10];
135
+ return [4 /*yield*/, __await(_c.call(_a))];
136
+ case 9:
137
+ _d.sent();
138
+ _d.label = 10;
139
+ case 10: return [3 /*break*/, 12];
140
+ case 11:
141
+ if (e_1) throw e_1.error;
142
+ return [7 /*endfinally*/];
143
+ case 12: return [7 /*endfinally*/];
144
+ case 13: return [2 /*return*/];
145
+ }
146
+ });
147
+ });
148
+ };
149
+ /**
150
+ * Async iterator to auto-paginate over elements returned by rawList()
151
+ *
152
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
153
+ */
154
+ SearchResult.prototype.rawListPagedIterator = function (queryParams, iteratorOptions) {
155
+ var _this = this;
156
+ return Utils.rawPageIterator({
157
+ defaultLimit: 20,
158
+ maxLimit: 100,
159
+ }, function (page) { return _this.rawList(__assign(__assign({}, queryParams), { page: page })); }, iteratorOptions);
160
+ };
45
161
  SearchResult.TYPE = 'search_result';
46
162
  return SearchResult;
47
163
  }(BaseResource));
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResult.js","sourceRoot":"","sources":["../../../../src/generated/resources/SearchResult.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C;IAA0C,gCAAY;IAAtD;;IA8BA,CAAC;IA3BC;;;;OAIG;IACH,2BAAI,GAAJ,UAAK,WAA+D;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACzC,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,8BAAO,GAAP,UACE,WAAyD;QAEzD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgD;YACxE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,iBAAiB;YACtB,WAAW,aAAA;SACZ,CAAC,CAAC;IACL,CAAC;IA5Be,iBAAI,GAAoB,eAAe,CAAC;IA6B1D,mBAAC;CAAA,AA9BD,CAA0C,YAAY,GA8BrD;eA9BoB,YAAY"}
1
+ {"version":3,"file":"SearchResult.js","sourceRoot":"","sources":["../../../../src/generated/resources/SearchResult.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C;IAA0C,gCAAY;IAAtD;;IAsEA,CAAC;IAnEC;;;;OAIG;IACH,2BAAI,GAAJ,UAAK,WAA8D;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACzC,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,8BAAO,GAAP,UACE,WAAwD;QAExD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgD;YACxE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,iBAAiB;YACtB,WAAW,aAAA;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,wCAAiB,GAAxB,UACE,WAA8D,EAC9D,eAAuC;;;;;;;;wBAEX,KAAA,cAAA,IAAI,CAAC,oBAAoB,CACnD,WAAW,EACX,eAAe,CAChB,CAAA;;;;;wBAHgB,OAAO,WAAA,CAAA;qDAIhB,KAAK,CAAC,qBAAqB,CAE/B,OAAO,CAAC;4BAFV,gCAEU;;wBAFV,SAEU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;KAEd;IAED;;;;OAIG;IACH,2CAAoB,GAApB,UACE,WAAwD,EACxD,eAAuC;QAFzC,iBAcC;QAVC,OAAO,KAAK,CAAC,eAAe,CAG1B;YACE,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,GAAG;SACd,EACD,UAAC,IAAI,IAAK,OAAA,KAAI,CAAC,OAAO,uBAAM,WAAW,KAAE,IAAI,MAAA,IAAG,EAAtC,CAAsC,EAChD,eAAe,CAChB,CAAC;IACJ,CAAC;IApEe,iBAAI,GAAoB,eAAe,CAAC;IAqE1D,mBAAC;CAAA,AAtED,CAA0C,YAAY,GAsErD;eAtEoB,YAAY"}
@@ -826,25 +826,37 @@ export declare type SearchResultIdentity = string;
826
826
  */
827
827
  export declare type SearchResultInstancesHrefSchema = {
828
828
  /**
829
- * The query string to search
830
- */
831
- q: string;
832
- /**
833
- * The build trigger ID on which the search will be performed
834
- */
835
- build_trigger_id?: string;
836
- /**
837
- * Restrict the search on one locale
838
- */
839
- locale?: string;
840
- /**
841
- * Maximum number of results to return (defaults to 20, maximum is 100)
829
+ * Attributes to manage results pagination
842
830
  */
843
- limit?: number;
831
+ page?: {
832
+ /**
833
+ * Index of first element to fetch (defaults to 0)
834
+ */
835
+ offset?: number;
836
+ /**
837
+ * Number of elements to fetch (defaults to 20, maximum is 100)
838
+ */
839
+ limit?: number;
840
+ [k: string]: unknown;
841
+ };
844
842
  /**
845
- * Number of records to offset for the search
843
+ * Attributes to filter search results
846
844
  */
847
- offset?: string;
845
+ filter: {
846
+ /**
847
+ * Text to search
848
+ */
849
+ query: string;
850
+ /**
851
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
852
+ */
853
+ build_trigger_id?: string;
854
+ /**
855
+ * Restrict the search on pages in a specific locale
856
+ */
857
+ locale?: string;
858
+ [k: string]: unknown;
859
+ };
848
860
  [k: string]: unknown;
849
861
  };
850
862
  /**
@@ -2963,6 +2975,10 @@ export declare type SitePlanAttributes = {
2963
2975
  * Whether or not use a static IP when sending webhooks
2964
2976
  */
2965
2977
  static_webhooks_ip: boolean;
2978
+ /**
2979
+ * Maximum size in bytes for a single file upload
2980
+ */
2981
+ maximum_single_upload_bytes: number;
2966
2982
  /**
2967
2983
  * Available extra packets
2968
2984
  */
@@ -7069,11 +7085,11 @@ export declare type SearchResult = {
7069
7085
  */
7070
7086
  export declare type SearchResultAttributes = {
7071
7087
  /**
7072
- * Page title
7088
+ * Title of the page
7073
7089
  */
7074
7090
  title: string;
7075
7091
  /**
7076
- * First lines of body
7092
+ * First 200 characters of page body, unformatted
7077
7093
  */
7078
7094
  body_excerpt: string;
7079
7095
  /**
@@ -7081,7 +7097,7 @@ export declare type SearchResultAttributes = {
7081
7097
  */
7082
7098
  url: string;
7083
7099
  /**
7084
- * Score
7100
+ * Search score
7085
7101
  */
7086
7102
  score: number;
7087
7103
  highlight: {
@@ -7105,7 +7121,7 @@ export declare type SearchResultData = {
7105
7121
  */
7106
7122
  export declare type SearchResultInstancesTargetSchema = {
7107
7123
  data: SearchResult[];
7108
- meta?: {
7124
+ meta: {
7109
7125
  total_count: number;
7110
7126
  };
7111
7127
  };
@@ -8705,6 +8721,7 @@ export declare type PublicInfoAttributes = {
8705
8721
  extras: null | {
8706
8722
  blocks_depth: number;
8707
8723
  blocks_per_item: number;
8724
+ maximum_single_upload_bytes: number;
8708
8725
  [k: string]: unknown;
8709
8726
  };
8710
8727
  };
@@ -1006,25 +1006,37 @@ export declare type SearchResultInstancesTargetSchema = SearchResult[];
1006
1006
  */
1007
1007
  export declare type SearchResultInstancesHrefSchema = {
1008
1008
  /**
1009
- * The query string to search
1010
- */
1011
- q: string;
1012
- /**
1013
- * The build trigger ID on which the search will be performed
1014
- */
1015
- build_trigger_id?: string;
1016
- /**
1017
- * Restrict the search on one locale
1018
- */
1019
- locale?: string;
1020
- /**
1021
- * Maximum number of results to return (defaults to 20, maximum is 100)
1009
+ * Attributes to manage results pagination
1022
1010
  */
1023
- limit?: number;
1011
+ page?: {
1012
+ /**
1013
+ * Index of first element to fetch (defaults to 0)
1014
+ */
1015
+ offset?: number;
1016
+ /**
1017
+ * Number of elements to fetch (defaults to 20, maximum is 100)
1018
+ */
1019
+ limit?: number;
1020
+ [k: string]: unknown;
1021
+ };
1024
1022
  /**
1025
- * Number of records to offset for the search
1023
+ * Attributes to filter search results
1026
1024
  */
1027
- offset?: string;
1025
+ filter: {
1026
+ /**
1027
+ * Text to search
1028
+ */
1029
+ query: string;
1030
+ /**
1031
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
1032
+ */
1033
+ build_trigger_id?: string;
1034
+ /**
1035
+ * Restrict the search on pages in a specific locale
1036
+ */
1037
+ locale?: string;
1038
+ [k: string]: unknown;
1039
+ };
1028
1040
  [k: string]: unknown;
1029
1041
  };
1030
1042
  /**
@@ -3340,6 +3352,10 @@ export declare type SitePlan = {
3340
3352
  * Whether or not use a static IP when sending webhooks
3341
3353
  */
3342
3354
  static_webhooks_ip: boolean;
3355
+ /**
3356
+ * Maximum size in bytes for a single file upload
3357
+ */
3358
+ maximum_single_upload_bytes: number;
3343
3359
  /**
3344
3360
  * Available extra packets
3345
3361
  */
@@ -3560,6 +3576,10 @@ export declare type SitePlanAttributes = {
3560
3576
  * Whether or not use a static IP when sending webhooks
3561
3577
  */
3562
3578
  static_webhooks_ip: boolean;
3579
+ /**
3580
+ * Maximum size in bytes for a single file upload
3581
+ */
3582
+ maximum_single_upload_bytes: number;
3563
3583
  /**
3564
3584
  * Available extra packets
3565
3585
  */
@@ -7073,11 +7093,11 @@ export declare type SearchResult = {
7073
7093
  id: SearchResultIdentity;
7074
7094
  type: SearchResultType;
7075
7095
  /**
7076
- * Page title
7096
+ * Title of the page
7077
7097
  */
7078
7098
  title: string;
7079
7099
  /**
7080
- * First lines of body
7100
+ * First 200 characters of page body, unformatted
7081
7101
  */
7082
7102
  body_excerpt: string;
7083
7103
  /**
@@ -7085,7 +7105,7 @@ export declare type SearchResult = {
7085
7105
  */
7086
7106
  url: string;
7087
7107
  /**
7088
- * Score
7108
+ * Search score
7089
7109
  */
7090
7110
  score: number;
7091
7111
  highlight: {
@@ -7111,11 +7131,11 @@ export declare type SearchResultData = {
7111
7131
  */
7112
7132
  export declare type SearchResultAttributes = {
7113
7133
  /**
7114
- * Page title
7134
+ * Title of the page
7115
7135
  */
7116
7136
  title: string;
7117
7137
  /**
7118
- * First lines of body
7138
+ * First 200 characters of page body, unformatted
7119
7139
  */
7120
7140
  body_excerpt: string;
7121
7141
  /**
@@ -7123,7 +7143,7 @@ export declare type SearchResultAttributes = {
7123
7143
  */
7124
7144
  url: string;
7125
7145
  /**
7126
- * Score
7146
+ * Search score
7127
7147
  */
7128
7148
  score: number;
7129
7149
  highlight: {
@@ -8425,6 +8445,7 @@ export declare type PublicInfo = {
8425
8445
  extras: null | {
8426
8446
  blocks_depth: number;
8427
8447
  blocks_per_item: number;
8448
+ maximum_single_upload_bytes: number;
8428
8449
  [k: string]: unknown;
8429
8450
  };
8430
8451
  };
@@ -8506,6 +8527,7 @@ export declare type PublicInfoAttributes = {
8506
8527
  extras: null | {
8507
8528
  blocks_depth: number;
8508
8529
  blocks_per_item: number;
8530
+ maximum_single_upload_bytes: number;
8509
8531
  [k: string]: unknown;
8510
8532
  };
8511
8533
  };
@@ -139,7 +139,7 @@ export default class Item extends BaseResource {
139
139
  *
140
140
  * @deprecated This API call is to be considered private and might change without notice
141
141
  */
142
- batchDestroy(queryParams?: SimpleSchemaTypes.ItemBatchDestroyHrefSchema): Promise<SimpleSchemaTypes.ItemBatchDestroyJobSchema>;
142
+ batchDestroy(queryParams: SimpleSchemaTypes.ItemBatchDestroyHrefSchema): Promise<SimpleSchemaTypes.ItemBatchDestroyJobSchema>;
143
143
  /**
144
144
  * Delete multiple records
145
145
  *
@@ -147,7 +147,7 @@ export default class Item extends BaseResource {
147
147
  *
148
148
  * @deprecated This API call is to be considered private and might change without notice
149
149
  */
150
- rawBatchDestroy(queryParams?: SchemaTypes.ItemBatchDestroyHrefSchema): Promise<SchemaTypes.ItemBatchDestroyJobSchema>;
150
+ rawBatchDestroy(queryParams: SchemaTypes.ItemBatchDestroyHrefSchema): Promise<SchemaTypes.ItemBatchDestroyJobSchema>;
151
151
  /**
152
152
  * Publish multiple records
153
153
  *
@@ -155,7 +155,7 @@ export default class Item extends BaseResource {
155
155
  *
156
156
  * @deprecated This API call is to be considered private and might change without notice
157
157
  */
158
- batchPublish(queryParams?: SimpleSchemaTypes.ItemBatchPublishHrefSchema): Promise<SimpleSchemaTypes.ItemBatchPublishJobSchema>;
158
+ batchPublish(queryParams: SimpleSchemaTypes.ItemBatchPublishHrefSchema): Promise<SimpleSchemaTypes.ItemBatchPublishJobSchema>;
159
159
  /**
160
160
  * Publish multiple records
161
161
  *
@@ -163,7 +163,7 @@ export default class Item extends BaseResource {
163
163
  *
164
164
  * @deprecated This API call is to be considered private and might change without notice
165
165
  */
166
- rawBatchPublish(queryParams?: SchemaTypes.ItemBatchPublishHrefSchema): Promise<SchemaTypes.ItemBatchPublishJobSchema>;
166
+ rawBatchPublish(queryParams: SchemaTypes.ItemBatchPublishHrefSchema): Promise<SchemaTypes.ItemBatchPublishJobSchema>;
167
167
  /**
168
168
  * Unpublish multiple records
169
169
  *
@@ -171,7 +171,7 @@ export default class Item extends BaseResource {
171
171
  *
172
172
  * @deprecated This API call is to be considered private and might change without notice
173
173
  */
174
- batchUnpublish(queryParams?: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema): Promise<SimpleSchemaTypes.ItemBatchUnpublishJobSchema>;
174
+ batchUnpublish(queryParams: SimpleSchemaTypes.ItemBatchUnpublishHrefSchema): Promise<SimpleSchemaTypes.ItemBatchUnpublishJobSchema>;
175
175
  /**
176
176
  * Unpublish multiple records
177
177
  *
@@ -179,7 +179,7 @@ export default class Item extends BaseResource {
179
179
  *
180
180
  * @deprecated This API call is to be considered private and might change without notice
181
181
  */
182
- rawBatchUnpublish(queryParams?: SchemaTypes.ItemBatchUnpublishHrefSchema): Promise<SchemaTypes.ItemBatchUnpublishJobSchema>;
182
+ rawBatchUnpublish(queryParams: SchemaTypes.ItemBatchUnpublishHrefSchema): Promise<SchemaTypes.ItemBatchUnpublishJobSchema>;
183
183
  /**
184
184
  * Publish a record
185
185
  *
@@ -1,3 +1,4 @@
1
+ import * as Utils from '@datocms/rest-client-utils';
1
2
  import * as SchemaTypes from '../SchemaTypes';
2
3
  import * as SimpleSchemaTypes from '../SimpleSchemaTypes';
3
4
  import BaseResource from '../../BaseResource';
@@ -8,11 +9,23 @@ export default class SearchResult extends BaseResource {
8
9
  *
9
10
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
10
11
  */
11
- list(queryParams?: SimpleSchemaTypes.SearchResultInstancesHrefSchema): Promise<SimpleSchemaTypes.SearchResultInstancesTargetSchema>;
12
+ list(queryParams: SimpleSchemaTypes.SearchResultInstancesHrefSchema): Promise<SimpleSchemaTypes.SearchResultInstancesTargetSchema>;
12
13
  /**
13
14
  * Search for results
14
15
  *
15
16
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
16
17
  */
17
- rawList(queryParams?: SchemaTypes.SearchResultInstancesHrefSchema): Promise<SchemaTypes.SearchResultInstancesTargetSchema>;
18
+ rawList(queryParams: SchemaTypes.SearchResultInstancesHrefSchema): Promise<SchemaTypes.SearchResultInstancesTargetSchema>;
19
+ /**
20
+ * Async iterator to auto-paginate over elements returned by list()
21
+ *
22
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
23
+ */
24
+ listPagedIterator(queryParams: SimpleSchemaTypes.SearchResultInstancesHrefSchema, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SimpleSchemaTypes.SearchResult, void, unknown>;
25
+ /**
26
+ * Async iterator to auto-paginate over elements returned by rawList()
27
+ *
28
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/search-result/instances
29
+ */
30
+ rawListPagedIterator(queryParams: SchemaTypes.SearchResultInstancesHrefSchema, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SchemaTypes.SearchResult, void, unknown>;
18
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datocms/cma-client",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "JS client for DatoCMS REST Content Management API",
5
5
  "keywords": [
6
6
  "datocms",
@@ -40,7 +40,7 @@
40
40
  "@datocms/rest-client-utils": "^1.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@datocms/dashboard-client": "^1.0.1"
43
+ "@datocms/dashboard-client": "^1.1.0"
44
44
  },
45
- "gitHead": "26cb4780ba5250b654e27356a6e948bee52ab989"
45
+ "gitHead": "4d0d4eed18bed416c5ceaf7b2460a6c2065440fe"
46
46
  }
package/resources.json CHANGED
@@ -728,6 +728,10 @@
728
728
  {
729
729
  "rel": "instances",
730
730
  "returnsCollection": true,
731
+ "paginatedResponse": {
732
+ "defaultLimit": 20,
733
+ "maxLimit": 100
734
+ },
731
735
  "name": "list",
732
736
  "rawName": "rawList"
733
737
  }
@@ -830,25 +830,37 @@ export type SearchResultIdentity = string;
830
830
  */
831
831
  export type SearchResultInstancesHrefSchema = {
832
832
  /**
833
- * The query string to search
834
- */
835
- q: string;
836
- /**
837
- * The build trigger ID on which the search will be performed
838
- */
839
- build_trigger_id?: string;
840
- /**
841
- * Restrict the search on one locale
842
- */
843
- locale?: string;
844
- /**
845
- * Maximum number of results to return (defaults to 20, maximum is 100)
833
+ * Attributes to manage results pagination
846
834
  */
847
- limit?: number;
835
+ page?: {
836
+ /**
837
+ * Index of first element to fetch (defaults to 0)
838
+ */
839
+ offset?: number;
840
+ /**
841
+ * Number of elements to fetch (defaults to 20, maximum is 100)
842
+ */
843
+ limit?: number;
844
+ [k: string]: unknown;
845
+ };
848
846
  /**
849
- * Number of records to offset for the search
847
+ * Attributes to filter search results
850
848
  */
851
- offset?: string;
849
+ filter: {
850
+ /**
851
+ * Text to search
852
+ */
853
+ query: string;
854
+ /**
855
+ * The build trigger ID on which the search will be performed. Required if more than one build trigger is present in a project
856
+ */
857
+ build_trigger_id?: string;
858
+ /**
859
+ * Restrict the search on pages in a specific locale
860
+ */
861
+ locale?: string;
862
+ [k: string]: unknown;
863
+ };
852
864
  [k: string]: unknown;
853
865
  };
854
866
  /**
@@ -3179,6 +3191,10 @@ export type SitePlanAttributes = {
3179
3191
  * Whether or not use a static IP when sending webhooks
3180
3192
  */
3181
3193
  static_webhooks_ip: boolean;
3194
+ /**
3195
+ * Maximum size in bytes for a single file upload
3196
+ */
3197
+ maximum_single_upload_bytes: number;
3182
3198
  /**
3183
3199
  * Available extra packets
3184
3200
  */
@@ -7551,11 +7567,11 @@ export type SearchResult = {
7551
7567
  */
7552
7568
  export type SearchResultAttributes = {
7553
7569
  /**
7554
- * Page title
7570
+ * Title of the page
7555
7571
  */
7556
7572
  title: string;
7557
7573
  /**
7558
- * First lines of body
7574
+ * First 200 characters of page body, unformatted
7559
7575
  */
7560
7576
  body_excerpt: string;
7561
7577
  /**
@@ -7563,7 +7579,7 @@ export type SearchResultAttributes = {
7563
7579
  */
7564
7580
  url: string;
7565
7581
  /**
7566
- * Score
7582
+ * Search score
7567
7583
  */
7568
7584
  score: number;
7569
7585
  highlight: {
@@ -7589,7 +7605,7 @@ export type SearchResultData = {
7589
7605
  */
7590
7606
  export type SearchResultInstancesTargetSchema = {
7591
7607
  data: SearchResult[];
7592
- meta?: {
7608
+ meta: {
7593
7609
  total_count: number;
7594
7610
  };
7595
7611
  };
@@ -9298,6 +9314,7 @@ export type PublicInfoAttributes = {
9298
9314
  extras: null | {
9299
9315
  blocks_depth: number;
9300
9316
  blocks_per_item: number;
9317
+ maximum_single_upload_bytes: number;
9301
9318
  [k: string]: unknown;
9302
9319
  };
9303
9320
  };