ipfs

package
v1.0.0-beta.25 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 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 (
	ListNamesRequestOrderByCreatedAtAsc  = ListNamesRequestOrderBy("created_at_asc")
	ListNamesRequestOrderByCreatedAtDesc = ListNamesRequestOrderBy("created_at_desc")
)
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 (
	NameStatusUnknownStatus = NameStatus("unknown_status")
	NameStatusQueued        = NameStatus("queued")
	NameStatusPublishing    = NameStatus("publishing")
	NameStatusFailed        = NameStatus("failed")
	NameStatusPublished     = NameStatus("published")
)
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
}

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: 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: 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 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: 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 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: 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: Retrieve information about a specific volume.

func (*API) ListPins

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

ListPins: Retrieve information about all pins within a volume.

func (*API) ListVolumes

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

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

func (*API) Regions

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

func (*API) ReplacePin

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

ReplacePin: Deletes the given resource ID and pins the new CID in its place. 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) is hosted by the pinning service until the pin is deleted. While the content is available any other IPFS peer can fetch and host your content. For this reason, we recommend that you pin either public or encrypted content. Several different pin requests 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) UpdateVolume

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

UpdateVolume: 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: volume ID on which you want to pin your content.
	VolumeID string `json:"volume_id"`

	// Cid: cID containing the content you want to pin.
	Cid string `json:"cid"`

	// Origins: node containing the content you want to pin.
	Origins []string `json:"origins"`

	// Name: pin name.
	Name *string `json:"name,omitempty"`
}

CreatePinByCIDRequest: create pin by cid request.

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: volume ID on which you want to pin your content.
	VolumeID string `json:"volume_id"`

	// URL: URL containing the content you want to pin.
	URL string `json:"url"`

	// Name: pin name.
	Name *string `json:"name,omitempty"`
}

CreatePinByURLRequest: create pin by url request.

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: project ID.
	ProjectID string `json:"project_id"`

	// Name: volume name.
	Name string `json:"name"`
}

CreateVolumeRequest: create volume request.

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: pin ID you want to remove from the volume.
	PinID string `json:"-"`

	// VolumeID: volume ID.
	VolumeID string `json:"volume_id"`
}

DeletePinRequest: delete pin request.

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: volume ID.
	VolumeID string `json:"-"`
}

DeleteVolumeRequest: delete volume request.

type ExportKeyNameResponse

type ExportKeyNameResponse struct {
	NameID string `json:"name_id"`

	ProjectID string `json:"project_id"`

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

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

	PublicKey string `json:"public_key"`

	PrivateKey string `json:"private_key"`
}

ExportKeyNameResponse: export key name response.

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: pin ID of which you want to obtain information.
	PinID string `json:"-"`

	// VolumeID: volume ID.
	VolumeID string `json:"volume_id"`
}

GetPinRequest: get pin request.

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: volume ID.
	VolumeID string `json:"-"`
}

GetVolumeRequest: get volume request.

type IpnsAPI

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

func NewIpnsAPI

func NewIpnsAPI(client *scw.Client) *IpnsAPI

NewIpnsAPI returns a IpnsAPI object from a Scaleway client.

func (*IpnsAPI) CreateName

func (s *IpnsAPI) CreateName(req *IpnsAPICreateNameRequest, opts ...scw.RequestOption) (*Name, error)

CreateName: You can use the `ipns key` command to list and generate more names and their respective keys.

func (*IpnsAPI) DeleteName

func (s *IpnsAPI) DeleteName(req *IpnsAPIDeleteNameRequest, opts ...scw.RequestOption) error

DeleteName: Delete a name by its ID.

func (*IpnsAPI) ExportKeyName

ExportKeyName: Export a private key by its ID.

func (*IpnsAPI) GetName

func (s *IpnsAPI) GetName(req *IpnsAPIGetNameRequest, opts ...scw.RequestOption) (*Name, error)

GetName: Retrieve information about a specific name.

func (*IpnsAPI) ImportKeyName

func (s *IpnsAPI) ImportKeyName(req *IpnsAPIImportKeyNameRequest, opts ...scw.RequestOption) (*Name, error)

ImportKeyName: Import a private key.

func (*IpnsAPI) ListNames

func (s *IpnsAPI) ListNames(req *IpnsAPIListNamesRequest, opts ...scw.RequestOption) (*ListNamesResponse, error)

ListNames: Retrieve information about all names from a Project ID.

func (*IpnsAPI) Regions

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

func (*IpnsAPI) UpdateName

func (s *IpnsAPI) UpdateName(req *IpnsAPIUpdateNameRequest, opts ...scw.RequestOption) (*Name, error)

UpdateName: Update name information (CID, tag, name...).

type IpnsAPICreateNameRequest

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

	// ProjectID: project ID.
	ProjectID string `json:"project_id"`

	// Name: name for your records.
	Name string `json:"name"`

	// Value: value you want to associate with your records, CID or IPNS key.
	Value string `json:"value"`
}

IpnsAPICreateNameRequest: ipns api create name request.

type IpnsAPIDeleteNameRequest

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

	// NameID: name ID you wish to delete.
	NameID string `json:"-"`
}

IpnsAPIDeleteNameRequest: ipns api delete name request.

type IpnsAPIExportKeyNameRequest

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

	// NameID: name ID whose keys you want to export.
	NameID string `json:"-"`
}

IpnsAPIExportKeyNameRequest: ipns api export key name request.

type IpnsAPIGetNameRequest

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

	// NameID: name ID whose information you want to retrieve.
	NameID string `json:"-"`
}

IpnsAPIGetNameRequest: ipns api get name request.

type IpnsAPIImportKeyNameRequest

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

	// ProjectID: project ID.
	ProjectID string `json:"project_id"`

	// Name: name for your records.
	Name string `json:"name"`

	// PrivateKey: base64 private key.
	PrivateKey string `json:"private_key"`

	// Value: value you want to associate with your records, CID or IPNS key.
	Value string `json:"value"`
}

IpnsAPIImportKeyNameRequest: ipns api import key name request.

type IpnsAPIListNamesRequest

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

	// ProjectID: project ID.
	ProjectID *string `json:"-"`

	// OrganizationID: organization ID.
	OrganizationID *string `json:"-"`

	// OrderBy: sort the order of the returned names.
	// Default value: created_at_asc
	OrderBy ListNamesRequestOrderBy `json:"-"`

	// Page: page number.
	Page *int32 `json:"-"`

	// PageSize: maximum number of names to return per page.
	PageSize *uint32 `json:"-"`
}

IpnsAPIListNamesRequest: ipns api list names request.

type IpnsAPIUpdateNameRequest

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

	// NameID: name ID you wish to update.
	NameID string `json:"-"`

	// Name: new name you want to associate with your record.
	Name *string `json:"name,omitempty"`

	// Tags: new tags you want to associate with your record.
	Tags *[]string `json:"tags,omitempty"`

	// Value: value you want to associate with your records, CID or IPNS key.
	Value *string `json:"value,omitempty"`
}

IpnsAPIUpdateNameRequest: ipns api update name request.

type ListNamesRequestOrderBy

type ListNamesRequestOrderBy string

func (ListNamesRequestOrderBy) MarshalJSON

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

func (ListNamesRequestOrderBy) String

func (enum ListNamesRequestOrderBy) String() string

func (*ListNamesRequestOrderBy) UnmarshalJSON

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

type ListNamesResponse

type ListNamesResponse struct {
	Names []*Name `json:"names"`

	TotalCount uint64 `json:"total_count"`
}

ListNamesResponse: list names response.

func (*ListNamesResponse) UnsafeAppend

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

UnsafeAppend should not be used Internal usage only

func (*ListNamesResponse) UnsafeGetTotalCount

func (r *ListNamesResponse) UnsafeGetTotalCount() uint64

UnsafeGetTotalCount should not be used Internal usage only

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: volume ID of which you want to list the pins.
	VolumeID string `json:"-"`

	// ProjectID: project ID.
	ProjectID *string `json:"-"`

	// OrganizationID: organization ID.
	OrganizationID *string `json:"-"`

	// OrderBy: sort order of the returned Volume.
	// Default value: created_at_asc
	OrderBy ListPinsRequestOrderBy `json:"-"`

	// Page: page number.
	Page *int32 `json:"-"`

	// PageSize: maximum number of volumes to return per page.
	PageSize *uint32 `json:"-"`

	// Status: list pins by status.
	// Default value: unknown_status
	Status PinStatus `json:"-"`
}

ListPinsRequest: list pins request.

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"`
}

ListPinsResponse: list pins response.

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: project ID, only volumes belonging to this project will be listed.
	ProjectID string `json:"-"`

	// OrderBy: sort the order of the returned volumes.
	// Default value: created_at_asc
	OrderBy ListVolumesRequestOrderBy `json:"-"`

	// Page: page number.
	Page *int32 `json:"-"`

	// PageSize: maximum number of volumes to return per page.
	PageSize *uint32 `json:"-"`
}

ListVolumesRequest: list volumes request.

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"`
}

ListVolumesResponse: list volumes response.

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 Name

type Name struct {
	NameID string `json:"name_id"`

	ProjectID string `json:"project_id"`

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

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

	Tags []string `json:"tags"`

	Name string `json:"name"`

	Key string `json:"key"`

	// Status: default value: unknown_status
	Status NameStatus `json:"status"`

	Value string `json:"value"`

	// Region: region to target. If none is passed will use default region from the config.
	Region scw.Region `json:"region"`
}

Name: name.

type NameStatus

type NameStatus string

func (NameStatus) MarshalJSON

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

func (NameStatus) String

func (enum NameStatus) String() string

func (*NameStatus) UnmarshalJSON

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

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"`
}

Pin: pin.

type PinCID

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

	Name *string `json:"name"`

	Origins []string `json:"origins"`

	Meta *PinCIDMeta `json:"meta"`
}

PinCID: pin cid.

type PinCIDMeta

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

PinCIDMeta: pin cid meta.

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"`
}

PinInfo: pin info.

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: pin ID whose information you wish to replace.
	PinID string `json:"-"`

	// VolumeID: volume ID.
	VolumeID string `json:"volume_id"`

	// Cid: new CID you want to pin in place of the old one.
	Cid string `json:"cid"`

	// Name: new name to replace.
	Name *string `json:"name,omitempty"`

	// Origins: node containing the content you want to pin.
	Origins []string `json:"origins"`
}

ReplacePinRequest: replace pin request.

type ReplacePinResponse

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

ReplacePinResponse: replace pin response.

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: volume ID.
	VolumeID string `json:"-"`

	// Name: volume name.
	Name *string `json:"name,omitempty"`

	// Tags: tags of the volume.
	Tags *[]string `json:"tags,omitempty"`
}

UpdateVolumeRequest: update volume request.

type Volume

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

	ProjectID string `json:"project_id"`

	// Region: region to target. If none is passed will use default region from the config.
	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"`
}

Volume: volume.

Jump to

Keyboard shortcuts

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