maventa

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

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseURL = url.URL{
		Scheme: "https",
		Host:   "ax.maventa.com",
		Path:   "",
	}
	ValidatorURL = url.URL{
		Scheme: "https",
		Host:   "validator.maventa.com",
		Path:   "",
	}
)

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 APIError

type APIError struct {
	Response *http.Response `json:"-"`

	Code    string   `json:"code"`
	Message string   `json:"message"`
	Details []string `json:"details"`
}

{"code":"invoice_create_api_error","message":"Error while creating invoice","details":["ERROR: INVOICE DATE NOT FOUND"]}

func (APIError) Error

func (e APIError) Error() string

type AccessTokenPathParams

type AccessTokenPathParams struct{}

func (AccessTokenPathParams) Params

func (pp AccessTokenPathParams) Params() map[string]string

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, vendorAPIKey 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) DefaultClient

func (c *Client) DefaultClient() *http.Client

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(base url.URL, path string, pathParams PathParams) url.URL

func (Client) MediaType

func (c Client) MediaType() string

func (*Client) NewFormRequest

func (c *Client) NewFormRequest(ctx context.Context, method string, URL url.URL, form Form) (*http.Request, error)

func (*Client) NewGetInvoicesRequest

func (c *Client) NewGetInvoicesRequest() GetInvoicesRequest

func (*Client) NewGetStatusAuthenticatedRequest

func (c *Client) NewGetStatusAuthenticatedRequest() GetStatusAuthenticatedRequest

func (*Client) NewPostInvoiceRequest

func (c *Client) NewPostInvoiceRequest() PostInvoiceRequest

func (*Client) NewRequest

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

func (*Client) NewValidateRequest

func (c *Client) NewValidateRequest() ValidateRequest

func (*Client) Scopes

func (c *Client) Scopes() []string

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) SetValidatorURL

func (c *Client) SetValidatorURL(validatorURL url.URL)

func (*Client) SetVendorAPIKey

func (c *Client) SetVendorAPIKey(vendorAPIKey string)

func (*Client) Unmarshal

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

func (Client) UserAgent

func (c Client) UserAgent() string

func (Client) ValidatorURL

func (c Client) ValidatorURL() url.URL

func (Client) VendorAPIKey

func (c Client) VendorAPIKey() string

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 DateTime

type DateTime struct {
	time.Time
}

func (DateTime) IsEmpty

func (d DateTime) IsEmpty() bool

func (*DateTime) MarshalJSON

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

func (DateTime) String

func (d DateTime) String() string

func (*DateTime) UnmarshalJSON

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

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response `json:"-"`
	// contains filtered or unexported fields
}

func (ErrorResponse) Error

func (r ErrorResponse) Error() string

type File

type File struct {
	Filename string
	Reader   io.Reader
}

type Form

type Form interface {
	Values() url.Values
	Files() map[string]File
}

type GetInvoicesPathParams

type GetInvoicesPathParams struct {
}

func (*GetInvoicesPathParams) Params

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

type GetInvoicesQueryParams

type GetInvoicesQueryParams struct {
	Direction string `schema:"direction"`
}

func (GetInvoicesQueryParams) ToURLValues

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

type GetInvoicesRequest

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

func (*GetInvoicesRequest) Do

func (*GetInvoicesRequest) Method

func (r *GetInvoicesRequest) Method() string

func (GetInvoicesRequest) NewGetInvoicesPathParams

func (r GetInvoicesRequest) NewGetInvoicesPathParams() *GetInvoicesPathParams

func (GetInvoicesRequest) NewGetInvoicesQueryParams

func (r GetInvoicesRequest) NewGetInvoicesQueryParams() *GetInvoicesQueryParams

func (GetInvoicesRequest) NewGetInvoicesRequestBody

func (r GetInvoicesRequest) NewGetInvoicesRequestBody() GetInvoicesRequestBody

func (*GetInvoicesRequest) NewResponseBody

func (r *GetInvoicesRequest) NewResponseBody() *GetInvoicesResponseBody

func (*GetInvoicesRequest) PathParams

func (r *GetInvoicesRequest) PathParams() *GetInvoicesPathParams

func (*GetInvoicesRequest) QueryParams

func (r *GetInvoicesRequest) QueryParams() *GetInvoicesQueryParams

func (*GetInvoicesRequest) RequestBody

func (r *GetInvoicesRequest) RequestBody() *GetInvoicesRequestBody

func (*GetInvoicesRequest) SetMethod

func (r *GetInvoicesRequest) SetMethod(method string)

func (*GetInvoicesRequest) SetRequestBody

func (r *GetInvoicesRequest) SetRequestBody(body GetInvoicesRequestBody)

func (*GetInvoicesRequest) URL

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

type GetInvoicesRequestBody

type GetInvoicesRequestBody struct{}

type GetInvoicesResponseBody

type GetInvoicesResponseBody []struct {
	ID        string `json:"id"`
	Status    string `json:"status"`
	Reference string `json:"reference"`
	Number    string `json:"number"`
	Sender    struct {
		Eia     string `json:"eia"`
		Bid     string `json:"bid"`
		Name    string `json:"name"`
		Country string `json:"country"`
	} `json:"sender"`
	Recipient struct {
		EIA      string `json:"eia"`
		BID      string `json:"bid"`
		Name     string `json:"name"`
		Country  string `json:"country"`
		Operator string `json:"operator"`
	} `json:"recipient"`
	CreatedAt    time.Time     `json:"created_at"`
	Date         string        `json:"date"`
	DateDue      string        `json:"date_due"`
	SourceFormat string        `json:"source_format"`
	Sum          float64       `json:"sum"`
	SumTax       float64       `json:"sum_tax"`
	Currency     string        `json:"currency"`
	Destination  string        `json:"destination"`
	Comment      string        `json:"comment"`
	Files        []interface{} `json:"files"`
}

type GetStatusAuthenticatedPathParams

type GetStatusAuthenticatedPathParams struct {
}

func (*GetStatusAuthenticatedPathParams) Params

type GetStatusAuthenticatedQueryParams

type GetStatusAuthenticatedQueryParams struct {
}

func (GetStatusAuthenticatedQueryParams) ToURLValues

type GetStatusAuthenticatedRequest

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

func (*GetStatusAuthenticatedRequest) Do

func (*GetStatusAuthenticatedRequest) Method

func (GetStatusAuthenticatedRequest) NewGetStatusAuthenticatedPathParams

func (r GetStatusAuthenticatedRequest) NewGetStatusAuthenticatedPathParams() *GetStatusAuthenticatedPathParams

func (GetStatusAuthenticatedRequest) NewGetStatusAuthenticatedQueryParams

func (r GetStatusAuthenticatedRequest) NewGetStatusAuthenticatedQueryParams() *GetStatusAuthenticatedQueryParams

func (GetStatusAuthenticatedRequest) NewGetStatusAuthenticatedRequestBody

func (r GetStatusAuthenticatedRequest) NewGetStatusAuthenticatedRequestBody() GetStatusAuthenticatedRequestBody

func (*GetStatusAuthenticatedRequest) NewResponseBody

func (*GetStatusAuthenticatedRequest) PathParams

func (*GetStatusAuthenticatedRequest) QueryParams

func (*GetStatusAuthenticatedRequest) RequestBody

func (*GetStatusAuthenticatedRequest) SetMethod

func (r *GetStatusAuthenticatedRequest) SetMethod(method string)

func (*GetStatusAuthenticatedRequest) SetRequestBody

func (*GetStatusAuthenticatedRequest) URL

type GetStatusAuthenticatedRequestBody

type GetStatusAuthenticatedRequestBody struct{}

type GetStatusAuthenticatedResponseBody

type GetStatusAuthenticatedResponseBody struct{}

type Number

type Number float64

func (Number) MarshalJSON

func (i Number) MarshalJSON() ([]byte, error)

func (*Number) UnmarshalJSON

func (i *Number) UnmarshalJSON(data []byte) error

type PathParams

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

type PostInvoiceFormParams

type PostInvoiceFormParams struct {
	File              File
	Format            string
	RecipientType     string
	RecipientEIA      string
	RecipientEmail    string
	RecipientOperator string
	DisabledRoutes    []string
	SenderComment     string
	RouteOrder        []string
}

func (PostInvoiceFormParams) Files

func (p PostInvoiceFormParams) Files() map[string]File

func (PostInvoiceFormParams) Values

func (p PostInvoiceFormParams) Values() url.Values

type PostInvoicePathParams

type PostInvoicePathParams struct {
}

func (*PostInvoicePathParams) Params

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

type PostInvoiceQueryParams

type PostInvoiceQueryParams struct {
}

func (PostInvoiceQueryParams) ToURLValues

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

type PostInvoiceRequest

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

func (*PostInvoiceRequest) Do

func (*PostInvoiceRequest) FormParams

func (r *PostInvoiceRequest) FormParams() *PostInvoiceFormParams

func (*PostInvoiceRequest) Method

func (r *PostInvoiceRequest) Method() string

func (PostInvoiceRequest) NewPostInvoiceFormParams

func (r PostInvoiceRequest) NewPostInvoiceFormParams() *PostInvoiceFormParams

func (PostInvoiceRequest) NewPostInvoicePathParams

func (r PostInvoiceRequest) NewPostInvoicePathParams() *PostInvoicePathParams

func (PostInvoiceRequest) NewPostInvoiceQueryParams

func (r PostInvoiceRequest) NewPostInvoiceQueryParams() *PostInvoiceQueryParams

func (PostInvoiceRequest) NewPostInvoiceRequestBody

func (r PostInvoiceRequest) NewPostInvoiceRequestBody() PostInvoiceRequestBody

func (*PostInvoiceRequest) NewResponseBody

func (r *PostInvoiceRequest) NewResponseBody() *PostInvoiceResponseBody

func (*PostInvoiceRequest) PathParams

func (r *PostInvoiceRequest) PathParams() *PostInvoicePathParams

func (*PostInvoiceRequest) QueryParams

func (r *PostInvoiceRequest) QueryParams() *PostInvoiceQueryParams

func (*PostInvoiceRequest) RequestBody

func (r *PostInvoiceRequest) RequestBody() *PostInvoiceRequestBody

func (*PostInvoiceRequest) SetMethod

func (r *PostInvoiceRequest) SetMethod(method string)

func (*PostInvoiceRequest) SetRequestBody

func (r *PostInvoiceRequest) SetRequestBody(body PostInvoiceRequestBody)

func (*PostInvoiceRequest) URL

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

type PostInvoiceRequestBody

type PostInvoiceRequestBody struct{}

type PostInvoiceResponseBody

type PostInvoiceResponseBody struct {
}

type RequestCompletionCallback

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

RequestCompletionCallback defines the type of the request callback function

type ValidateFormParams

type ValidateFormParams struct {
	File File
}

func (ValidateFormParams) Files

func (p ValidateFormParams) Files() map[string]File

func (ValidateFormParams) Values

func (p ValidateFormParams) Values() url.Values

type ValidatePathParams

type ValidatePathParams struct {
}

func (*ValidatePathParams) Params

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

type ValidateQueryParams

type ValidateQueryParams struct {
}

func (ValidateQueryParams) ToURLValues

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

type ValidateRequest

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

func (*ValidateRequest) Do

func (*ValidateRequest) FormParams

func (r *ValidateRequest) FormParams() *ValidateFormParams

func (*ValidateRequest) Method

func (r *ValidateRequest) Method() string

func (*ValidateRequest) NewResponseBody

func (r *ValidateRequest) NewResponseBody() *ValidateResponseBody

func (ValidateRequest) NewValidateFormParams

func (r ValidateRequest) NewValidateFormParams() *ValidateFormParams

func (ValidateRequest) NewValidatePathParams

func (r ValidateRequest) NewValidatePathParams() *ValidatePathParams

func (ValidateRequest) NewValidateQueryParams

func (r ValidateRequest) NewValidateQueryParams() *ValidateQueryParams

func (ValidateRequest) NewValidateRequestBody

func (r ValidateRequest) NewValidateRequestBody() ValidateRequestBody

func (*ValidateRequest) PathParams

func (r *ValidateRequest) PathParams() *ValidatePathParams

func (*ValidateRequest) QueryParams

func (r *ValidateRequest) QueryParams() *ValidateQueryParams

func (*ValidateRequest) RequestBody

func (r *ValidateRequest) RequestBody() *ValidateRequestBody

func (*ValidateRequest) SetMethod

func (r *ValidateRequest) SetMethod(method string)

func (*ValidateRequest) SetRequestBody

func (r *ValidateRequest) SetRequestBody(body ValidateRequestBody)

func (*ValidateRequest) URL

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

type ValidateRequestBody

type ValidateRequestBody struct{}

type ValidateResponseBody

type ValidateResponseBody struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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