pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn new(base: String, token: String) -> Self
pub fn set_debug(&mut self, debug: bool)
pub fn for_host(host: &str, token: String) -> Self
pub fn pulls<'a>(&'a self, repo: &'a Repo) -> Pulls<'a>
pub fn issues<'a>(&'a self, repo: &'a Repo) -> Issues<'a>
pub fn search<'a>(&'a self) -> Search<'a>
pub fn releases<'a>(&'a self, repo: &'a Repo) -> Releases<'a>
pub fn gists<'a>(&'a self) -> Gists<'a>
pub fn labels<'a>(&'a self, repo: &'a Repo) -> Labels<'a>
pub fn repos<'a>(&'a self) -> Repos<'a>
pub fn milestones<'a>(&'a self, repo: &'a Repo) -> Milestones<'a>
pub fn users<'a>(&'a self) -> Users<'a>
pub fn collaborators<'a>(&'a self, repo: &'a Repo) -> Collaborators<'a>
pub fn webhooks<'a>(&'a self, repo: &'a Repo) -> Webhooks<'a>
pub fn get<T: DeserializeOwned>( &self, path: &str, query: &[(&str, &str)], ) -> Result<T>
pub fn get_paged<T: DeserializeOwned>( &self, path: &str, query: &[(&str, &str)], limit: usize, ) -> Result<Vec<T>>
pub fn post<T: DeserializeOwned>( &self, path: &str, form: &[(&str, &str)], ) -> Result<T>
pub fn patch<T: DeserializeOwned>( &self, path: &str, form: &[(&str, &str)], ) -> Result<T>
Sourcepub fn patch_json<T: DeserializeOwned>(
&self,
path: &str,
body: &Value,
) -> Result<T>
pub fn patch_json<T: DeserializeOwned>( &self, path: &str, body: &Value, ) -> Result<T>
Issue update requires a JSON body (Gitee rejects form encoding here).
Sourcepub fn post_json<T: DeserializeOwned>(
&self,
path: &str,
body: &Value,
) -> Result<T>
pub fn post_json<T: DeserializeOwned>( &self, path: &str, body: &Value, ) -> Result<T>
POST with a JSON body (e.g. issue/PR label add: a JSON array of names).
Sourcepub fn post_ok(&self, path: &str, form: &[(&str, &str)]) -> Result<()>
pub fn post_ok(&self, path: &str, form: &[(&str, &str)]) -> Result<()>
For endpoints that return an empty body on success (e.g. PR review/merge).
pub fn put_ok(&self, path: &str, form: &[(&str, &str)]) -> Result<()>
Sourcepub fn delete_ok(&self, path: &str) -> Result<()>
pub fn delete_ok(&self, path: &str) -> Result<()>
DELETE expecting an empty-body 2xx (204), e.g. gist/label/repo delete.
Sourcepub fn delete_ok_query(&self, path: &str, query: &[(&str, &str)]) -> Result<()>
pub fn delete_ok_query(&self, path: &str, query: &[(&str, &str)]) -> Result<()>
DELETE with query parameters (e.g. PR assignees/testers removal). Gitee encodes those memberships as query, not form body.
Sourcepub fn get_ok(&self, path: &str) -> Result<()>
pub fn get_ok(&self, path: &str) -> Result<()>
GET expecting an empty-body 2xx (204), e.g. star/watch check endpoints.
pub fn post_multipart<T: DeserializeOwned>( &self, path: &str, file_path: &str, ) -> Result<T>
Sourcepub fn get_bytes(&self, url: &str) -> Result<Vec<u8>>
pub fn get_bytes(&self, url: &str) -> Result<Vec<u8>>
GET an absolute URL. Public assets are fetched without auth first; on
401 or 403 the request is retried with the Authorization header. reqwest
follows redirects and forwards headers — note that a redirect to a host
that rejects the forwarded token may still fail, so redirects are followed
manually with auth only on gitee.com hosts (excluding the CDN).
Sourcepub fn raw(&self, req: &RawRequest<'_>) -> Result<String>
pub fn raw(&self, req: &RawRequest<'_>) -> Result<String>
Issue a raw API request and return the response body text.