client

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClientEncodeErr represents an error encoding parameters.
	ClientEncodeErr = "client:encode"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL       string   `json:"baseurl"`       // BaseURL the API is served from, e.g. https://www.sherpadoc.org/example/
	Functions     []string `json:"functions"`     // Function names exported by the API
	ID            string   `json:"id"`            // Short ID of the API. May be nil.
	Title         string   `json:"title"`         // Human-readable name of the API. May be nil.
	Version       string   `json:"version"`       // Version of the API, should be in the form "major.minor.patch". May be nil.
	SherpaVersion int      `json:"sherpaVersion"` // Version of the Sherpa specification this API implements. May be nil.
}

Client lets you call functions from an existing Sherpa API. If the API was initialized with a non-nil function list, some fields will be nil (as indicated).

func New

func New(url string, functions []string) (*Client, error)

New makes a new sherpa Client, for the given URL. If "functions" is nil, the API at the URL is contacted for a function list.

func (*Client) Call

func (c *Client) Call(result interface{}, functionName string, params ...interface{}) error

Call an API function by name.

If error is not null, it's of type Error. If result is null, no attempt is made to parse the "result" part of the sherpa response.

Jump to

Keyboard shortcuts

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