@pinata/sdk 1.2.0 → 1.2.1

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.
Files changed (50) hide show
  1. package/README.md +21 -5
  2. package/lib/pinata-sdk.js +305 -155
  3. package/lib/pinata-sdk.min.js +5 -5
  4. package/package.json +1 -1
  5. package/src/commands/data/getFilesByCount/getFilesByCount.js +2 -5
  6. package/src/commands/data/pinList/pinList.js +4 -11
  7. package/src/commands/data/testAuthentication.js +4 -11
  8. package/src/commands/data/userPinnedDataTotal.js +4 -11
  9. package/src/commands/pinning/hashMetadata.js +4 -11
  10. package/src/commands/pinning/hashPinPolicy.js +4 -10
  11. package/src/commands/pinning/pinByHash.js +4 -11
  12. package/src/commands/pinning/pinFileToIPFS.js +5 -16
  13. package/src/commands/pinning/pinFromFS.js +6 -23
  14. package/src/commands/pinning/pinJSONToIPFS.js +4 -10
  15. package/src/commands/pinning/pinJobs/pinJobs.js +4 -10
  16. package/src/commands/pinning/unpin.js +4 -11
  17. package/src/commands/pinning/userPinPolicy.js +4 -10
  18. package/src/constants.js +3 -0
  19. package/src/index.js +60 -15
  20. package/src/util/validators.js +88 -12
  21. package/test/commands/data/getFilesByCount/getFilesByCount.test.js +17 -21
  22. package/test/commands/data/pinList/pinList.test.js +20 -15
  23. package/test/commands/data/testAuthentication.test.js +17 -13
  24. package/test/commands/data/userPinnedDataTotal.test.js +3 -3
  25. package/test/commands/pinning/hashMetadata.test.js +7 -7
  26. package/test/commands/pinning/hashPinPolicy.test.js +6 -6
  27. package/test/commands/pinning/pinByHash.test.js +4 -4
  28. package/test/commands/pinning/pinFileToIPFS.test.js +5 -5
  29. package/test/commands/pinning/pinFromFS.js +3 -3
  30. package/test/commands/pinning/pinJSONToIPFS.test.js +4 -4
  31. package/test/commands/pinning/pinJobs/pinJobs.test.js +3 -3
  32. package/test/commands/pinning/unpin.test.js +5 -5
  33. package/test/commands/pinning/userPinPolicy.test.js +51 -22
  34. package/test/util/validators.test.js +114 -72
  35. package/types/commands/data/getFilesByCount/getFilesByCount.d.ts +1 -1
  36. package/types/commands/data/pinList/pinList.d.ts +1 -1
  37. package/types/commands/data/testAuthentication.d.ts +1 -1
  38. package/types/commands/data/userPinnedDataTotal.d.ts +1 -1
  39. package/types/commands/pinning/hashMetadata.d.ts +1 -1
  40. package/types/commands/pinning/hashPinPolicy.d.ts +1 -1
  41. package/types/commands/pinning/pinByHash.d.ts +1 -1
  42. package/types/commands/pinning/pinFileToIPFS.d.ts +1 -1
  43. package/types/commands/pinning/pinFromFS.d.ts +1 -1
  44. package/types/commands/pinning/pinJSONToIPFS.d.ts +1 -1
  45. package/types/commands/pinning/pinJobs/pinJobs.d.ts +1 -1
  46. package/types/commands/pinning/unpin.d.ts +1 -1
  47. package/types/commands/pinning/userPinPolicy.d.ts +1 -1
  48. package/types/constants.d.ts +1 -0
  49. package/types/index.d.ts +9 -174
  50. package/types/util/validators.d.ts +34 -0
@@ -9,7 +9,7 @@ test('Result other than 200 status is returned', () => {
9
9
  };
10
10
  axios.get.mockResolvedValue(badStatus);
11
11
  expect.assertions(1);
12
- expect(pinJobs('test', 'test')).rejects.toEqual(Error(`unknown server response while attempting to retrieve pin jobs: ${badStatus}`));
12
+ expect(pinJobs({ pinataApiKey: 'test', pinataSecretApiKey: 'test' })).rejects.toEqual(Error(`unknown server response while attempting to retrieve pin jobs: ${badStatus}`));
13
13
  });
14
14
 
15
15
  test('200 status is returned', () => {
@@ -19,11 +19,11 @@ test('200 status is returned', () => {
19
19
  };
20
20
  axios.get.mockResolvedValue(goodStatus);
21
21
  expect.assertions(1);
22
- expect(pinJobs('test', 'test')).resolves.toEqual(goodStatus.data);
22
+ expect(pinJobs({ pinataApiKey: 'test', pinataSecretApiKey: 'test' })).resolves.toEqual(goodStatus.data);
23
23
  });
24
24
 
25
25
  test('Rejection handled', () => {
26
26
  axios.get.mockRejectedValue('test error');
27
27
  expect.assertions(1);
28
- expect(pinJobs('test', 'test')).rejects.toEqual('test error');
28
+ expect(pinJobs({ pinataApiKey: 'test', pinataSecretApiKey: 'test' })).rejects.toEqual('test error');
29
29
  });
@@ -9,13 +9,13 @@ const goodHashToUnpin = 'Qma6e8dovfLyiG2UUfdkSHNPAySzrWLX9qVXb44v1muqcp';
9
9
 
10
10
  test('No hashToUnpin value is provided should error', () => {
11
11
  expect(() => {
12
- unpin('test', 'test');
12
+ unpin({ pinataApiKey: 'test', pinataSecretApiKey: 'test' });
13
13
  }).toThrow('hashToUnpin value is required for removing a pin from Pinata');
14
14
  });
15
15
 
16
16
  test('Invalid hashToUnpin value is provided', () => {
17
17
  expect(() => {
18
- unpin('test', 'test', badHashToUnpin);
18
+ unpin({ pinataApiKey: 'test', pinataSecretApiKey: 'test' }, badHashToUnpin);
19
19
  }).toThrow(`${badHashToUnpin} is an invalid IPFS CID`);
20
20
  });
21
21
 
@@ -26,7 +26,7 @@ test('200 status is returned', () => {
26
26
  };
27
27
  axios.delete.mockResolvedValue(goodStatus);
28
28
  expect.assertions(1);
29
- expect(unpin('test', 'test', goodHashToUnpin)).resolves.toEqual(goodStatus.data);
29
+ expect(unpin({ pinataApiKey: 'test', pinataSecretApiKey: 'test' }, goodHashToUnpin)).resolves.toEqual(goodStatus.data);
30
30
  });
31
31
 
32
32
  test('Result other than 200 status is returned', () => {
@@ -35,13 +35,13 @@ test('Result other than 200 status is returned', () => {
35
35
  };
36
36
  axios.delete.mockResolvedValue(badStatus);
37
37
  expect.assertions(1);
38
- expect(unpin('test', 'test', goodHashToUnpin)).rejects.toEqual(Error(`unknown server response while removing pin from IPFS: ${badStatus}`));
38
+ expect(unpin({ pinataApiKey: 'test', pinataSecretApiKey: 'test' }, goodHashToUnpin)).rejects.toEqual(Error(`unknown server response while removing pin from IPFS: ${badStatus}`));
39
39
  });
40
40
 
41
41
  test('Rejection handled', () => {
42
42
  axios.delete.mockRejectedValue('test error');
43
43
  expect.assertions(1);
44
- expect(unpin('test', 'test', goodHashToUnpin)).rejects.toEqual('test error');
44
+ expect(unpin({ pinataApiKey: 'test', pinataSecretApiKey: 'test' }, goodHashToUnpin)).rejects.toEqual('test error');
45
45
  });
46
46
 
47
47
 
@@ -1,51 +1,80 @@
1
- import axios from 'axios';
2
- import userPinPolicy from'../../../src/commands/pinning/userPinPolicy';
1
+ import axios from "axios";
2
+ import userPinPolicy from "../../../src/commands/pinning/userPinPolicy";
3
3
 
4
- jest.mock('axios');
4
+ jest.mock("axios");
5
5
 
6
6
  //common values
7
7
  const newPinPolicy = {
8
8
  regions: [
9
9
  {
10
- id: 'FRA1',
11
- desiredReplicationCount: 2
10
+ id: "FRA1",
11
+ desiredReplicationCount: 2,
12
12
  },
13
13
  {
14
- id: 'NYC1',
15
- desiredReplicationCount: 2
16
- }
17
- ]
14
+ id: "NYC1",
15
+ desiredReplicationCount: 2,
16
+ },
17
+ ],
18
18
  };
19
19
 
20
- test('No newPinPolicy value provided should error', () => {
20
+ test("No newPinPolicy value provided should error", () => {
21
21
  expect(() => {
22
- userPinPolicy('test', 'test');
22
+ userPinPolicy({
23
+ pinataApiKey: "test",
24
+ pinataSecretApiKey: "test",
25
+ });
23
26
  }).toThrow();
24
27
  });
25
28
 
26
- test('200 status is returned', () => {
29
+ test("200 status is returned", () => {
27
30
  const goodStatus = {
28
31
  status: 200,
29
- data: 'testData'
32
+ data: "testData",
30
33
  };
31
34
  axios.put.mockResolvedValue(goodStatus);
32
35
  expect.assertions(1);
33
- expect(userPinPolicy('test', 'test', newPinPolicy)).resolves.toEqual(goodStatus.data);
36
+ expect(
37
+ userPinPolicy(
38
+ {
39
+ pinataApiKey: "test",
40
+ pinataSecretApiKey: "test",
41
+ },
42
+ newPinPolicy
43
+ )
44
+ ).resolves.toEqual(goodStatus.data);
34
45
  });
35
46
 
36
- test('Result other than 200 status is returned', () => {
47
+ test("Result other than 200 status is returned", () => {
37
48
  const badStatus = {
38
- status: 700
49
+ status: 700,
39
50
  };
40
51
  axios.put.mockResolvedValue(badStatus);
41
52
  expect.assertions(1);
42
- expect(userPinPolicy('test', 'test', newPinPolicy)).rejects.toEqual(Error(`unknown server response while changing pin policy for user: ${badStatus}`));
53
+ expect(
54
+ userPinPolicy(
55
+ {
56
+ pinataApiKey: "test",
57
+ pinataSecretApiKey: "test",
58
+ },
59
+ newPinPolicy
60
+ )
61
+ ).rejects.toEqual(
62
+ Error(
63
+ `unknown server response while changing pin policy for user: ${badStatus}`
64
+ )
65
+ );
43
66
  });
44
67
 
45
- test('Rejection handled', () => {
46
- axios.put.mockRejectedValue('test error');
68
+ test("Rejection handled", () => {
69
+ axios.put.mockRejectedValue("test error");
47
70
  expect.assertions(1);
48
- expect(userPinPolicy('test', 'test', newPinPolicy)).rejects.toEqual('test error');
71
+ expect(
72
+ userPinPolicy(
73
+ {
74
+ pinataApiKey: "test",
75
+ pinataSecretApiKey: "test",
76
+ },
77
+ newPinPolicy
78
+ )
79
+ ).rejects.toEqual("test error");
49
80
  });
50
-
51
-
@@ -1,61 +1,98 @@
1
- import { validateApiKeys, validateHostNodes, validateMetadata, validatePinPolicyStructure, validatePinataOptions } from "../../src/util/validators";
1
+ import {
2
+ validateApiKeys,
3
+ createConfigForAxiosHeaders,
4
+ validateHostNodes,
5
+ validateMetadata,
6
+ validatePinPolicyStructure,
7
+ validatePinataOptions,
8
+ } from "../../src/util/validators";
9
+ import { ERROR_NO_CREDENTIALS_PROVIDED } from "../../src/constants";
2
10
 
3
- describe('validateApiKeys function testing', () => {
4
- test('check to throw if either pinataApiKey or pinataSecretApiKey are not provided', () => {
5
- expect(() => {
6
- validateApiKeys('', 'test');
7
- }).toThrow('No pinataApiKey provided! Please provide your pinata api key as an argument when you start this script');
8
- expect(() => {
9
- validateApiKeys('test', '');
10
- }).toThrow('No pinataSecretApiKey provided! Please provide your pinata secret api key as an argument when you start this script');
11
+ describe("validateApiKeys function testing", () => {
12
+ test("check to throw if either pinataApiKey or pinataSecretApiKey are not provided", () => {
13
+ expect(() => {
14
+ validateApiKeys("", "test");
15
+ }).toThrow(
16
+ "No pinataApiKey provided! Please provide your pinata api key as an argument when you start this script"
17
+ );
18
+ expect(() => {
19
+ validateApiKeys("test", "");
20
+ }).toThrow(
21
+ "No pinataSecretApiKey provided! Please provide your pinata secret api key as an argument when you start this script"
22
+ );
11
23
  });
12
24
  });
13
25
 
14
- describe('validateHostNodes function testing', () => {
15
- test('host_nodes is not an array', () => {
26
+ describe("createConfigForAxiosHeaders function testing", () => {
27
+ expect(() => {
28
+ createConfigForAxiosHeaders({});
29
+ }).toThrow(ERROR_NO_CREDENTIALS_PROVIDED);
30
+
31
+ expect(() => {
32
+ createConfigForAxiosHeaders({ pinataApiKey: "some api key" });
33
+ }).toThrow(ERROR_NO_CREDENTIALS_PROVIDED);
34
+
35
+ expect(() => {
36
+ createConfigForAxiosHeaders({ pinataSecretApiKey: "some api secret" });
37
+ }).toThrow(ERROR_NO_CREDENTIALS_PROVIDED);
38
+
39
+ expect(
40
+ createConfigForAxiosHeaders({
41
+ pinataApiKey: "some api key",
42
+ pinataSecretApiKey: "some api secret",
43
+ })
44
+ ).toEqual({
45
+ withCredentials: true,
46
+ headers: {
47
+ pinata_api_key: "some api key",
48
+ pinata_secret_api_key: "some api secret",
49
+ },
50
+ });
51
+ });
52
+ describe("validateHostNodes function testing", () => {
53
+ test("host_nodes is not an array", () => {
16
54
  const hostNodes = {
17
- test: 'test'
55
+ test: "test",
18
56
  };
19
57
  expect(() => {
20
58
  validateHostNodes(hostNodes);
21
- }).toThrow('host_nodes value must be an array');
59
+ }).toThrow("host_nodes value must be an array");
22
60
  });
23
61
 
24
- test('invalid host_node entry', () => {
25
- const validHost = '/ip4/127.0.0.1/tcp/1234/ws/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj';
26
- const invalidHost = 'invalid host';
27
- const hostNodes = [
28
- validHost,
29
- invalidHost
30
- ];
62
+ test("invalid host_node entry", () => {
63
+ const validHost =
64
+ "/ip4/127.0.0.1/tcp/1234/ws/ipfs/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj";
65
+ const invalidHost = "invalid host";
66
+ const hostNodes = [validHost, invalidHost];
31
67
  expect(() => {
32
68
  validateHostNodes(hostNodes);
33
- }).toThrow(`host_node array entry: ${invalidHost} is not a valid peer multiaddr`);
69
+ }).toThrow(
70
+ `host_node array entry: ${invalidHost} is not a valid peer multiaddr`
71
+ );
34
72
  });
35
73
  });
36
74
 
37
-
38
- describe('validateMetadata function testing', () => {
39
- test('name is not a string', () => {
75
+ describe("validateMetadata function testing", () => {
76
+ test("name is not a string", () => {
40
77
  const badName = {
41
- test: 'testing'
78
+ test: "testing",
42
79
  };
43
80
  expect(() => {
44
81
  validateMetadata({
45
- name: badName
82
+ name: badName,
46
83
  });
47
- }).toThrow('metadata name must be of type string');
84
+ }).toThrow("metadata name must be of type string");
48
85
  });
49
- test('keyvalues is not an object', () => {
50
- const badKeyValues = 'testing';
86
+ test("keyvalues is not an object", () => {
87
+ const badKeyValues = "testing";
51
88
  expect(() => {
52
89
  validateMetadata({
53
- keyvalues: badKeyValues
90
+ keyvalues: badKeyValues,
54
91
  });
55
- }).toThrow('metatadata keyvalues must be an object');
92
+ }).toThrow("metatadata keyvalues must be an object");
56
93
  });
57
94
 
58
- test('more than 10 keyvalues was provided', () => {
95
+ test("more than 10 keyvalues was provided", () => {
59
96
  const tooManyKeyValues = {
60
97
  one: 1,
61
98
  two: 2,
@@ -67,19 +104,21 @@ describe('validateMetadata function testing', () => {
67
104
  eight: 8,
68
105
  nine: 9,
69
106
  ten: 10,
70
- eleven: 11
107
+ eleven: 11,
71
108
  };
72
109
  expect(() => {
73
110
  validateMetadata({
74
- keyvalues: tooManyKeyValues
111
+ keyvalues: tooManyKeyValues,
75
112
  });
76
- }).toThrow('No more than 10 keyvalues can be provided for metadata entries');
113
+ }).toThrow(
114
+ "No more than 10 keyvalues can be provided for metadata entries"
115
+ );
77
116
  });
78
- test('Throws error on an object being passed in as a value for a keyvalue', () => {
117
+ test("Throws error on an object being passed in as a value for a keyvalue", () => {
79
118
  const invalidValue = {
80
119
  one: 1,
81
120
  two: {
82
- test: 'test'
121
+ test: "test",
83
122
  },
84
123
  three: 3,
85
124
  four: 4,
@@ -89,15 +128,17 @@ describe('validateMetadata function testing', () => {
89
128
  eight: 8,
90
129
  nine: 9,
91
130
  ten: 10,
92
- eleven: 11
131
+ eleven: 11,
93
132
  };
94
133
  expect(() => {
95
134
  validateMetadata({
96
- keyvalues: invalidValue
135
+ keyvalues: invalidValue,
97
136
  });
98
- }).toThrow('Metadata keyvalue values must be strings, booleans, or numbers');
137
+ }).toThrow(
138
+ "Metadata keyvalue values must be strings, booleans, or numbers"
139
+ );
99
140
  });
100
- test('Does not throw an error if metadata is valid', () => {
141
+ test("Does not throw an error if metadata is valid", () => {
101
142
  const invalidValue = {
102
143
  one: 1,
103
144
  two: 2,
@@ -108,85 +149,86 @@ describe('validateMetadata function testing', () => {
108
149
  seven: 7,
109
150
  eight: 8,
110
151
  nine: 9,
111
- ten: 10
152
+ ten: 10,
112
153
  };
113
154
  expect(() => {
114
155
  validateMetadata({
115
- keyvalues: invalidValue
156
+ keyvalues: invalidValue,
116
157
  });
117
158
  }).not.toThrow();
118
159
  });
119
160
  });
120
161
 
121
- describe('validatePinPolicyStructure function testing', () => {
122
- test('No Policy Provided', () => {
162
+ describe("validatePinPolicyStructure function testing", () => {
163
+ test("No Policy Provided", () => {
123
164
  expect(() => {
124
165
  validatePinPolicyStructure();
125
166
  }).toThrow("No pin policy provided");
126
167
  });
127
- test('No Regions Provided', () => {
168
+ test("No Regions Provided", () => {
128
169
  expect(() => {
129
170
  validatePinPolicyStructure({
130
- test: 'test'
171
+ test: "test",
131
172
  });
132
173
  }).toThrow("No regions provided in pin policy");
133
174
  });
134
- test('region id is not a string', () => {
175
+ test("region id is not a string", () => {
135
176
  expect(() => {
136
177
  validatePinPolicyStructure({
137
178
  regions: [
138
179
  {
139
- id: 'goodRegionId',
140
- desiredReplicationCount: 1
180
+ id: "goodRegionId",
181
+ desiredReplicationCount: 1,
141
182
  },
142
183
  {
143
184
  id: 0,
144
- desiredReplicationCount: 1
145
- }
146
- ]
185
+ desiredReplicationCount: 1,
186
+ },
187
+ ],
147
188
  });
148
189
  }).toThrow("region id must be a string");
149
190
  });
150
- test('desiredReplicationCount is not an integer', () => {
191
+ test("desiredReplicationCount is not an integer", () => {
151
192
  expect(() => {
152
193
  validatePinPolicyStructure({
153
194
  regions: [
154
195
  {
155
- id: 'goodRegionId',
156
- desiredReplicationCount: 1
196
+ id: "goodRegionId",
197
+ desiredReplicationCount: 1,
157
198
  },
158
199
  {
159
- id: 'goodRegionId2',
160
- desiredReplicationCount: 'string that should fail'
161
- }
162
- ]
200
+ id: "goodRegionId2",
201
+ desiredReplicationCount: "string that should fail",
202
+ },
203
+ ],
163
204
  });
164
205
  }).toThrow("desiredReplicationCount must be an integer");
165
206
  });
166
207
  });
167
208
 
168
-
169
- describe('validatePinataOptions function testing', () => {
170
- test('options is not an object', () => {
209
+ describe("validatePinataOptions function testing", () => {
210
+ test("options is not an object", () => {
171
211
  expect(() => {
172
- validatePinataOptions('test');
173
- }).toThrow('options must be an object');
212
+ validatePinataOptions("test");
213
+ }).toThrow("options must be an object");
174
214
  });
175
- test('cidVersion is not a 0 or 1', () => {
215
+ test("cidVersion is not a 0 or 1", () => {
176
216
  const badVersion = {
177
- test: 'testing'
217
+ test: "testing",
178
218
  };
179
219
  expect(() => {
180
220
  validatePinataOptions({
181
- cidVersion: badVersion
221
+ cidVersion: badVersion,
182
222
  });
183
- }).toThrow('unsupported or invalid cidVersion');
223
+ }).toThrow("unsupported or invalid cidVersion");
184
224
  });
185
- test('wrapWithDirectory is not true or false', () => {
225
+ test("wrapWithDirectory is not true or false", () => {
186
226
  expect(() => {
187
227
  validatePinataOptions({
188
- wrapWithDirectory: 'test'
228
+ wrapWithDirectory: "test",
189
229
  });
190
- }).toThrow('wrapWithDirectory must be a boolean value of true or false');
230
+ }).toThrow(
231
+ "wrapWithDirectory must be a boolean value of true or false"
232
+ );
191
233
  });
192
234
  });
@@ -1,4 +1,4 @@
1
- export default function getFilesByCount(pinataApiKey: any, pinataSecretApiKey: any, filters?: {}, maxCount?: number): {
1
+ export default function getFilesByCount(config: any, filters?: {}, maxCount?: number): {
2
2
  [Symbol.asyncIterator]: () => {
3
3
  next(): Promise<{
4
4
  value: any;
@@ -5,4 +5,4 @@
5
5
  * @param {any} filters
6
6
  * @returns {Promise<unknown>}
7
7
  */
8
- export default function pinList(pinataApiKey: string, pinataSecretApiKey: string, filters?: any): Promise<unknown>;
8
+ export default function pinList(config: any, filters?: any): Promise<unknown>;
@@ -4,4 +4,4 @@
4
4
  * @param {string} pinataSecretApiKey
5
5
  * @returns {Promise<unknown>}
6
6
  */
7
- export default function testAuthentication(pinataApiKey: string, pinataSecretApiKey: string): Promise<unknown>;
7
+ export default function testAuthentication(config: any): Promise<unknown>;
@@ -4,4 +4,4 @@
4
4
  * @param {string} pinataSecretApiKey
5
5
  * @returns {Promise<unknown>}
6
6
  */
7
- export default function userPinnedDataTotal(pinataApiKey: string, pinataSecretApiKey: string): Promise<unknown>;
7
+ export default function userPinnedDataTotal(config: any): Promise<unknown>;
@@ -6,4 +6,4 @@
6
6
  * @param {*} metadata
7
7
  * @returns {Promise<unknown>}
8
8
  */
9
- export default function hashMetadata(pinataApiKey: string, pinataSecretApiKey: string, ipfsPinHash: any, metadata: any): Promise<unknown>;
9
+ export default function hashMetadata(config: any, ipfsPinHash: any, metadata: any): Promise<unknown>;
@@ -6,4 +6,4 @@
6
6
  * @param {*} newPinPolicy
7
7
  * @returns {Promise<unknown>}
8
8
  */
9
- export default function hashPinPolicy(pinataApiKey: string, pinataSecretApiKey: string, ipfsPinHash: any, newPinPolicy: any): Promise<unknown>;
9
+ export default function hashPinPolicy(config: any, ipfsPinHash: any, newPinPolicy: any): Promise<unknown>;
@@ -6,4 +6,4 @@
6
6
  * @param {*} options
7
7
  * @returns {Promise<unknown>}
8
8
  */
9
- export default function pinByHash(pinataApiKey: string, pinataSecretApiKey: string, hashToPin: any, options: any): Promise<unknown>;
9
+ export default function pinByHash(config: any, hashToPin: any, options: any): Promise<unknown>;
@@ -6,4 +6,4 @@
6
6
  * @param {*} options
7
7
  * @returns {Promise<unknown>}
8
8
  */
9
- export default function pinFileToIPFS(pinataApiKey: string, pinataSecretApiKey: string, readStream: any, options: any): Promise<unknown>;
9
+ export default function pinFileToIPFS(config: any, readStream: any, options: any): Promise<unknown>;
@@ -6,4 +6,4 @@
6
6
  * @param {*} options
7
7
  * @returns {Promise<unknown>}
8
8
  */
9
- export default function pinFromFS(pinataApiKey: string, pinataSecretApiKey: string, sourcePath: string, options: any): Promise<unknown>;
9
+ export default function pinFromFS(config: any, sourcePath: string, options: any): Promise<unknown>;
@@ -6,4 +6,4 @@
6
6
  * @param {*} options
7
7
  * @returns {Promise<unknown>}
8
8
  */
9
- export default function pinJSONToIPFS(pinataApiKey: string, pinataSecretApiKey: string, body: any, options: any): Promise<unknown>;
9
+ export default function pinJSONToIPFS(config: any, body: any, options: any): Promise<unknown>;
@@ -5,4 +5,4 @@
5
5
  * @param {*} filters
6
6
  * @returns {Promise<unknown>}
7
7
  */
8
- export default function pinJobs(pinataApiKey: string, pinataSecretApiKey: string, filters: any): Promise<unknown>;
8
+ export default function pinJobs(config: any, filters: any): Promise<unknown>;
@@ -5,4 +5,4 @@
5
5
  * @param {string} hashToUnpin
6
6
  * @returns {Promise<unknown>}
7
7
  */
8
- export default function unpin(pinataApiKey: string, pinataSecretApiKey: string, hashToUnpin: string): Promise<unknown>;
8
+ export default function unpin(config: any, hashToUnpin: string): Promise<unknown>;
@@ -5,4 +5,4 @@
5
5
  * @param {*} newPinPolicy
6
6
  * @returns {Promise<unknown>}
7
7
  */
8
- export default function userPinPolicy(pinataApiKey: string, pinataSecretApiKey: string, newPinPolicy: any): Promise<unknown>;
8
+ export default function userPinPolicy(config: any, newPinPolicy: any): Promise<unknown>;
@@ -1 +1,2 @@
1
1
  export const baseUrl: "https://api.pinata.cloud";
2
+ export const ERROR_NO_CREDENTIALS_PROVIDED: "No credentials provided! Please provide your pinata api key and pinata secret api key or your pinata JWT key as an argument when you start this script";