All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.blockfrost.sdk.api.IPFSService Maven / Gradle / Ivy

package io.blockfrost.sdk.api;

import io.blockfrost.sdk.api.exception.APIException;
import io.blockfrost.sdk.api.model.ipfs.IPFSObject;
import io.blockfrost.sdk.api.model.ipfs.PinItem;
import io.blockfrost.sdk.api.model.ipfs.PinResponse;
import io.blockfrost.sdk.api.util.OrderEnum;

import java.io.File;
import java.io.IOException;
import java.util.List;

public interface IPFSService {

    /**
     * Add a file to IPFS
     * You need to /ipfs/pin/add an object to avoid it being garbage collected. This usage is being counted in your user account quota.
     * @param file
     * @return IPFSObject
     */
    public IPFSObject add(File file) throws APIException, IOException;

    /**
     * Relay to an IPFS gateway
     * Retrieve an object from the IFPS gateway (useful if you do not want to rely on a public gateway, such as `ipfs.blockfrost.dev`).
     * @param ipfsPath
     * @return Content as byte[]
     * @throws APIException
     */
    public byte[] get(String ipfsPath) throws APIException;

    /**
     * Pin an object
     * Pinned objects are counted in your user storage quota.
     * @param ipfsPath  (required)
     * @return PinResponse
     */
    public PinResponse pinAdd(String ipfsPath) throws APIException;

    /**
     * List objects pinned to local storage
     * @param count The number of results displayed on one page.
     * @param page The page number for listing the results.
     * @param order The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last.
     * @return List<PinItem>
     */
    public List getPinnedObjects(int count, int page, OrderEnum order) throws APIException;

    /**
     * List objects pinned to local storage with default order asc
     * @return List<PinItem>
     */
    public List getAllPinnedObjects() throws APIException;

    /**
     * List objects pinned to local storage
     * @param order
     * @return List<PinItem>
     */
    public List getAllPinnedObjects(OrderEnum order) throws APIException;

    /**
     *
     * List objects pinned to local storage
     * @param ipfsPath
     * @return PinItem
     */
    public PinItem getPinnedObjectByIpfsPath(String ipfsPath) throws APIException;

    /**
     *
     * Remove pinned objects from local storage
     * @param ipfsPath
     * @return PinItem
     */
    public PinItem removePinnedObject(String ipfsPath) throws APIException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy