pa

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenInfo

type GenInfo struct {
	DisplayValue string
	Label        string `json:",omitempty"`
	Locale       string `json:",omitempty"`
}

type GenInfoFloat

type GenInfoFloat struct {
	DisplayValue float64
	Label        string `json:",omitempty"`
	Locale       string `json:",omitempty"`
}

type GenInfoInt

type GenInfoInt struct {
	DisplayValue int
	Label        string `json:",omitempty"`
	Locale       string `json:",omitempty"`
}

type GenInfoTime

type GenInfoTime struct {
	DisplayValue values.Date
	Label        string `json:",omitempty"`
	Locale       string `json:",omitempty"`
}

type IdInfo

type IdInfo struct {
	DisplayValues []string
	Label         string `json:",omitempty"`
	Locale        string `json:",omitempty"`
}

type Item

type Item struct {
	ASIN          string
	DetailPageURL string
	Images        *struct {
		Primary *struct {
			Medium *entity.BookCover `json:",omitempty"`
		} `json:",omitempty"`
	} `json:",omitempty"`
	ItemInfo *struct {
		ByLineInfo *struct {
			Brand        *GenInfo `json:",omitempty"`
			Manufacturer *GenInfo `json:",omitempty"`
			Contributors []struct {
				Name   string
				Locale string
				Role   string
			}
		} `json:",omitempty"`
		Classifications *struct {
			Binding      GenInfo
			ProductGroup GenInfo
		} `json:",omitempty"`
		ContentInfo *struct {
			Edition   *GenInfo `json:",omitempty"`
			Languages struct {
				DisplayValues []struct {
					DisplayValue string
					Type         string
				}
				Label  string
				Locale string
			}
			PagesCount struct {
				DisplayValue int
				Label        string
				Locale       string
			}
			PublicationDate GenInfoTime
		} `json:",omitempty"`
		ExternalIds *struct {
			EANs  *IdInfo `json:",omitempty"`
			ISBNs *IdInfo `json:",omitempty"`
			UPCs  *IdInfo `json:",omitempty"`
		} `json:",omitempty"`
		ProductInfo *struct {
			Color          *GenInfo `json:",omitempty"`
			IsAdultProduct struct {
				DisplayValue bool
				Label        string
				Locale       string
			}
			ItemDimensions *struct {
				Height *GenInfoFloat `json:",omitempty"`
				Length *GenInfoFloat `json:",omitempty"`
				Weight *GenInfoFloat `json:",omitempty"`
				Width  *GenInfoFloat `json:",omitempty"`
			} `json:",omitempty"`
			ReleaseDate *GenInfoTime `json:",omitempty"`
			Size        *GenInfo     `json:",omitempty"`
			UnitCount   *GenInfoInt  `json:",omitempty"`
		} `json:",omitempty"`
		Title *GenInfo `json:",omitempty"`
	}
}

func (*Item) BookCover

func (i *Item) BookCover() entity.BookCover

func (*Item) Codes

func (i *Item) Codes() []entity.Code

func (*Item) Creators

func (i *Item) Creators() []entity.Creator

func (*Item) LastRelease

func (i *Item) LastRelease() values.Date

func (*Item) ProductType

func (i *Item) ProductType() string

func (*Item) PublicationDate

func (i *Item) PublicationDate() values.Date

func (*Item) Publisher

func (i *Item) Publisher() string

func (*Item) Title

func (i *Item) Title() string

type PAAPI5

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

PAAPI5 is a api.API class for PA-API v5

func New

func New(marketplace, associateTag, accessKey, secretKey string) *PAAPI5

New returns PaAPI instance

func (*PAAPI5) LookupBook

func (a *PAAPI5) LookupBook(ctx context.Context, id string) (*entity.Book, error)

/LookupBook returns Book data from PA-API

func (*PAAPI5) LookupRawData

func (a *PAAPI5) LookupRawData(ctx context.Context, id string) (io.Reader, error)

/LookupRawData returns PA-API raw data

func (*PAAPI5) Name

func (a *PAAPI5) Name() string

Name returns name of API

type Price

type Price struct {
	DisplayAmount string
	Amount        float64
	Currency      string
}

type Query

type Query struct {
	OpeCode     paapi5.Operation `json:"Operation"`
	Marketplace string
	PartnerTag  string
	PartnerType string
	ItemIds     []string `json:",omitempty"`
	ItemIdType  string   `json:",omitempty"`
	Resources   []string `json:",omitempty"`
}

Query is query data class for PA-API v5

func NewQuery

func NewQuery(marketplace, partnerTag, partnerType string, itms []string) *Query

NewQuery creates new Query instance

func (*Query) Operation

func (q *Query) Operation() paapi5.Operation

func (*Query) Payload

func (q *Query) Payload() ([]byte, error)

func (*Query) String

func (q *Query) String() string

type Response

type Response struct {
	Errors []struct {
		Code    string
		Message string
	} `json:",omitempty"`
	ItemsResult struct {
		Items []Item `json:",omitempty"`
	}
}

func (*Response) CheckError

func (r *Response) CheckError() error

func (*Response) JSON

func (r *Response) JSON() ([]byte, error)

JSON returns JSON data from Response instance

func (*Response) Output

func (r *Response) Output(typeName string) (*entity.Book, error)

func (*Response) String

func (r *Response) String() string

Stringer

Jump to

Keyboard shortcuts

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