Skip to main content

Client

Struct Client 

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

Client for Nucel API

Nucel Platform REST API v1. Authenticate via Authorization: Bearer <personal-access-token>.

Version: 1.0.0

Implementations§

Source§

impl Client

Source

pub fn new(baseurl: &str) -> Self

Create a new client.

baseurl is the base URL provided to the internal reqwest::Client, and should include a scheme and hostname, as well as port and a path stem if applicable.

Source

pub fn new_with_client(baseurl: &str, client: Client) -> Self

Construct a new client with an existing reqwest::Client, allowing more control over its configuration.

baseurl is the base URL provided to the internal reqwest::Client, and should include a scheme and hostname, as well as port and a path stem if applicable.

Source

pub fn baseurl(&self) -> &String

Get the base URL to which requests are made.

Source

pub fn client(&self) -> &Client

Get the internal reqwest::Client used to make requests.

Source

pub fn api_version(&self) -> &'static str

Get the version of this API.

This string is pulled directly from the source OpenAPI document and may be in any format the API selects.

Source§

impl Client

Source

pub fn runner_complete(&self) -> RunnerComplete<'_>

POST /api/v1/ci/runner/complete

Sends a POST request to /api/v1/ci/runner/complete

let response = client.runner_complete()
    .body(body)
    .send()
    .await;
Source

pub fn runner_logs(&self) -> RunnerLogs<'_>

POST /api/v1/ci/runner/logs

Sends a POST request to /api/v1/ci/runner/logs

let response = client.runner_logs()
    .body(body)
    .send()
    .await;
Source

pub fn runner_start(&self) -> RunnerStart<'_>

POST /api/v1/ci/runner/start

Sends a POST request to /api/v1/ci/runner/start

let response = client.runner_start()
    .body(body)
    .send()
    .await;
Source

pub fn runner_step(&self) -> RunnerStep<'_>

POST /api/v1/ci/runner/step

Sends a POST request to /api/v1/ci/runner/step

let response = client.runner_step()
    .body(body)
    .send()
    .await;
Source

pub fn list_user_orgs(&self) -> ListUserOrgs<'_>

GET /api/v1/orgs

Sends a GET request to /api/v1/orgs

let response = client.list_user_orgs()
    .send()
    .await;
Source

pub fn list_repos(&self) -> ListRepos<'_>

GET /api/v1/orgs/:owner/repos

Sends a GET request to /api/v1/orgs/{owner}/repos

Arguments:

  • owner: Organization slug
  • page: Page number (default: 1)
  • per_page: Items per page (default: 20, max: 100)
let response = client.list_repos()
    .owner(owner)
    .page(page)
    .per_page(per_page)
    .send()
    .await;
Source

pub fn create_repo_handler(&self) -> CreateRepoHandler<'_>

POST /api/v1/orgs/:owner/repos

Sends a POST request to /api/v1/orgs/{owner}/repos

Arguments:

  • owner: Organization slug
  • body
let response = client.create_repo_handler()
    .owner(owner)
    .body(body)
    .send()
    .await;
Source

pub fn get_org(&self) -> GetOrg<'_>

GET /api/v1/orgs/:slug

Sends a GET request to /api/v1/orgs/{slug}

Arguments:

  • slug: Organization slug
let response = client.get_org()
    .slug(slug)
    .send()
    .await;
Source

pub fn list_members(&self) -> ListMembers<'_>

GET /api/v1/orgs/:slug/members

Sends a GET request to /api/v1/orgs/{slug}/members

Arguments:

  • slug: Organization slug
let response = client.list_members()
    .slug(slug)
    .send()
    .await;
Source

pub fn get_repo(&self) -> GetRepo<'_>

GET /api/v1/repos/:owner/:repo

Sends a GET request to /api/v1/repos/{owner}/{repo}

Arguments:

  • owner: Organization slug
  • repo: Repository slug
let response = client.get_repo()
    .owner(owner)
    .repo(repo)
    .send()
    .await;
Source

pub fn get_blob(&self) -> GetBlob<'_>

GET /api/v1/repos/:owner/:repo/blob/:path?ref=main

Sends a GET request to /api/v1/repos/{owner}/{repo}/blob/{path}

Arguments:

  • owner
  • repo
  • path: Path to file (URL-encoded)
  • ref_: Git ref (default: HEAD)
let response = client.get_blob()
    .owner(owner)
    .repo(repo)
    .path(path)
    .ref_(ref_)
    .send()
    .await;
Source

pub fn list_branches(&self) -> ListBranches<'_>

GET /api/v1/repos/:owner/:repo/branches

Sends a GET request to /api/v1/repos/{owner}/{repo}/branches

Arguments:

  • owner: Organization slug
  • repo: Repository slug
let response = client.list_branches()
    .owner(owner)
    .repo(repo)
    .send()
    .await;
Source

pub fn create_branch(&self) -> CreateBranch<'_>

POST /api/v1/repos/:owner/:repo/branches

Sends a POST request to /api/v1/repos/{owner}/{repo}/branches

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • body
let response = client.create_branch()
    .owner(owner)
    .repo(repo)
    .body(body)
    .send()
    .await;
Source

pub fn get_commit_status(&self) -> GetCommitStatus<'_>

GET /api/v1/repos/:owner/:repo/commits/:sha/status

Sends a GET request to /api/v1/repos/{owner}/{repo}/commits/{sha}/status

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • sha: Commit SHA
let response = client.get_commit_status()
    .owner(owner)
    .repo(repo)
    .sha(sha)
    .send()
    .await;
Source

pub fn compare_branches(&self) -> CompareBranches<'_>

GET /api/v1/repos/:owner/:repo/compare/:spec (spec = “base…head”)

Sends a GET request to /api/v1/repos/{owner}/{repo}/compare/{spec}

Arguments:

  • owner
  • repo
  • spec: Compare spec in the form ‘base…head’
let response = client.compare_branches()
    .owner(owner)
    .repo(repo)
    .spec(spec)
    .send()
    .await;
Source

pub fn list_issues(&self) -> ListIssues<'_>

GET /api/v1/repos/:owner/:repo/issues

Sends a GET request to /api/v1/repos/{owner}/{repo}/issues

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • page: Page number
  • per_page: Items per page (max 100)
  • state: Filter by state: open, closed
let response = client.list_issues()
    .owner(owner)
    .repo(repo)
    .page(page)
    .per_page(per_page)
    .state(state)
    .send()
    .await;
Source

pub fn create_issue(&self) -> CreateIssue<'_>

POST /api/v1/repos/:owner/:repo/issues

Sends a POST request to /api/v1/repos/{owner}/{repo}/issues

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • body
let response = client.create_issue()
    .owner(owner)
    .repo(repo)
    .body(body)
    .send()
    .await;
Source

pub fn get_issue(&self) -> GetIssue<'_>

GET /api/v1/repos/:owner/:repo/issues/:number

Sends a GET request to /api/v1/repos/{owner}/{repo}/issues/{number}

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • number: Issue number
let response = client.get_issue()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn close_issue(&self) -> CloseIssue<'_>

POST /api/v1/repos/:owner/:repo/issues/:number/close

Sends a POST request to /api/v1/repos/{owner}/{repo}/issues/{number}/close

Arguments:

  • owner
  • repo
  • number: Issue number
let response = client.close_issue()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn add_comment(&self) -> AddComment<'_>

POST /api/v1/repos/:owner/:repo/issues/:number/comments

Sends a POST request to /api/v1/repos/{owner}/{repo}/issues/{number}/comments

Arguments:

  • owner
  • repo
  • number: Issue number
  • body
let response = client.add_comment()
    .owner(owner)
    .repo(repo)
    .number(number)
    .body(body)
    .send()
    .await;
Source

pub fn update_labels(&self) -> UpdateLabels<'_>

PUT /api/v1/repos/:owner/:repo/issues/:number/labels

Sends a PUT request to /api/v1/repos/{owner}/{repo}/issues/{number}/labels

Arguments:

  • owner
  • repo
  • number: Issue number
  • body
let response = client.update_labels()
    .owner(owner)
    .repo(repo)
    .number(number)
    .body(body)
    .send()
    .await;
Source

pub fn remove_label(&self) -> RemoveLabel<'_>

DELETE /api/v1/repos/:owner/:repo/issues/:number/labels/:label

Sends a DELETE request to /api/v1/repos/{owner}/{repo}/issues/{number}/labels/{label}

Arguments:

  • owner
  • repo
  • number: Issue number
  • label: Label name
let response = client.remove_label()
    .owner(owner)
    .repo(repo)
    .number(number)
    .label(label)
    .send()
    .await;
Source

pub fn list_labels(&self) -> ListLabels<'_>

GET /api/v1/repos/:owner/:repo/labels

Sends a GET request to /api/v1/repos/{owner}/{repo}/labels

let response = client.list_labels()
    .owner(owner)
    .repo(repo)
    .send()
    .await;
Source

pub fn create_label(&self) -> CreateLabel<'_>

POST /api/v1/repos/:owner/:repo/labels

Sends a POST request to /api/v1/repos/{owner}/{repo}/labels

let response = client.create_label()
    .owner(owner)
    .repo(repo)
    .body(body)
    .send()
    .await;
Source

pub fn list_pipelines(&self) -> ListPipelines<'_>

GET /api/v1/repos/:owner/:repo/pipelines

Sends a GET request to /api/v1/repos/{owner}/{repo}/pipelines

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • page: Page number (default: 1)
  • per_page: Items per page (default: 20, max: 100)
  • ref_: Filter by git ref / branch
let response = client.list_pipelines()
    .owner(owner)
    .repo(repo)
    .page(page)
    .per_page(per_page)
    .ref_(ref_)
    .send()
    .await;
Source

pub fn get_pipeline(&self) -> GetPipeline<'_>

GET /api/v1/repos/:owner/:repo/pipelines/:number

Sends a GET request to /api/v1/repos/{owner}/{repo}/pipelines/{number}

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • number: Pipeline number
let response = client.get_pipeline()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn cancel_pipeline(&self) -> CancelPipeline<'_>

POST /api/v1/repos/:owner/:repo/pipelines/:number/cancel

Sends a POST request to /api/v1/repos/{owner}/{repo}/pipelines/{number}/cancel

let response = client.cancel_pipeline()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn get_pipeline_logs(&self) -> GetPipelineLogs<'_>

GET /api/v1/repos/:owner/:repo/pipelines/:number/logs

Sends a GET request to /api/v1/repos/{owner}/{repo}/pipelines/{number}/logs

let response = client.get_pipeline_logs()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn list_pulls(&self) -> ListPulls<'_>

GET /api/v1/repos/:owner/:repo/pulls

Sends a GET request to /api/v1/repos/{owner}/{repo}/pulls

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • page: Page number (default: 1)
  • per_page: Items per page (default: 20, max: 100)
let response = client.list_pulls()
    .owner(owner)
    .repo(repo)
    .page(page)
    .per_page(per_page)
    .send()
    .await;
Source

pub fn create_pull(&self) -> CreatePull<'_>

POST /api/v1/repos/:owner/:repo/pulls

Sends a POST request to /api/v1/repos/{owner}/{repo}/pulls

let response = client.create_pull()
    .owner(owner)
    .repo(repo)
    .body(body)
    .send()
    .await;
Source

pub fn get_pull(&self) -> GetPull<'_>

GET /api/v1/repos/:owner/:repo/pulls/:number

Sends a GET request to /api/v1/repos/{owner}/{repo}/pulls/{number}

Arguments:

  • owner: Organization slug
  • repo: Repository slug
  • number: Pull request number
let response = client.get_pull()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn update_pull(&self) -> UpdatePull<'_>

PUT /api/v1/repos/:owner/:repo/pulls/:number

Sends a PUT request to /api/v1/repos/{owner}/{repo}/pulls/{number}

Arguments:

  • owner
  • repo
  • number: Pull request number
  • body
let response = client.update_pull()
    .owner(owner)
    .repo(repo)
    .number(number)
    .body(body)
    .send()
    .await;
Source

pub fn add_pr_comment(&self) -> AddPrComment<'_>

POST /api/v1/repos/:owner/:repo/pulls/:number/comments

Sends a POST request to /api/v1/repos/{owner}/{repo}/pulls/{number}/comments

let response = client.add_pr_comment()
    .owner(owner)
    .repo(repo)
    .number(number)
    .body(body)
    .send()
    .await;
Source

pub fn get_pull_diff(&self) -> GetPullDiff<'_>

GET /api/v1/repos/:owner/:repo/pulls/:number/diff

Sends a GET request to /api/v1/repos/{owner}/{repo}/pulls/{number}/diff

let response = client.get_pull_diff()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn list_pull_files(&self) -> ListPullFiles<'_>

GET /api/v1/repos/:owner/:repo/pulls/:number/files

Sends a GET request to /api/v1/repos/{owner}/{repo}/pulls/{number}/files

let response = client.list_pull_files()
    .owner(owner)
    .repo(repo)
    .number(number)
    .send()
    .await;
Source

pub fn merge_pull(&self) -> MergePull<'_>

POST /api/v1/repos/:owner/:repo/pulls/:number/merge

Sends a POST request to /api/v1/repos/{owner}/{repo}/pulls/{number}/merge

Arguments:

  • owner
  • repo
  • number: Pull request number
  • body
let response = client.merge_pull()
    .owner(owner)
    .repo(repo)
    .number(number)
    .body(body)
    .send()
    .await;
Source

pub fn submit_review(&self) -> SubmitReview<'_>

POST /api/v1/repos/:owner/:repo/pulls/:number/reviews

Sends a POST request to /api/v1/repos/{owner}/{repo}/pulls/{number}/reviews

let response = client.submit_review()
    .owner(owner)
    .repo(repo)
    .number(number)
    .body(body)
    .send()
    .await;
Source

pub fn get_raw(&self) -> GetRaw<'_>

GET /api/v1/repos/:owner/:repo/raw/:path?ref=main

Sends a GET request to /api/v1/repos/{owner}/{repo}/raw/{path}

Arguments:

  • owner
  • repo
  • path: Path to file
  • ref_: Git ref
let response = client.get_raw()
    .owner(owner)
    .repo(repo)
    .path(path)
    .ref_(ref_)
    .send()
    .await;
Source

pub fn list_releases(&self) -> ListReleases<'_>

GET /api/v1/repos/:owner/:repo/releases

Sends a GET request to /api/v1/repos/{owner}/{repo}/releases

let response = client.list_releases()
    .owner(owner)
    .repo(repo)
    .send()
    .await;
Source

pub fn create_release(&self) -> CreateRelease<'_>

POST /api/v1/repos/:owner/:repo/releases

Sends a POST request to /api/v1/repos/{owner}/{repo}/releases

let response = client.create_release()
    .owner(owner)
    .repo(repo)
    .body(body)
    .send()
    .await;
Source

pub fn get_release(&self) -> GetRelease<'_>

GET /api/v1/repos/:owner/:repo/releases/:tag

Sends a GET request to /api/v1/repos/{owner}/{repo}/releases/{tag}

Arguments:

  • owner
  • repo
  • tag: Release tag name
let response = client.get_release()
    .owner(owner)
    .repo(repo)
    .tag(tag)
    .send()
    .await;
Source

pub fn delete_release(&self) -> DeleteRelease<'_>

DELETE /api/v1/repos/:owner/:repo/releases/:tag

Sends a DELETE request to /api/v1/repos/{owner}/{repo}/releases/{tag}

let response = client.delete_release()
    .owner(owner)
    .repo(repo)
    .tag(tag)
    .send()
    .await;
Source

pub fn get_tree(&self) -> GetTree<'_>

Sends a GET request to /api/v1/repos/{owner}/{repo}/tree

Arguments:

  • owner
  • repo
  • path: Subdirectory path
  • ref_: Git ref (default: HEAD)
let response = client.get_tree()
    .owner(owner)
    .repo(repo)
    .path(path)
    .ref_(ref_)
    .send()
    .await;
Source

pub fn list_webhooks(&self) -> ListWebhooks<'_>

GET /api/v1/repos/:owner/:repo/webhooks

Sends a GET request to /api/v1/repos/{owner}/{repo}/webhooks

let response = client.list_webhooks()
    .owner(owner)
    .repo(repo)
    .send()
    .await;
Source

pub fn create_webhook(&self) -> CreateWebhook<'_>

POST /api/v1/repos/:owner/:repo/webhooks

Sends a POST request to /api/v1/repos/{owner}/{repo}/webhooks

let response = client.create_webhook()
    .owner(owner)
    .repo(repo)
    .body(body)
    .send()
    .await;
Source

pub fn delete_webhook(&self) -> DeleteWebhook<'_>

DELETE /api/v1/repos/:owner/:repo/webhooks/:id

Sends a DELETE request to /api/v1/repos/{owner}/{repo}/webhooks/{id}

Arguments:

  • owner
  • repo
  • id: Webhook ID
let response = client.delete_webhook()
    .owner(owner)
    .repo(repo)
    .id(id)
    .send()
    .await;
Source

pub fn get_current_user(&self) -> GetCurrentUser<'_>

GET /api/v1/user

Sends a GET request to /api/v1/user

let response = client.get_current_user()
    .send()
    .await;

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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