@pinata/sdk 1.1.26 → 1.2.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.
@@ -0,0 +1,540 @@
1
+ import { baseUrl } from '../../../src/constants';
2
+
3
+ export const fakeHeaders = {
4
+ headers: {
5
+ pinata_api_key: "anykey",
6
+ pinata_secret_api_key: "anysecret",
7
+ },
8
+ withCredentials: true,
9
+ };
10
+ export const statusOk = {
11
+ status: 200,
12
+ };
13
+ export const APIData = {
14
+ rows: [
15
+ {
16
+ id: "b0fbdba0-de78-4736-9211-632633deb7be",
17
+ ipfs_pin_hash: "QmRLzdxyiT3waRz1i2J1CU4w868VAkcVpAcQ5vAWEmcNHD",
18
+ size: 52960,
19
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
20
+ date_pinned: "2022-10-05T22:46:53.843Z",
21
+ date_unpinned: null,
22
+ metadata: {
23
+ name: "pin20.png",
24
+ keyvalues: null,
25
+ },
26
+ regions: [
27
+ {
28
+ regionId: "FRA1",
29
+ currentReplicationCount: 1,
30
+ desiredReplicationCount: 1,
31
+ },
32
+ {
33
+ regionId: "NYC1",
34
+ currentReplicationCount: 1,
35
+ desiredReplicationCount: 1,
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ id: "e5a59111-760c-4f24-8b98-fbb6918d578f",
41
+ ipfs_pin_hash: "QmQ7M5otCbU3GdRizPNrktBfjP2kxxWMCAsT8X83GfQM6h",
42
+ size: 35318,
43
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
44
+ date_pinned: "2022-10-05T22:46:44.534Z",
45
+ date_unpinned: null,
46
+ metadata: {
47
+ name: "pin19.png",
48
+ keyvalues: null,
49
+ },
50
+ regions: [
51
+ {
52
+ regionId: "FRA1",
53
+ currentReplicationCount: 1,
54
+ desiredReplicationCount: 1,
55
+ },
56
+ {
57
+ regionId: "NYC1",
58
+ currentReplicationCount: 1,
59
+ desiredReplicationCount: 1,
60
+ },
61
+ ],
62
+ },
63
+ {
64
+ id: "efb2394a-ba19-4df7-9042-7c30e64cd377",
65
+ ipfs_pin_hash: "QmRz8F1KiLfw8SHfshhVjjwnSGjQrqspYjHUSBYFhrF6rD",
66
+ size: 66956,
67
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
68
+ date_pinned: "2022-10-05T22:46:33.390Z",
69
+ date_unpinned: null,
70
+ metadata: {
71
+ name: "pin18.png",
72
+ keyvalues: null,
73
+ },
74
+ regions: [
75
+ {
76
+ regionId: "FRA1",
77
+ currentReplicationCount: 1,
78
+ desiredReplicationCount: 1,
79
+ },
80
+ {
81
+ regionId: "NYC1",
82
+ currentReplicationCount: 1,
83
+ desiredReplicationCount: 1,
84
+ },
85
+ ],
86
+ },
87
+ {
88
+ id: "1b004592-e84b-4cb3-81ec-07850ba8186b",
89
+ ipfs_pin_hash: "QmauuvrS18r487tLtFHjZoqXFc3xrZLDBQqnpKycs9LPau",
90
+ size: 84599,
91
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
92
+ date_pinned: "2022-10-05T22:46:24.204Z",
93
+ date_unpinned: null,
94
+ metadata: {
95
+ name: "pin17.png",
96
+ keyvalues: null,
97
+ },
98
+ regions: [
99
+ {
100
+ regionId: "FRA1",
101
+ currentReplicationCount: 1,
102
+ desiredReplicationCount: 1,
103
+ },
104
+ {
105
+ regionId: "NYC1",
106
+ currentReplicationCount: 1,
107
+ desiredReplicationCount: 1,
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ id: "e1cb1fe1-9d82-4553-90b2-8888d998ff54",
113
+ ipfs_pin_hash: "QmV9S3Jx1abuA13VwD44CKRRnD7mdhbP4HL9HvjZdYpMZm",
114
+ size: 360611,
115
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
116
+ date_pinned: "2022-10-05T22:46:14.291Z",
117
+ date_unpinned: null,
118
+ metadata: {
119
+ name: "pin16.png",
120
+ keyvalues: null,
121
+ },
122
+ regions: [
123
+ {
124
+ regionId: "FRA1",
125
+ currentReplicationCount: 1,
126
+ desiredReplicationCount: 1,
127
+ },
128
+ {
129
+ regionId: "NYC1",
130
+ currentReplicationCount: 1,
131
+ desiredReplicationCount: 1,
132
+ },
133
+ ],
134
+ },
135
+ {
136
+ id: "38c0008a-5996-4166-b409-fe1fb699b62f",
137
+ ipfs_pin_hash: "QmcC1qN1ALkeTrd4wVPgP2R6UsTKBRb7PNL91GwSUYAc2q",
138
+ size: 329724,
139
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
140
+ date_pinned: "2022-10-05T22:45:56.523Z",
141
+ date_unpinned: null,
142
+ metadata: {
143
+ name: "pin15.png",
144
+ keyvalues: null,
145
+ },
146
+ regions: [
147
+ {
148
+ regionId: "FRA1",
149
+ currentReplicationCount: 1,
150
+ desiredReplicationCount: 1,
151
+ },
152
+ {
153
+ regionId: "NYC1",
154
+ currentReplicationCount: 1,
155
+ desiredReplicationCount: 1,
156
+ },
157
+ ],
158
+ },
159
+ {
160
+ id: "90cddd06-5531-4234-adf5-680fd7c59a62",
161
+ ipfs_pin_hash: "QmVMM2ogFUFZMnRtcsAj4zgBbAv8MYKRetD3iMNXjHWDqh",
162
+ size: 49229,
163
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
164
+ date_pinned: "2022-10-05T22:45:43.837Z",
165
+ date_unpinned: null,
166
+ metadata: {
167
+ name: "pin14.png",
168
+ keyvalues: null,
169
+ },
170
+ regions: [
171
+ {
172
+ regionId: "FRA1",
173
+ currentReplicationCount: 1,
174
+ desiredReplicationCount: 1,
175
+ },
176
+ {
177
+ regionId: "NYC1",
178
+ currentReplicationCount: 1,
179
+ desiredReplicationCount: 1,
180
+ },
181
+ ],
182
+ },
183
+ {
184
+ id: "40aff586-32a5-4142-9973-d35a0d596941",
185
+ ipfs_pin_hash: "QmWTnoGJ7AP2c3USkX42SpG4YdiiWNuQNvcpxR3uy7ZWfM",
186
+ size: 76626,
187
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
188
+ date_pinned: "2022-10-05T22:45:33.758Z",
189
+ date_unpinned: null,
190
+ metadata: {
191
+ name: "pin13.png",
192
+ keyvalues: null,
193
+ },
194
+ regions: [
195
+ {
196
+ regionId: "FRA1",
197
+ currentReplicationCount: 1,
198
+ desiredReplicationCount: 1,
199
+ },
200
+ {
201
+ regionId: "NYC1",
202
+ currentReplicationCount: 1,
203
+ desiredReplicationCount: 1,
204
+ },
205
+ ],
206
+ },
207
+ {
208
+ id: "38814347-144f-4140-9838-f7fce4d11f21",
209
+ ipfs_pin_hash: "QmZmUm6smWQqSquvWJr51e14fC6nT4HHsCWXcWKXnhNQH9",
210
+ size: 139412,
211
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
212
+ date_pinned: "2022-10-05T22:45:23.063Z",
213
+ date_unpinned: null,
214
+ metadata: {
215
+ name: "pin12.png",
216
+ keyvalues: null,
217
+ },
218
+ regions: [
219
+ {
220
+ regionId: "FRA1",
221
+ currentReplicationCount: 1,
222
+ desiredReplicationCount: 1,
223
+ },
224
+ {
225
+ regionId: "NYC1",
226
+ currentReplicationCount: 1,
227
+ desiredReplicationCount: 1,
228
+ },
229
+ ],
230
+ },
231
+ {
232
+ id: "381335b2-f64e-4c95-b5e6-63a6110bf639",
233
+ ipfs_pin_hash: "QmVcwfTjRki1o7WvCkfMVVfv9oRj3kaFnfWLq62TuAEqD9",
234
+ size: 146257,
235
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
236
+ date_pinned: "2022-10-05T22:45:12.268Z",
237
+ date_unpinned: null,
238
+ metadata: {
239
+ name: "pin11.png",
240
+ keyvalues: null,
241
+ },
242
+ regions: [
243
+ {
244
+ regionId: "FRA1",
245
+ currentReplicationCount: 1,
246
+ desiredReplicationCount: 1,
247
+ },
248
+ {
249
+ regionId: "NYC1",
250
+ currentReplicationCount: 1,
251
+ desiredReplicationCount: 1,
252
+ },
253
+ ],
254
+ },
255
+ {
256
+ id: "b1ce6263-b1fb-4831-8c74-6f71b31e72c6",
257
+ ipfs_pin_hash: "QmSWCZLFjGuWYjxDCvPcyqwA35kdH5RYExex3U2DXrXcfH",
258
+ size: 89932,
259
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
260
+ date_pinned: "2022-10-05T22:45:02.143Z",
261
+ date_unpinned: null,
262
+ metadata: {
263
+ name: "pin10.png",
264
+ keyvalues: null,
265
+ },
266
+ regions: [
267
+ {
268
+ regionId: "FRA1",
269
+ currentReplicationCount: 1,
270
+ desiredReplicationCount: 1,
271
+ },
272
+ {
273
+ regionId: "NYC1",
274
+ currentReplicationCount: 1,
275
+ desiredReplicationCount: 1,
276
+ },
277
+ ],
278
+ },
279
+ {
280
+ id: "65f89885-9a9c-47f5-8442-63942296f3f3",
281
+ ipfs_pin_hash: "QmZpTaAAxUdscD6mMkYADYHVRbekhHvXyL6MCCRc4hcM4t",
282
+ size: 121532,
283
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
284
+ date_pinned: "2022-10-05T22:44:50.487Z",
285
+ date_unpinned: null,
286
+ metadata: {
287
+ name: "pin9.png",
288
+ keyvalues: null,
289
+ },
290
+ regions: [
291
+ {
292
+ regionId: "FRA1",
293
+ currentReplicationCount: 1,
294
+ desiredReplicationCount: 1,
295
+ },
296
+ {
297
+ regionId: "NYC1",
298
+ currentReplicationCount: 1,
299
+ desiredReplicationCount: 1,
300
+ },
301
+ ],
302
+ },
303
+ {
304
+ id: "d74055a9-4b6b-439e-99c0-b4b908d027c7",
305
+ ipfs_pin_hash: "QmdKakBkbCpdeLTf3NMR382it4kZdo848FTvbSGNmmAmSi",
306
+ size: 80314,
307
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
308
+ date_pinned: "2022-10-05T22:44:38.972Z",
309
+ date_unpinned: null,
310
+ metadata: {
311
+ name: "pin8.png",
312
+ keyvalues: null,
313
+ },
314
+ regions: [
315
+ {
316
+ regionId: "FRA1",
317
+ currentReplicationCount: 1,
318
+ desiredReplicationCount: 1,
319
+ },
320
+ {
321
+ regionId: "NYC1",
322
+ currentReplicationCount: 1,
323
+ desiredReplicationCount: 1,
324
+ },
325
+ ],
326
+ },
327
+ {
328
+ id: "53a56f84-89c7-4947-979e-8f6e8d584151",
329
+ ipfs_pin_hash: "QmfLTuCn3iyhgL6iyZqGNovnAkv5ip5oAPFWmPTYXkmFgb",
330
+ size: 115132,
331
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
332
+ date_pinned: "2022-10-05T22:44:28.357Z",
333
+ date_unpinned: null,
334
+ metadata: {
335
+ name: "pin7.png",
336
+ keyvalues: null,
337
+ },
338
+ regions: [
339
+ {
340
+ regionId: "FRA1",
341
+ currentReplicationCount: 1,
342
+ desiredReplicationCount: 1,
343
+ },
344
+ {
345
+ regionId: "NYC1",
346
+ currentReplicationCount: 1,
347
+ desiredReplicationCount: 1,
348
+ },
349
+ ],
350
+ },
351
+ {
352
+ id: "7ce5f037-b991-4bcb-b888-6f1dd2f4005c",
353
+ ipfs_pin_hash: "QmaDVCBZ9sMQ7AFAqGqWqLymcetJBMsH9TuxwmqqZaVRss",
354
+ size: 68293,
355
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
356
+ date_pinned: "2022-10-05T22:44:16.939Z",
357
+ date_unpinned: null,
358
+ metadata: {
359
+ name: "pin6.png",
360
+ keyvalues: null,
361
+ },
362
+ regions: [
363
+ {
364
+ regionId: "FRA1",
365
+ currentReplicationCount: 1,
366
+ desiredReplicationCount: 1,
367
+ },
368
+ {
369
+ regionId: "NYC1",
370
+ currentReplicationCount: 1,
371
+ desiredReplicationCount: 1,
372
+ },
373
+ ],
374
+ },
375
+ {
376
+ id: "b6d9d849-51e4-4ea4-ae01-8c1cc000d0ad",
377
+ ipfs_pin_hash: "QmNsq42HSV4CAvNLuwe9ZjPkUYQoGiwxXdfyRRLx7Njd7f",
378
+ size: 82560,
379
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
380
+ date_pinned: "2022-10-05T22:44:05.743Z",
381
+ date_unpinned: null,
382
+ metadata: {
383
+ name: "pin5.png",
384
+ keyvalues: null,
385
+ },
386
+ regions: [
387
+ {
388
+ regionId: "FRA1",
389
+ currentReplicationCount: 1,
390
+ desiredReplicationCount: 1,
391
+ },
392
+ {
393
+ regionId: "NYC1",
394
+ currentReplicationCount: 1,
395
+ desiredReplicationCount: 1,
396
+ },
397
+ ],
398
+ },
399
+ {
400
+ id: "ae45ab56-aa22-4ffd-8116-96a5b6bc6fc8",
401
+ ipfs_pin_hash: "QmT8fjVvMZKEDgPZ3JcYqsZvdZLB1S8qT3FE777BE1R3RL",
402
+ size: 38428,
403
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
404
+ date_pinned: "2022-10-05T22:43:47.227Z",
405
+ date_unpinned: null,
406
+ metadata: {
407
+ name: "pin4.png",
408
+ keyvalues: null,
409
+ },
410
+ regions: [
411
+ {
412
+ regionId: "FRA1",
413
+ currentReplicationCount: 1,
414
+ desiredReplicationCount: 1,
415
+ },
416
+ {
417
+ regionId: "NYC1",
418
+ currentReplicationCount: 1,
419
+ desiredReplicationCount: 1,
420
+ },
421
+ ],
422
+ },
423
+ {
424
+ id: "86ee7b32-b723-4ef0-97ef-7efb4386ebcf",
425
+ ipfs_pin_hash: "QmZCZwCqKG8tsLCeUCCeevdKAQJy53uLCwDuXptg1E9xUa",
426
+ size: 113338,
427
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
428
+ date_pinned: "2022-10-05T22:42:09.658Z",
429
+ date_unpinned: null,
430
+ metadata: {
431
+ name: "pin3.png",
432
+ keyvalues: null,
433
+ },
434
+ regions: [
435
+ {
436
+ regionId: "FRA1",
437
+ currentReplicationCount: 1,
438
+ desiredReplicationCount: 1,
439
+ },
440
+ {
441
+ regionId: "NYC1",
442
+ currentReplicationCount: 1,
443
+ desiredReplicationCount: 1,
444
+ },
445
+ ],
446
+ },
447
+ {
448
+ id: "76bb512a-52de-41ab-9008-22b0b0965a59",
449
+ ipfs_pin_hash: "QmSgwD6mjitrh59koPLpswMtwUZnuASi7durphHuXUQnex",
450
+ size: 23661,
451
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
452
+ date_pinned: "2022-10-05T22:41:57.767Z",
453
+ date_unpinned: null,
454
+ metadata: {
455
+ name: "pin2.png",
456
+ keyvalues: null,
457
+ },
458
+ regions: [
459
+ {
460
+ regionId: "FRA1",
461
+ currentReplicationCount: 1,
462
+ desiredReplicationCount: 1,
463
+ },
464
+ {
465
+ regionId: "NYC1",
466
+ currentReplicationCount: 1,
467
+ desiredReplicationCount: 1,
468
+ },
469
+ ],
470
+ },
471
+ {
472
+ id: "0b5ba870-1230-47ba-8298-6de92978ff3f",
473
+ ipfs_pin_hash: "QmNdoq9LuNmKYCKTWsCaowLWCZxv6K5payarU8i5TB4Bo6",
474
+ size: 6850,
475
+ user_id: "6002b716-edbd-40ee-8f64-c50e452ccc3a",
476
+ date_pinned: "2022-10-05T22:41:45.109Z",
477
+ date_unpinned: null,
478
+ metadata: {
479
+ name: "pin1.png",
480
+ keyvalues: null,
481
+ },
482
+ regions: [
483
+ {
484
+ regionId: "FRA1",
485
+ currentReplicationCount: 0,
486
+ desiredReplicationCount: 1,
487
+ },
488
+ {
489
+ regionId: "NYC1",
490
+ currentReplicationCount: 1,
491
+ desiredReplicationCount: 1,
492
+ },
493
+ ],
494
+ },
495
+ ],
496
+ };
497
+
498
+ export const pinListAxiosMockPages = {
499
+ firstPage: {
500
+ url: `${baseUrl}/data/pinList?includeCount=false&pageLimit=10&`,
501
+ headers: fakeHeaders,
502
+ response: {
503
+ ...statusOk,
504
+ data: {
505
+ rows: APIData.rows.slice(0, 10),
506
+ },
507
+ },
508
+ },
509
+ secondPage: {
510
+ url: `${baseUrl}/data/pinList?includeCount=false&pageLimit=10&pageOffset=10&`,
511
+ headers: fakeHeaders,
512
+ response: {
513
+ ...statusOk,
514
+ data: {
515
+ rows: APIData.rows.slice(10, 20),
516
+ },
517
+ },
518
+ },
519
+ thirdPageEmpty: {
520
+ url: `${baseUrl}/data/pinList?includeCount=false&pageLimit=10&pageOffset=20&`,
521
+ headers: fakeHeaders,
522
+ response: {
523
+ ...statusOk,
524
+ data: {
525
+ rows: [],
526
+ },
527
+ },
528
+ },
529
+ firstPageEmpty: {
530
+ url: `${baseUrl}/data/pinList?includeCount=false&pageLimit=10&`,
531
+ headers: fakeHeaders,
532
+
533
+ response: {
534
+ ...statusOk,
535
+ data: {
536
+ rows: [],
537
+ },
538
+ },
539
+ },
540
+ };
@@ -0,0 +1,12 @@
1
+ export default function getFilesByCount(pinataApiKey: any, pinataSecretApiKey: any, filters?: {}, maxCount?: number): {
2
+ [Symbol.asyncIterator]: () => {
3
+ next(): Promise<{
4
+ value: any;
5
+ done: boolean;
6
+ }>;
7
+ return(): Promise<{
8
+ value: number;
9
+ done: boolean;
10
+ }>;
11
+ };
12
+ };
@@ -2,7 +2,7 @@
2
2
  * Pin List
3
3
  * @param {string} pinataApiKey
4
4
  * @param {string} pinataSecretApiKey
5
- * @param {string} filters
5
+ * @param {any} filters
6
6
  * @returns {Promise<unknown>}
7
7
  */
8
- export default function pinList(pinataApiKey: string, pinataSecretApiKey: string, filters: string): Promise<unknown>;
8
+ export default function pinList(pinataApiKey: string, pinataSecretApiKey: string, filters?: any): Promise<unknown>;