Skip to main content

SimklRequest

Trait SimklRequest 

Source
pub trait SimklRequest {
    // Required method
    fn endpoint(&self) -> String;

    // Provided methods
    fn method(&self) -> HttpMethod { ... }
    fn query_params(&self) -> Vec<(String, String)> { ... }
    fn headers(&self) -> Vec<(String, String)> { ... }
    fn build_url(&self) -> String { ... }
}
Expand description

A URL-and-query-parameter description for a Simkl API endpoint.

This trait models GET endpoints — the ones whose entire request is captured by URL + query string. POST endpoints with a JSON body (checkin, sync/history, sync/ratings, sync/add-to-list) do not implement this trait; their payload types are serialised directly via serde_json.

Required Methods§

Source

fn endpoint(&self) -> String

The path segment starting with / (e.g. "/tv/12345").

Provided Methods§

Source

fn method(&self) -> HttpMethod

HTTP verb; defaults to GET.

Source

fn query_params(&self) -> Vec<(String, String)>

Query-string key/value pairs. Values are URL-encoded in [build_url].

Source

fn headers(&self) -> Vec<(String, String)>

Extra headers to attach to the request.

Source

fn build_url(&self) -> String

Assemble the full URL (API_URL + endpoint + "?" + encoded params).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§