git_cliff_core::remote

Trait RemoteClient

source
pub trait RemoteClient {
    // Required methods
    fn api_url() -> String;
    fn remote(&self) -> Remote;
    fn client(&self) -> ClientWithMiddleware;

    // Provided methods
    fn early_exit<T: DeserializeOwned + RemoteEntry>(&self, page: &T) -> bool { ... }
    async fn get_entry<T: DeserializeOwned + RemoteEntry>(
        &self,
        project_id: i64,
        page: i32,
    ) -> Result<T> { ... }
    async fn get_entries_with_page<T: DeserializeOwned + RemoteEntry>(
        &self,
        project_id: i64,
        page: i32,
    ) -> Result<Vec<T>> { ... }
    async fn fetch<T: DeserializeOwned + RemoteEntry>(
        &self,
        project_id: i64,
    ) -> Result<Vec<T>> { ... }
    async fn fetch_with_early_exit<T: DeserializeOwned + RemoteEntry>(
        &self,
        project_id: i64,
    ) -> Result<Vec<T>> { ... }
}
Available on crate feature remote only.
Expand description

Trait for handling the API connection and fetching.

Required Methods§

source

fn api_url() -> String

Returns the API url.

source

fn remote(&self) -> Remote

Returns the remote repository information.

source

fn client(&self) -> ClientWithMiddleware

Returns the HTTP client for making requests.

Provided Methods§

source

fn early_exit<T: DeserializeOwned + RemoteEntry>(&self, page: &T) -> bool

Returns true if the client should early exit.

source

async fn get_entry<T: DeserializeOwned + RemoteEntry>( &self, project_id: i64, page: i32, ) -> Result<T>

Retrieves a single object.

source

async fn get_entries_with_page<T: DeserializeOwned + RemoteEntry>( &self, project_id: i64, page: i32, ) -> Result<Vec<T>>

Retrieves a single page of entries.

source

async fn fetch<T: DeserializeOwned + RemoteEntry>( &self, project_id: i64, ) -> Result<Vec<T>>

Fetches the remote API and returns the given entry.

See fetch_with_early_exit for the early exit version of this method.

source

async fn fetch_with_early_exit<T: DeserializeOwned + RemoteEntry>( &self, project_id: i64, ) -> Result<Vec<T>>

Fetches the remote API and returns the given entry.

Early exits based on the response.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl RemoteClient for BitbucketClient

Available on crate feature bitbucket only.
source§

impl RemoteClient for GiteaClient

Available on crate feature gitea only.
source§

impl RemoteClient for GitHubClient

Available on crate feature github only.
source§

impl RemoteClient for GitLabClient

Available on crate feature gitlab only.