pinata 1.0.6 → 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.
package/dist/index.d.mts CHANGED
@@ -327,7 +327,8 @@ declare class FilterFiles {
327
327
  constructor(config: PinataConfig | undefined);
328
328
  limit(limit: number): FilterFiles;
329
329
  cidPending(cidPending: boolean): FilterFiles;
330
- then(onfulfilled?: ((value: FileListItem[]) => any) | null): Promise<any>;
330
+ pageToken(pageToken: string): FilterFiles;
331
+ then(onfulfilled?: ((value: FileListResponse) => any) | null): Promise<any>;
331
332
  private fetchPage;
332
333
  [Symbol.asyncIterator](): AsyncGenerator<FileListItem, void, unknown>;
333
334
  all(): Promise<FileListItem[]>;
@@ -377,7 +378,8 @@ declare class FilterGroups {
377
378
  constructor(config: PinataConfig | undefined);
378
379
  limit(limit: number): FilterGroups;
379
380
  isPublic(isPublic: boolean): FilterGroups;
380
- then(onfulfilled?: ((value: GroupResponseItem[]) => any) | null): Promise<GroupResponseItem[]>;
381
+ pageToken(pageToken: string): FilterGroups;
382
+ then(onfulfilled?: ((value: GroupListResponse) => any) | null): Promise<GroupListResponse>;
381
383
  private fetchPage;
382
384
  [Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown>;
383
385
  all(): Promise<GroupResponseItem[]>;
package/dist/index.d.ts CHANGED
@@ -327,7 +327,8 @@ declare class FilterFiles {
327
327
  constructor(config: PinataConfig | undefined);
328
328
  limit(limit: number): FilterFiles;
329
329
  cidPending(cidPending: boolean): FilterFiles;
330
- then(onfulfilled?: ((value: FileListItem[]) => any) | null): Promise<any>;
330
+ pageToken(pageToken: string): FilterFiles;
331
+ then(onfulfilled?: ((value: FileListResponse) => any) | null): Promise<any>;
331
332
  private fetchPage;
332
333
  [Symbol.asyncIterator](): AsyncGenerator<FileListItem, void, unknown>;
333
334
  all(): Promise<FileListItem[]>;
@@ -377,7 +378,8 @@ declare class FilterGroups {
377
378
  constructor(config: PinataConfig | undefined);
378
379
  limit(limit: number): FilterGroups;
379
380
  isPublic(isPublic: boolean): FilterGroups;
380
- then(onfulfilled?: ((value: GroupResponseItem[]) => any) | null): Promise<GroupResponseItem[]>;
381
+ pageToken(pageToken: string): FilterGroups;
382
+ then(onfulfilled?: ((value: GroupListResponse) => any) | null): Promise<GroupListResponse>;
381
383
  private fetchPage;
382
384
  [Symbol.asyncIterator](): AsyncGenerator<GroupResponseItem, void, unknown>;
383
385
  all(): Promise<GroupResponseItem[]>;
package/dist/index.js CHANGED
@@ -1303,6 +1303,10 @@ var FilterFiles = class {
1303
1303
  this.query.cidPending = cidPending;
1304
1304
  return this;
1305
1305
  }
1306
+ pageToken(pageToken) {
1307
+ this.query.pageToken = pageToken;
1308
+ return this;
1309
+ }
1306
1310
  then(onfulfilled) {
1307
1311
  return this.fetchPage().then(onfulfilled);
1308
1312
  }
@@ -1312,7 +1316,7 @@ var FilterFiles = class {
1312
1316
  }
1313
1317
  const response = await listFiles(this.config, this.query);
1314
1318
  this.currentPageToken = response.next_page_token;
1315
- return response.files;
1319
+ return response;
1316
1320
  }
1317
1321
  // // rate limit, hopefully temporary?
1318
1322
  // private async rateLimit(): Promise<void> {
@@ -1331,7 +1335,7 @@ var FilterFiles = class {
1331
1335
  async *[Symbol.asyncIterator]() {
1332
1336
  while (true) {
1333
1337
  const items = await this.fetchPage();
1334
- for (const item of items) {
1338
+ for (const item of items.files) {
1335
1339
  yield item;
1336
1340
  }
1337
1341
  if (!this.currentPageToken) {
@@ -1548,10 +1552,14 @@ var FilterGroups = class {
1548
1552
  this.query.isPublic = isPublic;
1549
1553
  return this;
1550
1554
  }
1555
+ pageToken(pageToken) {
1556
+ this.query.pageToken = pageToken;
1557
+ return this;
1558
+ }
1551
1559
  then(onfulfilled) {
1552
1560
  return this.fetchPage().then((response) => {
1553
1561
  this.nextPageToken = response.next_page_token;
1554
- return response.groups;
1562
+ return response;
1555
1563
  }).then(onfulfilled);
1556
1564
  }
1557
1565
  async fetchPage() {