-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
service_product_projection.go
128 lines (117 loc) · 5.22 KB
/
service_product_projection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Automatically generated, do not edit
package commercetools
import (
"context"
"fmt"
"net/url"
)
// ProductProjectionQuery allows querying for type ProductProjection
/*
You can use the product projections query endpoint to get the current or staged representations of Products.
When used with an API client that has the view_published_products:{projectKey} scope,
this endpoint only returns published (current) product projections.
*/
func (client *Client) ProductProjectionQuery(ctx context.Context, input *QueryInput) (result *ProductProjectionPagedQueryResponse, err error) {
endpoint := "product-projections"
err = client.query(ctx, endpoint, input.toParams(), &result)
if err != nil {
return nil, err
}
return result, nil
}
/*
ProductProjectionGetWithID Gets the current or staged representation of a product in a catalog by ID.
When used with an API client that has the view_published_products:{projectKey} scope,
this endpoint only returns published (current) product projections.
*/
func (client *Client) ProductProjectionGetWithID(ctx context.Context, id string, opts ...RequestOption) (result *ProductProjection, err error) {
params := url.Values{}
for _, opt := range opts {
opt(¶ms)
}
endpoint := fmt.Sprintf("product-projections/%s", id)
err = client.get(ctx, endpoint, params, &result)
if err != nil {
return nil, err
}
return result, nil
}
/*
ProductProjectionGetWithKey Gets the current or staged representation of a product found by Key.
When used with an API client that has the view_published_products:{projectKey} scope,
this endpoint only returns published (current) product projections.
*/
func (client *Client) ProductProjectionGetWithKey(ctx context.Context, key string, opts ...RequestOption) (result *ProductProjection, err error) {
params := url.Values{}
for _, opt := range opts {
opt(¶ms)
}
endpoint := fmt.Sprintf("product-projections/key=%s", key)
err = client.get(ctx, endpoint, params, &result)
if err != nil {
return nil, err
}
return result, nil
}
// ProductProjectionSearchInput is input for function ProductProjectionSearch
type ProductProjectionSearchInput struct {
Text map[string]string `url:"text"`
Facet []string `url:"facet,omitempty"`
FilterFacets []string `url:"filter.facets,omitempty"`
FilterQuery []string `url:"filter.query,omitempty"`
Filter []string `url:"filter,omitempty"`
Fuzzy bool `url:"fuzzy,omitempty"`
FuzzyLevel float64 `url:"fuzzyLevel,omitempty"`
MarkMatchingVariants bool `url:"markMatchingVariants,omitempty"`
Staged bool `url:"staged,omitempty"`
Limit float64 `url:"limit,omitempty"`
Offset float64 `url:"offset,omitempty"`
WithTotal bool `url:"withTotal,omitempty"`
LocaleProjection string `url:"localeProjection,omitempty"`
PriceChannel string `url:"priceChannel,omitempty"`
PriceCountry string `url:"priceCountry,omitempty"`
PriceCurrency string `url:"priceCurrency,omitempty"`
PriceCustomerGroup string `url:"priceCustomerGroup,omitempty"`
StoreProjection string `url:"storeProjection,omitempty"`
Expand []string `url:"expand,omitempty"`
}
/*
ProductProjectionSearch This endpoint provides high performance search queries over ProductProjections. The query result contains the
ProductProjections for which at least one ProductVariant matches the search query. This means that variants can
be included in the result also for which the search query does not match. To determine which ProductVariants match
the search query, the returned ProductProjections include the additional field isMatchingVariant.
*/
func (client *Client) ProductProjectionSearch(ctx context.Context, value *ProductProjectionSearchInput, opts ...RequestOption) (result *ProductProjectionPagedSearchResponse, err error) {
params := serializeQueryParams(value)
for _, opt := range opts {
opt(¶ms)
}
endpoint := "product-projections/search"
err = client.get(ctx, endpoint, params, &result)
if err != nil {
return nil, err
}
return result, nil
}
// ProductProjectionSuggestInput is input for function ProductProjectionSuggest
type ProductProjectionSuggestInput struct {
SearchKeywords map[string]string `url:"searchKeywords"`
Fuzzy bool `url:"fuzzy,omitempty"`
Staged bool `url:"staged,omitempty"`
Limit float64 `url:"limit,omitempty"`
Offset float64 `url:"offset,omitempty"`
WithTotal bool `url:"withTotal,omitempty"`
}
// ProductProjectionSuggest The source of data for suggestions is the searchKeyword field in a product
func (client *Client) ProductProjectionSuggest(ctx context.Context, value *ProductProjectionSuggestInput, opts ...RequestOption) (result *ProductProjection, err error) {
params := serializeQueryParams(value)
for _, opt := range opts {
opt(¶ms)
}
endpoint := "product-projections/suggest"
err = client.get(ctx, endpoint, params, &result)
if err != nil {
return nil, err
}
return result, nil
}