sitedish

package module
v0.0.0-...-701a3dd Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BaseURL = url.URL{
		Scheme: "https",
		Host:   "api.sitedish.nl",
		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 Accounting

type Accounting struct {
	Revenue float64 `json:"revenue"`
	VAT     struct {
		VatLowPercentage  float64 `json:"vat_low_percentage"`
		VatLowAmount      float64 `json:"vat_low_amount"`
		VatLow            float64 `json:"vat_low"`
		VatHighPercentage float64 `json:"vat_high_percentage"`
		VatHighAmount     float64 `json:"vat_high_amount"`
		VatHigh           float64 `json:"vat_high"`
		VatNoneAmount     float64 `json:"vat_none_amount"`
	} `json:"vat"`
}

type BeforeRequestDoCallback

type BeforeRequestDoCallback func(*http.Client, *http.Request, interface{})

type Client

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

Client manages communication with Exact Globe Client

func NewClient

func NewClient(httpClient *http.Client) *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) Debug

func (c Client) Debug() bool

func (*Client) Do

func (c *Client) Do(req *http.Request, body 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(p string, pathParams PathParams) url.URL

func (Client) MediaType

func (c Client) MediaType() string

func (*Client) NewOrdersArchivedGet

func (c *Client) NewOrdersArchivedGet() OrdersArchivedGet

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, req Request) (*http.Request, error)

func (*Client) SetBaseURL

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

func (*Client) SetBeforeRequestDo

func (c *Client) SetBeforeRequestDo(fun BeforeRequestDoCallback)

func (*Client) SetCharset

func (c *Client) SetCharset(charset 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 Customer

type Customer struct {
	Name             string `json:"name"`
	CompanyName      string `json:"companyName"`
	PhoneNumber      string `json:"phoneNumber"`
	Street           string `json:"street"`
	StreetNumber     string `json:"streetNumber"`
	PostalCode       string `json:"postalCode"`
	City             string `json:"city"`
	ExtraAddressInfo string `json:"extraAddressInfo"`
	NewCustomer      bool   `json:"newCustomer"`
}

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

func (d Date) MarshalSchema() 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) MarshalSchema

func (d DateTime) MarshalSchema() string

type Discount

type Discount struct {
	Name  string  `json:"name"`
	Price float64 `json:"price"`
	Count int     `json:"count"`
}

type Discounts

type Discounts []Discount

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response

	Success    bool `json:"success"`
	Validation struct {
		ErrorLogReference string `json:"errorLogReference"`
		Summary           string `json:"summary"`
		Exception         string `json:"exception"`
	} `json:"validation"`
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Location

type Location struct {
	Lat      float64 `json:"lat"`
	Lng      float64 `json:"lng"`
	Distance int     `json:"distance"`
	Duration int     `json:"duration"`
}

type Meta

type Meta struct {
	Version     int         `json:"version"`
	LastUpdated interface{} `json:"lastUpdated"`
}

type Oauth2Config

type Oauth2Config struct {
	clientcredentials.Config
}

func NewOauth2Config

func NewOauth2Config() *Oauth2Config

func (*Oauth2Config) SetBaseURL

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

type Order

type Order struct {
	ID            string     `json:"id"`
	OrderNumber   string     `json:"orderNumber"`
	Platform      string     `json:"platform"`
	RestaurantID  string     `json:"restaurantId"`
	ReceiptNumber int        `json:"receiptNumber"`
	OrderStatus   int        `json:"orderStatus"`
	OrderDate     time.Time  `json:"orderDate"`
	OrderType     string     `json:"orderType"`
	Courier       string     `json:"courier"`
	DeliveryCosts float64    `json:"deliveryCosts"`
	Tip           float64    `json:"tip"`
	TotalPrice    float64    `json:"totalPrice"`
	TotalSupFee   float64    `json:"totalSupFee"`
	TotalFee      float64    `json:"totalFee"`
	TotalDiscount float64    `json:"totalDiscount"`
	TotalDeposit  float64    `json:"totalDeposit"`
	PaymentMethod string     `json:"paymentMethod"`
	PaysExact     bool       `json:"paysExact"`
	PaysWith      float64    `json:"paysWith"`
	Customer      Customer   `json:"customer"`
	Products      Products   `json:"products"`
	Discounts     Discounts  `json:"discounts"`
	Remark        string     `json:"remark"`
	Location      Location   `json:"location"`
	Canceled      bool       `json:"canceled"`
	Deleted       bool       `json:"deleted"`
	Refunded      bool       `json:"refunded"`
	IsPaid        bool       `json:"isPaid"`
	RequestedAsap bool       `json:"requestedAsap"`
	ConfirmedTime DateTime   `json:"confirmedTime"`
	Version       string     `json:"version"`
	Accounting    Accounting `json:"accounting"`
	Meta          Meta       `json:"meta"`
}

type Orders

type Orders []Order

type OrdersArchivedGet

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

func (*OrdersArchivedGet) Do

func (*OrdersArchivedGet) Method

func (r *OrdersArchivedGet) Method() string

func (OrdersArchivedGet) NewPathParams

func (OrdersArchivedGet) NewQueryParams

func (r OrdersArchivedGet) NewQueryParams() *OrdersArchivedGetQueryParams

func (OrdersArchivedGet) NewRequestBody

func (r OrdersArchivedGet) NewRequestBody() OrdersArchivedGetBody

func (*OrdersArchivedGet) NewResponseBody

func (r *OrdersArchivedGet) NewResponseBody() *OrdersArchivedGetResponseBody

func (*OrdersArchivedGet) PathParams

func (*OrdersArchivedGet) PathParamsInterface

func (r *OrdersArchivedGet) PathParamsInterface() PathParams

func (*OrdersArchivedGet) QueryParams

func (*OrdersArchivedGet) RequestBody

func (r *OrdersArchivedGet) RequestBody() *OrdersArchivedGetBody

func (*OrdersArchivedGet) RequestBodyInterface

func (r *OrdersArchivedGet) RequestBodyInterface() interface{}

func (*OrdersArchivedGet) SetMethod

func (r *OrdersArchivedGet) SetMethod(method string)

func (*OrdersArchivedGet) SetRequestBody

func (r *OrdersArchivedGet) SetRequestBody(body OrdersArchivedGetBody)

func (*OrdersArchivedGet) URL

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

type OrdersArchivedGetBody

type OrdersArchivedGetBody struct {
}

type OrdersArchivedGetPathParams

type OrdersArchivedGetPathParams struct {
	Platform string
}

func (*OrdersArchivedGetPathParams) Params

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

type OrdersArchivedGetQueryParams

type OrdersArchivedGetQueryParams struct {
	Start DateTime `schema:"start,omitempty"`
	End   DateTime `schema:"end,omitempty"`
}

func (OrdersArchivedGetQueryParams) ToURLValues

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

type OrdersArchivedGetResponseBody

type OrdersArchivedGetResponseBody Orders

type PathParams

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

type Product

type Product struct {
	ID           string  `json:"id"`
	Posid        string  `json:"posid"`
	Number       string  `json:"number"`
	Name         string  `json:"name"`
	Category     string  `json:"category"`
	Instructions string  `json:"instructions"`
	Count        int     `json:"count"`
	UnitPrice    float64 `json:"unitPrice"`
	Price        float64 `json:"price"`
	SupFee       float64 `json:"supFee"`
	UnitDiscount float64 `json:"unitDiscount"`
	Subtotal     float64 `json:"subtotal"`
	VAT          float64 `json:"vat"`
	Deposit      float64 `json:"deposit"`
	SideDishes   []struct {
		ID      string      `json:"id"`
		Posid   string      `json:"posid"`
		Number  interface{} `json:"number"`
		Name    string      `json:"name"`
		Count   int         `json:"count"`
		Price   float64     `json:"price"`
		VAT     float64     `json:"vat"`
		Deposit float64     `json:"deposit"`
	} `json:"sideDishes"`
}

type Products

type Products []Product

type QueryParams

type QueryParams interface {
	ToURLValues() (url.Values, error)
}

type Request

type Request interface {
	Method() string
	// QueryParams() QueryParams
	PathParamsInterface() PathParams
	RequestBodyInterface() interface{}
	URL() *url.URL
}

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