Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #108 from PinataCloud/remove-pin-policy-funcs
Browse files Browse the repository at this point in the history
removed pin policy references
  • Loading branch information
obo20 authored Jun 8, 2022
2 parents c698285 + 36c7d43 commit c54722f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 350 deletions.
110 changes: 2 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Once you've set up your instance, using the Pinata SDK is easy. Simply call your

* Pinning
* [hashMetadata](#hashMetadata-anchor)
* [hashPinPolicy](#hashPinPolicy-anchor)
* [pinByHash](#pinByHash-anchor)
* [pinFileToIPFS](#pinFileToIPFS-anchor)
* [pinFromFS](#pinFromFS-anchor)
Expand Down Expand Up @@ -102,46 +101,6 @@ pinata.hashMetadata('yourHashHere', metadata).then((result) => {
});
```


<a name="hashPinPolicy-anchor"></a>
### `hashPinPolicy`
Allows the user to change the pin policy for an individual piece of content.
Changes made via this endpoint only affect the content for the hash passed in. They do not affect a user's account level pin policy.

To read more about pin policies, please check out the [Regions and Replications Documentation](https://pinata.cloud/documentation#RegionsAndReplications).

##### `pinata.hashPinPolicy(ipfsPinHash, newPinPolicy)`
##### Params
* `ipfsPinHash` - A string for a valid IPFS Hash that you have pinned on Pinata.
* `newPinPolicy` A JSON object with a new [Pin Policy](#pinPolicies-anchor) for the hash.

#### Response
If the operation is successful, you will receive back an "OK" REST 200 status.

##### Example Code
```javascript
const newPinPolicy = {
regions: [
{
id: 'FRA1',
desiredReplicationCount: 2
},
{
id: 'NYC1',
desiredReplicationCount: 2
}
]
}
};
pinata.hashPinPolicy('yourHashHere', newPinPolicy).then((result) => {
//handle results here
console.log(result);
}).catch((err) => {
//handle error here
console.log(err);
});
```

<a name="pinByHash-anchor"></a>
### `pinByHash`
Adds a hash to Pinata's pin queue to be pinned asynchronously. For the synchronous version of this operation see: [pinHashToIPFS](#pinHashToIPFS-anchor)
Expand All @@ -153,7 +112,6 @@ Adds a hash to Pinata's pin queue to be pinned asynchronously. For the synchrono
* `pinataMetadata` (optional): A JSON object with [optional metadata](#metadata-anchor) for the hash being pinned
* `pinataOptions`
* `hostNodes` (optional): An array of [multiaddresses for nodes](#hostNode-anchor) that are currently hosting the content to be pinned
* `customPinPolicy` A JSON object with a new [Pin Policy](#pinPolicies-anchor) for the hash.
#### Response
```
{
Expand All @@ -177,19 +135,7 @@ const options = {
hostNodes: [
'/ip4/hostNode1ExternalIP/tcp/4001/ipfs/hostNode1PeerId',
'/ip4/hostNode2ExternalIP/tcp/4001/ipfs/hostNode2PeerId'
],
customPinPolicy: {
regions: [
{
id: 'FRA1',
desiredReplicationCount: 1
},
{
id: 'NYC1',
desiredReplicationCount: 2
}
]
}
]
}
};
pinata.pinByHash('yourHashHere', options).then((result) => {
Expand Down Expand Up @@ -414,45 +360,6 @@ pinata.unpin(hashToUnpin).then((result) => {
});
```

<a name="userPinPolicy-anchor"></a>
### `userPinPolicy`
This allows the sender to change the pin policy their account.

Following a successful call of this endpoint, the new pin policy provided will be utilized for every new piece of content pinned to IPFS via Pinata.

To read more about pin policies, please check out the [Regions and Replications Documentation](https://pinata.cloud/documentation#RegionsAndReplications).

##### `pinata.userPinPolicy(newPinPolicy)`
##### Params
* `newPinPolicy` A JSON object with a new [Pin Policy](#pinPolicies-anchor) for the hash.

#### Response
If the operation is successful, you will receive back an "OK" REST 200 status.

##### Example Code
```javascript
const newPinPolicy = {
regions: [
{
id: 'FRA1',
desiredReplicationCount: 2
},
{
id: 'NYC1',
desiredReplicationCount: 2
}
]
}
};
pinata.userPinPolicy(newPinPolicy).then((result) => {
//handle results here
console.log(result);
}).catch((err) => {
//handle error here
console.log(err);
});
```

<a name="testAuthentication-anchor"></a>
### `testAuthentication`
Tests that you can authenticate with Pinata correctly
Expand Down Expand Up @@ -724,26 +631,13 @@ The options object can consist of the following values:
* wrapWithDirectory (optional) - Tells IPFS to wrap your content in a directory to preserve the content's original name. See [this blog post](https://flyingzumwalt.gitbooks.io/decentralized-web-primer/content/files-on-ipfs/lessons/wrap-directories-around-content.html) for more details on what this does. Valid options are:
* `true`
* `false`
* customPinPolicy (optional) - a custom [Pin Policy](#pinPolicies-anchor) for the piece of content being pinned. Providing a custom pin policy as part of a request means that the content being pinned will be replicated differently from the user's default pin policy found under the [Account](https://pinata.cloud/account) page.


##### Example pinataOptions object
```
{
cidVersion: 1,
wrapWithDirectory: true,
customPinPolicy: {
regions: [
{
id: 'FRA1',
desiredReplicationCount: 2
},
{
id: 'NYC1',
desiredReplicationCount: 2
}
]
}
wrapWithDirectory: true
}
```

Expand Down
Loading

0 comments on commit c54722f

Please sign in to comment.