Function construct_url

Source
pub fn construct_url(
    base_url: &str,
    endpoint: &str,
    params: &impl Serialize,
    query: &impl Serialize,
) -> Result<String, IntoHttpError>
Expand description

Constructs a complete URL from a base URL, an endpoint, and parameters.

  • The base_url is the base URL of the API: https://api.trakt.tv.
  • The endpoint is the path of the specific endpoint with parameters enclosed in curly braces: /shows/{id}/seasons/{season}/episodes/{episode}.
  • The params is a struct that will be serialized into the parameters of the endpoint.
  • The query is a struct that will be serialized into the query parameters of the URL.

ยงErrors

Returns an IntoHttpError if the URL cannot be constructed.