go_pinning_service_http_client

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2023 License: Apache-2.0, MIT Imports: 11 Imported by: 16

README

go-pinning-service-http-client

This repo is contains a reference implementation of a client for the IPFS Pinning Services API Spec

❗ This repo is no longer maintained.

👉 We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/pinning/remote. 🏎️ Good news! There is tooling and documentation to expedite a switch in your repo.

⚠️ If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).

📚 Learn more, including how to take the maintainership mantle or ask questions, here.

Updating Pinning Service Spec

Download the openapi-generator from https://github.com/OpenAPITools/openapi-generator and generate the code using:

Current code generated with: openapi-generator 5.0.0-beta

openapi-generator generate -g go-experimental -i https://raw.githubusercontent.com/ipfs/pinning-services-api-spec/master/ipfs-pinning-service.yaml -o openapi
rm openapi/go.mod openapi/go.sum

Notes: Due to https://github.com/OpenAPITools/openapi-generator/issues/7473 the code generator the http error codes processing may need some manual editing.

go-experimental is becoming mainstream and so in later versions will be replaced with go

License

SPDX-License-Identifier: Apache-2.0 OR MIT

Documentation

Index

Constants

View Source
const UserAgent = "go-pinning-service-http-client"

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.UserAgent

Variables

View Source
var PinOpts = pinOpts{}

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.PinOpts

Functions

This section is empty.

Types

type AddOption deprecated

type AddOption func(options *addSettings) error

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.AddOption

type Client deprecated

type Client struct {
	// contains filtered or unexported fields
}

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.Client

func NewClient deprecated

func NewClient(url, bearerToken string) *Client

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.NewClient

func (*Client) Add

func (c *Client) Add(ctx context.Context, cid cid.Cid, opts ...AddOption) (PinStatusGetter, error)

func (*Client) DeleteByID

func (c *Client) DeleteByID(ctx context.Context, pinID string) error

func (*Client) GetStatusByID

func (c *Client) GetStatusByID(ctx context.Context, pinID string) (PinStatusGetter, error)

func (*Client) Ls

func (c *Client) Ls(ctx context.Context, opts ...LsOption) (chan PinStatusGetter, chan error)

func (*Client) LsBatchSync added in v0.1.0

func (c *Client) LsBatchSync(ctx context.Context, opts ...LsOption) ([]PinStatusGetter, int, error)

Manual version of Ls that returns a single batch of results and int with total count

func (*Client) LsSync

func (c *Client) LsSync(ctx context.Context, opts ...LsOption) ([]PinStatusGetter, error)

func (*Client) Replace added in v0.1.0

func (c *Client) Replace(ctx context.Context, pinID string, cid cid.Cid, opts ...AddOption) (PinStatusGetter, error)

type LsOption deprecated

type LsOption func(options *lsSettings) error

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.LsOption

type PinGetter deprecated

type PinGetter interface {
	fmt.Stringer
	json.Marshaler
	// CID to be pinned recursively
	GetCid() cid.Cid
	// Optional name for pinned data; can be used for lookups later
	GetName() string
	// Optional list of multiaddrs known to provide the data
	GetOrigins() []string
	// Optional metadata for pin object
	GetMeta() map[string]string
}

PinGetter Getter for Pin object

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.PinGetter

type PinStatusGetter deprecated

type PinStatusGetter interface {
	fmt.Stringer
	json.Marshaler
	// Globally unique ID of the pin request; can be used to check the status of ongoing pinning, modification of pin object, or pin removal
	GetRequestId() string
	GetStatus() Status
	// Immutable timestamp indicating when a pin request entered a pinning service; can be used for filtering results and pagination
	GetCreated() time.Time
	GetPin() PinGetter
	// List of multiaddrs designated by pinning service for transferring any new data from external peers
	GetDelegates() []multiaddr.Multiaddr
	// Optional info for PinStatus response
	GetInfo() map[string]string
}

PinStatusGetter Getter for Pin object with status

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.PinStatusGetter

type Status deprecated

type Status string

Deprecated: use github.com/ipfs/boxo/pinning/remote/client.Status

const (
	// Deprecated: use github.com/ipfs/boxo/pinning/remote/client.StatusUnknown
	StatusUnknown Status = ""
	// Deprecated: use github.com/ipfs/boxo/pinning/remote/client.StatusQueued
	StatusQueued Status = Status(openapi.QUEUED)
	// Deprecated: use github.com/ipfs/boxo/pinning/remote/client.StatusPinning
	StatusPinning Status = Status(openapi.PINNING)
	// Deprecated: use github.com/ipfs/boxo/pinning/remote/client.StatusPinned
	StatusPinned Status = Status(openapi.PINNED)
	// Deprecated: use github.com/ipfs/boxo/pinning/remote/client.StatusFailed
	StatusFailed Status = Status(openapi.FAILED)
)

func (Status) String

func (s Status) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL