Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertImgUrls(imgUrls []gjson.Result) []string
- func GetStartEndPrice(filter string) (startPrice float64, endPrice float64)
- func GetUri(host, apiName, query string) string
- type CompoundClient
- type DetailClient
- type Feature
- type Name
- type SearchClient
- type SearchItemsParameters
- func (p *SearchItemsParameters) CatId(categoryId string) *SearchItemsParameters
- func (p *SearchItemsParameters) Cn()
- func (p *SearchItemsParameters) En()
- func (p *SearchItemsParameters) EndPrice(endPrice float64) *SearchItemsParameters
- func (p *SearchItemsParameters) Ppath(ppath string) *SearchItemsParameters
- func (p *SearchItemsParameters) Q(query string) *SearchItemsParameters
- func (p *SearchItemsParameters) StartPrice(startPrice float64) *SearchItemsParameters
- func (p *SearchItemsParameters) ToXml() string
- func (p *SearchItemsParameters) VAreaId(vendorAreaId string) *SearchItemsParameters
- func (p *SearchItemsParameters) VId(vendorId string) *SearchItemsParameters
- func (p *SearchItemsParameters) VName(vendorName string) *SearchItemsParameters
- type SearchParam
Constants ¶
View Source
const ( InstanceKeyParam = `instanceKey` ItemIdParam = `itemId` DescEncodedString = `\"` DescDecodedString = `"` DescriptionPath = `OtapiItemDescription.ItemDescription` ItemParam = `itemParameters` ItemParamValue = `<Parameters AllowIncomplete="false" AllowDeleted="false" WaitingTime="500"/>` FullInfoPath = `OtapiItemFullInfo` AttributesPath = `Attributes.#(IsConfigurator==true)#` CombinationPath = `ConfiguredItems.#(Quantity!=0)#` PromotionsPath = `Promotions.#.ConfiguredItems` OptionName = `OriginalPropertyName` OptionValue = `OriginalValue` OptionImage = `ImageUrl` Configurators = `Configurators` )
View Source
const ( IdPath = "Id" TitlePath = "OriginalTitle" CategoryIdPath = "ExternalCategoryId" ProductUrlPath = "ExternalItemUrl" MainImgUrlPath = "MainPictureUrl" PricePath = "Price.OriginalPrice" ImgsPath = "Pictures.#.Url" ErrorPartialUrl = "img.alicdn.com/imgextra///img.alicdn.com/imgextra" FixPartialUrl = "img.alicdn.com/imgextra" )
Variables ¶
View Source
var ( DescFail = errors.New("get desc failed") DetailFail = errors.New("get detail failed") DescRegex = regexp.MustCompile("(?U)img\\.alicdn\\.com.*\\.jpg") )
View Source
var (
SearchFail = errors.New("search failed")
)
Functions ¶
func ConvertImgUrls ¶
func GetStartEndPrice ¶
Types ¶
type CompoundClient ¶
func NewCompoundClient ¶
func NewCompoundClient(apiKey string, searchLimit int) *CompoundClient
func (*CompoundClient) GetDetails ¶ added in v0.2.0
func (c *CompoundClient) GetDetails(items []model.Item) (chan model.DetailItem, error)
func (*CompoundClient) SearchAndGetDetail ¶
func (c *CompoundClient) SearchAndGetDetail(param *SearchParam) ([]model.DetailItem, error)
func (*CompoundClient) SearchAndGetDetailsMultiRequestOneTime ¶
func (c *CompoundClient) SearchAndGetDetailsMultiRequestOneTime(param *SearchParam) (chan model.DetailItem, error)
type DetailClient ¶
type DetailClient struct {
ApiKey string
}
func NewDetailClient ¶
func NewDetailClient(apiKey string) *DetailClient
func (*DetailClient) GetDescImgs ¶
func (c *DetailClient) GetDescImgs(id string) ([]string, error)
func (*DetailClient) GetDetail ¶
func (c *DetailClient) GetDetail(item model.Item) (*model.DetailItem, error)
type SearchClient ¶
type SearchClient struct {
ApiKey string
}
func NewSearchClient ¶
func NewSearchClient(apiKey string) *SearchClient
func (*SearchClient) SearchItems ¶
func (c *SearchClient) SearchItems(param SearchParam) (model.SearchResult, error)
func (*SearchClient) SearchTilLimit ¶ added in v0.2.0
func (c *SearchClient) SearchTilLimit(param *SearchParam, limit int) []model.Item
type SearchItemsParameters ¶
type SearchItemsParameters struct { Provider string `xml:"Provider"` SearchMethod string `xml:"SearchMethod"` CategoryMode string `xml:"CategoryMode"` CurrencyCode string `xml:"CurrencyCode"` IsSellAllowed bool `xml:"IsSellAllowed"` UseOptimalFameSize bool `xml:"UseOptimalFameSize"` Features []Feature `xml:"Features"` LanguageOfQuery *string `xml:"LanguageOfQuery"` BrandId *string `xml:"BrandId,omitempty"` // ppath CategoryId *string `xml:"CategoryId,omitempty"` VendorName *string `xml:"VendorName,omitempty"` VendorId *string `xml:"VendorId,omitempty"` VendorAreaId *string `xml:"VendorAreaId,omitempty"` ItemTitle *string `xml:"ItemTitle,omitempty"` // q MinPrice *float64 `xml:"MinPrice,omitempty"` // start price MaxPrice *float64 `xml:"MaxPrice,omitempty"` // end price }
func NewParams ¶
func NewParams() *SearchItemsParameters
func (*SearchItemsParameters) CatId ¶
func (p *SearchItemsParameters) CatId(categoryId string) *SearchItemsParameters
func (*SearchItemsParameters) Cn ¶ added in v0.0.4
func (p *SearchItemsParameters) Cn()
func (*SearchItemsParameters) En ¶ added in v0.0.4
func (p *SearchItemsParameters) En()
func (*SearchItemsParameters) EndPrice ¶
func (p *SearchItemsParameters) EndPrice(endPrice float64) *SearchItemsParameters
func (*SearchItemsParameters) Ppath ¶
func (p *SearchItemsParameters) Ppath(ppath string) *SearchItemsParameters
func (*SearchItemsParameters) Q ¶
func (p *SearchItemsParameters) Q(query string) *SearchItemsParameters
func (*SearchItemsParameters) StartPrice ¶
func (p *SearchItemsParameters) StartPrice(startPrice float64) *SearchItemsParameters
func (*SearchItemsParameters) ToXml ¶
func (p *SearchItemsParameters) ToXml() string
func (*SearchItemsParameters) VAreaId ¶
func (p *SearchItemsParameters) VAreaId(vendorAreaId string) *SearchItemsParameters
func (*SearchItemsParameters) VId ¶
func (p *SearchItemsParameters) VId(vendorId string) *SearchItemsParameters
func (*SearchItemsParameters) VName ¶
func (p *SearchItemsParameters) VName(vendorName string) *SearchItemsParameters
type SearchParam ¶
type SearchParam struct { Page int PageSize int XmlParameters *SearchItemsParameters }
func SearchParamFromUri ¶
func SearchParamFromUri(page int, uri string) SearchParam
func (SearchParam) ToQuery ¶
func (p SearchParam) ToQuery(apiKey string) string
Click to show internal directories.
Click to hide internal directories.