Skip to content

Commit

Permalink
add fixed VariationsResult in Response
Browse files Browse the repository at this point in the history
  • Loading branch information
Oakes6 committed Feb 13, 2024
1 parent 3db3b21 commit 03288fe
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,17 @@ type Response struct {
SearchURL string
TotalResultCount int
} `json:",omitempty"`
VariationSummary *struct {
PageCount int
VariationCount int
Price *struct {
HighestPrice *Price `json:",omitempty"`
LowestPrice *Price `json:",omitempty"`
VariationsResult *struct {
Items []Item `json:",omitempty"`
VariationSummary *struct {
PageCount int
VariationCount int
Price *struct {
HighestPrice *Price `json:",omitempty"`
LowestPrice *Price `json:",omitempty"`
} `json:",omitempty"`
VariationDimensions []VariationDimension `json:",omitempty"`
} `json:",omitempty"`
VariationDimensions []VariationDimension `json:",omitempty"`
} `json:",omitempty"`
BrowseNodesResult *struct {
BrowseNodes []*struct {
Expand All @@ -300,7 +303,7 @@ type Response struct {
} `json:",omitempty"`
}

//DecodeResponse returns array of Response instance from byte buffer
// DecodeResponse returns array of Response instance from byte buffer
func DecodeResponse(b []byte) (*Response, error) {
rsp := Response{}
if err := json.NewDecoder(bytes.NewReader(b)).Decode(&rsp); err != nil {
Expand All @@ -309,13 +312,13 @@ func DecodeResponse(b []byte) (*Response, error) {
return &rsp, nil
}

//JSON returns JSON data from Response instance
// JSON returns JSON data from Response instance
func (r *Response) JSON() ([]byte, error) {
b, err := json.Marshal(r)
return b, errs.Wrap(err)
}

//Stringer
// Stringer
func (r *Response) String() string {
b, err := r.JSON()
if err != nil {
Expand Down

0 comments on commit 03288fe

Please sign in to comment.