models

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package models contains models needed to work with api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonError added in v0.2.0

type CommonError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

CommonError error structure common for most of responses.

func (CommonError) Error added in v0.4.0

func (e CommonError) Error() string

Error implement error interface.

type CommonErrors added in v0.4.0

type CommonErrors []CommonError

CommonErrors list of CommonError.

func (CommonErrors) Error added in v0.4.0

func (e CommonErrors) Error() string

type CommonPagingOptions added in v0.4.0

type CommonPagingOptions struct {
	PageNumber int32
	PageSize   int32
	Limit      int32
	Offset     int32
}

CommonPagingOptions common paging options.

type CommonResponse added in v0.2.0

type CommonResponse struct {
	Errors CommonErrors `json:"errors"`
	Status Status       `json:"status"`
}

CommonResponse response structure common for most of responses.

type Content

type Content struct {
	Status              Status `json:"status"`
	TotalOffersCount    int64  `json:"totalOffersCount"`
	RejectedOffersCount int64  `json:"rejectedOffersCount"`
}

Content describes feed offer status.

type Currency added in v0.4.0

type Currency string

Currency is enum for yandex market currencies.

const (
	// CurrencyRUR is russian ruble.
	CurrencyRUR Currency = "RUR"
	// CurrencyBYN is belarussian ruble.
	CurrencyBYN Currency = "BYN"
	// CurrencyKZT is kazakh tenge.
	CurrencyKZT Currency = "KZT"
	// CurrencyUAH is ukrainian grivna.
	CurrencyUAH Currency = "UAH"
)

type Download

type Download struct {
	Status Status `json:"status"`
}

Download describes download status.

type ExploreOffersResponse added in v0.3.0

type ExploreOffersResponse struct {
	Offers []OfferExploreModel `json:"offers"`
	Pager  Pager               `json:"pager"`
}

ExploreOffersResponse explore response structure.

type ExploreOption added in v0.4.0

type ExploreOption func(*ExploreOptions)

ExploreOption modifies ExploreOptions.

func WithCurrencyExploreOption added in v0.4.0

func WithCurrencyExploreOption(currency Currency) ExploreOption

WithCurrencyExploreOption sets currency.

func WithFeedIDExploreOption added in v0.4.0

func WithFeedIDExploreOption(feedID int64) ExploreOption

WithFeedIDExploreOption sets feedID.

func WithMatchedExploreOption added in v0.4.0

func WithMatchedExploreOption(matched bool) ExploreOption

WithMatchedExploreOption sets Matched.

func WithPaginationExploreOption added in v0.4.0

func WithPaginationExploreOption(pageNumber, pageSize int32) ExploreOption

WithPaginationExploreOption sets pageNumber and pageSize.

func WithQueryExploreOption added in v0.4.0

func WithQueryExploreOption(query string) ExploreOption

WithQueryExploreOption sets Query.

func WithShopCategoryIDExploreOption added in v0.4.0

func WithShopCategoryIDExploreOption(shopCategoryID string) ExploreOption

WithShopCategoryIDExploreOption sets ShopCategoryID.

type ExploreOptions added in v0.3.0

type ExploreOptions struct {
	Currency       Currency
	FeedID         int64
	Matched        bool
	Query          string
	ShopCategoryID string
	PageNumber     int32
	PageSize       int32
}

ExploreOptions describes exploring option to get campaign offers. Doc: https://yandex.ru/dev/market/partner/doc/dg/reference/get-campaigns-id-offers.html.

func (ExploreOptions) ToQueryArgs added in v0.4.0

func (o ExploreOptions) ToQueryArgs() url.Values

ToQueryArgs converts options to query args according to documentation of yandex market API.

type Feed

type Feed struct {
	ID          int64       `json:"id"`
	URL         string      `json:"url"`
	Download    Download    `json:"download"`
	Content     Content     `json:"content"`
	Publication Publication `json:"publication"`
	Placement   Download    `json:"placement"`
}

Feed feed structure.

type FeedObj added in v0.2.0

type FeedObj struct {
	ID int64 `json:"id"`
}

FeedObj describes feed.

type FeedResponse

type FeedResponse struct {
	Feeds []Feed `json:"feeds"`
}

FeedResponse feeds response structure.

type GetHiddenOfferResponse added in v0.2.0

type GetHiddenOfferResponse struct {
	Errors CommonErrors         `json:"errors"`
	Result GetHiddenOfferResult `json:"result"`
	Status Status               `json:"status"`
}

GetHiddenOfferResponse response structure.

type GetHiddenOfferResult added in v0.2.0

type GetHiddenOfferResult struct {
	HiddenOffers []HiddenOffer `json:"hiddenOffers"`
	Total        int64         `json:"total"`
	Paging       Paging        `json:"paging"`
}

GetHiddenOfferResult get hidden offers result structure.

type GetHiddenOffersOption added in v0.4.0

type GetHiddenOffersOption func(*GetHiddenOffersOptions)

GetHiddenOffersOption modifies PaginationOptions.

func WithFeedID added in v0.4.0

func WithFeedID(feedID int64) GetHiddenOffersOption

WithFeedID sets feed id.

func WithLimit added in v0.4.0

func WithLimit(limit int32) GetHiddenOffersOption

WithLimit sets limit.

func WithOfferID added in v0.4.0

func WithOfferID(offerID string) GetHiddenOffersOption

WithOfferID sets offer id.

func WithOffset added in v0.4.0

func WithOffset(offset int32) GetHiddenOffersOption

WithOffset sets offset.

func WithPageSizeAndNumber added in v0.4.0

func WithPageSizeAndNumber(size, number int32) GetHiddenOffersOption

WithPageSizeAndNumber sets page size and number.

func WithPageToken added in v0.4.0

func WithPageToken(token string) GetHiddenOffersOption

WithPageToken sets page token.

type GetHiddenOffersOptions added in v0.4.0

type GetHiddenOffersOptions struct {
	CommonPagingOptions

	PageToken string

	OfferID string
	FeedID  int64
}

GetHiddenOffersOptions describes pagination options for get hidden offers request. Docs: https://yandex.ru/dev/market/partner/doc/dg/reference/get-campaigns-id-hidden-offers.html .

func (*GetHiddenOffersOptions) ToQueryArgs added in v0.4.0

func (o *GetHiddenOffersOptions) ToQueryArgs() url.Values

ToQueryArgs converts options to query args according to documentation of yandex market API.

type GetOfferPricesOption added in v0.4.0

type GetOfferPricesOption func(*GetOfferPricesOptions)

GetOfferPricesOption modifies GetOfferPricesOptions.

func WithLimitAndOffsetPriceOption added in v0.4.0

func WithLimitAndOffsetPriceOption(limit, offset int32) GetOfferPricesOption

WithLimitAndOffsetPriceOption sets limit and offset.

func WithPageNumberAndSizePriceOption added in v0.4.0

func WithPageNumberAndSizePriceOption(number, size int32) GetOfferPricesOption

WithPageNumberAndSizePriceOption sets page number and page size.

type GetOfferPricesOptions added in v0.4.0

type GetOfferPricesOptions struct {
	CommonPagingOptions
}

GetOfferPricesOptions describes pagination option for offers with prices set via API. Docs: https://yandex.ru/dev/market/partner/doc/dg/reference/get-campaigns-id-offer-prices.html

func (GetOfferPricesOptions) ToQueryArgs added in v0.4.0

func (o GetOfferPricesOptions) ToQueryArgs() url.Values

ToQueryArgs converts options to query args according to documentation of yandex market API.

type GetPriceOfferModel added in v0.2.0

type GetPriceOfferModel struct {
	Feed      Feed   `json:"feed"`
	ID        string `json:"id"`
	Price     Price  `json:"price"`
	UpdatedAt string `json:"updatedAt"`
}

GetPriceOfferModel offer model for get price response.

type GetPricesResponse added in v0.2.0

type GetPricesResponse struct {
	Errors CommonErrors `json:"errors"`
	Result Result       `json:"result"`
	Status Status       `json:"status"`
}

GetPricesResponse get price response structure.

type HiddenOffer added in v0.2.0

type HiddenOffer struct {
	FeedID     int64  `json:"feedId"`
	OfferID    string `json:"offerId"`
	Comment    string `json:"comment"`
	TTLInHours int64  `json:"ttlInHours"`
}

HiddenOffer is a structure of offer to hide.

type Offer added in v0.2.0

type Offer struct {
	Feed   FeedObj `json:"feed"`
	ID     string  `json:"id"`
	Delete bool    `json:"delete"`
	Price  Price   `json:"price"`
}

Offer describes offer structure.

type OfferExploreModel added in v0.3.0

type OfferExploreModel struct {
	Bid              float64 `json:"bid"`
	Currency         string  `json:"currency"`
	CutPrice         bool    `json:"cutPrice"`
	Discount         int64   `json:"discount"`
	FeedID           int64   `json:"feedId"`
	ID               string  `json:"id"`
	MarketCategoryID int64   `json:"marketCategoryId"`
	ModelID          int64   `json:"modelId"`
	PreDiscountPrice float64 `json:"preDiscountPrice"`
	Price            float64 `json:"price"`
	ShopCategoryID   string  `json:"shopCategoryId"`
	Name             string  `json:"name"`
	URL              string  `json:"url"`
}

OfferExploreModel explore response offer model.

type OfferHideRequest added in v0.2.0

type OfferHideRequest struct {
	HiddenOffers []HiddenOffer `json:"hiddenOffers"`
}

OfferHideRequest hide offers request body structure.

type OfferToUnhide added in v0.2.0

type OfferToUnhide struct {
	FeedID  int64  `json:"feedId"`
	OfferID string `json:"offerId"`
}

OfferToUnhide describes offer to unhide.

type OfferUnhideRequest added in v0.2.0

type OfferUnhideRequest struct {
	HiddenOffers []OfferToUnhide `json:"hiddenOffers"`
}

OfferUnhideRequest unhide request body.

type Pager added in v0.3.0

type Pager struct {
	CurrentPage int64 `json:"currentPage"`
	From        int64 `json:"from"`
	PagesCount  int64 `json:"pagesCount"`
	PageSize    int64 `json:"pageSize"`
	To          int64 `json:"to"`
	Total       int64 `json:"total"`
}

Pager describes pagination status.

type Paging added in v0.2.0

type Paging struct {
	PrevPageToken string `json:"prevPageToken"`
	NextPageToken string `json:"nextPageToken"`
}

Paging contains page tokens to use in further requests.

type Price added in v0.2.0

type Price struct {
	CurrencyID   Currency `json:"currencyId"`
	Value        float64  `json:"value"`
	DiscountBase float64  `json:"discountBase,omitempty"`
}

Price describes offer price.

type Publication

type Publication struct {
	Full                Time   `json:"full"`
	PriceAndStockUpdate Time   `json:"priceAndStockUpdate"`
	Status              Status `json:"status"`
}

Publication describes publication status.

type Result added in v0.2.0

type Result struct {
	Offers []GetPriceOfferModel `json:"offers"`
	Total  int64                `json:"total"`
}

Result is a get prices response result.

type SetPriceRequest added in v0.2.0

type SetPriceRequest struct {
	Offers []Offer `json:"offers"`
}

SetPriceRequest is set price body.

type SetPriceResponse added in v0.2.0

type SetPriceResponse struct {
	Status Status `json:"status"`
}

SetPriceResponse set price response structure.

type Status

type Status string

Status is a status.

const (
	// StatusNa not available.
	StatusNa Status = "NA"
	// StatusOk everything is ok.
	StatusOk Status = "OK"
	// StatusError some error happened.
	StatusError Status = "ERROR"
)

func (Status) IsError added in v0.4.1

func (s Status) IsError() bool

IsError returns true if status is StatusError.

type Time added in v0.4.0

type Time struct {
	FileTime      string `json:"fileTime"`
	PublishedTime string `json:"publishedTime"`
}

Time describes action time.

Jump to

Keyboard shortcuts

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