client

package
v1.4.8-rc2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 22 Imported by: 16

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")
)

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.APIPasssword 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) 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) DaemonStopGet ¶

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

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

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) GatewayAppendBlacklistPost ¶ added in v1.4.2

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

GatewayAppendBlacklistPost uses the /gateway/blacklist endpoint to append addresses to the Gateway's blacklist

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) GatewayBlacklistGet ¶ added in v1.4.2

func (c *Client) GatewayBlacklistGet() (gbg api.GatewayBlacklistGET, err error)

GatewayBlacklistGet uses the /gateway/blacklist endpoint to request the Gateway's blacklist

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) GatewayRemoveBlacklistPost ¶ added in v1.4.2

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

GatewayRemoveBlacklistPost uses the /gateway/blacklist endpoint to remove addresses from the Gateway's blacklist

func (*Client) GatewaySetBlacklistPost ¶ added in v1.4.2

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

GatewaySetBlacklistPost uses the /gateway/blacklist endpoint to set the Gateway's blacklist

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) 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) 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) 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) 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

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 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) (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 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) 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

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, stuck bool) (err error)

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

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) 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 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 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, ct crypto.CipherType) (skykey.Skykey, error)

SkykeyCreateKeyPost requests the /skynet/createskykey POST endpoint.

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) SkynetBlacklistGet ¶ added in v1.4.4

func (c *Client) SkynetBlacklistGet() (blacklist api.SkynetBlacklistGET, err error)

SkynetBlacklistGet requests the /skynet/blacklist Get endpoint

func (*Client) SkynetBlacklistPost ¶ added in v1.4.4

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

SkynetBlacklistPost requests the /skynet/blacklist Post endpoint

func (*Client) SkynetConvertSiafileToSkyfilePost ¶ added in v1.4.3

func (c *Client) SkynetConvertSiafileToSkyfilePost(lup modules.SkyfileUploadParameters, convert modules.SiaPath) (string, 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) 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) SkynetSkyfileMultiPartPost ¶ added in v1.4.4

func (c *Client) SkynetSkyfileMultiPartPost(params modules.SkyfileMultipartUploadParameters) (string, api.SkynetSkyfileHandlerPOST, error)

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(params 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) SkynetSkylinkConcatGet ¶ added in v1.4.4

func (c *Client) SkynetSkylinkConcatGet(skylink string) ([]byte, modules.SkyfileMetadata, 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) 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) 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, timeout int) (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) SkynetSkylinkPinPost ¶ added in v1.4.3

func (c *Client) SkynetSkylinkPinPost(skylink string, params 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, params 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) 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) SkynetSkylinkTarGzReaderGet ¶ added in v1.4.4

func (c *Client) SkynetSkylinkTarGzReaderGet(skylink string) (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) (io.ReadCloser, error)

SkynetSkylinkTarReaderGet uses the /skynet/skylink endpoint to fetch a reader of the file data with the 'tar' 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) 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
}

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) 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`.

Jump to

Keyboard shortcuts

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