pub struct GitLabClient { /* private fields */ }Expand description
GitLab API client
Implementations§
Source§impl GitLabClient
impl GitLabClient
Sourcepub fn new(config: &GitLabConfig, auth: BoxedAuthProvider) -> GitLabResult<Self>
pub fn new(config: &GitLabConfig, auth: BoxedAuthProvider) -> GitLabResult<Self>
Create a new GitLab client from configuration
Sourcepub async fn get<T: DeserializeOwned>(&self, endpoint: &str) -> GitLabResult<T>
pub async fn get<T: DeserializeOwned>(&self, endpoint: &str) -> GitLabResult<T>
Make a GET request
Sourcepub async fn get_json(&self, endpoint: &str) -> GitLabResult<Value>
pub async fn get_json(&self, endpoint: &str) -> GitLabResult<Value>
Make a GET request returning raw JSON value
Sourcepub async fn get_text(&self, endpoint: &str) -> GitLabResult<String>
pub async fn get_text(&self, endpoint: &str) -> GitLabResult<String>
Make a GET request returning raw text (not JSON)
Sourcepub async fn post<T: DeserializeOwned, B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<T>
pub async fn post<T: DeserializeOwned, B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<T>
Make a POST request
Sourcepub async fn post_json<B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<Value>
pub async fn post_json<B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<Value>
Make a POST request returning raw JSON value
Sourcepub async fn post_no_content<B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<()>
pub async fn post_no_content<B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<()>
Make a POST request that expects no content in response (HTTP 204)
Sourcepub async fn put<T: DeserializeOwned, B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<T>
pub async fn put<T: DeserializeOwned, B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<T>
Make a PUT request
Sourcepub async fn put_json<B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<Value>
pub async fn put_json<B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<Value>
Make a PUT request returning raw JSON value
Sourcepub async fn put_no_content<B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<()>
pub async fn put_no_content<B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<()>
Make a PUT request that expects no content in response (HTTP 204)
Sourcepub async fn delete(&self, endpoint: &str) -> GitLabResult<()>
pub async fn delete(&self, endpoint: &str) -> GitLabResult<()>
Make a DELETE request
Sourcepub async fn delete_with_body<B: Serialize + ?Sized>(
&self,
endpoint: &str,
body: &B,
) -> GitLabResult<()>
pub async fn delete_with_body<B: Serialize + ?Sized>( &self, endpoint: &str, body: &B, ) -> GitLabResult<()>
Make a DELETE request with a body
Sourcepub async fn request<T: DeserializeOwned>(
&self,
method: Method,
endpoint: &str,
) -> GitLabResult<T>
pub async fn request<T: DeserializeOwned>( &self, method: Method, endpoint: &str, ) -> GitLabResult<T>
Make a request with custom method
Sourcepub async fn request_with_body<T: DeserializeOwned, B: Serialize + ?Sized>(
&self,
method: Method,
endpoint: &str,
body: &B,
) -> GitLabResult<T>
pub async fn request_with_body<T: DeserializeOwned, B: Serialize + ?Sized>( &self, method: Method, endpoint: &str, body: &B, ) -> GitLabResult<T>
Make a request with custom method and body
Sourcepub fn encode_project(project: &str) -> String
pub fn encode_project(project: &str) -> String
URL-encode a project path for use in API endpoints
Auto Trait Implementations§
impl Freeze for GitLabClient
impl !RefUnwindSafe for GitLabClient
impl Send for GitLabClient
impl Sync for GitLabClient
impl Unpin for GitLabClient
impl !UnwindSafe for GitLabClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more