Skip to main content

GiteeClient

Struct GiteeClient 

Source
pub struct GiteeClient { /* private fields */ }
Expand description

Gitee API Client

Implementations§

Source§

impl GiteeClient

Source

pub async fn get_authenticated_user(&self) -> Result<User, GiteeError>

Get authenticated user information (current user)

Source

pub async fn get_user_info(&self, username: &str) -> Result<User, GiteeError>

Get user information by username

Source

pub async fn search_users( &self, query: &str, ) -> Result<Vec<SearchUserResult>, GiteeError>

Search users

Source§

impl GiteeClient

Source

pub async fn get_repo( &self, owner: &str, repo: &str, ) -> Result<Repository, GiteeError>

Get repository information

Source

pub async fn create_user_repo( &self, name: &str, description: Option<&str>, private: bool, ) -> Result<Repository, GiteeError>

Create a new user repository

Source

pub async fn create_org_repo( &self, org: &str, name: &str, description: Option<&str>, private: bool, ) -> Result<Repository, GiteeError>

Create a new organization repository

Source

pub async fn create_enterprise_repo( &self, enterprise: &str, name: &str, description: Option<&str>, private: bool, ) -> Result<Repository, GiteeError>

Create a new enterprise repository

Source

pub async fn list_user_repos(&self) -> Result<Vec<Repository>, GiteeError>

List user repositories

Source

pub async fn fork_repository( &self, owner: &str, repo: &str, ) -> Result<Repository, GiteeError>

Fork a repository

Source

pub async fn search_repositories( &self, query: &str, from: Option<i32>, size: Option<i32>, sort: Option<&str>, ) -> Result<Vec<Repository>, GiteeError>

Search repositories (Open source)

Source

pub async fn delete_repo( &self, owner: &str, repo: &str, ) -> Result<(), GiteeError>

Delete a repository

Source

pub async fn star_repo(&self, owner: &str, repo: &str) -> Result<(), GiteeError>

Star a repository

Source

pub async fn unstar_repo( &self, owner: &str, repo: &str, ) -> Result<(), GiteeError>

Unstar a repository

Source

pub async fn watch_repo( &self, owner: &str, repo: &str, ) -> Result<(), GiteeError>

Watch a repository

Source

pub async fn unwatch_repo( &self, owner: &str, repo: &str, ) -> Result<(), GiteeError>

Unwatch a repository

Source§

impl GiteeClient

Source

pub async fn list_issues( &self, options: Option<IssueListOptions>, ) -> Result<Vec<Issue>, GiteeError>

List all issues

Source

pub async fn list_repo_issues( &self, owner: &str, repo: &str, options: Option<IssueListOptions>, ) -> Result<Vec<Issue>, GiteeError>

List repository issues

Source

pub async fn create_issue( &self, repo_owner: &str, repo_name: &str, title: &str, body: Option<&str>, ) -> Result<Issue, GiteeError>

Create a new issue

Source

pub async fn close_issue( &self, repo_owner: &str, repo_name: &str, issue_number: &str, ) -> Result<Issue, GiteeError>

Close an issue by setting its state to “closed”

Source

pub async fn update_issue( &self, owner: &str, repo: &str, number: &str, title: Option<&str>, body: Option<&str>, state: Option<&str>, ) -> Result<Issue, GiteeError>

Update an issue

Source

pub async fn get_issue_detail( &self, owner: &str, repo: &str, number: &str, ) -> Result<Issue, GiteeError>

Get issue detail

Source

pub async fn comment_issue( &self, owner: &str, repo: &str, number: &str, body: &str, ) -> Result<Comment, GiteeError>

Comment on an issue

Source

pub async fn list_issue_comments( &self, owner: &str, repo: &str, number: &str, ) -> Result<Vec<Comment>, GiteeError>

List issue comments

Source

pub async fn list_repo_milestones( &self, owner: &str, repo: &str, state: Option<&str>, ) -> Result<Vec<Milestone>, GiteeError>

List repository milestones

Source

pub async fn create_milestone( &self, owner: &str, repo: &str, title: &str, description: Option<&str>, due_on: Option<&str>, ) -> Result<Milestone, GiteeError>

Create a new milestone

Source

pub async fn get_milestone( &self, owner: &str, repo: &str, number: i32, ) -> Result<Milestone, GiteeError>

Get a milestone by number

Source

pub async fn update_milestone( &self, owner: &str, repo: &str, number: i32, title: Option<&str>, description: Option<&str>, state: Option<&str>, ) -> Result<Milestone, GiteeError>

Update a milestone

Source

pub async fn delete_milestone( &self, owner: &str, repo: &str, number: i32, ) -> Result<(), GiteeError>

Delete a milestone

Source§

impl GiteeClient

Source

pub async fn list_pulls( &self, owner: &str, repo: &str, options: Option<PullListOptions>, ) -> Result<Vec<PullRequest>, GiteeError>

List all pull requests for a repository

Source

pub async fn create_pull( &self, owner: &str, repo: &str, title: &str, head: &str, base: &str, body: Option<&str>, ) -> Result<PullRequest, GiteeError>

Create a new pull request

Source

pub async fn close_pull( &self, owner: &str, repo: &str, pull_number: &str, ) -> Result<PullRequest, GiteeError>

Close a pull request by setting its state to “closed”

Source

pub async fn merge_pull( &self, owner: &str, repo: &str, pull_number: &str, ) -> Result<PullRequest, GiteeError>

Merge a pull request

Source

pub async fn get_pull_detail( &self, owner: &str, repo: &str, number: &str, ) -> Result<PullRequest, GiteeError>

Get pull request detail

Source

pub async fn update_pull( &self, owner: &str, repo: &str, number: &str, title: Option<&str>, body: Option<&str>, state: Option<&str>, ) -> Result<PullRequest, GiteeError>

Update a pull request

Source

pub async fn comment_pull( &self, owner: &str, repo: &str, number: &str, body: &str, ) -> Result<Comment, GiteeError>

Comment on a pull request

Source

pub async fn list_pull_comments( &self, owner: &str, repo: &str, number: &str, ) -> Result<Vec<Comment>, GiteeError>

List pull request comments

Source

pub async fn get_diff_files( &self, owner: &str, repo: &str, number: &str, ) -> Result<Vec<FileDiff>, GiteeError>

Get diff files for a pull request

Source§

impl GiteeClient

Source

pub async fn list_labels( &self, owner: &str, repo: &str, ) -> Result<Vec<Label>, GiteeError>

List all labels in a repository

Source

pub async fn create_label( &self, owner: &str, repo: &str, name: &str, color: &str, description: Option<&str>, ) -> Result<Label, GiteeError>

Create a new label in a repository

Source

pub async fn update_label( &self, owner: &str, repo: &str, name: &str, new_name: Option<&str>, color: Option<&str>, description: Option<&str>, ) -> Result<Label, GiteeError>

Update a label in a repository

Source

pub async fn delete_label( &self, owner: &str, repo: &str, name: &str, ) -> Result<(), GiteeError>

Delete a label from a repository

Source§

impl GiteeClient

Source

pub async fn get_file_content( &self, owner: &str, repo: &str, file_path: &str, ref: Option<&str>, ) -> Result<FileContent, GiteeError>

Get file content

Source

pub async fn list_repo_files( &self, owner: &str, repo: &str, path: Option<&str>, ref: Option<&str>, ) -> Result<Vec<RepoFile>, GiteeError>

List repository files

Source

pub async fn search_files_by_content( &self, query: &str, owner: Option<&str>, repo: Option<&str>, page: Option<i32>, per_page: Option<i32>, ) -> Result<Vec<RepoFile>, GiteeError>

Search files by content

Source§

impl GiteeClient

Source

pub async fn list_user_notifications( &self, ) -> Result<Vec<Notification>, GiteeError>

List user notifications

Source§

impl GiteeClient

Source

pub async fn create_release( &self, owner: &str, repo: &str, tag_name: &str, name: &str, body: Option<&str>, ) -> Result<Release, GiteeError>

Create a release

Source

pub async fn list_releases( &self, owner: &str, repo: &str, ) -> Result<Vec<Release>, GiteeError>

List releases

Source§

impl GiteeClient

Source

pub async fn list_repo_wikis( &self, owner: &str, repo: &str, ) -> Result<Vec<WikiPage>, GiteeError>

List all wiki pages for a repository by cloning it locally

Source

pub async fn get_repo_wiki( &self, owner: &str, repo: &str, slug: &str, ) -> Result<WikiPage, GiteeError>

Get a single wiki page content

Source

pub async fn create_repo_wiki( &self, owner: &str, repo: &str, title: &str, body: &str, ) -> Result<WikiPage, GiteeError>

Create or Update a wiki page

Source

pub async fn update_repo_wiki( &self, owner: &str, repo: &str, _slug: &str, title: &str, body: &str, ) -> Result<WikiPage, GiteeError>

Update a wiki page (alias to create_repo_wiki)

Source

pub async fn delete_repo_wiki( &self, owner: &str, repo: &str, slug: &str, ) -> Result<(), GiteeError>

Delete a wiki page

Source§

impl GiteeClient

Source

pub fn new( token: Option<String>, base_url: Option<String>, ) -> Result<Self, GiteeError>

Creates a new GiteeClient instance

Source

pub fn client(&self) -> &Client

Get the HTTP client

Source

pub fn base_url(&self) -> &str

Get the API base URL

Source

pub fn token(&self) -> &str

Get the authentication token

Source

pub fn auth_header(&self) -> String

Build authorization header value

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more