client

package
Version: v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 27 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// HostParamCollateralBudget is the collateral budget of the host in
	// hastings.
	HostParamCollateralBudget = HostParam("collateralbudget")
	// HostParamMaxCollateral is the max collateral of the host in hastings.
	HostParamMaxCollateral = HostParam("maxcollateral")
	// HostParamMinContractPrice is the min contract price in hastings.
	HostParamMinContractPrice = HostParam("mincontractprice")
	// HostParamMinDownloadBandwidthPrice is the min download bandwidth price
	// in hastings/byte.
	HostParamMinDownloadBandwidthPrice = HostParam("mindownloadbandwidthprice")
	// HostParamMinUploadBandwidthPrice is the min upload bandwidth price in
	// hastings/byte.
	HostParamMinUploadBandwidthPrice = HostParam("minuploadbandwidthprice")
	// HostParamCollateral is the host's collateral in hastings/byte/block.
	HostParamCollateral = HostParam("collateral")
	// HostParamMinBaseRPCPrice is the minimum base RPC price in hastings.
	HostParamMinBaseRPCPrice = HostParam("minbaserpcprice")
	// HostParamMinSectorAccessPrice is the minimum sector access price in
	// hastings.
	HostParamMinSectorAccessPrice = HostParam("minsectoraccessprice")
	// HostParamMinStoragePrice is the minimum storage price in
	// hastings/byte/block.
	HostParamMinStoragePrice = HostParam("minstorageprice")
	// HostParamAcceptingContracts indicates if the host is accepting new
	// contracts.
	HostParamAcceptingContracts = HostParam("acceptingcontracts")
	// HostParamMaxDuration is the max duration of a contract in blocks.
	HostParamMaxDuration = HostParam("maxduration")
	// HostParamWindowSize is the size of the proof window in blocks.
	HostParamWindowSize = HostParam("windowsize")
	// HostParamMaxDownloadBatchSize is the maximum size of the download batch
	// size in bytes.
	HostParamMaxDownloadBatchSize = HostParam("maxdownloadbatchsize")
	// HostParamMaxReviseBatchSize is the maximum size of the revise batch size.
	HostParamMaxReviseBatchSize = HostParam("maxrevisebatchsize")
	// HostParamNetAddress is the announced netaddress of the host.
	HostParamNetAddress = HostParam("netaddress")
	// HostParamEphemeralAccountExpiry is the maximum amount of time an
	// ephemeral account can be inactive before it expires and gets deleted.
	HostParamEphemeralAccountExpiry = HostParam("ephemeralaccountexpiry")
	// HostParamMaxEphemeralAccountBalance is the maximum ephemeral account
	// balance in hastings
	HostParamMaxEphemeralAccountBalance = HostParam("maxephemeralaccountbalance")
	// HostParamMaxEphemeralAccountRisk is the maximum ephemeral account risk in
	// hastings
	HostParamMaxEphemeralAccountRisk = HostParam("maxephemeralaccountrisk")
	// HostParamRegistrySize is the preallocated size of the host's registry on
	// disk.
	HostParamRegistrySize = HostParam("registrysize")
	// HostParamCustomRegistryPath is the locataion of the host's registry on
	// disk.
	HostParamCustomRegistryPath = HostParam("customregistrypath")
)

Variables

View Source
var (
	// ErrPeerExists indicates that two peers are already connected. The string
	// of this error needs to be updated if the string of errPeerExists in the
	// gateway package is changed.
	ErrPeerExists = errors.New("already connected to this peer")
)

Functions

This section is empty.

Types

type AllowanceRequestPost added in v1.4.0

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

AllowanceRequestPost is a helper type to be able to build an allowance request.

func (*AllowanceRequestPost) Send added in v1.4.0

func (a *AllowanceRequestPost) Send() (err error)

Send finalizes and sends the request.

func (*AllowanceRequestPost) WithExpectedDownload added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedDownload(expectedDownload uint64) *AllowanceRequestPost

WithExpectedDownload adds the expected download field to the request.

func (*AllowanceRequestPost) WithExpectedRedundancy added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedRedundancy(expectedRedundancy float64) *AllowanceRequestPost

WithExpectedRedundancy adds the expected redundancy field to the request.

func (*AllowanceRequestPost) WithExpectedStorage added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedStorage(expectedStorage uint64) *AllowanceRequestPost

WithExpectedStorage adds the expected storage field to the request.

func (*AllowanceRequestPost) WithExpectedUpload added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedUpload(expectedUpload uint64) *AllowanceRequestPost

WithExpectedUpload adds the expected upload field to the request.

func (*AllowanceRequestPost) WithFunds added in v1.4.0

WithFunds adds the funds field to the request.

func (*AllowanceRequestPost) WithHosts added in v1.4.0

func (a *AllowanceRequestPost) WithHosts(hosts uint64) *AllowanceRequestPost

WithHosts adds the hosts field to the request.

func (*AllowanceRequestPost) WithMaxContractPrice added in v1.4.2

func (a *AllowanceRequestPost) WithMaxContractPrice(price types.Currency) *AllowanceRequestPost

WithMaxContractPrice adds the maxcontract field to the request.

func (*AllowanceRequestPost) WithMaxDownloadBandwidthPrice added in v1.4.2

func (a *AllowanceRequestPost) WithMaxDownloadBandwidthPrice(price types.Currency) *AllowanceRequestPost

WithMaxDownloadBandwidthPrice adds the maxdownloadbandwidthprice field to the request.

func (*AllowanceRequestPost) WithMaxPeriodChurn added in v1.4.2

func (a *AllowanceRequestPost) WithMaxPeriodChurn(maxPeriodChurn uint64) *AllowanceRequestPost

WithMaxPeriodChurn adds the expected redundancy field to the request.

func (*AllowanceRequestPost) WithMaxRPCPrice added in v1.4.2

func (a *AllowanceRequestPost) WithMaxRPCPrice(price types.Currency) *AllowanceRequestPost

WithMaxRPCPrice adds the maxrpcprice field to the request.

func (*AllowanceRequestPost) WithMaxSectorAccessPrice added in v1.4.2

func (a *AllowanceRequestPost) WithMaxSectorAccessPrice(price types.Currency) *AllowanceRequestPost

WithMaxSectorAccessPrice adds the maxsectoraccessprice field to the request.

func (*AllowanceRequestPost) WithMaxStoragePrice added in v1.4.2

func (a *AllowanceRequestPost) WithMaxStoragePrice(price types.Currency) *AllowanceRequestPost

WithMaxStoragePrice adds the maxstorageprice field to the request.

func (*AllowanceRequestPost) WithMaxUploadBandwidthPrice added in v1.4.2

func (a *AllowanceRequestPost) WithMaxUploadBandwidthPrice(price types.Currency) *AllowanceRequestPost

WithMaxUploadBandwidthPrice adds the maxuploadbandwidthprice field to the request.

func (*AllowanceRequestPost) WithPaymentContractInitialFunding added in v1.4.3

func (a *AllowanceRequestPost) WithPaymentContractInitialFunding(price types.Currency) *AllowanceRequestPost

WithPaymentContractInitialFunding adds the paymentcontractinitialfunding field to the request.

func (*AllowanceRequestPost) WithPeriod added in v1.4.0

WithPeriod adds the period field to the request.

func (*AllowanceRequestPost) WithRenewWindow added in v1.4.0

func (a *AllowanceRequestPost) WithRenewWindow(renewWindow types.BlockHeight) *AllowanceRequestPost

WithRenewWindow adds the renewwindow field to the request.

type Client

type Client struct {
	Options
}

A Client makes requests to the siad HTTP API.

func New

func New(opts Options) *Client

New creates a new Client using the provided address. The password will be set using build.APIPassword and the user agent will be set to "Sia-Agent". Both can be changed manually by the caller after the client is returned.

func (*Client) ConsensusBlocksHeightGet added in v1.3.3

func (c *Client) ConsensusBlocksHeightGet(height types.BlockHeight) (cbg api.ConsensusBlocksGet, err error)

ConsensusBlocksHeightGet requests the /consensus/blocks api resource

func (*Client) ConsensusBlocksIDGet added in v1.3.3

func (c *Client) ConsensusBlocksIDGet(id types.BlockID) (cbg api.ConsensusBlocksGet, err error)

ConsensusBlocksIDGet requests the /consensus/blocks api resource

func (*Client) ConsensusGet

func (c *Client) ConsensusGet() (cg api.ConsensusGET, err error)

ConsensusGet requests the /consensus api resource

func (*Client) ConsensusSetSubscribe added in v1.4.9

func (c *Client) ConsensusSetSubscribe(subscriber modules.ConsensusSetSubscriber, ccid modules.ConsensusChangeID, cancel <-chan struct{}) (<-chan error, func())

ConsensusSetSubscribe polls the /consensus/subscribe endpoint, streaming consensus changes to the subscriber indefinitely. First, it will stream changes until the subscriber is fully caught up. It will send any error encountered down the returned channel, or nil. Consequently, the caller should always wait for the first error before proceeding with initialization. Subsequent errors may be handled asynchronously. It also returns a function that can be called to unsubscribe from further changes.

func (*Client) ConsensusSubscribeSingle added in v1.4.9

func (c *Client) ConsensusSubscribeSingle(subscriber modules.ConsensusSetSubscriber, ccid modules.ConsensusChangeID, cancel <-chan struct{}) (modules.ConsensusChangeID, error)

ConsensusSubscribeSingle streams consensus changes from the /consensus/subscribe endpoint to the provided subscriber. Multiple calls may be required before the subscriber is fully caught up. It returns the latest change ID; if no changes were sent, this will be the same as the input ID.

func (*Client) DaemonAlertsGet added in v1.4.2

func (c *Client) DaemonAlertsGet() (dag api.DaemonAlertsGet, err error)

DaemonAlertsGet requests the /daemon/alerts resource.

func (*Client) DaemonGlobalRateLimitPost added in v1.4.1

func (c *Client) DaemonGlobalRateLimitPost(downloadSpeed, uploadSpeed int64) (err error)

DaemonGlobalRateLimitPost uses the /daemon/settings endpoint to change the siad's bandwidth rate limit. downloadSpeed and uploadSpeed are interpreted as bytes/second.

func (*Client) DaemonSettingsGet added in v1.4.1

func (c *Client) DaemonSettingsGet() (dsg api.DaemonSettingsGet, err error)

DaemonSettingsGet requests the /daemon/settings api resource.

func (*Client) DaemonStackGet added in v1.5.0

func (c *Client) DaemonStackGet() (dsg api.DaemonStackGet, err error)

DaemonStackGet requests the /daemon/stack api resource.

func (*Client) DaemonStartProfilePost added in v1.5.1

func (c *Client) DaemonStartProfilePost(profileFlags, profileDir string) (err error)

DaemonStartProfilePost requests the /daemon/startprofile api resource.

func (*Client) DaemonStopGet

func (c *Client) DaemonStopGet() (err error)

DaemonStopGet stops the daemon using the /daemon/stop endpoint.

func (*Client) DaemonStopProfilePost added in v1.5.1

func (c *Client) DaemonStopProfilePost() (err error)

DaemonStopProfilePost requests the /daemon/stopprofile api resource.

func (*Client) DaemonUpdateGet added in v1.3.3

func (c *Client) DaemonUpdateGet() (dig api.DaemonUpdateGet, err error)

DaemonUpdateGet checks for an available daemon update.

func (*Client) DaemonUpdatePost added in v1.3.3

func (c *Client) DaemonUpdatePost() (err error)

DaemonUpdatePost updates the daemon.

func (*Client) DaemonVersionGet

func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error)

DaemonVersionGet requests the /daemon/version resource.

func (*Client) FeeManagerAddPost added in v1.4.8

func (c *Client) FeeManagerAddPost(address types.UnlockHash, amount types.Currency, appUID modules.AppUID, recurring bool) (fmap api.FeeManagerAddFeePOST, err error)

FeeManagerAddPost use the /feemanager/add POST endpoint to add a fee for the FeeManager to manage

func (*Client) FeeManagerCancelPost added in v1.4.8

func (c *Client) FeeManagerCancelPost(feeUID modules.FeeUID) (err error)

FeeManagerCancelPost uses the /feemanager/cancel POST endpoint to cancel a fee being managed by the FeeManager

func (*Client) FeeManagerGet added in v1.4.8

func (c *Client) FeeManagerGet() (fmg api.FeeManagerGET, err error)

FeeManagerGet uses the /feemanager GET endpoint to return information about the FeeManager

func (*Client) FeeManagerPaidFeesGet added in v1.4.8

func (c *Client) FeeManagerPaidFeesGet() (pfg api.FeeManagerPaidFeesGET, err error)

FeeManagerPaidFeesGet uses the /feemanager/paidfees GET endpoint to return the paid fees the FeeManager is tracking

func (*Client) FeeManagerPendingFeesGet added in v1.4.8

func (c *Client) FeeManagerPendingFeesGet() (pfg api.FeeManagerPendingFeesGET, err error)

FeeManagerPendingFeesGet uses the /feemanager/pendingfees GET endpoint to return the pending fees the FeeManager is tracking

func (*Client) GatewayAppendBlocklistPost added in v1.5.0

func (c *Client) GatewayAppendBlocklistPost(addresses []string) (err error)

GatewayAppendBlocklistPost uses the /gateway/blocklist endpoint to append addresses to the Gateway's blocklist

func (*Client) GatewayBandwidthGet added in v1.4.2

func (c *Client) GatewayBandwidthGet() (gbg api.GatewayBandwidthGET, err error)

GatewayBandwidthGet requests the /gateway/bandwidth api resource

func (*Client) GatewayBlocklistGet added in v1.5.0

func (c *Client) GatewayBlocklistGet() (gbg api.GatewayBlocklistGET, err error)

GatewayBlocklistGet uses the /gateway/blocklist endpoint to request the Gateway's blocklist

func (*Client) GatewayConnectPost

func (c *Client) GatewayConnectPost(address modules.NetAddress) (err error)

GatewayConnectPost uses the /gateway/connect/:address endpoint to connect to the gateway at address

func (*Client) GatewayDisconnectPost added in v1.3.3

func (c *Client) GatewayDisconnectPost(address modules.NetAddress) (err error)

GatewayDisconnectPost uses the /gateway/disconnect/:address endpoint to disconnect the gateway from a peer.

func (*Client) GatewayGet

func (c *Client) GatewayGet() (gwg api.GatewayGET, err error)

GatewayGet requests the /gateway api resource

func (*Client) GatewayRateLimitPost added in v1.4.0

func (c *Client) GatewayRateLimitPost(downloadSpeed, uploadSpeed int64) (err error)

GatewayRateLimitPost uses the /gateway endpoint to change the gateway's bandwidth rate limit. downloadSpeed and uploadSpeed are interpreted as bytes/second.

func (*Client) GatewayRemoveBlocklistPost added in v1.5.0

func (c *Client) GatewayRemoveBlocklistPost(addresses []string) (err error)

GatewayRemoveBlocklistPost uses the /gateway/blocklist endpoint to remove addresses from the Gateway's blocklist

func (*Client) GatewaySetBlocklistPost added in v1.5.0

func (c *Client) GatewaySetBlocklistPost(addresses []string) (err error)

GatewaySetBlocklistPost uses the /gateway/blocklist endpoint to set the Gateway's blocklist

func (*Client) HostAnnounceAddrPost added in v1.3.3

func (c *Client) HostAnnounceAddrPost(address modules.NetAddress) (err error)

HostAnnounceAddrPost uses the /host/anounce endpoint to announce the host to the network using the provided address.

func (*Client) HostAnnouncePost

func (c *Client) HostAnnouncePost() (err error)

HostAnnouncePost uses the /host/announce endpoint to announce the host to the network

func (*Client) HostBandwidthGet added in v1.4.3

func (c *Client) HostBandwidthGet() (gbg api.GatewayBandwidthGET, err error)

HostBandwidthGet requests the /host/bandwidth api resource

func (*Client) HostContractGet added in v1.5.6

func (c *Client) HostContractGet(obligationID types.FileContractID) (cg api.HostContractGET, err error)

HostContractGet uses the /host/contracts/:id endpoint to get information about a contract on the host.

func (*Client) HostContractInfoGet added in v1.3.3

func (c *Client) HostContractInfoGet() (cg api.ContractInfoGET, err error)

HostContractInfoGet uses the /host/contracts endpoint to get information about contracts on the host.

func (*Client) HostDbActiveGet

func (c *Client) HostDbActiveGet() (hdag api.HostdbActiveGET, err error)

HostDbActiveGet requests the /hostdb/active endpoint's resources.

func (*Client) HostDbAllGet added in v1.3.3

func (c *Client) HostDbAllGet() (hdag api.HostdbAllGET, err error)

HostDbAllGet requests the /hostdb/all endpoint's resources.

func (*Client) HostDbFilterModeGet added in v1.4.1

func (c *Client) HostDbFilterModeGet() (hdfmg api.HostdbFilterModeGET, err error)

HostDbFilterModeGet requests the /hostdb/filtermode GET endpoint

func (*Client) HostDbFilterModePost added in v1.4.0

func (c *Client) HostDbFilterModePost(fm modules.FilterMode, hosts []types.SiaPublicKey) (err error)

HostDbFilterModePost requests the /hostdb/filtermode POST endpoint

func (*Client) HostDbGet added in v1.3.3

func (c *Client) HostDbGet() (hdg api.HostdbGet, err error)

HostDbGet requests the /hostdb endpoint's resources.

func (*Client) HostDbHostsGet added in v1.3.3

func (c *Client) HostDbHostsGet(pk types.SiaPublicKey) (hhg api.HostdbHostsGET, err error)

HostDbHostsGet request the /hostdb/hosts/:pubkey endpoint's resources.

func (*Client) HostEstimateScoreGet added in v1.3.3

func (c *Client) HostEstimateScoreGet(param, value string) (eg api.HostEstimateScoreGET, err error)

HostEstimateScoreGet requests the /host/estimatescore endpoint.

func (*Client) HostGet

func (c *Client) HostGet() (hg api.HostGET, err error)

HostGet requests the /host endpoint.

func (*Client) HostModifySettingPost added in v1.3.3

func (c *Client) HostModifySettingPost(param HostParam, value interface{}) (err error)

HostModifySettingPost uses the /host endpoint to change a param of the host settings to a certain value.

func (*Client) HostStorageFoldersAddPost

func (c *Client) HostStorageFoldersAddPost(path string, size uint64) (err error)

HostStorageFoldersAddPost uses the /host/storage/folders/add api endpoint to add a storage folder to a host

func (*Client) HostStorageFoldersRemovePost added in v1.3.3

func (c *Client) HostStorageFoldersRemovePost(path string, force bool) (err error)

HostStorageFoldersRemovePost uses the /host/storage/folders/remove api endpoint to remove a storage folder from a host.

func (*Client) HostStorageFoldersResizePost added in v1.3.3

func (c *Client) HostStorageFoldersResizePost(path string, size uint64) (err error)

HostStorageFoldersResizePost uses the /host/storage/folders/resize api endpoint to resize an existing storage folder.

func (*Client) HostStorageGet added in v1.3.3

func (c *Client) HostStorageGet() (sg api.StorageGET, err error)

HostStorageGet requests the /host/storage endpoint.

func (*Client) HostStorageSectorsDeletePost added in v1.3.3

func (c *Client) HostStorageSectorsDeletePost(root crypto.Hash) (err error)

HostStorageSectorsDeletePost uses the /host/storage/sectors/delete endpoint to delete a sector from the host.

func (*Client) MinerBlockPost added in v1.4.2

func (c *Client) MinerBlockPost(b types.Block) (err error)

MinerBlockPost uses the /miner/block endpoint to submit a solved block.

func (*Client) MinerGet added in v1.3.3

func (c *Client) MinerGet() (mg api.MinerGET, err error)

MinerGet requests the /miner endpoint's resources.

func (*Client) MinerHeaderGet

func (c *Client) MinerHeaderGet() (target types.Target, bh types.BlockHeader, err error)

MinerHeaderGet uses the /miner/header endpoint to get a header for work.

func (*Client) MinerHeaderPost

func (c *Client) MinerHeaderPost(bh types.BlockHeader) (err error)

MinerHeaderPost uses the /miner/header endpoint to submit a solved block header that was previously received from the same endpoint

func (*Client) MinerStartGet

func (c *Client) MinerStartGet() (err error)

MinerStartGet uses the /miner/start endpoint to start the cpu miner.

func (*Client) MinerStopGet

func (c *Client) MinerStopGet() (err error)

MinerStopGet uses the /miner/stop endpoint to stop the cpu miner.

func (*Client) NewRequest

func (c *Client) NewRequest(method, resource string, body io.Reader) (*http.Request, error)

NewRequest constructs a request to the siad HTTP API, setting the correct User-Agent and Basic Auth. The resource path must begin with /.

func (*Client) RegistryRead added in v1.5.1

func (c *Client) RegistryRead(spk types.SiaPublicKey, dataKey crypto.Hash) (modules.SignedRegistryValue, error)

RegistryRead queries the /skynet/registry [GET] endpoint.

func (*Client) RegistryReadWithTimeout added in v1.5.1

func (c *Client) RegistryReadWithTimeout(spk types.SiaPublicKey, dataKey crypto.Hash, timeout time.Duration) (modules.SignedRegistryValue, error)

RegistryReadWithTimeout queries the /skynet/registry [GET] endpoint with the specified timeout.

func (*Client) RegistryUpdate added in v1.5.1

func (c *Client) RegistryUpdate(spk types.SiaPublicKey, dataKey crypto.Hash, revision uint64, sig crypto.Signature, skylink modules.Skylink) error

RegistryUpdate queries the /skynet/registry [POST] endpoint.

func (*Client) RenterAllContractsGet added in v1.4.1

func (c *Client) RenterAllContractsGet() (rc api.RenterContracts, err error)

RenterAllContractsGet requests the /renter/contracts resource with all options set to true

func (*Client) RenterAllowanceCancelPost added in v1.4.2

func (c *Client) RenterAllowanceCancelPost() (err error)

RenterAllowanceCancelPost uses the /renter/allowance/cancel endpoint to cancel the allowance.

func (*Client) RenterBackups added in v1.4.1

func (c *Client) RenterBackups() (ubs api.RenterBackupsGET, err error)

RenterBackups lists the backups the renter has uploaded to hosts.

func (*Client) RenterBackupsOnHost added in v1.4.2

func (c *Client) RenterBackupsOnHost(host types.SiaPublicKey) (ubs api.RenterBackupsGET, err error)

RenterBackupsOnHost lists the backups that the renter has uploaded to a specific host.

func (*Client) RenterBubblePost added in v1.5.5

func (c *Client) RenterBubblePost(siaPath modules.SiaPath, force, recursive bool) (err error)

RenterBubblePost uses the /renter/bubble endpoint to manually trigger an update to the directories metadata.

func (*Client) RenterCancelDownloadPost added in v1.4.1

func (c *Client) RenterCancelDownloadPost(id modules.DownloadID) (err error)

RenterCancelDownloadPost requests the /renter/download/cancel endpoint to cancel an ongoing doing.

func (*Client) RenterCleanPost added in v1.5.4

func (c *Client) RenterCleanPost() (err error)

RenterCleanPost uses the /renter/clean endpoint to clean any lost files from the renter

func (*Client) RenterClearAllDownloadsPost added in v1.3.4

func (c *Client) RenterClearAllDownloadsPost() (err error)

RenterClearAllDownloadsPost requests the /renter/downloads/clear resource with no parameters

func (*Client) RenterClearDownloadsAfterPost added in v1.3.4

func (c *Client) RenterClearDownloadsAfterPost(after time.Time) (err error)

RenterClearDownloadsAfterPost requests the /renter/downloads/clear resource with only the after timestamp provided

func (*Client) RenterClearDownloadsBeforePost added in v1.3.4

func (c *Client) RenterClearDownloadsBeforePost(before time.Time) (err error)

RenterClearDownloadsBeforePost requests the /renter/downloads/clear resource with only the before timestamp provided

func (*Client) RenterClearDownloadsRangePost added in v1.3.4

func (c *Client) RenterClearDownloadsRangePost(after, before time.Time) (err error)

RenterClearDownloadsRangePost requests the /renter/downloads/clear resource with both before and after timestamps provided

func (*Client) RenterContractCancelPost added in v1.3.4

func (c *Client) RenterContractCancelPost(id types.FileContractID) (err error)

RenterContractCancelPost uses the /renter/contract/cancel endpoint to cancel a contract

func (*Client) RenterContractRecoveryProgressGet added in v1.4.0

func (c *Client) RenterContractRecoveryProgressGet() (rrs api.RenterRecoveryStatusGET, err error)

RenterContractRecoveryProgressGet returns information about potentially ongoing contract recovery scans.

func (*Client) RenterContractStatus added in v1.4.2

func (c *Client) RenterContractStatus(fcID types.FileContractID) (status modules.ContractWatchStatus, err error)

RenterContractStatus requests the /watchdog/contractstatus resource and returns the status of a contract.

func (*Client) RenterContractorChurnStatus added in v1.4.2

func (c *Client) RenterContractorChurnStatus() (churnStatus modules.ContractorChurnStatus, err error)

RenterContractorChurnStatus uses the /renter/contractorchurnstatus endpoint to get the current contractor churn status.

func (*Client) RenterContractsGet

func (c *Client) RenterContractsGet() (rc api.RenterContracts, err error)

RenterContractsGet requests the /renter/contracts resource and returns Contracts and ActiveContracts

func (*Client) RenterCreateBackupPost added in v1.4.0

func (c *Client) RenterCreateBackupPost(name string) (err error)

RenterCreateBackupPost creates a backup of the SiaFiles of the renter and uploads it to hosts.

func (*Client) RenterCreateLocalBackupPost deprecated added in v1.4.1

This method has been deprecated.
func (c *Client) RenterCreateLocalBackupPost(dst string) (err error)

RenterCreateLocalBackupPost creates a local backup of the SiaFiles of the renter.

Deprecated: Use RenterCreateBackupPost instead.

func (*Client) RenterDirCreatePost added in v1.4.0

func (c *Client) RenterDirCreatePost(siaPath modules.SiaPath) (err error)

RenterDirCreatePost uses the /renter/dir/ endpoint to create a directory for the renter

func (*Client) RenterDirCreateWithModePost added in v1.4.2

func (c *Client) RenterDirCreateWithModePost(siaPath modules.SiaPath, mode os.FileMode) (err error)

RenterDirCreateWithModePost uses the /renter/dir/ endpoint to create a directory for the renter with the specified permissions.

func (*Client) RenterDirDeletePost added in v1.4.0

func (c *Client) RenterDirDeletePost(siaPath modules.SiaPath) (err error)

RenterDirDeletePost uses the /renter/dir/ endpoint to delete a directory for the renter

func (*Client) RenterDirDeleteRootPost added in v1.4.4

func (c *Client) RenterDirDeleteRootPost(siaPath modules.SiaPath) (err error)

RenterDirDeleteRootPost uses the /renter/dir/ endpoint to delete a directory for the renter. It passes the `root=true` flag to indicate an absolute path.

func (*Client) RenterDirGet added in v1.4.2

func (c *Client) RenterDirGet(siaPath modules.SiaPath) (rd api.RenterDirectory, err error)

RenterDirGet uses the /renter/dir/ endpoint to query a directory

func (*Client) RenterDirRenamePost added in v1.4.0

func (c *Client) RenterDirRenamePost(siaPath, newSiaPath modules.SiaPath) (err error)

RenterDirRenamePost uses the /renter/dir/ endpoint to rename a directory for the renter

func (*Client) RenterDirRootGet added in v1.4.3

func (c *Client) RenterDirRootGet(siaPath modules.SiaPath) (rd api.RenterDirectory, err error)

RenterDirRootGet uses the /renter/dir/ endpoint to query a directory, starting from the root path.

func (*Client) RenterDisabledContractsGet added in v1.4.1

func (c *Client) RenterDisabledContractsGet() (rc api.RenterContracts, err error)

RenterDisabledContractsGet requests the /renter/contracts resource with the disabled flag set to true

func (*Client) RenterDownloadFullGet added in v1.3.3

func (c *Client) RenterDownloadFullGet(siaPath modules.SiaPath, destination string, async, root bool) (modules.DownloadID, error)

RenterDownloadFullGet uses the /renter/download endpoint to download a full file.

func (*Client) RenterDownloadGet

func (c *Client) RenterDownloadGet(siaPath modules.SiaPath, destination string, offset, length uint64, async bool, disableLocalFetch bool, root bool) (modules.DownloadID, error)

RenterDownloadGet uses the /renter/download endpoint to download a file to a destination on disk.

func (*Client) RenterDownloadHTTPResponseGet

func (c *Client) RenterDownloadHTTPResponseGet(siaPath modules.SiaPath, offset, length uint64, disableLocalFetch, root bool) (modules.DownloadID, []byte, error)

RenterDownloadHTTPResponseGet uses the /renter/download endpoint to download a file and return its data.

func (*Client) RenterDownloadInfoGet added in v1.4.2

func (c *Client) RenterDownloadInfoGet(uid modules.DownloadID) (di api.DownloadInfo, err error)

RenterDownloadInfoGet uses the /renter/downloadinfo endpoint to fetch information about a download from the history.

func (*Client) RenterDownloadsGet

func (c *Client) RenterDownloadsGet() (rdq api.RenterDownloadQueue, err error)

RenterDownloadsGet requests the /renter/downloads resource

func (*Client) RenterDownloadsRootGet added in v1.5.1

func (c *Client) RenterDownloadsRootGet() (rdq api.RenterDownloadQueue, err error)

RenterDownloadsRootGet requests the /renter/downloads resource with the root flag set.

func (*Client) RenterExpiredContractsGet added in v1.3.4

func (c *Client) RenterExpiredContractsGet() (rc api.RenterContracts, err error)

RenterExpiredContractsGet requests the /renter/contracts resource with the expired flag set to true

func (*Client) RenterFileDeletePost added in v1.4.2

func (c *Client) RenterFileDeletePost(siaPath modules.SiaPath) (err error)

RenterFileDeletePost uses the /renter/delete endpoint to delete a file.

func (*Client) RenterFileDeleteRootPost added in v1.4.4

func (c *Client) RenterFileDeleteRootPost(siaPath modules.SiaPath) (err error)

RenterFileDeleteRootPost uses the /renter/delete endpoint to delete a file. It passes the `root=true` flag to indicate an absolute path.

func (*Client) RenterFileGet added in v1.3.3

func (c *Client) RenterFileGet(siaPath modules.SiaPath) (rf api.RenterFile, err error)

RenterFileGet uses the /renter/file/:siapath endpoint to query a file.

func (*Client) RenterFileRootGet added in v1.4.3

func (c *Client) RenterFileRootGet(siaPath modules.SiaPath) (rf api.RenterFile, err error)

RenterFileRootGet uses the /renter/file/:siapath endpoint to query a file. It passes the `root=true` flag to indicate an absolute path.

func (*Client) RenterFilesGet

func (c *Client) RenterFilesGet(cached bool) (rf api.RenterFiles, err error)

RenterFilesGet requests the /renter/files resource.

func (*Client) RenterFuse added in v1.4.2

func (c *Client) RenterFuse() (fi api.RenterFuseInfo, err error)

RenterFuse uses the /renter/fuse endpoint to return information about the current fuse mount point.

func (*Client) RenterFuseMount added in v1.4.2

func (c *Client) RenterFuseMount(mount string, siaPath modules.SiaPath, opts modules.MountOptions) (err error)

RenterFuseMount uses the /renter/fuse/mount endpoint to mount a fuse filesystem serving the provided siapath.

func (*Client) RenterFuseUnmount added in v1.4.2

func (c *Client) RenterFuseUnmount(mount string) (err error)

RenterFuseUnmount uses the /renter/fuse/unmount endpoint to unmount the currently-mounted fuse filesystem.

func (*Client) RenterGet added in v1.3.3

func (c *Client) RenterGet() (rg api.RenterGET, err error)

RenterGet requests the /renter resource.

func (*Client) RenterInactiveContractsGet added in v1.3.4

func (c *Client) RenterInactiveContractsGet() (rc api.RenterContracts, err error)

RenterInactiveContractsGet requests the /renter/contracts resource with the inactive flag set to true

func (*Client) RenterInitContractRecoveryScanPost added in v1.4.0

func (c *Client) RenterInitContractRecoveryScanPost() (err error)

RenterInitContractRecoveryScanPost initializes a contract recovery scan using the /renter/recoveryscan endpoint.

func (*Client) RenterPost

func (c *Client) RenterPost(values url.Values) (err error)

RenterPost uses the /renter POST endpoint to set fields of the renter. Values are encoded as a query string in the body

func (*Client) RenterPostAllowance added in v1.3.3

func (c *Client) RenterPostAllowance(allowance modules.Allowance) error

RenterPostAllowance uses the /renter endpoint to change the renter's allowance

func (*Client) RenterPostPartialAllowance added in v1.4.0

func (c *Client) RenterPostPartialAllowance() *AllowanceRequestPost

RenterPostPartialAllowance starts an allowance request which can be extended using its methods.

func (*Client) RenterPricesGet added in v1.3.3

func (c *Client) RenterPricesGet(allowance modules.Allowance) (rpg api.RenterPricesGET, err error)

RenterPricesGet requests the /renter/prices endpoint's resources.

func (*Client) RenterRateLimitPost added in v1.4.2

func (c *Client) RenterRateLimitPost(readBPS, writeBPS int64) (err error)

RenterRateLimitPost uses the /renter endpoint to change the renter's bandwidth rate limit.

func (*Client) RenterRecoverBackupPost added in v1.4.0

func (c *Client) RenterRecoverBackupPost(name string) (err error)

RenterRecoverBackupPost downloads and restores the specified backup.

func (*Client) RenterRecoverLocalBackupPost deprecated added in v1.4.1

This method has been deprecated.
func (c *Client) RenterRecoverLocalBackupPost(src string) (err error)

RenterRecoverLocalBackupPost restores the specified backup.

Deprecated: Use RenterCreateBackupPost instead.

func (*Client) RenterRecoverableContractsGet added in v1.4.0

func (c *Client) RenterRecoverableContractsGet() (rc api.RenterContracts, err error)

RenterRecoverableContractsGet requests the /renter/contracts resource with the recoverable flag set to true

func (*Client) RenterRenamePost added in v1.3.3

func (c *Client) RenterRenamePost(siaPathOld, siaPathNew modules.SiaPath, root bool) (err error)

RenterRenamePost uses the /renter/rename/:siapath endpoint to rename a file.

func (*Client) RenterSetCheckIPViolationPost added in v1.4.0

func (c *Client) RenterSetCheckIPViolationPost(enabled bool) (err error)

RenterSetCheckIPViolationPost uses the /renter endpoint to enable/disable the IP violation check in the renter.

func (*Client) RenterSetFileStuckPost added in v1.4.1

func (c *Client) RenterSetFileStuckPost(siaPath modules.SiaPath, root, stuck bool) (err error)

RenterSetFileStuckPost sets the 'stuck' field of the siafile at siaPath to stuck.

func (*Client) RenterSetMonetizationBase added in v1.5.6

func (c *Client) RenterSetMonetizationBase(mb types.Currency) (err error)

RenterSetMonetizationBase updates the renter's monetization base.

func (*Client) RenterSetRepairPathPost added in v1.3.5

func (c *Client) RenterSetRepairPathPost(siaPath modules.SiaPath, newPath string) (err error)

RenterSetRepairPathPost uses the /renter/tracking endpoint to set the repair path of a file to a new location. The file at newPath must exists.

func (*Client) RenterSetStreamCacheSizePost added in v1.3.3

func (c *Client) RenterSetStreamCacheSizePost(cacheSize uint64) (err error)

RenterSetStreamCacheSizePost uses the /renter endpoint to change the renter's streamCacheSize for streaming

func (*Client) RenterSetUSDConversionRate added in v1.5.6

func (c *Client) RenterSetUSDConversionRate(cr types.Currency) (err error)

RenterSetUSDConversionRate update the renter's usd conversion rate.

func (*Client) RenterSkyfileGet added in v1.4.8

func (c *Client) RenterSkyfileGet(siaPath modules.SiaPath, root bool) (rf api.RenterFile, err error)

RenterSkyfileGet wraps RenterFileRootGet to query a skyfile.

func (*Client) RenterStreamGet added in v1.3.3

func (c *Client) RenterStreamGet(siaPath modules.SiaPath, disableLocalFetch, root bool) (resp []byte, err error)

RenterStreamGet uses the /renter/stream endpoint to download data as a stream.

func (*Client) RenterStreamPartialGet added in v1.3.3

func (c *Client) RenterStreamPartialGet(siaPath modules.SiaPath, start, end uint64, disableLocalFetch, root bool) (resp []byte, err error)

RenterStreamPartialGet uses the /renter/stream endpoint to download a part of data as a stream.

func (*Client) RenterUploadDefaultPost added in v1.3.3

func (c *Client) RenterUploadDefaultPost(path string, siaPath modules.SiaPath) (err error)

RenterUploadDefaultPost uses the /renter/upload endpoint with default redundancy settings to upload a file.

func (*Client) RenterUploadForcePost added in v1.4.0

func (c *Client) RenterUploadForcePost(path string, siaPath modules.SiaPath, dataPieces, parityPieces uint64, force bool) (err error)

RenterUploadForcePost uses the /renter/upload endpoint to upload a file and to overwrite if the file already exists

func (*Client) RenterUploadPost

func (c *Client) RenterUploadPost(path string, siaPath modules.SiaPath, dataPieces, parityPieces uint64) (err error)

RenterUploadPost uses the /renter/upload endpoint to upload a file

func (*Client) RenterUploadReadyDefaultGet added in v1.4.2

func (c *Client) RenterUploadReadyDefaultGet() (rur api.RenterUploadReadyGet, err error)

RenterUploadReadyDefaultGet uses the /renter/uploadready endpoint to determine if the renter is ready for upload.

func (*Client) RenterUploadReadyGet added in v1.4.2

func (c *Client) RenterUploadReadyGet(dataPieces, parityPieces uint64) (rur api.RenterUploadReadyGet, err error)

RenterUploadReadyGet uses the /renter/uploadready endpoint to determine if the renter is ready for upload.

func (*Client) RenterUploadStreamPost added in v1.4.1

func (c *Client) RenterUploadStreamPost(r io.Reader, siaPath modules.SiaPath, dataPieces, parityPieces uint64, force bool) error

RenterUploadStreamPost uploads data using a stream.

func (*Client) RenterUploadStreamRepairPost added in v1.4.1

func (c *Client) RenterUploadStreamRepairPost(r io.Reader, siaPath modules.SiaPath) error

RenterUploadStreamRepairPost a siafile using a stream. If the data provided by r is not the same as the previously uploaded data, the data will be corrupted.

func (*Client) RenterUploadsPausePost added in v1.4.2

func (c *Client) RenterUploadsPausePost(duration time.Duration) (err error)

RenterUploadsPausePost uses the /renter/uploads/pause endpoint to pause the renter's uploads and repairs

func (*Client) RenterUploadsResumePost added in v1.4.2

func (c *Client) RenterUploadsResumePost() (err error)

RenterUploadsResumePost uses the /renter/uploads/resume endpoint to resume the renter's uploads and repairs

func (*Client) RenterValidateSiaPathPost added in v1.4.1

func (c *Client) RenterValidateSiaPathPost(siaPathStr string) (err error)

RenterValidateSiaPathPost uses the /renter/validatesiapath endpoint to validate a potential siapath

NOTE: This function specifically takes a string as an argument not a type SiaPath

func (*Client) RenterWorkersGet added in v1.4.8

func (c *Client) RenterWorkersGet() (wps modules.WorkerPoolStatus, err error)

RenterWorkersGet uses the /renter/workers endpoint to get the current status of the renter's workers.

func (*Client) SkykeyAddKeyPost added in v1.4.8

func (c *Client) SkykeyAddKeyPost(sk skykey.Skykey) error

SkykeyAddKeyPost requests the /skynet/addskykey POST endpoint.

func (*Client) SkykeyCreateKeyPost added in v1.4.8

func (c *Client) SkykeyCreateKeyPost(name string, skType skykey.SkykeyType) (skykey.Skykey, error)

SkykeyCreateKeyPost requests the /skynet/createskykey POST endpoint.

func (*Client) SkykeyDeleteByIDPost added in v1.5.0

func (c *Client) SkykeyDeleteByIDPost(id skykey.SkykeyID) error

SkykeyDeleteByIDPost requests the /skynet/deleteskykey POST endpoint using the key ID.

func (*Client) SkykeyDeleteByNamePost added in v1.5.0

func (c *Client) SkykeyDeleteByNamePost(name string) error

SkykeyDeleteByNamePost requests the /skynet/deleteskykey POST endpoint using the key name.

func (*Client) SkykeyGetByID added in v1.4.8

func (c *Client) SkykeyGetByID(id skykey.SkykeyID) (skykey.Skykey, error)

SkykeyGetByID requests the /skynet/skykey Get endpoint using the key ID.

func (*Client) SkykeyGetByName added in v1.4.8

func (c *Client) SkykeyGetByName(name string) (skykey.Skykey, error)

SkykeyGetByName requests the /skynet/skykey Get endpoint using the key name.

func (*Client) SkykeySkykeysGet added in v1.4.9

func (c *Client) SkykeySkykeysGet() ([]skykey.Skykey, error)

SkykeySkykeysGet requests the /skynet/skykeys GET endpoint.

func (*Client) SkynetBaseSectorGet added in v1.5.1

func (c *Client) SkynetBaseSectorGet(skylink string) (io.ReadCloser, error)

SkynetBaseSectorGet uses the /skynet/basesector endpoint to fetch a reader of the basesector data.

func (*Client) SkynetBlocklistGet added in v1.5.1

func (c *Client) SkynetBlocklistGet() (blocklist api.SkynetBlocklistGET, err error)

SkynetBlocklistGet requests the /skynet/blocklist Get endpoint

func (*Client) SkynetBlocklistHashPost added in v1.5.1

func (c *Client) SkynetBlocklistHashPost(additions, removals []string, isHash bool) (err error)

SkynetBlocklistHashPost requests the /skynet/blocklist Post endpoint

func (*Client) SkynetBlocklistPost added in v1.5.1

func (c *Client) SkynetBlocklistPost(additions, removals []string) (err error)

SkynetBlocklistPost requests the /skynet/blocklist Post endpoint

func (*Client) SkynetConvertSiafileToSkyfilePost added in v1.4.3

func (c *Client) SkynetConvertSiafileToSkyfilePost(sup modules.SkyfileUploadParameters, convert modules.SiaPath) (api.SkynetSkyfileHandlerPOST, error)

SkynetConvertSiafileToSkyfilePost uses the /skynet/skyfile endpoint to convert an existing siafile to a skyfile. The input SiaPath 'convert' is the siapath of the siafile that should be converted. The siapath provided inside of the upload params is the name that will be used for the base sector of the skyfile.

func (*Client) SkynetDownloadByRootGet added in v1.5.4

func (c *Client) SkynetDownloadByRootGet(root crypto.Hash, offset, length uint64, timeout time.Duration) (io.ReadCloser, error)

SkynetDownloadByRootGet uses the /skynet/root endpoint to fetch a reader of a sector.

func (*Client) SkynetPortalsGet added in v1.4.8

func (c *Client) SkynetPortalsGet() (portals api.SkynetPortalsGET, err error)

SkynetPortalsGet requests the /skynet/portals Get endpoint.

func (*Client) SkynetPortalsPost added in v1.4.8

func (c *Client) SkynetPortalsPost(additions []modules.SkynetPortal, removals []modules.NetAddress) (err error)

SkynetPortalsPost requests the /skynet/portals Post endpoint.

func (*Client) SkynetSkyfileMultiPartEncryptedPost added in v1.5.4

func (c *Client) SkynetSkyfileMultiPartEncryptedPost(smup modules.SkyfileMultipartUploadParameters, skykeyName string, skykeyID skykey.SkykeyID) (string, api.SkynetSkyfileHandlerPOST, error)

SkynetSkyfileMultiPartEncryptedPost uses the /skynet/skyfile endpoint to upload a skyfile using multipart form data with Skykey params. The resulting skylink is returned along with an error.

func (*Client) SkynetSkyfileMultiPartPost added in v1.4.4

SkynetSkyfileMultiPartPost uses the /skynet/skyfile endpoint to upload a skyfile using multipart form data. The resulting skylink is returned along with an error.

func (*Client) SkynetSkyfilePost added in v1.4.3

SkynetSkyfilePost uses the /skynet/skyfile endpoint to upload a skyfile. The resulting skylink is returned along with an error.

func (*Client) SkynetSkyfilePostDisableForce added in v1.4.4

func (c *Client) SkynetSkyfilePostDisableForce(sup modules.SkyfileUploadParameters, disableForce bool) (string, api.SkynetSkyfileHandlerPOST, error)

SkynetSkyfilePostDisableForce uses the /skynet/skyfile endpoint to upload a skyfile. This method allows to set the Disable-Force header. The resulting skylink is returned along with an error.

func (*Client) SkynetSkylinkBackup added in v1.5.5

func (c *Client) SkynetSkylinkBackup(skylinkStr string, backupDst io.Writer) error

SkynetSkylinkBackup uses the /skynet/skylink endpoint to fetch the Skyfile's basesector, and reader for large Skyfiles, and writes it to the backupDst writer.

func (*Client) SkynetSkylinkConcatGet added in v1.4.4

func (c *Client) SkynetSkylinkConcatGet(skylink string) (_ []byte, _ modules.SkyfileMetadata, err error)

SkynetSkylinkConcatGet uses the /skynet/skylink endpoint to download a skylink file with the 'concat' format specified.

func (*Client) SkynetSkylinkConcatReaderGet added in v1.4.4

func (c *Client) SkynetSkylinkConcatReaderGet(skylink string) (io.ReadCloser, error)

SkynetSkylinkConcatReaderGet uses the /skynet/skylink endpoint to fetch a reader of the file data with the 'concat' format specified.

func (*Client) SkynetSkylinkFormatGet added in v1.5.1

func (c *Client) SkynetSkylinkFormatGet(skylink string, format modules.SkyfileFormat) (http.Header, io.ReadCloser, error)

SkynetSkylinkFormatGet uses the /skynet/skylink endpoint to fetch a reader of the file data with the format specified.

func (*Client) SkynetSkylinkGet added in v1.4.3

func (c *Client) SkynetSkylinkGet(skylink string) ([]byte, modules.SkyfileMetadata, error)

SkynetSkylinkGet uses the /skynet/skylink endpoint to download a skylink file.

func (*Client) SkynetSkylinkGetWithLayout added in v1.5.5

func (c *Client) SkynetSkylinkGetWithLayout(skylink string, incLayout bool) ([]byte, modules.SkyfileLayout, error)

SkynetSkylinkGetWithLayout uses the /skynet/skylink endpoint to download a skylink file, specifying the given value for the 'include-layout' parameter.

func (*Client) SkynetSkylinkGetWithNoMetadata added in v1.5.4

func (c *Client) SkynetSkylinkGetWithNoMetadata(skylink string, nometadata bool) ([]byte, modules.SkyfileMetadata, error)

SkynetSkylinkGetWithNoMetadata uses the /skynet/skylink endpoint to download a skylink file, specifying the given value for the 'no-response-metadata' parameter.

func (*Client) SkynetSkylinkGetWithTimeout added in v1.4.5

func (c *Client) SkynetSkylinkGetWithTimeout(skylink string, timeout int) ([]byte, modules.SkyfileMetadata, error)

SkynetSkylinkGetWithTimeout uses the /skynet/skylink endpoint to download a skylink file, specifying the given timeout.

func (*Client) SkynetSkylinkHead added in v1.4.4

func (c *Client) SkynetSkylinkHead(skylink string) (int, http.Header, error)

SkynetSkylinkHead uses the /skynet/skylink endpoint to get the headers that are returned if the skyfile were to be requested using the SkynetSkylinkGet method.

func (*Client) SkynetSkylinkHeadWithAttachment added in v1.5.0

func (c *Client) SkynetSkylinkHeadWithAttachment(skylink string, attachment bool) (int, http.Header, error)

SkynetSkylinkHeadWithAttachment uses the /skynet/skylink endpoint to get the headers that are returned if the skyfile were to be requested using the SkynetSkylinkGet method. It allows to pass the 'attachment' parameter.

func (*Client) SkynetSkylinkHeadWithFormat added in v1.5.0

func (c *Client) SkynetSkylinkHeadWithFormat(skylink string, format modules.SkyfileFormat) (int, http.Header, error)

SkynetSkylinkHeadWithFormat uses the /skynet/skylink endpoint to get the headers that are returned if the skyfile were to be requested using the SkynetSkylinkGet method. It allows to pass the 'format' parameter.

func (*Client) SkynetSkylinkHeadWithParameters added in v1.5.0

func (c *Client) SkynetSkylinkHeadWithParameters(skylink string, values url.Values) (int, http.Header, error)

SkynetSkylinkHeadWithParameters uses the /skynet/skylink endpoint to get the headers that are returned if the skyfile were to be requested using the SkynetSkylinkGet method. The values are encoded in the querystring.

func (*Client) SkynetSkylinkHeadWithTimeout added in v1.5.0

func (c *Client) SkynetSkylinkHeadWithTimeout(skylink string, timeout int) (int, http.Header, error)

SkynetSkylinkHeadWithTimeout uses the /skynet/skylink endpoint to get the headers that are returned if the skyfile were to be requested using the SkynetSkylinkGet method. It allows to pass a timeout parameter for the request.

func (*Client) SkynetSkylinkPinPost added in v1.4.3

func (c *Client) SkynetSkylinkPinPost(skylink string, spp modules.SkyfilePinParameters) error

SkynetSkylinkPinPost uses the /skynet/pin endpoint to pin the file at the given skylink.

func (*Client) SkynetSkylinkPinPostWithTimeout added in v1.4.5

func (c *Client) SkynetSkylinkPinPostWithTimeout(skylink string, spp modules.SkyfilePinParameters, timeout int) error

SkynetSkylinkPinPostWithTimeout uses the /skynet/pin endpoint to pin the file at the given skylink, specifying the given timeout.

func (*Client) SkynetSkylinkRange added in v1.5.5

func (c *Client) SkynetSkylinkRange(skylink string, from, to uint64) ([]byte, error)

SkynetSkylinkRange uses the /skynet/skylink endpoint to download a range from a skylink file.

func (*Client) SkynetSkylinkReaderGet added in v1.4.3

func (c *Client) SkynetSkylinkReaderGet(skylink string) (io.ReadCloser, error)

SkynetSkylinkReaderGet uses the /skynet/skylink endpoint to fetch a reader of the file data.

func (*Client) SkynetSkylinkRestorePost added in v1.5.5

func (c *Client) SkynetSkylinkRestorePost(backup io.Reader) (string, error)

SkynetSkylinkRestorePost uses the /skynet/restore endpoint to restore a skylink from the backup.

func (*Client) SkynetSkylinkTarGzReaderGet added in v1.4.4

func (c *Client) SkynetSkylinkTarGzReaderGet(skylink string) (http.Header, io.ReadCloser, error)

SkynetSkylinkTarGzReaderGet uses the /skynet/skylink endpoint to fetch a reader of the file data with the 'targz' format specified.

func (*Client) SkynetSkylinkTarReaderGet added in v1.4.4

func (c *Client) SkynetSkylinkTarReaderGet(skylink string) (http.Header, io.ReadCloser, error)

SkynetSkylinkTarReaderGet uses the /skynet/skylink endpoint to fetch a reader of the file data with the 'tar' format specified.

func (*Client) SkynetSkylinkZipReaderGet added in v1.5.0

func (c *Client) SkynetSkylinkZipReaderGet(skylink string) (http.Header, io.ReadCloser, error)

SkynetSkylinkZipReaderGet uses the /skynet/skylink endpoint to fetch a reader of the file data with the 'zip' format specified.

func (*Client) SkynetStatsGet added in v1.4.4

func (c *Client) SkynetStatsGet() (stats api.SkynetStatsGET, err error)

SkynetStatsGet requests the /skynet/stats Get endpoint

func (*Client) TransactionPoolFeeGet added in v1.3.3

func (c *Client) TransactionPoolFeeGet() (tfg api.TpoolFeeGET, err error)

TransactionPoolFeeGet uses the /tpool/fee endpoint to get a fee estimation.

func (*Client) TransactionPoolRawPost added in v1.3.3

func (c *Client) TransactionPoolRawPost(txn types.Transaction, parents []types.Transaction) (err error)

TransactionPoolRawPost uses the /tpool/raw endpoint to send a raw transaction to the transaction pool.

func (*Client) TransactionPoolTransactionsGet added in v1.4.2

func (c *Client) TransactionPoolTransactionsGet() (tptg api.TpoolTxnsGET, err error)

TransactionPoolTransactionsGet uses the /tpool/transactions endpoint to get the transactions of the tpool

func (*Client) Wallet033xPost added in v1.3.3

func (c *Client) Wallet033xPost(path, password string) (err error)

Wallet033xPost uses the /wallet/033x endpoint to load a v0.3.3.x wallet into the current wallet.

func (*Client) WalletAddressGet

func (c *Client) WalletAddressGet() (wag api.WalletAddressGET, err error)

WalletAddressGet requests a new address from the /wallet/address endpoint

func (*Client) WalletAddressesGet added in v1.3.3

func (c *Client) WalletAddressesGet() (wag api.WalletAddressesGET, err error)

WalletAddressesGet requests the wallets known addresses from the /wallet/addresses endpoint.

func (*Client) WalletChangePasswordPost added in v1.3.3

func (c *Client) WalletChangePasswordPost(currentPassword, newPassword string) (err error)

WalletChangePasswordPost uses the /wallet/changepassword endpoint to change the wallet's password.

func (*Client) WalletChangePasswordWithSeedPost added in v1.4.2

func (c *Client) WalletChangePasswordWithSeedPost(seed modules.Seed, newPassword string) (err error)

WalletChangePasswordWithSeedPost uses the /wallet/changepassword endpoint to change the password used to encrypt the wallet.

func (*Client) WalletGet

func (c *Client) WalletGet() (wg api.WalletGET, err error)

WalletGet requests the /wallet api resource

func (*Client) WalletInitPost

func (c *Client) WalletInitPost(password string, force bool) (wip api.WalletInitPOST, err error)

WalletInitPost uses the /wallet/init endpoint to initialize and encrypt a wallet

func (*Client) WalletInitSeedPost added in v1.3.3

func (c *Client) WalletInitSeedPost(seed, password string, force bool) (err error)

WalletInitSeedPost uses the /wallet/init/seed endpoint to initialize and encrypt a wallet using a given seed.

func (*Client) WalletLastAddressesGet added in v1.4.0

func (c *Client) WalletLastAddressesGet(count uint64) (wag api.WalletAddressesGET, err error)

WalletLastAddressesGet returns the count last addresses generated by the wallet in reverse order. That means the last generated address will be the first one in the slice.

func (*Client) WalletLockPost added in v1.3.3

func (c *Client) WalletLockPost() (err error)

WalletLockPost uses the /wallet/lock endpoint to lock the wallet.

func (*Client) WalletSeedPost added in v1.3.3

func (c *Client) WalletSeedPost(seed, password string) (err error)

WalletSeedPost uses the /wallet/seed endpoint to add a seed to the wallet's list of seeds.

func (*Client) WalletSeedsGet added in v1.3.3

func (c *Client) WalletSeedsGet() (wsg api.WalletSeedsGET, err error)

WalletSeedsGet uses the /wallet/seeds endpoint to return the wallet's current seeds.

func (*Client) WalletSiacoinsMultiPost

func (c *Client) WalletSiacoinsMultiPost(outputs []types.SiacoinOutput) (wsp api.WalletSiacoinsPOST, err error)

WalletSiacoinsMultiPost uses the /wallet/siacoin api endpoint to send money to multiple addresses at once

func (*Client) WalletSiacoinsPost

func (c *Client) WalletSiacoinsPost(amount types.Currency, destination types.UnlockHash, feeIncluded bool) (wsp api.WalletSiacoinsPOST, err error)

WalletSiacoinsPost uses the /wallet/siacoins api endpoint to send money to a single address

func (*Client) WalletSiafundsPost added in v1.3.3

func (c *Client) WalletSiafundsPost(amount types.Currency, destination types.UnlockHash) (wsp api.WalletSiafundsPOST, err error)

WalletSiafundsPost uses the /wallet/siafunds api endpoint to send siafunds to a single address.

func (*Client) WalletSiagKeyPost added in v1.3.3

func (c *Client) WalletSiagKeyPost(keyfiles, password string) (err error)

WalletSiagKeyPost uses the /wallet/siagkey endpoint to load a siag key into the wallet.

func (*Client) WalletSignPost added in v1.3.5

func (c *Client) WalletSignPost(txn types.Transaction, toSign []crypto.Hash) (wspr api.WalletSignPOSTResp, err error)

WalletSignPost uses the /wallet/sign api endpoint to sign a transaction.

func (*Client) WalletSweepPost added in v1.3.3

func (c *Client) WalletSweepPost(seed string) (wsp api.WalletSweepPOST, err error)

WalletSweepPost uses the /wallet/sweep/seed endpoint to sweep a seed into the current wallet.

func (*Client) WalletTransactionGet added in v1.3.3

func (c *Client) WalletTransactionGet(id types.TransactionID) (wtg api.WalletTransactionGETid, err error)

WalletTransactionGet requests the /wallet/transaction/:id api resource for a certain TransactionID.

func (*Client) WalletTransactionsGet

func (c *Client) WalletTransactionsGet(startHeight types.BlockHeight, endHeight types.BlockHeight) (wtg api.WalletTransactionsGET, err error)

WalletTransactionsGet requests the/wallet/transactions api resource for a certain startheight and endheight

func (*Client) WalletUnlockConditionsGet added in v1.3.5

func (c *Client) WalletUnlockConditionsGet(addr types.UnlockHash) (wucg api.WalletUnlockConditionsGET, err error)

WalletUnlockConditionsGet requests the /wallet/unlockconditions endpoint and returns the UnlockConditions of addr.

func (*Client) WalletUnlockPost

func (c *Client) WalletUnlockPost(password string) (err error)

WalletUnlockPost uses the /wallet/unlock endpoint to unlock the wallet with a given encryption key. Per default this key is the seed.

func (*Client) WalletUnspentGet added in v1.3.5

func (c *Client) WalletUnspentGet() (wug api.WalletUnspentGET, err error)

WalletUnspentGet requests the /wallet/unspent endpoint and returns all of the unspent outputs related to the wallet.

func (*Client) WalletVerifyPasswordGet added in v1.4.2

func (c *Client) WalletVerifyPasswordGet(password string) (wvpg api.WalletVerifyPasswordGET, err error)

WalletVerifyPasswordGet uses the /wallet/verifypassword endpoint to check the wallet's password.

func (*Client) WalletVerifyPasswordSeedGet added in v1.4.9

func (c *Client) WalletVerifyPasswordSeedGet(seed modules.Seed) (wvpg api.WalletVerifyPasswordGET, err error)

WalletVerifyPasswordSeedGet takes a seed and generates a seed string to submit to the /wallet/verifypassword endpoint

func (*Client) WalletWatchAddPost added in v1.3.5

func (c *Client) WalletWatchAddPost(addrs []types.UnlockHash, unused bool) error

WalletWatchAddPost uses the /wallet/watch endpoint to add a set of addresses to the watch set. The unused flag should be set to true if the addresses have never appeared in the blockchain.

func (*Client) WalletWatchGet added in v1.3.5

func (c *Client) WalletWatchGet() (wwg api.WalletWatchGET, err error)

WalletWatchGet requests the /wallet/watch endpoint and returns the set of currently watched addresses.

func (*Client) WalletWatchRemovePost added in v1.3.5

func (c *Client) WalletWatchRemovePost(addrs []types.UnlockHash, unused bool) error

WalletWatchRemovePost uses the /wallet/watch endpoint to remove a set of addresses from the watch set. The unused flag should be set to true if the addresses have never appeared in the blockchain.

type HostParam added in v1.3.3

type HostParam string

HostParam is a parameter in the host's settings that can be changed via the API. It is primarily used as a helper struct to ensure type safety.

type Options added in v1.4.8

type Options struct {
	// Address is the API address of the siad server.
	Address string

	// Password must match the password of the siad server.
	Password string

	// UserAgent must match the User-Agent required by the siad server. If not
	// set, it defaults to "Sia-Agent".
	UserAgent string

	// CheckRedirect is an optional handler to be called if the request
	// receives a redirect status code.
	// For more see https://golang.org/pkg/net/http/#Client
	CheckRedirect func(req *http.Request, via []*http.Request) error
}

Options defines the options that are available when creating a client.

func DefaultOptions added in v1.4.8

func DefaultOptions() (Options, error)

DefaultOptions returns the default options for a client. This includes setting the default siad user agent to "Sia-Agent" and setting the password using the build.APIPassword() function.

type UnsafeClient added in v1.4.8

type UnsafeClient struct {
	Client
}

A UnsafeClient is a Client with additional access to unsafe methods that are easy to misuse. It should only be used for testing.

func NewUnsafeClient added in v1.4.8

func NewUnsafeClient(client Client) *UnsafeClient

NewUnsafeClient creates a new UnsafeClient using the provided address.

func (*UnsafeClient) Get added in v1.4.8

func (uc *UnsafeClient) Get(resource string, obj interface{}) error

Get requests the specified resource. The response, if provided, will be decoded into obj. The resource path must begin with /.

func (*UnsafeClient) GetWithHeaders added in v1.5.1

func (uc *UnsafeClient) GetWithHeaders(resource string, headers http.Header) (*http.Response, error)

GetWithHeaders requests the specified resource using the given request headers.

func (*UnsafeClient) Post added in v1.4.8

func (uc *UnsafeClient) Post(resource string, data string, obj interface{}) error

Post makes a POST request to the resource at `resource`, using `data` as the request body. The response, if provided, will be decoded into `obj`.

func (*UnsafeClient) SkynetSkyfilePostRawResponse added in v1.5.1

func (uc *UnsafeClient) SkynetSkyfilePostRawResponse(sup modules.SkyfileUploadParameters) (http.Header, []byte, error)

SkynetSkyfilePostRawResponse uses the /skynet/skyfile endpoint to upload a skyfile. This function is unsafe as it returns the raw response alongside the http headers.

func (*UnsafeClient) SkynetSkylinkGetWithETag added in v1.5.1

func (uc *UnsafeClient) SkynetSkylinkGetWithETag(skylink string, eTag string) (*http.Response, error)

SkynetSkylinkGetWithETag uses the /skynet/skylink endpoint to download a skylink file setting the given ETag as value in the If-None-Match request header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL