{"id":15417568,"url":"https://github.com/maht0rz/pinata-sdk","last_synced_at":"2025-03-21T20:34:33.063Z","repository":{"id":57324334,"uuid":"166118555","full_name":"maht0rz/pinata-sdk","owner":"maht0rz","description":"Unofficial SDK for Pinata IPFS pinning service","archived":false,"fork":false,"pushed_at":"2019-01-20T13:32:29.000Z","size":465,"stargazers_count":26,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-13T21:34:03.206Z","etag":null,"topics":["docker","ipfs","javascript","pinata","reasonml"],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maht0rz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-16T21:59:24.000Z","updated_at":"2024-05-30T10:50:31.000Z","dependencies_parsed_at":"2022-09-21T01:11:42.751Z","dependency_job_id":null,"html_url":"https://github.com/maht0rz/pinata-sdk","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maht0rz%2Fpinata-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maht0rz%2Fpinata-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maht0rz%2Fpinata-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maht0rz%2Fpinata-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maht0rz","download_url":"https://codeload.github.com/maht0rz/pinata-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221819064,"owners_count":16885886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","ipfs","javascript","pinata","reasonml"],"created_at":"2024-10-01T17:16:11.792Z","updated_at":"2024-10-28T10:52:35.410Z","avatar_url":"https://github.com/maht0rz.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pinata SDK \n\nUnofficial SDK for [Pinata](https://pinata.cloud), implemented in ReasonML and compiled to Javascript.\n\n### What is Pinata?\nPinning service that improves your IPFS experience by deploying the underlying infrastructure so you don't have to!\n\nIn order to use some of the SDK's features, you'll have to [sign up](https://pinata.cloud/signup) with Pinata to obtain your API keys. To learn more about Pinata check out the [getting started guide](https://pinata.cloud/documentation#GettingStarted).\n\n## Installing\n\nInstall the package - it includes both the javascript \u0026 reason versions.\n```\nnpm i --save pinata-sdk\n```\n\nIf you're using ReasonML, add this to your `bsconfig.json`:\n```javascript\n\"bs-dependencies\": [\n    \"pinata-sdk\"  \n],\n```\n\n## Quick start 👩‍💻\nFollowing examples demonstrates pinning an IPFS hash on Pinata, using the SDK. In order to do so, you need to authenticate yourself with [Pinata API keys](https://pinata.cloud/documentation#GettingStarted).\n\n\u003e ⚠️ For usage with Node.js, make sure to include the `node-fetch` polyfill. \n\n### ReasonML\n\n```ocaml\nopen PinataSdk;\nopen PinataSdk.PinHashToIPFS;\n\nlet hash = \"\u003cyour ipfs content hash\u003e\";\nlet apiKey = \"\u003cyour api key\u003e\";\nlet privateApiKey = \"\u003cyour private api key\u003e\";\nlet pinata = Pinata.configure(\n  ~apiKey = apiKey,\n  ~privateApiKey = privateApiKey,\n  ()\n);\n\npinata\n  -\u003ePinata.pinHashToIPFS(~hash=hash)\n    |\u003e then_(result =\u003e {\n      Js.log(\"Content pinned successfully\" ++ result-\u003eipfsHashGet)\n      Js.Promise.resolve(result);\n    })\n```\n\n### TypeScript\n\n```typescript\nimport * as Pinata from 'pinata-sdk';\nconst apiKey = \"\u003cyour api key\u003e\";\nconst privateApiKey = \"\u003cyour private api key\u003e\";\nconst hash = \"\u003cyour ipfs content hash\u003e\";\nconst pinata: Pinata.PinataConfig = Pinata.configure(apiKey, privateApiKey);\n\n(async function() {\n    try {\n        const result: Pinata.PinHashToIPFSResponseJS = await Pinata.pinHashToIPFS(\n            pinata,\n            hash\n        );\n        console.log(\"Content pinned successfully\", result.ipfsHash);\n    } catch (err) {\n        console.error(\"Content was not pinned\", err);\n    }\n})();\n```\n\n### Javascript\n\n```javascript\nconst Pinata = require('pinata-sdk');\nconst apiKey = \"\u003cyour api key\u003e\";\nconst privateApiKey = \"\u003cyour private api key\u003e\";\nconst hash = \"\u003cyour ipfs content hash\u003e\";\nconst pinata = Pinata.configure(apiKey, privateApiKey);\n\n(async function() {\n    try {\n        const result = await Pinata.pinHashToIPFS(\n            pinata,\n            hash\n        );\n        console.log(\"Content pinned successfully\", result.ipfsHash);\n    } catch (err) {\n        console.error(\"Content was not pinned\", err);\n    }\n})();\n```\n\n## API 🕹\n\nAvailable methods of the SDK, for usage examples see the [quick start guide](https://github.com/maht0rz/pinata-sdk#quick-start-) or the [examples](https://github.com/maht0rz/pinata-sdk#examples-) section.\n\n##### configure (~apiKey: string, ~privateApiKey: string, ~apiURL: string = apiURL): pinataConfig\n\n- `apiKey` your api key from pinata\n- `privateApiKey` your private api key from pinata\n- `apiURL` optional, default value `https://api.pinata.cloud`\n\n##### pinHashToIPFS (config: pinataConfig, ~hash: ipfsHash): Promise.t(pinHashToIPFSResponseJS)\n\n- `config` SDK configuration created via `configure()`\n- `hash` IPFS content hash to be pinned\n\n## Examples 🤓\n\nYou can find the usage examples in the [`examples`](https://github.com/maht0rz/pinata-sdk/tree/master/examples) folder.\n\n\u003e 🐳 Optionally you can start the development container described in the [contributing](https://github.com/maht0rz/pinata-sdk#contributing-) section, in order to run the examples smoothly.\n\nMake sure to:\n1. `npm i` before running each example.\n2. Update your Pinata API credentials in `examples/**/credentials.js`\n3. Update the IPFS hash you want to pin - usually a string in the example's source files.\n\nEach example can be run using `npm start`. \n\nSome examples might contain additional `README.md` to help you understand the details.\n\n## Contributing 🔧\n\nPinataSDK is developed \u0026 built trough docker, to start contributing, you'll have to [setup docker](https://www.docker.com) for your platform first. \n\u003e Editor support for ReasonML works well with VSCode's [OCaml and Reason IDE](https://marketplace.visualstudio.com/items?itemName=freebroccolo.reasonml)\n\n### Development container\n\nEverything you need to contribute to PinataSDK happens inside the development container\n\n```bash\n# Build an image for our dev container\nmake build-image\n# Launch the container with an interactive bash session\nmake bash\n```\n\n### Available commands\n\nList of available commands can be found in `package.json`.\n\n```bash\n# Install dependencies\nnpm install\n\n# Rebuild on every file change\nnpm run start\n\n# Build the SDK\nnpm run build\n\n# Cleans build artifacts\nnpm run clean\n```\n\n## License 📃\n\nPinataSDK is available under the MIT License\n\n## Powered by\n\n\u003cdiv float=\"left\"\u003e\n  \u003cimg src=\"https://cdn-images-1.medium.com/max/1200/1*BTGStLRXsQUbkp0t-oxJhQ.png\" width=\"100\" /\u003e\n  \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Ipfs-logo-1024-ice-text.png/220px-Ipfs-logo-1024-ice-text.png\" width=\"100\" /\u003e\n  \u003cimg src=\"https://cdn-images-1.medium.com/max/1050/1*rFOtAIWjbeAyNNFcW029bQ.png\" width=\"100\" /\u003e \n  \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/6/6a/JavaScript-logo.png\" width=\"100\" /\u003e \n  \u003cimg src=\"https://raw.githubusercontent.com/remojansen/logo.ts/master/ts.png\" width=\"100\" /\u003e \n  \n\u003c/div\u003e\n\u003cbr/\u003e\n\n## Credits 😎\n\nPinata SDK is created and maintained by [Matej Sima](https://t.me/maht0rz).\n\nSpecial thanks to the Pinata team for such an awesome service!\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaht0rz%2Fpinata-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaht0rz%2Fpinata-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaht0rz%2Fpinata-sdk/lists"}