soter

package
v0.0.0-...-c07167e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddFileRawData

type AddFileRawData struct {
	RequestUser string `json:"request_user"`
	SignedUser  string `json:"signed_user"`
	RequestId   string `json:"request_id"`
	Timestamp   int64  `json:"timestamp"`
}

type Error

type Error struct {
	Command string
	Message string
	Code    int
}

func (*Error) Error

func (e *Error) Error() string

type Request

type Request struct {
	Ctx     context.Context
	ApiBase string
	Command string
	Args    []string
	Opts    map[string]string
	Body    io.Reader
	Headers map[string]string
	Method  string
}

func NewRequest

func NewRequest(ctx context.Context, url, command string, args ...string) *Request

func (*Request) Send

func (r *Request) Send(c *http.Client) (*Response, error)

type RequestBuilder

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

RequestBuilder is an commands request builder.

func (*RequestBuilder) Arguments

func (r *RequestBuilder) Arguments(args ...string) *RequestBuilder

Arguments adds the arguments to the args.

func (*RequestBuilder) Body

func (r *RequestBuilder) Body(body io.Reader) *RequestBuilder

Body sets the request body to the given reader.

func (*RequestBuilder) BodyBytes

func (r *RequestBuilder) BodyBytes(body []byte) *RequestBuilder

BodyBytes sets the request body to the given buffer.

func (*RequestBuilder) BodyString

func (r *RequestBuilder) BodyString(body string) *RequestBuilder

BodyString sets the request body to the given string.

func (*RequestBuilder) Exec

func (r *RequestBuilder) Exec(ctx context.Context, res interface{}) error

Exec sends the request a request and decodes the response.

func (*RequestBuilder) Header

func (r *RequestBuilder) Header(name, value string) *RequestBuilder

Header sets the given header.

func (*RequestBuilder) Option

func (r *RequestBuilder) Option(key string, value interface{}) *RequestBuilder

Option sets the given option.

func (*RequestBuilder) Send

func (r *RequestBuilder) Send(ctx context.Context) (*Response, error)

Send sends the request and return the response.

func (*RequestBuilder) SetMethod

func (r *RequestBuilder) SetMethod(method string) *RequestBuilder

SetMethod sets the https request method, GET/POST

type Response

type Response struct {
	Output io.ReadCloser
	Error  *Error
}

func (*Response) Close

func (r *Response) Close() error

func (*Response) Decode

func (r *Response) Decode(dec interface{}) error

type Shell

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

func NewShell

func NewShell(privateKey, userAddress, url string) *Shell

func NewShellWithClient

func NewShellWithClient(privateKey, userAddress, url string, c *gohttp.Client) *Shell

func (*Shell) AddFile

func (s *Shell) AddFile(requestUser, filePath string) (SoterResponse, error)

func (*Shell) Autopay

func (s *Shell) Autopay(enable bool) (SoterResponse, error)

func (*Shell) Balance

func (s *Shell) Balance() (SoterResponse, error)

func (*Shell) EditProfile

func (s *Shell) EditProfile(email, phoneNumber string) (SoterResponse, error)

func (*Shell) QueryDepositHistory

func (s *Shell) QueryDepositHistory(start, end int64, offset, limit int32) (SoterResponse, error)

func (*Shell) QueryFileList

func (s *Shell) QueryFileList(start, end int64, offset, limit int32, deleted bool) (SoterResponse, error)

func (*Shell) QueryOrderDetails

func (s *Shell) QueryOrderDetails(requestId string) (SoterResponse, error)

func (*Shell) QueryOrderList

func (s *Shell) QueryOrderList(start, end int64, offset, limit int32) (SoterResponse, error)

func (*Shell) QueryProfile

func (s *Shell) QueryProfile() (SoterResponse, error)

func (*Shell) Request

func (s *Shell) Request(command string, args ...string) *RequestBuilder

func (*Shell) SetTimeout

func (s *Shell) SetTimeout(d time.Duration)

type SoterOpts

type SoterOpts = func(*RequestBuilder) error

func RawDataOpts

func RawDataOpts(rawData string) SoterOpts

func SignatureOpts

func SignatureOpts(signature string) SoterOpts

func UserAddressOpts

func UserAddressOpts(userAddress string) SoterOpts

type SoterResponse

type SoterResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

response

Jump to

Keyboard shortcuts

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