Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fixed VariationsResult in Response #35

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading