-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add sort option commands #175
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
feat: add sort option commands #175
Conversation
Mudaafi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. I had some implementation suggestions, but looking at the timeline, I might just push those changes up directly
| private String sortBy; | ||
|
|
||
| @SerializedName("sort_order") | ||
| private String sortOrder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since sort_order can only be one of two values "ascending" | "descending", would it be better to type it as an enum?
| * @return returns the sort options response | ||
| * @throws ConstructorException if the request is invalid | ||
| */ | ||
| public SortOptionsResponse retrieveSortOptions(String section, String sortBy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having this overload, we would probably prefer having an overload that takes in a RetrieveSortOptionsRequest so that we cover all the different request parameters.
| * @return returns the deleted sort options as JSON string | ||
| * @throws ConstructorException if the request is invalid | ||
| */ | ||
| public String deleteSortOptions(String sortBy, String sortOrder, String section) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method only deletes one sort option. We can keep this method for ease of use and rename it as deleteSortOption, but we should have another method that takes in an array of sortOptions to allow for the deletion of multiple options at once
evanyan13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Left some lint-related comments for consideration please
| } | ||
|
|
||
| /** | ||
| * Retrieves all sort options with default section "Products" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment here is meant to be:
Retrieves all sort options with provided sortBy value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
| public void sortOptionDeserialization() throws Exception { | ||
| String json = | ||
| "{" | ||
| + "\"display_name\": \"Preis\"," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be "Price"?
Or is this left as a weird value by intention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's German. I'll change it to be Price
| + "\"total_count\": 2," | ||
| + "\"sort_options\": [" | ||
| + " {" | ||
| + " \"display_name\": \"Preis\"," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is missing the ability to batch-create sort options. Will add it in a future PR. Tests pass locally.
Adds the possibility to manage (CRUD) the sort options through the java client.
I used the docs regarding the sort option management to create the operations and tested it to be working. Also created an integration test to hopefully prove that it's working as intended.