pinata 1.5.0 → 1.6.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
@@ -30,6 +30,7 @@ type FileObject = {
30
30
  type JsonBody = Record<string, unknown>;
31
31
  type PinataMetadata = {
32
32
  name?: string;
33
+ keyvalues?: Record<string, string>;
33
34
  };
34
35
  type UpdateFileOptions = {
35
36
  id: string;
@@ -63,6 +64,7 @@ type FileListResponse = {
63
64
  type FileListQuery = {
64
65
  name?: string;
65
66
  group?: string;
67
+ noGroup?: boolean;
66
68
  mimeType?: string;
67
69
  cid?: string;
68
70
  cidPending?: boolean;
@@ -346,6 +348,7 @@ declare class FilterFiles {
346
348
  limit(limit: number): FilterFiles;
347
349
  cidPending(cidPending: boolean): FilterFiles;
348
350
  metadata(keyvalues: Record<string, string>): FilterFiles;
351
+ noGroup(noGroup: boolean): FilterFiles;
349
352
  pageToken(pageToken: string): FilterFiles;
350
353
  then(onfulfilled?: ((value: FileListResponse) => any) | null): Promise<any>;
351
354
  private fetchPage;
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ type FileObject = {
30
30
  type JsonBody = Record<string, unknown>;
31
31
  type PinataMetadata = {
32
32
  name?: string;
33
+ keyvalues?: Record<string, string>;
33
34
  };
34
35
  type UpdateFileOptions = {
35
36
  id: string;
@@ -63,6 +64,7 @@ type FileListResponse = {
63
64
  type FileListQuery = {
64
65
  name?: string;
65
66
  group?: string;
67
+ noGroup?: boolean;
66
68
  mimeType?: string;
67
69
  cid?: string;
68
70
  cidPending?: boolean;
@@ -346,6 +348,7 @@ declare class FilterFiles {
346
348
  limit(limit: number): FilterFiles;
347
349
  cidPending(cidPending: boolean): FilterFiles;
348
350
  metadata(keyvalues: Record<string, string>): FilterFiles;
351
+ noGroup(noGroup: boolean): FilterFiles;
349
352
  pageToken(pageToken: string): FilterFiles;
350
353
  then(onfulfilled?: ((value: FileListResponse) => any) | null): Promise<any>;
351
354
  private fetchPage;
package/dist/index.js CHANGED
@@ -122,6 +122,9 @@ var uploadFile = async (config, file, options) => {
122
122
  if (options?.groupId) {
123
123
  data.append("group_id", options.groupId);
124
124
  }
125
+ if (options?.metadata?.keyvalues) {
126
+ data.append("keyvalues", JSON.stringify(options.metadata.keyvalues));
127
+ }
125
128
  let headers;
126
129
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
127
130
  headers = {
@@ -188,6 +191,9 @@ var uploadBase64 = async (config, base64String, options) => {
188
191
  if (options?.groupId) {
189
192
  data.append("group_id", options.groupId);
190
193
  }
194
+ if (options?.metadata?.keyvalues) {
195
+ data.append("keyvalues", JSON.stringify(options.metadata.keyvalues));
196
+ }
191
197
  let headers;
192
198
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
193
199
  headers = {
@@ -266,6 +272,9 @@ var uploadUrl = async (config, url, options) => {
266
272
  if (options?.groupId) {
267
273
  data.append("group_id", options.groupId);
268
274
  }
275
+ if (options?.metadata?.keyvalues) {
276
+ data.append("keyvalues", JSON.stringify(options.metadata.keyvalues));
277
+ }
269
278
  let headers;
270
279
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
271
280
  headers = {
@@ -332,6 +341,9 @@ var uploadJson = async (config, jsonData, options) => {
332
341
  if (options?.groupId) {
333
342
  data.append("group_id", options.groupId);
334
343
  }
344
+ if (options?.metadata?.keyvalues) {
345
+ data.append("keyvalues", JSON.stringify(options.metadata.keyvalues));
346
+ }
335
347
  let headers;
336
348
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
337
349
  headers = {
@@ -470,7 +482,8 @@ var listFiles = async (config, options) => {
470
482
  mimeType,
471
483
  pageToken,
472
484
  cidPending,
473
- metadata
485
+ metadata,
486
+ noGroup
474
487
  } = options;
475
488
  if (limit)
476
489
  params.append("limit", limit.toString());
@@ -488,6 +501,8 @@ var listFiles = async (config, options) => {
488
501
  params.append("pageToken", pageToken);
489
502
  if (cidPending)
490
503
  params.append("cidPending", "true");
504
+ if (noGroup)
505
+ params.append("group", "null");
491
506
  if (metadata && typeof metadata === "object") {
492
507
  Object.entries(metadata).forEach(([key, value]) => {
493
508
  params.append(`metadata[${key}]`, value.toString());
@@ -1740,6 +1755,10 @@ var FilterFiles = class {
1740
1755
  this.query.metadata = keyvalues;
1741
1756
  return this;
1742
1757
  }
1758
+ noGroup(noGroup) {
1759
+ this.query.noGroup = noGroup;
1760
+ return this;
1761
+ }
1743
1762
  pageToken(pageToken) {
1744
1763
  this.query.pageToken = pageToken;
1745
1764
  return this;