Skip to content

Commit

Permalink
Merge pull request #35 from Oakes6/bugs/variations
Browse files Browse the repository at this point in the history
add fixed VariationsResult in Response
  • Loading branch information
spiegel-im-spiegel committed Feb 13, 2024
2 parents 3db3b21 + 03288fe commit 17c8339
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 17c8339

Please sign in to comment.