xmlrpc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FullXMLRpcTime is the format of a full XML-RPC time
	FullXMLRpcTime = "2006-01-02T15:04:05-07:00"
	// LocalXMLRpcTime is the XML-RPC time without timezone
	LocalXMLRpcTime = "2006-01-02T15:04:05"
	// DenseXMLRpcTime is a dense-formatted local time
	DenseXMLRpcTime = "20060102T15:04:05"
	// DummyXMLRpcTime is seen in the wild
	DummyXMLRpcTime = "20060102T15:04:05-0700"
)

/ ISO8601 is not very much restrictive, so many combinations exist

Variables

View Source
var ErrUnsupported = errors.New("Unsupported type")

Unsupported is the error of "Unsupported type"

Functions

func ErrEq

func ErrEq(a, b error) bool

ErrEq checks equality of the errorStructs (equality of the embedded main errors

func Errorf2

func Errorf2(err error, format string, a ...interface{}) error

Errorf2 returns an error embedding the main error with the formatted message

func Marshal

func Marshal(w io.Writer, name string, args ...interface{}) (err error)

Marshal marshals the named thing (methodResponse if name == "", otherwise a methodCall) into the w Writer

func SetLogger

func SetLogger(lgr *log.Logger) *log.Logger

SetLogger sets a new logger for this package, returns old logger

func WriteXML

func WriteXML(w io.Writer, v interface{}, typ bool) (err error)

WriteXML writes v, typed if typ is true, into w Writer

Types

type Client

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

Client implements a basic XMLRPC client

func NewClient

func NewClient(addr string, insecure bool) *Client

NewClient returns a new instance of Client Pass in a true value for `insecure` to turn off certificate verification

func (*Client) Call

func (c *Client) Call(name string, args ...interface{}) (interface{}, error)

Call calls the method with "name" with the given args Returns the result, and an error for communication errors

type Fault

type Fault struct {
	Code    int
	Message string
}

Fault is the struct for the fault response

func Unmarshal

func Unmarshal(r io.Reader) (name string, params []interface{}, fault *Fault, e error)

Unmarshal unmarshals the thing (methodResponse, methodCall or fault), returns the name of the method call in the first return argument; the params of the call or the response or the Fault if this is a Fault

func (Fault) Error

func (f Fault) Error() string

func (Fault) String

func (f Fault) String() string

func (Fault) WriteXML

func (f Fault) WriteXML(w io.Writer) (int, error)

WriteXML writes the XML representation of the fault into the Writer

Jump to

Keyboard shortcuts

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