ipfs

package
v1.0.0-beta.20 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package ipfs provides methods and message types of the ipfs v1alpha1 API.

Index

Constants

View Source
const (
	ListPinsRequestOrderByCreatedAtAsc  = ListPinsRequestOrderBy("created_at_asc")
	ListPinsRequestOrderByCreatedAtDesc = ListPinsRequestOrderBy("created_at_desc")
)
View Source
const (
	ListVolumesRequestOrderByCreatedAtAsc  = ListVolumesRequestOrderBy("created_at_asc")
	ListVolumesRequestOrderByCreatedAtDesc = ListVolumesRequestOrderBy("created_at_desc")
)
View Source
const (
	PinDetailsUnknownDetails                  = PinDetails("unknown_details")
	PinDetailsPinningLookingForProvider       = PinDetails("pinning_looking_for_provider")
	PinDetailsPinningInProgress               = PinDetails("pinning_in_progress")
	PinDetailsPinningBlocksFetched            = PinDetails("pinning_blocks_fetched")
	PinDetailsPinningFetchingURLData          = PinDetails("pinning_fetching_url_data")
	PinDetailsPinnedOk                        = PinDetails("pinned_ok")
	PinDetailsUnpinnedOk                      = PinDetails("unpinned_ok")
	PinDetailsUnpinningInProgress             = PinDetails("unpinning_in_progress")
	PinDetailsFailedContainsBannedCid         = PinDetails("failed_contains_banned_cid")
	PinDetailsFailedPinning                   = PinDetails("failed_pinning")
	PinDetailsFailedPinningNoProvider         = PinDetails("failed_pinning_no_provider")
	PinDetailsFailedPinningBadCidFormat       = PinDetails("failed_pinning_bad_cid_format")
	PinDetailsFailedPinningTimeout            = PinDetails("failed_pinning_timeout")
	PinDetailsFailedPinningTooBigContent      = PinDetails("failed_pinning_too_big_content")
	PinDetailsFailedPinningUnreachableURL     = PinDetails("failed_pinning_unreachable_url")
	PinDetailsFailedPinningBadURLFormat       = PinDetails("failed_pinning_bad_url_format")
	PinDetailsFailedPinningNoURLContentLength = PinDetails("failed_pinning_no_url_content_length")
	PinDetailsFailedPinningBadURLStatusCode   = PinDetails("failed_pinning_bad_url_status_code")
	PinDetailsFailedUnpinning                 = PinDetails("failed_unpinning")
	PinDetailsCheckingCoherence               = PinDetails("checking_coherence")
	PinDetailsRescheduled                     = PinDetails("rescheduled")
)
View Source
const (
	PinStatusUnknownStatus = PinStatus("unknown_status")
	PinStatusQueued        = PinStatus("queued")
	PinStatusPinning       = PinStatus("pinning")
	PinStatusFailed        = PinStatus("failed")
	PinStatusPinned        = PinStatus("pinned")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API: iPFS Pinning service API.

func NewAPI

func NewAPI(client *scw.Client) *API

NewAPI returns a API object from a Scaleway client.

func (*API) CreatePinByCID

func (s *API) CreatePinByCID(req *CreatePinByCIDRequest, opts ...scw.RequestOption) (*Pin, error)

CreatePinByCID: create a pin by CID. Will fetch and store the content pointed by the provided CID. The content must be available on the public IPFS network. The content (IPFS blocks) will be host by the pinning service until pin deletion. From that point, any other IPFS peer can fetch and host your content: Make sure to pin public or encrypted content. Many pin requests (from different users) can target the same CID. A pin is defined by its ID (UUID), its status (queued, pinning, pinned or failed) and target CID.

func (*API) CreatePinByURL

func (s *API) CreatePinByURL(req *CreatePinByURLRequest, opts ...scw.RequestOption) (*Pin, error)

CreatePinByURL: create a pin by URL. Will fetch and store the content pointed by the provided URL. The content must be available on the public IPFS network. The content (IPFS blocks) will be host by the pinning service until pin deletion. From that point, any other IPFS peer can fetch and host your content: Make sure to pin public or encrypted content. Many pin requests (from different users) can target the same CID. A pin is defined by its ID (UUID), its status (queued, pinning, pinned or failed) and target CID.

func (*API) CreateVolume

func (s *API) CreateVolume(req *CreateVolumeRequest, opts ...scw.RequestOption) (*Volume, error)

CreateVolume: create a new volume. Create a new volume from a Project ID. Volume is identified by an ID and used to host pin references. Volume is personal (at least to your organization) even if IPFS blocks and CID are available to anyone. Should be the first command you made because every pin must be attached to a volume.

func (*API) DeletePin

func (s *API) DeletePin(req *DeletePinRequest, opts ...scw.RequestOption) error

DeletePin: create an unpin request. An unpin request means that you no longer own the content. This content can therefore be removed and no longer provided on the IPFS network.

func (*API) DeleteVolume

func (s *API) DeleteVolume(req *DeleteVolumeRequest, opts ...scw.RequestOption) error

DeleteVolume: delete an existing volume. Delete a volume by its ID and every pin attached to this volume. This process can take a while to conclude, depending on the size of your pinned content.

func (*API) GetPin

func (s *API) GetPin(req *GetPinRequest, opts ...scw.RequestOption) (*Pin, error)

GetPin: get pin information. Retrieve information about the provided **pin ID**, such as status, last modification, and CID.

func (*API) GetVolume

func (s *API) GetVolume(req *GetVolumeRequest, opts ...scw.RequestOption) (*Volume, error)

GetVolume: get information about a volume. Retrieve information about a specific volume.

func (*API) ListPins

func (s *API) ListPins(req *ListPinsRequest, opts ...scw.RequestOption) (*ListPinsResponse, error)

ListPins: list all pins within a volume. Retrieve information about all pins into a volume.

func (*API) ListVolumes

func (s *API) ListVolumes(req *ListVolumesRequest, opts ...scw.RequestOption) (*ListVolumesResponse, error)

ListVolumes: list all volumes by a Project ID. Retrieve information about all volumes from a Project ID.

func (*API) Regions

func (s *API) Regions() []scw.Region

Regions list localities the api is available in

func (*API) ReplacePin

func (s *API) ReplacePin(req *ReplacePinRequest, opts ...scw.RequestOption) (*ReplacePinResponse, error)

func (*API) UpdateVolume

func (s *API) UpdateVolume(req *UpdateVolumeRequest, opts ...scw.RequestOption) (*Volume, error)

UpdateVolume: update volume information. Update volume information (tag, name...).

type CreatePinByCIDRequest

type CreatePinByCIDRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	VolumeID string `json:"volume_id"`

	Cid string `json:"cid"`

	Name *string `json:"name"`

	Origins []string `json:"origins"`

	PinOptions *PinOptions `json:"pin_options"`
}

type CreatePinByURLRequest

type CreatePinByURLRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	VolumeID string `json:"volume_id"`

	URL string `json:"url"`

	Name *string `json:"name"`

	PinOptions *PinOptions `json:"pin_options"`
}

type CreateVolumeRequest

type CreateVolumeRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	ProjectID string `json:"project_id"`

	Name string `json:"name"`
}

type DeletePinRequest

type DeletePinRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	PinID string `json:"-"`

	VolumeID string `json:"-"`
}

type DeleteVolumeRequest

type DeleteVolumeRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	VolumeID string `json:"-"`
}

type GetPinRequest

type GetPinRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	PinID string `json:"-"`

	VolumeID string `json:"-"`
}

type GetVolumeRequest

type GetVolumeRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	VolumeID string `json:"-"`
}

type ListPinsRequest

type ListPinsRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	VolumeID string `json:"-"`

	ProjectID *string `json:"-"`

	OrganizationID *string `json:"-"`

	Page *int32 `json:"-"`

	PageSize *uint32 `json:"-"`
	// OrderBy: default value: created_at_asc
	OrderBy ListPinsRequestOrderBy `json:"-"`
	// Status: default value: unknown_status
	Status PinStatus `json:"-"`
}

type ListPinsRequestOrderBy

type ListPinsRequestOrderBy string

func (ListPinsRequestOrderBy) MarshalJSON

func (enum ListPinsRequestOrderBy) MarshalJSON() ([]byte, error)

func (ListPinsRequestOrderBy) String

func (enum ListPinsRequestOrderBy) String() string

func (*ListPinsRequestOrderBy) UnmarshalJSON

func (enum *ListPinsRequestOrderBy) UnmarshalJSON(data []byte) error

type ListPinsResponse

type ListPinsResponse struct {
	TotalCount uint64 `json:"total_count"`

	Pins []*Pin `json:"pins"`
}

func (*ListPinsResponse) UnsafeAppend

func (r *ListPinsResponse) UnsafeAppend(res interface{}) (uint64, error)

UnsafeAppend should not be used Internal usage only

func (*ListPinsResponse) UnsafeGetTotalCount

func (r *ListPinsResponse) UnsafeGetTotalCount() uint64

UnsafeGetTotalCount should not be used Internal usage only

type ListVolumesRequest

type ListVolumesRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	ProjectID string `json:"-"`

	Page *int32 `json:"-"`

	PageSize *uint32 `json:"-"`
	// OrderBy: default value: created_at_asc
	OrderBy ListVolumesRequestOrderBy `json:"-"`
}

type ListVolumesRequestOrderBy

type ListVolumesRequestOrderBy string

func (ListVolumesRequestOrderBy) MarshalJSON

func (enum ListVolumesRequestOrderBy) MarshalJSON() ([]byte, error)

func (ListVolumesRequestOrderBy) String

func (enum ListVolumesRequestOrderBy) String() string

func (*ListVolumesRequestOrderBy) UnmarshalJSON

func (enum *ListVolumesRequestOrderBy) UnmarshalJSON(data []byte) error

type ListVolumesResponse

type ListVolumesResponse struct {
	Volumes []*Volume `json:"volumes"`

	TotalCount uint64 `json:"total_count"`
}

func (*ListVolumesResponse) UnsafeAppend

func (r *ListVolumesResponse) UnsafeAppend(res interface{}) (uint64, error)

UnsafeAppend should not be used Internal usage only

func (*ListVolumesResponse) UnsafeGetTotalCount

func (r *ListVolumesResponse) UnsafeGetTotalCount() uint64

UnsafeGetTotalCount should not be used Internal usage only

type Pin

type Pin struct {
	PinID string `json:"pin_id"`
	// Status: default value: unknown_status
	Status PinStatus `json:"status"`

	CreatedAt *time.Time `json:"created_at"`

	Cid *PinCID `json:"cid"`

	Delegates []string `json:"delegates"`

	Info *PinInfo `json:"info"`
}

type PinCID

type PinCID struct {
	Cid *string `json:"cid"`

	Name *string `json:"name"`

	Origins []string `json:"origins"`

	Meta *PinCIDMeta `json:"meta"`
}

type PinCIDMeta

type PinCIDMeta struct {
	ID *string `json:"id"`
}

type PinDetails

type PinDetails string

func (PinDetails) MarshalJSON

func (enum PinDetails) MarshalJSON() ([]byte, error)

func (PinDetails) String

func (enum PinDetails) String() string

func (*PinDetails) UnmarshalJSON

func (enum *PinDetails) UnmarshalJSON(data []byte) error

type PinInfo

type PinInfo struct {
	ID *string `json:"id"`

	URL *string `json:"url"`

	Size *uint64 `json:"size"`

	Progress *uint32 `json:"progress"`
	// StatusDetails: default value: unknown_details
	StatusDetails PinDetails `json:"status_details"`
}

type PinOptions

type PinOptions struct {
	RequiredZones []string `json:"required_zones"`

	ReplicationCount uint32 `json:"replication_count"`
}

type PinStatus

type PinStatus string

func (PinStatus) MarshalJSON

func (enum PinStatus) MarshalJSON() ([]byte, error)

func (PinStatus) String

func (enum PinStatus) String() string

func (*PinStatus) UnmarshalJSON

func (enum *PinStatus) UnmarshalJSON(data []byte) error

type ReplacePinRequest

type ReplacePinRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	PinID string `json:"-"`

	VolumeID string `json:"volume_id"`

	Cid string `json:"cid"`

	Name *string `json:"name"`

	Origins []string `json:"origins"`

	PinOptions *PinOptions `json:"pin_options"`
}

type ReplacePinResponse

type ReplacePinResponse struct {
	Pin *Pin `json:"pin"`
}

type UpdateVolumeRequest

type UpdateVolumeRequest struct {
	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"-"`

	VolumeID string `json:"-"`

	Name *string `json:"name"`

	Tags *[]string `json:"tags"`
}

type Volume

type Volume struct {
	ID string `json:"id"`

	ProjectID string `json:"project_id"`

	Region scw.Region `json:"region"`

	CountPin uint64 `json:"count_pin"`

	CreatedAt *time.Time `json:"created_at"`

	UpdatedAt *time.Time `json:"updated_at"`

	Tags []string `json:"tags"`

	Name string `json:"name"`

	Size *uint64 `json:"size"`
}

Jump to

Keyboard shortcuts

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