next

package
v0.0.0-...-0140298 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointGetExtendedOptions is an endpoint for extended options retrieval
	EndpointGetExtendedOptions = "/itemstock/getextendedoptions"

	// EndpointSearch is an endpoint to search items
	EndpointSearch = "/search"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError error

APIError represents various Next API errors which may occur

type Client

type Client struct {
	HTTPClient HTTPClient
	BaseURL    string
	Language   string
}

Client is a wrapper for some Next APIs

func NewClient

func NewClient(httpClient HTTPClient, c Config) *Client

NewClient creates a Next client

func (*Client) FindOptionBySize

func (c *Client) FindOptionBySize(options []shop.ItemOption, size int) (shop.ItemOption, bool)

func (*Client) GetItemExtendedOption

func (c *Client) GetItemExtendedOption(article string) (shop.ItemExtendedOption, error)

GetItemExtendedOption fetches available options information for particular article

func (*Client) GetItemOption

func (c *Client) GetItemOption(article string, size int) (shop.ItemOption, error)

GetItemOption fetches a single option object for article and size combination

func (*Client) GetItemURLByArticle

func (c *Client) GetItemURLByArticle(article string) (string, error)

func (*Client) GetOptionsByArticle

func (c *Client) GetOptionsByArticle(article string) ([]shop.ItemOption, error)

GetOptionsByArticle fetched item options by article

type Config

type Config struct {
	BaseURL string
	Lang    string
}

Config holds necessary configuration for HTTPClient

type HTTPClient

type HTTPClient interface {
	Get(url string) (resp *http.Response, err error)
}

HTTPClient interface to be implemented by different clients

type NextClient

type NextClient interface {
	GetOptionsByArticle(article string) ([]shop.ItemOption, error)
	GetItemOption(article string, size int) (shop.ItemOption, error)
	GetItemExtendedOption(article string) (shop.ItemExtendedOption, error)
	FindOptionBySize(options []shop.ItemOption, size int) (shop.ItemOption, bool)
	GetItemURLByArticle(article string) (string, error)
}

Directories

Path Synopsis
bot

Jump to

Keyboard shortcuts

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