@datocms/cma-client 3.4.5 → 4.0.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.
@@ -131,7 +131,7 @@ var Client = /** @class */ (function () {
131
131
  });
132
132
  Client.prototype.request = function (options) {
133
133
  var _this = this;
134
- return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.4.5', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
134
+ return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v4.0.0', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
135
135
  ? { 'X-Environment': this.config.environment }
136
136
  : {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) {
137
137
  return _this.jobResultsFetcher
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
17
28
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
29
  if (k2 === undefined) k2 = k;
19
30
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -37,6 +48,52 @@ var __importStar = (this && this.__importStar) || function (mod) {
37
48
  __setModuleDefault(result, mod);
38
49
  return result;
39
50
  };
51
+ var __generator = (this && this.__generator) || function (thisArg, body) {
52
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
53
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
54
+ function verb(n) { return function (v) { return step([n, v]); }; }
55
+ function step(op) {
56
+ if (f) throw new TypeError("Generator is already executing.");
57
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
58
+ 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;
59
+ if (y = 0, t) op = [op[0] & 2, t.value];
60
+ switch (op[0]) {
61
+ case 0: case 1: t = op; break;
62
+ case 4: _.label++; return { value: op[1], done: false };
63
+ case 5: _.label++; y = op[1]; op = [0]; continue;
64
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
65
+ default:
66
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
67
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
68
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
69
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
70
+ if (t[2]) _.ops.pop();
71
+ _.trys.pop(); continue;
72
+ }
73
+ op = body.call(thisArg, _);
74
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
75
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
76
+ }
77
+ };
78
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
79
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
80
+ var m = o[Symbol.asyncIterator], i;
81
+ 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);
82
+ 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); }); }; }
83
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
84
+ };
85
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
86
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
87
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
88
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
89
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
90
+ 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); }); }; }
91
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
92
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
93
+ function fulfill(value) { resume("next", value); }
94
+ function reject(value) { resume("throw", value); }
95
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
96
+ };
40
97
  var __importDefault = (this && this.__importDefault) || function (mod) {
41
98
  return (mod && mod.__esModule) ? mod : { "default": mod };
42
99
  };
@@ -56,8 +113,8 @@ var BuildEvent = /** @class */ (function (_super) {
56
113
  * @throws {ApiError}
57
114
  * @throws {TimeoutError}
58
115
  */
59
- BuildEvent.prototype.list = function () {
60
- return this.rawList().then(function (body) {
116
+ BuildEvent.prototype.list = function (queryParams) {
117
+ return this.rawList(queryParams).then(function (body) {
61
118
  return Utils.deserializeResponseBody(body);
62
119
  });
63
120
  };
@@ -69,12 +126,89 @@ var BuildEvent = /** @class */ (function (_super) {
69
126
  * @throws {ApiError}
70
127
  * @throws {TimeoutError}
71
128
  */
72
- BuildEvent.prototype.rawList = function () {
129
+ BuildEvent.prototype.rawList = function (queryParams) {
73
130
  return this.client.request({
74
131
  method: 'GET',
75
132
  url: '/build-events',
133
+ queryParams: queryParams,
76
134
  });
77
135
  };
136
+ /**
137
+ * Async iterator to auto-paginate over elements returned by list()
138
+ *
139
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
140
+ *
141
+ * @throws {ApiError}
142
+ * @throws {TimeoutError}
143
+ */
144
+ BuildEvent.prototype.listPagedIterator = function (queryParams, iteratorOptions) {
145
+ return __asyncGenerator(this, arguments, function listPagedIterator_1() {
146
+ var _a, _b, _c, element, e_1_1;
147
+ var _d, e_1, _e, _f;
148
+ return __generator(this, function (_g) {
149
+ switch (_g.label) {
150
+ case 0:
151
+ _g.trys.push([0, 9, 10, 15]);
152
+ _a = true, _b = __asyncValues(this.rawListPagedIterator(queryParams, iteratorOptions));
153
+ _g.label = 1;
154
+ case 1: return [4 /*yield*/, __await(_b.next())];
155
+ case 2:
156
+ if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 8];
157
+ _f = _c.value;
158
+ _a = false;
159
+ _g.label = 3;
160
+ case 3:
161
+ _g.trys.push([3, , 6, 7]);
162
+ element = _f;
163
+ return [4 /*yield*/, __await(Utils.deserializeJsonEntity(element))];
164
+ case 4: return [4 /*yield*/, _g.sent()];
165
+ case 5:
166
+ _g.sent();
167
+ return [3 /*break*/, 7];
168
+ case 6:
169
+ _a = true;
170
+ return [7 /*endfinally*/];
171
+ case 7: return [3 /*break*/, 1];
172
+ case 8: return [3 /*break*/, 15];
173
+ case 9:
174
+ e_1_1 = _g.sent();
175
+ e_1 = { error: e_1_1 };
176
+ return [3 /*break*/, 15];
177
+ case 10:
178
+ _g.trys.push([10, , 13, 14]);
179
+ if (!(!_a && !_d && (_e = _b.return))) return [3 /*break*/, 12];
180
+ return [4 /*yield*/, __await(_e.call(_b))];
181
+ case 11:
182
+ _g.sent();
183
+ _g.label = 12;
184
+ case 12: return [3 /*break*/, 14];
185
+ case 13:
186
+ if (e_1) throw e_1.error;
187
+ return [7 /*endfinally*/];
188
+ case 14: return [7 /*endfinally*/];
189
+ case 15: return [2 /*return*/];
190
+ }
191
+ });
192
+ });
193
+ };
194
+ /**
195
+ * Async iterator to auto-paginate over elements returned by rawList()
196
+ *
197
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
198
+ *
199
+ * @throws {ApiError}
200
+ * @throws {TimeoutError}
201
+ */
202
+ BuildEvent.prototype.rawListPagedIterator = function (queryParams, iteratorOptions) {
203
+ var _this = this;
204
+ Utils.warnOnPageQueryParam(queryParams);
205
+ return Utils.rawPageIterator({
206
+ defaultLimit: 30,
207
+ maxLimit: 500,
208
+ }, function (page) {
209
+ return _this.rawList(__assign(__assign({}, queryParams), { page: page }));
210
+ }, iteratorOptions);
211
+ };
78
212
  /**
79
213
  * Retrieve a deploy event
80
214
  *
@@ -1 +1 @@
1
- {"version":3,"file":"BuildEvent.js","sourceRoot":"","sources":["../../../../src/generated/resources/BuildEvent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAoD;AACpD,oEAA8C;AAI9C;IAAwC,8BAAY;IAApD;;IAkEA,CAAC;IA/DC;;;;;;;OAOG;IACH,yBAAI,GAAJ;QACE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,UAAC,IAAI;YAC9B,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACtE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,eAAe;SACrB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,yBAAI,GAAJ,UAAK,YAAuD;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACtD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAO,GAAP,UACE,YAAoB;QAEpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,wBAAiB,YAAY,CAAE;SACrC,CAAC,CAAC;IACL,CAAC;IAhEe,eAAI,GAAG,aAAsB,CAAC;IAiEhD,iBAAC;CAAA,AAlED,CAAwC,sBAAY,GAkEnD;kBAlEoB,UAAU"}
1
+ {"version":3,"file":"BuildEvent.js","sourceRoot":"","sources":["../../../../src/generated/resources/BuildEvent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAoD;AACpD,oEAA8C;AAI9C;IAAwC,8BAAY;IAApD;;IA4HA,CAAC;IAzHC;;;;;;;OAOG;IACH,yBAAI,GAAJ,UAAK,WAA6D;QAChE,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;;;;;;;OAOG;IACH,4BAAO,GAAP,UACE,WAAuD;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACtE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,eAAe;YACpB,WAAW,aAAA;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACI,sCAAiB,GAAxB,UACE,WAGC,EACD,eAAuC;;;;;;;;mCAEX,KAAA,cAAA,IAAI,CAAC,oBAAoB,CACnD,WAAW,EACX,eAAe,CAChB,CAAA;;;;;wBAH2B,cAG3B;wBAH2B,WAG3B;;;;wBAHgB,OAAO,KAAA,CAAA;qDAIhB,KAAK,CAAC,qBAAqB,CAE/B,OAAO,CAAC;4BAFV,gCAEU;;wBAFV,SAEU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEd;IAED;;;;;;;OAOG;IACH,yCAAoB,GAApB,UACE,WAGC,EACD,eAAuC;QALzC,iBAoBC;QAbC,KAAK,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAExC,OAAO,KAAK,CAAC,eAAe,CAG1B;YACE,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,GAAG;SACd,EACD,UAAC,IAAuD;YACtD,OAAA,KAAI,CAAC,OAAO,uBAAM,WAAW,KAAE,IAAI,MAAA,IAAG;QAAtC,CAAsC,EACxC,eAAe,CAChB,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,yBAAI,GAAJ,UAAK,YAAuD;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACtD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAO,GAAP,UACE,YAAoB;QAEpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,wBAAiB,YAAY,CAAE;SACrC,CAAC,CAAC;IACL,CAAC;IA1He,eAAI,GAAG,aAAsB,CAAC;IA2HhD,iBAAC;CAAA,AA5HD,CAAwC,sBAAY,GA4HnD;kBA5HoB,UAAU"}
@@ -105,7 +105,7 @@ var Client = /** @class */ (function () {
105
105
  });
106
106
  Client.prototype.request = function (options) {
107
107
  var _this = this;
108
- return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.4.5', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
108
+ return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v4.0.0', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
109
109
  ? { 'X-Environment': this.config.environment }
110
110
  : {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) {
111
111
  return _this.jobResultsFetcher
@@ -538,6 +538,54 @@ export type BuildEventIdentity = string;
538
538
  * via the `definition` "type".
539
539
  */
540
540
  export type BuildTriggerType = 'build_trigger';
541
+ /**
542
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
543
+ * via the `instances.hrefSchema` link.
544
+ */
545
+ export type BuildEventInstancesHrefSchema = {
546
+ /**
547
+ * Parameters to control offset-based pagination
548
+ */
549
+ page?: {
550
+ /**
551
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
552
+ */
553
+ offset?: number;
554
+ /**
555
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
556
+ */
557
+ limit?: number;
558
+ };
559
+ /**
560
+ * Attributes to filter
561
+ */
562
+ filter?: {
563
+ /**
564
+ * IDs to fetch, comma separated
565
+ */
566
+ ids?: string;
567
+ fields?: {
568
+ build_trigger_id?: {
569
+ eq?: string;
570
+ };
571
+ event_type?: {
572
+ /**
573
+ * The type of activity
574
+ */
575
+ eq?: 'request_success' | 'request_failure' | 'response_success' | 'response_failure' | 'request_aborted' | 'response_unprocessable' | 'indexing_started' | 'indexing_success' | 'indexing_failure';
576
+ };
577
+ created_at?: {
578
+ gt?: string;
579
+ lt?: string;
580
+ };
581
+ };
582
+ };
583
+ /**
584
+ * Fields used to order results
585
+ */
586
+ order_by?: 'build_trigger_id_asc' | 'build_trigger_id_desc' | 'created_at_asc' | 'created_at_desc' | 'event_type_asc' | 'event_type_desc';
587
+ [k: string]: unknown;
588
+ };
541
589
  /**
542
590
  * This interface was referenced by `Item`'s JSON-Schema
543
591
  * via the `instances.hrefSchema` link.
@@ -6635,6 +6683,9 @@ export type BuildEventData = {
6635
6683
  */
6636
6684
  export type BuildEventInstancesTargetSchema = {
6637
6685
  data: BuildEvent[];
6686
+ meta: {
6687
+ total_count: number;
6688
+ };
6638
6689
  };
6639
6690
  /**
6640
6691
  * This interface was referenced by `BuildEvent`'s JSON-Schema
@@ -717,6 +717,54 @@ export type BuildTriggerType = 'build_trigger';
717
717
  * via the `instances.targetSchema` link.
718
718
  */
719
719
  export type BuildEventInstancesTargetSchema = BuildEvent[];
720
+ /**
721
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
722
+ * via the `instances.hrefSchema` link.
723
+ */
724
+ export type BuildEventInstancesHrefSchema = {
725
+ /**
726
+ * Parameters to control offset-based pagination
727
+ */
728
+ page?: {
729
+ /**
730
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
731
+ */
732
+ offset?: number;
733
+ /**
734
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
735
+ */
736
+ limit?: number;
737
+ };
738
+ /**
739
+ * Attributes to filter
740
+ */
741
+ filter?: {
742
+ /**
743
+ * IDs to fetch, comma separated
744
+ */
745
+ ids?: string;
746
+ fields?: {
747
+ build_trigger_id?: {
748
+ eq?: string;
749
+ };
750
+ event_type?: {
751
+ /**
752
+ * The type of activity
753
+ */
754
+ eq?: 'request_success' | 'request_failure' | 'response_success' | 'response_failure' | 'request_aborted' | 'response_unprocessable' | 'indexing_started' | 'indexing_success' | 'indexing_failure';
755
+ };
756
+ created_at?: {
757
+ gt?: string;
758
+ lt?: string;
759
+ };
760
+ };
761
+ };
762
+ /**
763
+ * Fields used to order results
764
+ */
765
+ order_by?: 'build_trigger_id_asc' | 'build_trigger_id_desc' | 'created_at_asc' | 'created_at_desc' | 'event_type_asc' | 'event_type_desc';
766
+ [k: string]: unknown;
767
+ };
720
768
  /**
721
769
  * This interface was referenced by `Item`'s JSON-Schema
722
770
  * via the `instances.targetSchema` link.
@@ -1,3 +1,4 @@
1
+ import * as Utils from '@datocms/rest-client-utils';
1
2
  import BaseResource from '../../BaseResource';
2
3
  import type * as SchemaTypes from '../SchemaTypes';
3
4
  import type * as SimpleSchemaTypes from '../SimpleSchemaTypes';
@@ -11,7 +12,7 @@ export default class BuildEvent extends BaseResource {
11
12
  * @throws {ApiError}
12
13
  * @throws {TimeoutError}
13
14
  */
14
- list(): Promise<SimpleSchemaTypes.BuildEventInstancesTargetSchema>;
15
+ list(queryParams?: SimpleSchemaTypes.BuildEventInstancesHrefSchema): Promise<SimpleSchemaTypes.BuildEventInstancesTargetSchema>;
15
16
  /**
16
17
  * List all deploy events
17
18
  *
@@ -20,7 +21,25 @@ export default class BuildEvent extends BaseResource {
20
21
  * @throws {ApiError}
21
22
  * @throws {TimeoutError}
22
23
  */
23
- rawList(): Promise<SchemaTypes.BuildEventInstancesTargetSchema>;
24
+ rawList(queryParams?: SchemaTypes.BuildEventInstancesHrefSchema): Promise<SchemaTypes.BuildEventInstancesTargetSchema>;
25
+ /**
26
+ * Async iterator to auto-paginate over elements returned by list()
27
+ *
28
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
29
+ *
30
+ * @throws {ApiError}
31
+ * @throws {TimeoutError}
32
+ */
33
+ listPagedIterator(queryParams?: Utils.OmitFromKnownKeys<SimpleSchemaTypes.BuildEventInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SimpleSchemaTypes.BuildEvent, void, unknown>;
34
+ /**
35
+ * Async iterator to auto-paginate over elements returned by rawList()
36
+ *
37
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
38
+ *
39
+ * @throws {ApiError}
40
+ * @throws {TimeoutError}
41
+ */
42
+ rawListPagedIterator(queryParams?: Utils.OmitFromKnownKeys<SchemaTypes.BuildEventInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SchemaTypes.BuildEvent, void, unknown>;
24
43
  /**
25
44
  * Retrieve a deploy event
26
45
  *
@@ -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 (g && (g = 0, op[0] && (_ = 0)), _) 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 BuildEvent = /** @class */ (function (_super) {
@@ -28,8 +85,8 @@ var BuildEvent = /** @class */ (function (_super) {
28
85
  * @throws {ApiError}
29
86
  * @throws {TimeoutError}
30
87
  */
31
- BuildEvent.prototype.list = function () {
32
- return this.rawList().then(function (body) {
88
+ BuildEvent.prototype.list = function (queryParams) {
89
+ return this.rawList(queryParams).then(function (body) {
33
90
  return Utils.deserializeResponseBody(body);
34
91
  });
35
92
  };
@@ -41,12 +98,89 @@ var BuildEvent = /** @class */ (function (_super) {
41
98
  * @throws {ApiError}
42
99
  * @throws {TimeoutError}
43
100
  */
44
- BuildEvent.prototype.rawList = function () {
101
+ BuildEvent.prototype.rawList = function (queryParams) {
45
102
  return this.client.request({
46
103
  method: 'GET',
47
104
  url: '/build-events',
105
+ queryParams: queryParams,
48
106
  });
49
107
  };
108
+ /**
109
+ * Async iterator to auto-paginate over elements returned by list()
110
+ *
111
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
112
+ *
113
+ * @throws {ApiError}
114
+ * @throws {TimeoutError}
115
+ */
116
+ BuildEvent.prototype.listPagedIterator = function (queryParams, iteratorOptions) {
117
+ return __asyncGenerator(this, arguments, function listPagedIterator_1() {
118
+ var _a, _b, _c, element, e_1_1;
119
+ var _d, e_1, _e, _f;
120
+ return __generator(this, function (_g) {
121
+ switch (_g.label) {
122
+ case 0:
123
+ _g.trys.push([0, 9, 10, 15]);
124
+ _a = true, _b = __asyncValues(this.rawListPagedIterator(queryParams, iteratorOptions));
125
+ _g.label = 1;
126
+ case 1: return [4 /*yield*/, __await(_b.next())];
127
+ case 2:
128
+ if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 8];
129
+ _f = _c.value;
130
+ _a = false;
131
+ _g.label = 3;
132
+ case 3:
133
+ _g.trys.push([3, , 6, 7]);
134
+ element = _f;
135
+ return [4 /*yield*/, __await(Utils.deserializeJsonEntity(element))];
136
+ case 4: return [4 /*yield*/, _g.sent()];
137
+ case 5:
138
+ _g.sent();
139
+ return [3 /*break*/, 7];
140
+ case 6:
141
+ _a = true;
142
+ return [7 /*endfinally*/];
143
+ case 7: return [3 /*break*/, 1];
144
+ case 8: return [3 /*break*/, 15];
145
+ case 9:
146
+ e_1_1 = _g.sent();
147
+ e_1 = { error: e_1_1 };
148
+ return [3 /*break*/, 15];
149
+ case 10:
150
+ _g.trys.push([10, , 13, 14]);
151
+ if (!(!_a && !_d && (_e = _b.return))) return [3 /*break*/, 12];
152
+ return [4 /*yield*/, __await(_e.call(_b))];
153
+ case 11:
154
+ _g.sent();
155
+ _g.label = 12;
156
+ case 12: return [3 /*break*/, 14];
157
+ case 13:
158
+ if (e_1) throw e_1.error;
159
+ return [7 /*endfinally*/];
160
+ case 14: return [7 /*endfinally*/];
161
+ case 15: return [2 /*return*/];
162
+ }
163
+ });
164
+ });
165
+ };
166
+ /**
167
+ * Async iterator to auto-paginate over elements returned by rawList()
168
+ *
169
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
170
+ *
171
+ * @throws {ApiError}
172
+ * @throws {TimeoutError}
173
+ */
174
+ BuildEvent.prototype.rawListPagedIterator = function (queryParams, iteratorOptions) {
175
+ var _this = this;
176
+ Utils.warnOnPageQueryParam(queryParams);
177
+ return Utils.rawPageIterator({
178
+ defaultLimit: 30,
179
+ maxLimit: 500,
180
+ }, function (page) {
181
+ return _this.rawList(__assign(__assign({}, queryParams), { page: page }));
182
+ }, iteratorOptions);
183
+ };
50
184
  /**
51
185
  * Retrieve a deploy event
52
186
  *
@@ -1 +1 @@
1
- {"version":3,"file":"BuildEvent.js","sourceRoot":"","sources":["../../../../src/generated/resources/BuildEvent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AACpD,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAI9C;IAAwC,8BAAY;IAApD;;IAkEA,CAAC;IA/DC;;;;;;;OAOG;IACH,yBAAI,GAAJ;QACE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,UAAC,IAAI;YAC9B,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACtE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,eAAe;SACrB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,yBAAI,GAAJ,UAAK,YAAuD;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACtD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAO,GAAP,UACE,YAAoB;QAEpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,wBAAiB,YAAY,CAAE;SACrC,CAAC,CAAC;IACL,CAAC;IAhEe,eAAI,GAAG,aAAsB,CAAC;IAiEhD,iBAAC;CAAA,AAlED,CAAwC,YAAY,GAkEnD;eAlEoB,UAAU"}
1
+ {"version":3,"file":"BuildEvent.js","sourceRoot":"","sources":["../../../../src/generated/resources/BuildEvent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AACpD,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAI9C;IAAwC,8BAAY;IAApD;;IA4HA,CAAC;IAzHC;;;;;;;OAOG;IACH,yBAAI,GAAJ,UAAK,WAA6D;QAChE,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;;;;;;;OAOG;IACH,4BAAO,GAAP,UACE,WAAuD;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACtE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,eAAe;YACpB,WAAW,aAAA;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACI,sCAAiB,GAAxB,UACE,WAGC,EACD,eAAuC;;;;;;;;mCAEX,KAAA,cAAA,IAAI,CAAC,oBAAoB,CACnD,WAAW,EACX,eAAe,CAChB,CAAA;;;;;wBAH2B,cAG3B;wBAH2B,WAG3B;;;;wBAHgB,OAAO,KAAA,CAAA;qDAIhB,KAAK,CAAC,qBAAqB,CAE/B,OAAO,CAAC;4BAFV,gCAEU;;wBAFV,SAEU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEd;IAED;;;;;;;OAOG;IACH,yCAAoB,GAApB,UACE,WAGC,EACD,eAAuC;QALzC,iBAoBC;QAbC,KAAK,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAExC,OAAO,KAAK,CAAC,eAAe,CAG1B;YACE,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,GAAG;SACd,EACD,UAAC,IAAuD;YACtD,OAAA,KAAI,CAAC,OAAO,uBAAM,WAAW,KAAE,IAAI,MAAA,IAAG;QAAtC,CAAsC,EACxC,eAAe,CAChB,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,yBAAI,GAAJ,UAAK,YAAuD;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACtD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAO,GAAP,UACE,YAAoB;QAEpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,wBAAiB,YAAY,CAAE;SACrC,CAAC,CAAC;IACL,CAAC;IA1He,eAAI,GAAG,aAAsB,CAAC;IA2HhD,iBAAC;CAAA,AA5HD,CAAwC,YAAY,GA4HnD;eA5HoB,UAAU"}
@@ -538,6 +538,54 @@ export type BuildEventIdentity = string;
538
538
  * via the `definition` "type".
539
539
  */
540
540
  export type BuildTriggerType = 'build_trigger';
541
+ /**
542
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
543
+ * via the `instances.hrefSchema` link.
544
+ */
545
+ export type BuildEventInstancesHrefSchema = {
546
+ /**
547
+ * Parameters to control offset-based pagination
548
+ */
549
+ page?: {
550
+ /**
551
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
552
+ */
553
+ offset?: number;
554
+ /**
555
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
556
+ */
557
+ limit?: number;
558
+ };
559
+ /**
560
+ * Attributes to filter
561
+ */
562
+ filter?: {
563
+ /**
564
+ * IDs to fetch, comma separated
565
+ */
566
+ ids?: string;
567
+ fields?: {
568
+ build_trigger_id?: {
569
+ eq?: string;
570
+ };
571
+ event_type?: {
572
+ /**
573
+ * The type of activity
574
+ */
575
+ eq?: 'request_success' | 'request_failure' | 'response_success' | 'response_failure' | 'request_aborted' | 'response_unprocessable' | 'indexing_started' | 'indexing_success' | 'indexing_failure';
576
+ };
577
+ created_at?: {
578
+ gt?: string;
579
+ lt?: string;
580
+ };
581
+ };
582
+ };
583
+ /**
584
+ * Fields used to order results
585
+ */
586
+ order_by?: 'build_trigger_id_asc' | 'build_trigger_id_desc' | 'created_at_asc' | 'created_at_desc' | 'event_type_asc' | 'event_type_desc';
587
+ [k: string]: unknown;
588
+ };
541
589
  /**
542
590
  * This interface was referenced by `Item`'s JSON-Schema
543
591
  * via the `instances.hrefSchema` link.
@@ -6635,6 +6683,9 @@ export type BuildEventData = {
6635
6683
  */
6636
6684
  export type BuildEventInstancesTargetSchema = {
6637
6685
  data: BuildEvent[];
6686
+ meta: {
6687
+ total_count: number;
6688
+ };
6638
6689
  };
6639
6690
  /**
6640
6691
  * This interface was referenced by `BuildEvent`'s JSON-Schema
@@ -717,6 +717,54 @@ export type BuildTriggerType = 'build_trigger';
717
717
  * via the `instances.targetSchema` link.
718
718
  */
719
719
  export type BuildEventInstancesTargetSchema = BuildEvent[];
720
+ /**
721
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
722
+ * via the `instances.hrefSchema` link.
723
+ */
724
+ export type BuildEventInstancesHrefSchema = {
725
+ /**
726
+ * Parameters to control offset-based pagination
727
+ */
728
+ page?: {
729
+ /**
730
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
731
+ */
732
+ offset?: number;
733
+ /**
734
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
735
+ */
736
+ limit?: number;
737
+ };
738
+ /**
739
+ * Attributes to filter
740
+ */
741
+ filter?: {
742
+ /**
743
+ * IDs to fetch, comma separated
744
+ */
745
+ ids?: string;
746
+ fields?: {
747
+ build_trigger_id?: {
748
+ eq?: string;
749
+ };
750
+ event_type?: {
751
+ /**
752
+ * The type of activity
753
+ */
754
+ eq?: 'request_success' | 'request_failure' | 'response_success' | 'response_failure' | 'request_aborted' | 'response_unprocessable' | 'indexing_started' | 'indexing_success' | 'indexing_failure';
755
+ };
756
+ created_at?: {
757
+ gt?: string;
758
+ lt?: string;
759
+ };
760
+ };
761
+ };
762
+ /**
763
+ * Fields used to order results
764
+ */
765
+ order_by?: 'build_trigger_id_asc' | 'build_trigger_id_desc' | 'created_at_asc' | 'created_at_desc' | 'event_type_asc' | 'event_type_desc';
766
+ [k: string]: unknown;
767
+ };
720
768
  /**
721
769
  * This interface was referenced by `Item`'s JSON-Schema
722
770
  * via the `instances.targetSchema` link.
@@ -1,3 +1,4 @@
1
+ import * as Utils from '@datocms/rest-client-utils';
1
2
  import BaseResource from '../../BaseResource';
2
3
  import type * as SchemaTypes from '../SchemaTypes';
3
4
  import type * as SimpleSchemaTypes from '../SimpleSchemaTypes';
@@ -11,7 +12,7 @@ export default class BuildEvent extends BaseResource {
11
12
  * @throws {ApiError}
12
13
  * @throws {TimeoutError}
13
14
  */
14
- list(): Promise<SimpleSchemaTypes.BuildEventInstancesTargetSchema>;
15
+ list(queryParams?: SimpleSchemaTypes.BuildEventInstancesHrefSchema): Promise<SimpleSchemaTypes.BuildEventInstancesTargetSchema>;
15
16
  /**
16
17
  * List all deploy events
17
18
  *
@@ -20,7 +21,25 @@ export default class BuildEvent extends BaseResource {
20
21
  * @throws {ApiError}
21
22
  * @throws {TimeoutError}
22
23
  */
23
- rawList(): Promise<SchemaTypes.BuildEventInstancesTargetSchema>;
24
+ rawList(queryParams?: SchemaTypes.BuildEventInstancesHrefSchema): Promise<SchemaTypes.BuildEventInstancesTargetSchema>;
25
+ /**
26
+ * Async iterator to auto-paginate over elements returned by list()
27
+ *
28
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
29
+ *
30
+ * @throws {ApiError}
31
+ * @throws {TimeoutError}
32
+ */
33
+ listPagedIterator(queryParams?: Utils.OmitFromKnownKeys<SimpleSchemaTypes.BuildEventInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SimpleSchemaTypes.BuildEvent, void, unknown>;
34
+ /**
35
+ * Async iterator to auto-paginate over elements returned by rawList()
36
+ *
37
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
38
+ *
39
+ * @throws {ApiError}
40
+ * @throws {TimeoutError}
41
+ */
42
+ rawListPagedIterator(queryParams?: Utils.OmitFromKnownKeys<SchemaTypes.BuildEventInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<SchemaTypes.BuildEvent, void, unknown>;
24
43
  /**
25
44
  * Retrieve a deploy event
26
45
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datocms/cma-client",
3
- "version": "3.4.5",
3
+ "version": "4.0.0",
4
4
  "description": "JS client for DatoCMS REST Content Management API",
5
5
  "keywords": [
6
6
  "datocms",
@@ -37,12 +37,12 @@
37
37
  "url": "https://github.com/datocms/js-rest-api-clients/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@datocms/rest-client-utils": "^3.4.2",
40
+ "@datocms/rest-client-utils": "^4.0.0",
41
41
  "uuid": "^9.0.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@datocms/dashboard-client": "^3.4.2",
44
+ "@datocms/dashboard-client": "^4.0.0",
45
45
  "@types/uuid": "^9.0.7"
46
46
  },
47
- "gitHead": "54dda266335fd21274045fac0551a24b4aeec9a1"
47
+ "gitHead": "61359df87116a647daa042e3642b01341d45ecc6"
48
48
  }
package/resources.json CHANGED
@@ -1939,8 +1939,13 @@
1939
1939
  "comment": "List all deploy events",
1940
1940
  "urlPlaceholders": [],
1941
1941
  "optionalRequestBody": false,
1942
+ "queryParamsType": "BuildEventInstancesHrefSchema",
1942
1943
  "queryParamsRequired": false,
1943
1944
  "responseType": "BuildEventInstancesTargetSchema",
1945
+ "paginatedResponse": {
1946
+ "defaultLimit": 30,
1947
+ "maxLimit": 500
1948
+ },
1944
1949
  "name": "list",
1945
1950
  "rawName": "rawList"
1946
1951
  },
@@ -147,7 +147,7 @@ export class Client {
147
147
  ...this.config,
148
148
  ...options,
149
149
  logFn: this.config.logFn || console.log,
150
- userAgent: '@datocms/cma-client v3.4.5',
150
+ userAgent: '@datocms/cma-client v4.0.0',
151
151
  baseUrl: this.baseUrl,
152
152
  preCallStack: new Error().stack,
153
153
  extraHeaders: {
@@ -540,6 +540,69 @@ export type BuildEventIdentity = string;
540
540
  * via the `definition` "type".
541
541
  */
542
542
  export type BuildTriggerType = 'build_trigger';
543
+ /**
544
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
545
+ * via the `instances.hrefSchema` link.
546
+ */
547
+ export type BuildEventInstancesHrefSchema = {
548
+ /**
549
+ * Parameters to control offset-based pagination
550
+ */
551
+ page?: {
552
+ /**
553
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
554
+ */
555
+ offset?: number;
556
+ /**
557
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
558
+ */
559
+ limit?: number;
560
+ };
561
+ /**
562
+ * Attributes to filter
563
+ */
564
+ filter?: {
565
+ /**
566
+ * IDs to fetch, comma separated
567
+ */
568
+ ids?: string;
569
+ fields?: {
570
+ build_trigger_id?: {
571
+ eq?: string;
572
+ };
573
+ event_type?: {
574
+ /**
575
+ * The type of activity
576
+ */
577
+ eq?:
578
+ | 'request_success'
579
+ | 'request_failure'
580
+ | 'response_success'
581
+ | 'response_failure'
582
+ | 'request_aborted'
583
+ | 'response_unprocessable'
584
+ | 'indexing_started'
585
+ | 'indexing_success'
586
+ | 'indexing_failure';
587
+ };
588
+ created_at?: {
589
+ gt?: string;
590
+ lt?: string;
591
+ };
592
+ };
593
+ };
594
+ /**
595
+ * Fields used to order results
596
+ */
597
+ order_by?:
598
+ | 'build_trigger_id_asc'
599
+ | 'build_trigger_id_desc'
600
+ | 'created_at_asc'
601
+ | 'created_at_desc'
602
+ | 'event_type_asc'
603
+ | 'event_type_desc';
604
+ [k: string]: unknown;
605
+ };
543
606
  /**
544
607
  * This interface was referenced by `Item`'s JSON-Schema
545
608
  * via the `instances.hrefSchema` link.
@@ -7158,6 +7221,9 @@ export type BuildEventData = {
7158
7221
  */
7159
7222
  export type BuildEventInstancesTargetSchema = {
7160
7223
  data: BuildEvent[];
7224
+ meta: {
7225
+ total_count: number;
7226
+ };
7161
7227
  };
7162
7228
 
7163
7229
  /**
@@ -722,6 +722,69 @@ export type BuildTriggerType = 'build_trigger';
722
722
  * via the `instances.targetSchema` link.
723
723
  */
724
724
  export type BuildEventInstancesTargetSchema = BuildEvent[];
725
+ /**
726
+ * This interface was referenced by `BuildEvent`'s JSON-Schema
727
+ * via the `instances.hrefSchema` link.
728
+ */
729
+ export type BuildEventInstancesHrefSchema = {
730
+ /**
731
+ * Parameters to control offset-based pagination
732
+ */
733
+ page?: {
734
+ /**
735
+ * The (zero-based) offset of the first entity returned in the collection (defaults to 0)
736
+ */
737
+ offset?: number;
738
+ /**
739
+ * The maximum number of entities to return (defaults to 30, maximum is 500)
740
+ */
741
+ limit?: number;
742
+ };
743
+ /**
744
+ * Attributes to filter
745
+ */
746
+ filter?: {
747
+ /**
748
+ * IDs to fetch, comma separated
749
+ */
750
+ ids?: string;
751
+ fields?: {
752
+ build_trigger_id?: {
753
+ eq?: string;
754
+ };
755
+ event_type?: {
756
+ /**
757
+ * The type of activity
758
+ */
759
+ eq?:
760
+ | 'request_success'
761
+ | 'request_failure'
762
+ | 'response_success'
763
+ | 'response_failure'
764
+ | 'request_aborted'
765
+ | 'response_unprocessable'
766
+ | 'indexing_started'
767
+ | 'indexing_success'
768
+ | 'indexing_failure';
769
+ };
770
+ created_at?: {
771
+ gt?: string;
772
+ lt?: string;
773
+ };
774
+ };
775
+ };
776
+ /**
777
+ * Fields used to order results
778
+ */
779
+ order_by?:
780
+ | 'build_trigger_id_asc'
781
+ | 'build_trigger_id_desc'
782
+ | 'created_at_asc'
783
+ | 'created_at_desc'
784
+ | 'event_type_asc'
785
+ | 'event_type_desc';
786
+ [k: string]: unknown;
787
+ };
725
788
  /**
726
789
  * This interface was referenced by `Item`'s JSON-Schema
727
790
  * via the `instances.targetSchema` link.
@@ -14,8 +14,8 @@ export default class BuildEvent extends BaseResource {
14
14
  * @throws {ApiError}
15
15
  * @throws {TimeoutError}
16
16
  */
17
- list() {
18
- return this.rawList().then((body) =>
17
+ list(queryParams?: SimpleSchemaTypes.BuildEventInstancesHrefSchema) {
18
+ return this.rawList(queryParams).then((body) =>
19
19
  Utils.deserializeResponseBody<SimpleSchemaTypes.BuildEventInstancesTargetSchema>(
20
20
  body,
21
21
  ),
@@ -30,13 +30,71 @@ export default class BuildEvent extends BaseResource {
30
30
  * @throws {ApiError}
31
31
  * @throws {TimeoutError}
32
32
  */
33
- rawList(): Promise<SchemaTypes.BuildEventInstancesTargetSchema> {
33
+ rawList(
34
+ queryParams?: SchemaTypes.BuildEventInstancesHrefSchema,
35
+ ): Promise<SchemaTypes.BuildEventInstancesTargetSchema> {
34
36
  return this.client.request<SchemaTypes.BuildEventInstancesTargetSchema>({
35
37
  method: 'GET',
36
38
  url: '/build-events',
39
+ queryParams,
37
40
  });
38
41
  }
39
42
 
43
+ /**
44
+ * Async iterator to auto-paginate over elements returned by list()
45
+ *
46
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
47
+ *
48
+ * @throws {ApiError}
49
+ * @throws {TimeoutError}
50
+ */
51
+ async *listPagedIterator(
52
+ queryParams?: Utils.OmitFromKnownKeys<
53
+ SimpleSchemaTypes.BuildEventInstancesHrefSchema,
54
+ 'page'
55
+ >,
56
+ iteratorOptions?: Utils.IteratorOptions,
57
+ ) {
58
+ for await (const element of this.rawListPagedIterator(
59
+ queryParams,
60
+ iteratorOptions,
61
+ )) {
62
+ yield Utils.deserializeJsonEntity<
63
+ SimpleSchemaTypes.BuildEventInstancesTargetSchema[0]
64
+ >(element);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Async iterator to auto-paginate over elements returned by rawList()
70
+ *
71
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/build-event/instances
72
+ *
73
+ * @throws {ApiError}
74
+ * @throws {TimeoutError}
75
+ */
76
+ rawListPagedIterator(
77
+ queryParams?: Utils.OmitFromKnownKeys<
78
+ SchemaTypes.BuildEventInstancesHrefSchema,
79
+ 'page'
80
+ >,
81
+ iteratorOptions?: Utils.IteratorOptions,
82
+ ) {
83
+ Utils.warnOnPageQueryParam(queryParams);
84
+
85
+ return Utils.rawPageIterator<
86
+ SchemaTypes.BuildEventInstancesTargetSchema['data'][0]
87
+ >(
88
+ {
89
+ defaultLimit: 30,
90
+ maxLimit: 500,
91
+ },
92
+ (page: SchemaTypes.BuildEventInstancesHrefSchema['page']) =>
93
+ this.rawList({ ...queryParams, page }),
94
+ iteratorOptions,
95
+ );
96
+ }
97
+
40
98
  /**
41
99
  * Retrieve a deploy event
42
100
  *