client

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRetryCount    = 3
	RetryWaitTime    = 1 * time.Second
	MaxRetryWaitTime = 5 * time.Second
	Rows             = 10
)

Variables

This section is empty.

Functions

func CSVHeader

func CSVHeader(w io.Writer, compact bool)

Types

type Book

type Book struct {
	ProductID           string          `json:"product_id"`
	Translated          string          `json:"translated"`
	PublishingStatus    string          `json:"publishing_status"`
	LastUpdate          time.Time       `json:"last_update"`
	ProductStatus       bool            `json:"product_status"`
	Lcx                 bool            `json:"lcx"`
	AddProductTs        time.Time       `json:"add_product_ts"`
	ProductFormID       string          `json:"product_form_id"`
	ProductForm         string          `json:"product_form"`
	ProductKind         string          `json:"product_kind"`
	PubID               string          `json:"pub_id"`
	PubName             string          `json:"pub_name"`
	Imprint             string          `json:"imprint"`
	Pages               int64           `json:"pages"`
	DistinctiveTitle    string          `json:"distinctive_title"`
	DistinctiveSubtitle string          `json:"distinctive_subtitle"`
	Description         string          `json:"description"`
	ThemaCode           []string        `json:"thema_code"`
	Classification      []string        `json:"classification"`
	Category            []string        `json:"category"`
	Audience            []string        `json:"audience"`
	Language            []string        `json:"language"`
	EditionNo           int64           `json:"edition_no"`
	City                string          `json:"city"`
	PubMonth            uint8           `json:"pub_month"`
	PubYear             uint16          `json:"pub_year"`
	PubDay              uint8           `json:"pub_day"`
	LicenseNo           int64           `json:"license_no"`
	Lcno                int64           `json:"lcno"`
	GTin13              string          `json:"gtin13"`
	Prefix              string          `json:"prefix"`
	Isbn13              string          `json:"isbn13"`
	ContrID             []string        `json:"contr_id"`
	ContrName           []string        `json:"contr_name"`
	ContrIDRole         []string        `json:"contr_id_role"`
	ContrIDTab          []string        `json:"contr_id_tab"`
	ContrRole           []string        `json:"contr_role"`
	ContrDenoms         []string        `json:"contr_denoms"`
	LastPriceUpdate     time.Time       `json:"last_price_update"`
	Price               decimal.Decimal `json:"price"`
	PriceChange         decimal.Decimal `json:"price_change"`
	Vat                 decimal.Decimal `json:"vat"`
	VatChange           decimal.Decimal `json:"vat_change"`
	PriceType           string          `json:"price_type"`
	PriceValidUntil     time.Time       `json:"price_valid_until"`
	Cover               string          `json:"cover"`
	CoverBack           string          `json:"cover_back"`
	Version             int64           `json:"_version_"`
}

func (*Book) CSVRow

func (b *Book) CSVRow(w io.Writer, compact bool)

type Client

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

func New

func New(opts Opts) (*Client, error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, verbose bool) (*Response, error)

type CompactBook

type CompactBook struct {
	ProductID        string          `json:"product_id"`
	PublishingStatus string          `json:"publishing_status"`
	PubID            string          `json:"pub_id"`
	PubName          string          `json:"pub_name"`
	Isbn13           string          `json:"isbn13"`
	DistinctiveTitle string          `json:"distinctive_title"`
	LastUpdate       time.Time       `json:"last_update"`
	LastPriceUpdate  time.Time       `json:"last_price_update"`
	PriceValidUntil  time.Time       `json:"price_valid_until"`
	Price            decimal.Decimal `json:"price"`
	PriceChange      decimal.Decimal `json:"price_change"`
	Vat              decimal.Decimal `json:"vat"`
	VatChange        decimal.Decimal `json:"vat_change"`
	PriceType        string          `json:"price_type"`
}

type Data

type Data struct {
	NumFound      int64  `json:"numFound"`
	Start         int64  `json:"start"`
	NumFoundExact bool   `json:"numFoundExact"`
	Docs          []Book `json:"docs"`
}

type Opts

type Opts struct {
	URL              string
	MaxRetryCount    *int           // Max retry count for the request. Default is 3.
	RetryWaitTime    *time.Duration // Wait time between retry attempts. Default is 1 second.
	MaxRetryWaitTime *time.Duration // Maximum wait time between retry attempts. Default is 3 seconds.
	User             string         // Username for the authorization of the request.
	Password         string         // Password for the authorization of the request.
	Rows             *int64         // Number of rows to fetch. Default is 10.
	Query            *string        // Query to search for. Default is "*:*".
}

type QueryParams

type QueryParams struct {
	Q      string `json:"q"`
	Indent bool   `json:"indent,omitempty"`
	Wt     string `json:"wt,omitempty"`
	Start  int64  `json:"start,omitempty"`
	Rows   string `json:"rows,omitempty"`
}

type Response

type Response struct {
	ResponseHeader ResponseHeader `json:"responseHeader"`
	Response       Data           `json:"response"`
}

type ResponseHeader

type ResponseHeader struct {
	Status int64       `json:"status"`
	QTime  int64       `json:"QTime"`
	Params QueryParams `json:"params"`
}

Jump to

Keyboard shortcuts

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