client

package
Version: v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpenRequest = []byte{1, 8, 1, 3, 0, 0, 2, 4}

OpenRequest is a expectation bytes on first place in every request service.

Functions

This section is empty.

Types

type Client

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

func New

func New(conn io.ReadWriteCloser) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Exec

func (c *Client) Exec(service, method string, auth fmt.Stringer, args oscript.M, result interface{}) (*Response, error)

func (*Client) Read

func (c *Client) Read(r interface{}) (*Response, error)

func (*Client) ReadFile

func (c *Client) ReadFile(fa interface{}) (*Response, error)

func (*Client) ReadTo

func (c *Client) ReadTo(w io.Writer) error

func (*Client) Write

func (c *Client) Write(service, method string, auth fmt.Stringer, args oscript.M) error

func (*Client) WriteFrom

func (c *Client) WriteFrom(r io.Reader) error

type OpError

type OpError struct {
	// service is a service with happened error
	Service string
	// Err is a message of the error
	Err error
}

An OpError is the error type usually returned by functions in the ot package. It describes the service method, and text of an error.

func (*OpError) Error

func (e *OpError) Error() string

type Response

type Response struct {
	Status        int         `oscript:"_Status"`
	API           string      `oscript:"_apiError"`
	StatusMessage string      `oscript:"_StatusMessage"`
	Desc          string      `oscript:"_errMsg"`
	Results       interface{} `oscript:"Results"`
	FileAttr      interface{} `oscript:"FileAttributes"`
	Service       string      `oscript:"-"`
}

Response is response on any request.

func (*Response) ErrMessage

func (r *Response) ErrMessage() (desc string, ecode string)

Jump to

Keyboard shortcuts

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