Skip to main content

ReleasesClient

Struct ReleasesClient 

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

Domain client for release operations.

Obtained via InstallationClient::releases(). Cheap to clone (Arc-backed).

See docs/specs/interfaces/additional-operations.md

Implementations§

Source§

impl ReleasesClient

Source

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

List releases in a repository.

Retrieves all releases for a repository, including drafts and prereleases.

§Arguments
  • owner - Repository owner
  • repo - Repository name
§Returns

Returns vector of releases ordered by creation date (newest first).

§Errors
  • ApiError::NotFound - Repository does not exist
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
let releases = client.list("owner", "repo").await?;
for release in releases {
    println!("Release: {} ({})", release.name.unwrap_or_default(), release.tag_name);
}
Source

pub async fn get_latest( &self, owner: &str, repo: &str, ) -> Result<Release, ApiError>

Get the latest published release.

Returns the most recent non-draft, non-prerelease release.

§Arguments
  • owner - Repository owner
  • repo - Repository name
§Returns

Returns the latest published Release.

§Errors
  • ApiError::NotFound - Repository or no published releases exist
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
let release = client.get_latest("owner", "repo").await?;
println!("Latest: {} ({})", release.name.unwrap_or_default(), release.tag_name);
Source

pub async fn get_by_tag( &self, owner: &str, repo: &str, tag: &str, ) -> Result<Release, ApiError>

Get a release by tag name.

Retrieves a release by its git tag name.

§Arguments
  • owner - Repository owner
  • repo - Repository name
  • tag - Git tag name
§Returns

Returns the Release with the specified tag.

§Errors
  • ApiError::NotFound - Release with tag does not exist
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
let release = client.get_by_tag("owner", "repo", "v1.0.0").await?;
println!("Release: {}", release.tag_name);
Source

pub async fn get( &self, owner: &str, repo: &str, release_id: u64, ) -> Result<Release, ApiError>

Get a release by ID.

Retrieves a release by its unique identifier.

§Arguments
  • owner - Repository owner
  • repo - Repository name
  • release_id - Release ID
§Returns

Returns the Release with the specified ID.

§Errors
  • ApiError::NotFound - Release does not exist
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
let release = client.get("owner", "repo", 12345).await?;
println!("Release: {}", release.tag_name);
Source

pub async fn create( &self, owner: &str, repo: &str, request: CreateReleaseRequest, ) -> Result<Release, ApiError>

Create a new release.

Creates a new release for a repository. Can create published releases, drafts, or prereleases.

§Arguments
  • owner - Repository owner
  • repo - Repository name
  • request - Release creation parameters
§Returns

Returns the created Release.

§Errors
  • ApiError::InvalidRequest - Tag already exists or invalid parameters
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
let request = CreateReleaseRequest {
    tag_name: "v1.0.0".to_string(),
    name: Some("Version 1.0.0".to_string()),
    body: Some("Release notes".to_string()),
    draft: Some(false),
    prerelease: Some(false),
    target_commitish: None,
    generate_release_notes: None,
};
let release = client.create("owner", "repo", request).await?;
println!("Created release: {}", release.tag_name);
Source

pub async fn update( &self, owner: &str, repo: &str, release_id: u64, request: UpdateReleaseRequest, ) -> Result<Release, ApiError>

Update an existing release.

Updates release properties. Only specified fields are modified.

§Arguments
  • owner - Repository owner
  • repo - Repository name
  • release_id - Release ID
  • request - Fields to update
§Returns

Returns the updated Release.

§Errors
  • ApiError::NotFound - Release does not exist
  • ApiError::InvalidRequest - Invalid parameters
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
let request = UpdateReleaseRequest {
    name: Some("Updated name".to_string()),
    body: Some("Updated notes".to_string()),
    ..Default::default()
};
let release = client.update("owner", "repo", 12345, request).await?;
println!("Updated release: {}", release.tag_name);
Source

pub async fn delete( &self, owner: &str, repo: &str, release_id: u64, ) -> Result<(), ApiError>

Delete a release.

Deletes a release. Does not delete the associated git tag.

§Arguments
  • owner - Repository owner
  • repo - Repository name
  • release_id - Release ID
§Returns

Returns Ok(()) on successful deletion.

§Errors
  • ApiError::NotFound - Release does not exist
  • ApiError::AuthorizationFailed - Insufficient permissions
§Example
client.delete("owner", "repo", 12345).await?;
println!("Release deleted");

Trait Implementations§

Source§

impl Clone for ReleasesClient

Source§

fn clone(&self) -> ReleasesClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ReleasesClient

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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: Sized + 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: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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