sdks

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

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 a sdk client instance

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

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

func (*ZBox) InitWallet

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

InitWallet init wallet from json

func (*ZBox) SignRequest

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

SignRequest sign request with client_id, client_key and sign

Directories

Path Synopsis
package blobber wrap blobber's apis as sdk client
package blobber wrap blobber's apis as sdk client

Jump to

Keyboard shortcuts

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