Data
pinJobs
List pin by CID jobs
Usage
import { PinataSDK } from "pinata-web3";
const pinata = new PinataSDK({
pinataJwt: process.env.PINATA_JWT!,
pinataGateway: "example-gateway.mypinata.cloud",
});
const jobs = await pinata.pinJobs().status("prechecking")
Returns
type PinJobItem = {
id: string;
ipfs_pin_hash: string;
date_queued: string;
name: string;
status: string;
keyvalues: any;
host_nodes: string[];
pin_policy: {
regions: {
id: string;
desiredReplicationCount: number;
}[];
version: number;
};
};
Parameters
Filter results with the following methods. All filters are optional.
cid
- Type:
string
Filter by cid
const jobs = await pinata
.pinJobs()
.cid('bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4')
status
- Type:
"prechecking" | "retrieving" | "expired" | "over_free_limit" | "over_max_size" | "invalid_object" | "bad_host_node"
Filter by current status
const jobs = await pinata
.pinJobs()
.status("prechecking")
sort
- Type:
"ASC" | "DSC"
Order results by either ascending or descending by submission
const jobs = await pinata
.pinJobs()
.sort("ASC")
pageLimit
- Type:
number
Limit the number of results. Default is 10
, max is 250
const jobs = await pinata
.pinJobs()
.pageLimit(100)
pageOffset
- Type:
number
Offset the number of files returned to paginate
const jobs = await pinata
.pinJobs()
.pageOffset(100)
Auto Paginate
The pinJobs
method has an auto pagination feature that is triggered when used inside a for await
iterator
for await (const job of pinata.pinJobs().status("expired") {
console.log(job.ipfs_pin_hash);
}