example

package
v0.0.0-...-adadc03 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStreetRequired = errors.New("missing street")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Type    string `json:"type"`
}

type Client

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

func NewClient

func NewClient(baseURL string) Client

func (Client) StoreProperty

func (c Client) StoreProperty(ctx context.Context, r StorePropertyReq) (*StorePropertyRes, error)

StoreProperty attempts to store a property using the RPM API when the response code is >=400 you will get an ErrorResponse as the error

func (Client) With429Retry

func (c Client) With429Retry(retries int) Client

func (Client) WithBaseURL

func (c Client) WithBaseURL(host string) Client

func (Client) WithCredentials

func (c Client) WithCredentials(key, secret string) Client

func (Client) WithLogger

func (c Client) WithLogger(ll httputil.LevelLogger) Client

func (Client) WithRateLimiter

func (c Client) WithRateLimiter(rl *httputil.RateLimiter) Client

func (Client) WithSetHeader

func (c Client) WithSetHeader(k string, vals ...string) Client

type ErrorResponse

type ErrorResponse struct {
	APIError APIError `json:"error"`
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

func (ErrorResponse) ErrorOrNil

func (e ErrorResponse) ErrorOrNil() error

func (ErrorResponse) IsZero

func (e ErrorResponse) IsZero() bool

type Property

type Property struct {
	ID     string `json:"id"`
	Street string `json:"street"`
	City   string `json:"city"`
	State  string `json:"state"`
	Zip    string `json:"zip"`
}

type StorePropertyReq

type StorePropertyReq struct {
	httputil.ReqHeaders `json:"-"`
	Property            struct {
		ID     string `json:"-"` // path arg
		Street string `json:"street"`
		City   string `json:"city"`
		State  string `json:"state"`
		Zip    string `json:"zip"`
	} `json:"property"`
}

func NewStorePropertyReq

func NewStorePropertyReq(p Property) StorePropertyReq

func (StorePropertyReq) Path

func (req StorePropertyReq) Path() httputil.Path

func (StorePropertyReq) Validate

func (req StorePropertyReq) Validate() error

type StorePropertyRes

type StorePropertyRes struct {
	Property `json:"property"`
}

Jump to

Keyboard shortcuts

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