pub struct GitFoxClient { /* private fields */ }Expand description
A GitFox API client bound to one host.
Implementations§
Source§impl GitFoxClient
impl GitFoxClient
pub fn builder(host: impl Into<String>) -> GitFoxClientBuilder
pub fn base_url(&self) -> &Url
pub fn has_token(&self) -> bool
pub fn auth(&self) -> AuthApi<'_>
pub fn repos(&self) -> ReposApi<'_>
pub fn pull_requests(&self) -> PullRequestsApi<'_>
pub fn principals(&self) -> PrincipalsApi<'_>
pub fn pipelines(&self) -> PipelinesApi<'_>
pub fn labels(&self) -> LabelsApi<'_>
Sourcepub fn spaces(&self) -> SpacesApi<'_>
pub fn spaces(&self) -> SpacesApi<'_>
Spaces, their secrets, the caller’s SSH keys and the system config.
pub fn rules(&self) -> RulesApi<'_>
pub fn gitspaces(&self) -> GitspacesApi<'_>
Sourcepub fn resolve(&self, path: &str) -> Result<Url>
pub fn resolve(&self, path: &str) -> Result<Url>
Resolve an API path against the host.
Accepts /api/v1/user, api/v1/user and a fully qualified URL, so
gf api can take whatever the user pasted.
Sourcepub async fn request(
&self,
method: Method,
path: &str,
body: Option<&Value>,
extra_headers: &[(String, String)],
) -> Result<RawResponse>
pub async fn request( &self, method: Method, path: &str, body: Option<&Value>, extra_headers: &[(String, String)], ) -> Result<RawResponse>
The one place an HTTP request is issued. Everything typed is built on top.
Transient failures are retried with exponential backoff — but only for
methods that are safe to repeat. See is_retryable_method.
Sourcepub async fn sse_lines<T: DeserializeOwned>(
&self,
path: &str,
idle: Duration,
) -> Result<Vec<T>>
pub async fn sse_lines<T: DeserializeOwned>( &self, path: &str, idle: Duration, ) -> Result<Vec<T>>
Read a server-sent-event stream, collecting each data: payload that
deserialises into T.
Stops on the stream’s own event: error / data: eof, or once idle
passes with no new bytes — a stream following something still in
progress never ends on its own, so a snapshot has to decide when the
backlog has been drained.
The client’s request timeout is deliberately not applied: it bounds a whole request/response, which for a stream would cut the body off mid-flight. The idle window bounds this instead.
Sourcepub async fn get_json<T: DeserializeOwned>(&self, path: &str) -> Result<T>
pub async fn get_json<T: DeserializeOwned>(&self, path: &str) -> Result<T>
Convenience wrapper for typed GET requests.