Documentation ¶
Index ¶
- type BalanceOfAddress
- type Client
- func (cli *Client) Authorized(ctx context.Context, token string) (bool, error)
- func (cli *Client) Balance(ctx context.Context, address string) (BalanceOfAddress, error)
- func (cli *Client) ChannelFilesFromEntryOrFolder(ctx context.Context, nodeHash string) (rpc.FilesFromEntryOrFolderResponse, error)
- func (cli *Client) CheckDataQueryResponse(ctx context.Context, dataQueryRequestHash string) (rpc.CheckDataQueryResponse, error)
- func (cli *Client) CreateChannelNodeItemsTxDataPayload(ctx context.Context, nodes []rpc.NodeItemJSON) (string, string, error)
- func (cli *Client) CreateContractsFromDataQueryResponses(ctx context.Context, dataQueryRequestHash string) ([]string, error)
- func (cli *Client) CreateTransactionsWithDataPayloadFromContractHashes(ctx context.Context, contractHashes []string, ...) ([]string, string, error)
- func (cli *Client) DownloadFile(ctx context.Context, contractHash, fileHash string, reDownload bool) (string, error)
- func (cli *Client) DownloadFileProgress(ctx context.Context, contractHash, fileHash string) (rpc.DownloadFileProgressResponse, error)
- func (cli *Client) GetBlockByHash(ctx context.Context, blockHash string) (rpc.JSONBlock, error)
- func (cli *Client) GetBlockByNumber(ctx context.Context, blockNumber uint64) (rpc.JSONBlock, error)
- func (cli *Client) GetBlockPool(ctx context.Context) (rpc.PoolResponse, error)
- func (cli *Client) GetChannelNodeItem(ctx context.Context, nodeHash string) (rpc.GetNodeItemResponse, error)
- func (cli *Client) GetDownloadContract(ctx context.Context, contractHash string) (rpc.GetDownloadContractResponse, error)
- func (cli *Client) GetHostInfo(ctx context.Context) (rpc.HostInfoResponse, error)
- func (cli *Client) GetNodeStats(ctx context.Context) (rpc.StatsResponse, error)
- func (cli *Client) GetStorageAccessToken(ctx context.Context, storageAdminToken string) (string, error)
- func (cli *Client) GetTransactionByAddress(ctx context.Context, address string, currentPage, pageSize int) (rpc.TransactionsResponse, error)
- func (cli *Client) GetTransactionByHash(ctx context.Context, transactionHash string) (rpc.TransactionsResponse, error)
- func (cli *Client) ListAddresses(ctx context.Context) ([]string, error)
- func (cli *Client) ListChannels(ctx context.Context, currentPage, pageSize int, order string) (rpc.ListResponse, error)
- func (cli *Client) LockAddress(ctx context.Context, address, token string) (bool, error)
- func (cli *Client) OverrideHTTPHeaders(headers map[string]string)
- func (cli *Client) PauseFileDownload(ctx context.Context, contractHash, fileHash string) error
- func (cli *Client) RebroadcastDataQueryRequest(ctx context.Context, dataQueryRequestHash string) error
- func (cli *Client) RequestDataQueryResponseFromVerifiers(ctx context.Context, dataQueryRequestHash string) (rpc.CheckDataQueryResponse, error)
- func (cli *Client) RequestEncryptionDataFromVerifierAndDecrypt(ctx context.Context, contractHash string, ...) ([]string, error)
- func (cli *Client) SearchChannels(ctx context.Context, query string, searchType search.Type, ...) (rpc.SearchResponse, error)
- func (cli *Client) SendContractToFileHosterAndVerifier(ctx context.Context, contractHash string) (bool, error)
- func (cli *Client) SendDataQueryRequest(ctx context.Context, fileHashes []string) (string, error)
- func (cli *Client) SendFileMerkleTreeNodesToVerifier(ctx context.Context, contractHash, fileHash string) (bool, error)
- func (cli *Client) SendRawTransaction(ctx context.Context, jsonEncodedTransactionBytes string) (rpc.TransactionResponse, error)
- func (cli *Client) SendTransaction(ctx context.Context, token string, tx SendTransaction) (rpc.TransactionResponse, error)
- func (cli *Client) TransactionPool(ctx context.Context) (rpc.MemPoolResponse, error)
- func (cli *Client) UnlockAddress(ctx context.Context, address, passphrase string) (string, error)
- func (cli *Client) UploadFile(ctx context.Context, filePath, nodeHash, storageToken string) (FileUploadResponse, error)
- type FileUploadResponse
- type HTTPClient
- type JSONRPCRequest
- type JSONRPCResponse
- type SendTransaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalanceOfAddress ¶
BalanceOfAddress represents the balance response of an address.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the client data.
func New ¶
func New(urlEndpoint string, httpClient HTTPClient) (*Client, error)
New creates a new client.
func (*Client) Authorized ¶ added in v1.1.16
Authorized checks if an access token is authorized.
func (*Client) ChannelFilesFromEntryOrFolder ¶
func (cli *Client) ChannelFilesFromEntryOrFolder(ctx context.Context, nodeHash string) (rpc.FilesFromEntryOrFolderResponse, error)
ChannelFilesFromEntryOrFolder gets a list of files recursively under an entry or a directory.
func (*Client) CheckDataQueryResponse ¶
func (cli *Client) CheckDataQueryResponse(ctx context.Context, dataQueryRequestHash string) (rpc.CheckDataQueryResponse, error)
CheckDataQueryResponse checks for a data query response.
func (*Client) CreateChannelNodeItemsTxDataPayload ¶ added in v1.1.7
func (cli *Client) CreateChannelNodeItemsTxDataPayload(ctx context.Context, nodes []rpc.NodeItemJSON) (string, string, error)
CreateChannelNodeItemsDataPayload creates the transaction data payload given the channel node items list.
func (*Client) CreateContractsFromDataQueryResponses ¶
func (cli *Client) CreateContractsFromDataQueryResponses(ctx context.Context, dataQueryRequestHash string) ([]string, error)
CreateContractsFromDataQueryResponses creates contract based on the data query responses on this node.
func (*Client) CreateTransactionsWithDataPayloadFromContractHashes ¶
func (cli *Client) CreateTransactionsWithDataPayloadFromContractHashes(ctx context.Context, contractHashes []string, accessToken, currentAddressNounce, transactionFeesToBeUsed string) ([]string, string, error)
CreateTransactionsWithDataPayloadFromContractHashes given a list of contract hashes it creates the transactions and its data payloads and returns them in a raw json format.
func (*Client) DownloadFile ¶
func (cli *Client) DownloadFile(ctx context.Context, contractHash, fileHash string, reDownload bool) (string, error)
DownloadFile requests a file download from file hoster given the file segments start and end.
func (*Client) DownloadFileProgress ¶
func (cli *Client) DownloadFileProgress(ctx context.Context, contractHash, fileHash string) (rpc.DownloadFileProgressResponse, error)
DownloadFileProgress reports the file download progress.
func (*Client) GetBlockByHash ¶
GetBlockByHash get a block by hash.
func (*Client) GetBlockByNumber ¶
GetBlockByNumber get a block by number.
func (*Client) GetBlockPool ¶
GetBlockPool gets the block pool of the node.
func (*Client) GetChannelNodeItem ¶
func (cli *Client) GetChannelNodeItem(ctx context.Context, nodeHash string) (rpc.GetNodeItemResponse, error)
GetChannelNodeItem gets channel node item.
func (*Client) GetDownloadContract ¶
func (cli *Client) GetDownloadContract(ctx context.Context, contractHash string) (rpc.GetDownloadContractResponse, error)
GetDownloadContract gets a download contract
func (*Client) GetHostInfo ¶
GetHostInfo gets the node's info.
func (*Client) GetNodeStats ¶
GetNodeStats gets the node's stats.
func (*Client) GetStorageAccessToken ¶
func (cli *Client) GetStorageAccessToken(ctx context.Context, storageAdminToken string) (string, error)
GetStorageAccessToken gets a user access token based on the admin access token to be used for uploading data.
func (*Client) GetTransactionByAddress ¶
func (cli *Client) GetTransactionByAddress(ctx context.Context, address string, currentPage, pageSize int) (rpc.TransactionsResponse, error)
GetTransactionByAddress given transactions of an address.
func (*Client) GetTransactionByHash ¶
func (cli *Client) GetTransactionByHash(ctx context.Context, transactionHash string) (rpc.TransactionsResponse, error)
GetTransactionByHash given transactions hash returns the transaction data and block number.
func (*Client) ListAddresses ¶ added in v1.1.6
ListAddresses lists the available addresses
func (*Client) ListChannels ¶
func (cli *Client) ListChannels(ctx context.Context, currentPage, pageSize int, order string) (rpc.ListResponse, error)
ListChannels gets the list of channels.
func (*Client) LockAddress ¶
LockAddress removes the unlocked address and jwt token to forbid access.
func (*Client) OverrideHTTPHeaders ¶
OverrideHTTPHeaders adds headers to all requests.
func (*Client) PauseFileDownload ¶ added in v1.1.9
PauseFileDownload pauses a file download.
func (*Client) RebroadcastDataQueryRequest ¶ added in v1.1.16
func (cli *Client) RebroadcastDataQueryRequest(ctx context.Context, dataQueryRequestHash string) error
RebroadcastDataQueryRequest rebroadcasts a data query request.
func (*Client) RequestDataQueryResponseFromVerifiers ¶
func (cli *Client) RequestDataQueryResponseFromVerifiers(ctx context.Context, dataQueryRequestHash string) (rpc.CheckDataQueryResponse, error)
RequestDataQueryResponseFromVerifiers requests data query responses from verifiers.
func (*Client) RequestEncryptionDataFromVerifierAndDecrypt ¶
func (cli *Client) RequestEncryptionDataFromVerifierAndDecrypt(ctx context.Context, contractHash string, fileHashes, fileMerkleRootHashes, restoredFilePaths []string) ([]string, error)
RequestEncryptionDataFromVerifierAndDecrypt requests decryption data from verifier and decrypts the files to the provides output paths.
func (*Client) SearchChannels ¶
func (cli *Client) SearchChannels(ctx context.Context, query string, searchType search.Type, size, currentPage int, fieldScope string) (rpc.SearchResponse, error)
SearchChannels search channel items.
func (*Client) SendContractToFileHosterAndVerifier ¶
func (cli *Client) SendContractToFileHosterAndVerifier(ctx context.Context, contractHash string) (bool, error)
SendContractToFileHosterAndVerifier sends a contract to verifier and file hoster.
func (*Client) SendDataQueryRequest ¶
SendDataQueryRequest sends a data query request.
func (*Client) SendFileMerkleTreeNodesToVerifier ¶
func (cli *Client) SendFileMerkleTreeNodesToVerifier(ctx context.Context, contractHash, fileHash string) (bool, error)
SendFileMerkleTreeNodesToVerifier send the files merkle tree nodes to verifier.
func (*Client) SendRawTransaction ¶
func (cli *Client) SendRawTransaction(ctx context.Context, jsonEncodedTransactionBytes string) (rpc.TransactionResponse, error)
SendRawTransaction sends a raw transaction.
func (*Client) SendTransaction ¶
func (cli *Client) SendTransaction(ctx context.Context, token string, tx SendTransaction) (rpc.TransactionResponse, error)
SendTransaction sends a transaction. this method requires the address to be unlocked and a token supplied
func (*Client) TransactionPool ¶
TransactionPool returns the transaction in the tx pool
func (*Client) UnlockAddress ¶
UnlockAddress unlocks an address or a node identity key.
func (*Client) UploadFile ¶
func (cli *Client) UploadFile(ctx context.Context, filePath, nodeHash, storageToken string) (FileUploadResponse, error)
UploadFile uploads a file given the path and storage access token.
type FileUploadResponse ¶
type FileUploadResponse struct { Error string `json:"error"` FileName string `json:"file_name"` FileHash string `json:"file_hash"` MerkleRootHash string `json:"merkle_root_hash"` Size int `json:"size"` }
FileUploadResponse represents the uploaded file metadata.
type HTTPClient ¶
HTTPClient defines the functionality of an HTTP client.
type JSONRPCRequest ¶
type JSONRPCRequest struct { JSONRPC string `json:"jsonrpc"` Method string `json:"method"` Params []interface{} `json:"params"` ID uint64 `json:"id"` }
JSONRPCRequest is the jsonrpc2.0 request.
type JSONRPCResponse ¶
type JSONRPCResponse struct { Result interface{} `json:"result"` Error string `json:"error"` ID uint64 `json:"id"` }
JSONRPCResponse is the jsonrpc2.0 response.