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

Map URL parts to builders #2

Closed
russcam opened this issue Sep 25, 2019 · 1 comment
Closed

Map URL parts to builders #2

russcam opened this issue Sep 25, 2019 · 1 comment
Assignees
Labels
todo Required for a working alpha implementation

Comments

@russcam
Copy link
Contributor

russcam commented Sep 25, 2019

Each API endpoint maps to one or more URL paths, where each path may contain placeholders for URL parts that should be replaced with values supplied by the user. For example, _search has the following paths in 7.3.1 Rest API spec

/_search
/{index}/_search

The builder for the _search API, Search, should contain an index field that when set, results in the API call using the path specifying the index. It's envisaged that this will require

  1. An index field on the `Search struct
  2. An index function on Search implementation that sets the index field
  3. An implementation in the Sender trait send() function that checks whether index has a value and if it does, creates a path by replacing {index} in /{index}/_search with the index value, and uses this for the API function.

This implementation can be entirely generated from the REST API spec.

@russcam russcam added the todo Required for a working alpha implementation label Sep 25, 2019
@russcam russcam assigned russcam and unassigned russcam Oct 30, 2019
@russcam
Copy link
Contributor Author

russcam commented Nov 15, 2019

This has been implemented in 08dd846, patterning matching on tuples of the optional URL parts, where each optional part may be set or not (Some(T) or None). An optional part is a URL part that is not required by all URL variants for an API.

This implementation is problematic per the commit message in 08dd846. Closing this issue in favour of opening a new issue to track replacing the implementation with enums

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
todo Required for a working alpha implementation
Projects
None yet
Development

No branches or pull requests

1 participant