sdks

package
v1.18.0-RC10 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Miscellaneous provider-related SDKs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ClientID        string
	ClientPublicKey string
	BaseURL         string
}

Client a client instance of restful api

func NewClient

func NewClient(clientID, clientPublicKey, baseURL string) (Client, error)

create client instance

func (*Client) SignRequest

func (c *Client) SignRequest(req *http.Request, allocation string) error

type Request added in v1.7.3

type Request struct {

	//AllocationID optional. allocation id
	AllocationID string
	//ConnectionID optional. session id
	ConnectionID string

	// ContentType content-type in header
	ContentType string
	// Body form data
	Body io.Reader
	// QueryString query string
	QueryString map[string]string
}

Request request payload

type ZBox

type ZBox struct {
	// ClientID client id
	ClientID string
	// ClientKey client key
	ClientKey string
	// SignatureScheme signature scheme
	SignatureScheme string

	// Wallet wallet
	Wallet *zcncrypto.Wallet

	// NewRequest create http request
	NewRequest func(method, url string, body io.Reader) (*http.Request, error)
}

ZBox sdk client instance

func New

func New(clientID, clientKey, signatureScheme string, wallet *zcncrypto.Wallet) *ZBox

New create an sdk client instance given its configuration

  • clientID client id of the using client
  • clientKey client key of the using client
  • signatureScheme signature scheme for transaction encryption
  • wallet wallet of the using client

func (*ZBox) BuildUrls added in v1.7.3

func (z *ZBox) BuildUrls(baseURLs []string, queryString map[string]string, pathFormat string, pathArgs ...interface{}) []string

BuildUrls build full request url given base urls, query string, path format and path args

  • baseURLs base urls
  • queryString query string
  • pathFormat path format
  • pathArgs path args

func (*ZBox) CreateTransport added in v1.7.3

func (z *ZBox) CreateTransport() *http.Transport

CreateTransport create http.Transport with default dial timeout

func (*ZBox) DoPost added in v1.7.3

func (z *ZBox) DoPost(req *Request, handle resty.Handle) *resty.Resty

DoPost do post request with request and handle

  • req request instance
  • handle handle function for the response

func (*ZBox) InitWallet

func (z *ZBox) InitWallet(js string) error

InitWallet init wallet from json

  • js json string of wallet

func (*ZBox) SignRequest

func (z *ZBox) SignRequest(req *http.Request, allocationID string) error

SignRequest sign request with client_id, client_key and sign by adding headers to the request

  • req http request
  • allocationID allocation id

Directories

Path Synopsis
Provides sdk functions to be used by the blobber.
Provides sdk functions to be used by the blobber.

Jump to

Keyboard shortcuts

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