elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
705 stars 72 forks source link

[ENHANCEMENT] Model API Url part variants as enums #8

Closed russcam closed 4 years ago

russcam commented 4 years ago

Relates: #2

The Url parts within a API Url variants should be modelled as an enum. For example, for the search API

pub enum SearchParts {
    None,
    Index(Vec<String>),
    IndexType(Vec<String>, Vec<String>),
}

(the Vec<String> would be reference such as &[&str], but this can be addressed later).

Modelling as enums prevents a user from being able to specify a URL part that can only be provided when another URL part is also specified. The parts enums can be generated from the REST API spec.