pub trait Provider {
type Project: DeserializeOwned + Project;
type Error: DeserializeOwned + JsonError;
fn new(
filter: Filter,
secret_token: AuthToken,
api_url_override: Option<String>
) -> Result<Self, String>
where
Self: Sized;
fn filter(&self) -> &Filter;
fn secret_token(&self) -> &AuthToken;
fn auth_header_key() -> &'static str;
fn get_user_projects(
&self,
user: &str
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>;
fn get_group_projects(
&self,
group: &str
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>;
fn get_accessible_projects(
&self
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>;
fn get_current_user(&self) -> Result<String, ApiErrorResponse<Self::Error>>;
fn get_own_projects(
&self
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>> { ... }
fn call_list(
&self,
uri: &str,
accept_header: Option<&str>
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>> { ... }
fn get_repos(
&self,
worktree_setup: bool,
force_ssh: bool,
remote_name: Option<String>
) -> Result<HashMap<Option<String>, Vec<Repo>>, String> { ... }
}
Required Associated Types
type Project: DeserializeOwned + Project
type Error: DeserializeOwned + JsonError
Required Methods
fn new(
filter: Filter,
secret_token: AuthToken,
api_url_override: Option<String>
) -> Result<Self, String> where
Self: Sized,
fn secret_token(&self) -> &AuthToken
fn auth_header_key() -> &'static str
fn get_user_projects(
&self,
user: &str
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>
fn get_group_projects(
&self,
group: &str
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>
fn get_accessible_projects(
&self
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>
fn get_current_user(&self) -> Result<String, ApiErrorResponse<Self::Error>>
Provided Methods
fn get_own_projects(
&self
) -> Result<Vec<Self::Project>, ApiErrorResponse<Self::Error>>
Calls the API at specific uri and expects a successful response of Vec
Handles paging with “link” HTTP headers properly and reads all pages to the end.