pub struct Client { /* private fields */ }Expand description
Client for the GitLab REST API v4.
Implementations§
Source§impl Client
impl Client
Sourcepub fn from_project_url(url: &str, token: &str) -> Result<Self, Box<dyn Error>>
pub fn from_project_url(url: &str, token: &str) -> Result<Self, Box<dyn Error>>
Create a client from a GitLab project URL and token.
Sourcepub fn new(
base_url: &str,
project_path: &str,
token: &str,
) -> Result<Self, Box<dyn Error>>
pub fn new( base_url: &str, project_path: &str, token: &str, ) -> Result<Self, Box<dyn Error>>
Create a client with explicit parameters.
Sourcepub fn merge_request(&self, iid: u64) -> Result<MergeRequest, Box<dyn Error>>
pub fn merge_request(&self, iid: u64) -> Result<MergeRequest, Box<dyn Error>>
Fetch a merge request by its internal ID (iid).
Sourcepub fn issue(&self, iid: u64) -> Result<Issue, Box<dyn Error>>
pub fn issue(&self, iid: u64) -> Result<Issue, Box<dyn Error>>
Fetch a single issue by its internal ID (iid).
Sourcepub fn create_issue(
&self,
title: &str,
description: Option<&str>,
labels: Option<&str>,
) -> Result<Issue, Box<dyn Error>>
pub fn create_issue( &self, title: &str, description: Option<&str>, labels: Option<&str>, ) -> Result<Issue, Box<dyn Error>>
Create a new issue.
Sourcepub fn list_issues(
&self,
label: &str,
state: Option<&str>,
) -> Result<Vec<Issue>, Box<dyn Error>>
pub fn list_issues( &self, label: &str, state: Option<&str>, ) -> Result<Vec<Issue>, Box<dyn Error>>
List issues matching a label and optional state.
Sourcepub fn add_note(&self, iid: u64, body: &str) -> Result<(), Box<dyn Error>>
pub fn add_note(&self, iid: u64, body: &str) -> Result<(), Box<dyn Error>>
Add a note (comment) to an issue.
Sourcepub fn edit_issue(
&self,
iid: u64,
updates: &IssueUpdate,
) -> Result<Issue, Box<dyn Error>>
pub fn edit_issue( &self, iid: u64, updates: &IssueUpdate, ) -> Result<Issue, Box<dyn Error>>
Edit an existing issue.
Sourcepub fn get_work_item_status(
&self,
iid: u64,
) -> Result<Option<String>, Box<dyn Error>>
pub fn get_work_item_status( &self, iid: u64, ) -> Result<Option<String>, Box<dyn Error>>
Fetch the work-item status for an issue via GraphQL.
Returns the status name (e.g. “To do”, “In progress”)
or None if the work-item has no status widget.
Sourcepub fn set_work_item_dates(
&self,
iid: u64,
start_date: Option<&str>,
due_date: Option<&str>,
) -> Result<(), Box<dyn Error>>
pub fn set_work_item_dates( &self, iid: u64, start_date: Option<&str>, due_date: Option<&str>, ) -> Result<(), Box<dyn Error>>
Set the start / due dates on a work item via GraphQL.
GitLab’s REST PUT /issues/:iid endpoint silently
ignores start_date and doesn’t reliably honor
due_date for work items, so date updates go through
the workItemUpdate mutation’s startAndDueDateWidget.
Passing None for a field leaves it unchanged; passing
Some("") clears it.