m3

package module
v0.0.0-...-f5df2b3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseURL = url.URL{
		Scheme: "https",
		Host:   "intg.m3as.com",
		Path:   "/api/v1/",
	}
)

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the Client response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. Client error responses are expected to have either no response body, or a json response body that maps to ErrorResponse. Any other response body will be silently ignored.

Types

type Activity

type Activity struct {
	BusinessDate      Date        `json:"businessDate"`
	PropertyCode      string      `json:"propertyCode"`
	CustomerShortName string      `json:"customerShortNamek"`
	SourceSystem      string      `json:"sourceSystem"`
	DataRecords       DataRecords `json:"dataRecords"`
}

type Client

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

Client manages communication with Exact Globe Client

func NewClient

func NewClient(httpClient *http.Client, clientID, clientSecret string) *Client

NewClient returns a new Exact Globe Client client

func (Client) BaseURL

func (c Client) BaseURL() url.URL

func (Client) Charset

func (c Client) Charset() string

func (Client) ClientID

func (c Client) ClientID() string

func (Client) ClientSecret

func (c Client) ClientSecret() string

func (Client) Debug

func (c Client) Debug() bool

func (*Client) Do

func (c *Client) Do(req *http.Request, responseBody interface{}) (*http.Response, error)

Do sends an Client request and returns the Client response. The Client response is json decoded and stored in the value pointed to by v, or returned as an error if an Client error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.

func (*Client) GetEndpointURL

func (c *Client) GetEndpointURL(path string, pathParams PathParams) url.URL

func (Client) MediaType

func (c Client) MediaType() string

func (*Client) NewPostActivitiesRequest

func (c *Client) NewPostActivitiesRequest() PostActivitiesRequest

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method string, URL url.URL, body interface{}) (*http.Request, error)

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(baseURL url.URL)

func (*Client) SetCharset

func (c *Client) SetCharset(charset string)

func (*Client) SetClientID

func (c *Client) SetClientID(clientID string)

func (*Client) SetClientSecret

func (c *Client) SetClientSecret(clientSecret string)

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool)

func (*Client) SetDisallowUnknownFields

func (c *Client) SetDisallowUnknownFields(disallowUnknownFields bool)

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(client *http.Client)

func (*Client) SetMediaType

func (c *Client) SetMediaType(mediaType string)

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(userAgent string)

func (*Client) Unmarshal

func (c *Client) Unmarshal(r io.Reader, vv ...interface{}) error

func (Client) UserAgent

func (c Client) UserAgent() string

type DataRecord

type DataRecord struct {
	AccountDescription string  `json:"accountDescription"`
	AccountingID       string  `json:"accountingId"`
	Amount             float64 `json:"amount"`
	RecordType         string  `json:"recordType"`
}

type DataRecords

type DataRecords []DataRecord

type Date

type Date struct {
	time.Time
}

func (Date) IsEmpty

func (d Date) IsEmpty() bool

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (Date) String

func (d Date) String() string

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(text []byte) (err error)

type Error

type Error struct {
	Message       string `json:"message"`
	MessageDetail string `json:"MessageDetail"`
}

func (Error) Error

func (e Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response `json:"-"`

	Errors []error
}

func (ErrorResponse) Error

func (r ErrorResponse) Error() string

func (*ErrorResponse) UnmarshalJSON

func (r *ErrorResponse) UnmarshalJSON(data []byte) error

type PathParams

type PathParams interface {
	Params() map[string]string
}

type PostActivitiesPathParams

type PostActivitiesPathParams struct {
}

func (*PostActivitiesPathParams) Params

func (p *PostActivitiesPathParams) Params() map[string]string

type PostActivitiesQueryParams

type PostActivitiesQueryParams struct {
}

func (PostActivitiesQueryParams) ToURLValues

func (p PostActivitiesQueryParams) ToURLValues() (url.Values, error)

type PostActivitiesRequest

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

func (*PostActivitiesRequest) Do

func (*PostActivitiesRequest) Method

func (r *PostActivitiesRequest) Method() string

func (PostActivitiesRequest) NewPostActivitiesPathParams

func (r PostActivitiesRequest) NewPostActivitiesPathParams() *PostActivitiesPathParams

func (PostActivitiesRequest) NewPostActivitiesQueryParams

func (r PostActivitiesRequest) NewPostActivitiesQueryParams() *PostActivitiesQueryParams

func (PostActivitiesRequest) NewPostActivitiesRequestBody

func (r PostActivitiesRequest) NewPostActivitiesRequestBody() PostActivitiesRequestBody

func (*PostActivitiesRequest) NewResponseBody

func (r *PostActivitiesRequest) NewResponseBody() *PostActivitiesResponseBody

func (*PostActivitiesRequest) PathParams

func (*PostActivitiesRequest) QueryParams

func (*PostActivitiesRequest) RequestBody

func (*PostActivitiesRequest) SetMethod

func (r *PostActivitiesRequest) SetMethod(method string)

func (*PostActivitiesRequest) SetRequestBody

func (r *PostActivitiesRequest) SetRequestBody(body PostActivitiesRequestBody)

func (*PostActivitiesRequest) URL

func (r *PostActivitiesRequest) URL() url.URL

type PostActivitiesRequestBody

type PostActivitiesRequestBody Activity

type PostActivitiesResponseBody

type PostActivitiesResponseBody struct{}

type RequestCompletionCallback

type RequestCompletionCallback func(*http.Request, *http.Response)

RequestCompletionCallback defines the type of the request callback function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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