GistManager

Struct GistManager 

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

Gist Manager for creating and managing GitHub Gists

Implementations§

Source§

impl GistManager

Source

pub fn new(token: impl Into<String>, username: impl Into<String>) -> Self

Create a new GistManager

Source

pub async fn create_gist( &self, filename: impl Into<String>, content: impl Into<String>, _language: Option<String>, options: GistOptions, ) -> Result<GistCreationResult>

Create a new Gist from code snippet

§Arguments
  • filename - Name of the file in the gist
  • content - Code content
  • language - Programming language (optional)
  • options - Gist creation options
§Returns

Result containing the creation result with gist ID and URL

Source

pub fn generate_gist_url(&self, gist_id: impl Into<String>) -> String

Generate a shareable Gist URL

§Arguments
  • gist_id - The Gist ID
§Returns

The shareable URL

Source

pub async fn update_gist( &self, gist_id: impl Into<String>, filename: impl Into<String>, content: impl Into<String>, _language: Option<String>, ) -> Result<GistUpdateResult>

Update an existing Gist

§Arguments
  • gist_id - The Gist ID to update
  • filename - File name in the gist
  • content - New content
  • language - Programming language (optional)
§Returns

Result containing the update result

Source

pub async fn delete_gist( &self, gist_id: impl Into<String>, ) -> Result<GistLifecycleResult>

Delete a Gist

§Arguments
  • gist_id - The Gist ID to delete
§Returns

Result containing the lifecycle result

Source

pub async fn archive_gist( &self, gist_id: impl Into<String>, ) -> Result<GistLifecycleResult>

Archive a Gist (mark as archived without deleting)

§Arguments
  • gist_id - The Gist ID to archive
§Returns

Result containing the lifecycle result

Source

pub async fn get_gist_metadata( &self, gist_id: impl Into<String>, ) -> Result<GistMetadata>

Get Gist metadata

§Arguments
  • gist_id - The Gist ID
§Returns

Result containing the gist metadata

Source

pub async fn update_gist_metadata( &self, gist_id: impl Into<String>, metadata: GistMetadata, ) -> Result<GistMetadata>

Update Gist metadata (tags, category, etc.)

§Arguments
  • gist_id - The Gist ID
  • metadata - New metadata
§Returns

Result containing the updated metadata

Source

pub async fn set_gist_visibility( &self, gist_id: impl Into<String>, public: bool, ) -> Result<Gist>

Change Gist visibility (public/private)

§Arguments
  • gist_id - The Gist ID
  • public - Whether the gist should be public
§Returns

Result containing the updated gist

Source

pub async fn restore_gist( &self, gist_id: impl Into<String>, ) -> Result<GistLifecycleResult>

Restore a Gist from archive

§Arguments
  • gist_id - The Gist ID to restore
§Returns

Result containing the lifecycle result

Source

pub async fn list_gists(&self) -> Result<Vec<String>>

List all Gists for the user

§Returns

Result containing a list of gist IDs

Source

pub async fn get_gist(&self, gist_id: impl Into<String>) -> Result<Gist>

Get a specific Gist by ID

§Arguments
  • gist_id - The Gist ID to retrieve
§Returns

Result containing the Gist

Trait Implementations§

Source§

impl Clone for GistManager

Source§

fn clone(&self) -> GistManager

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 GistManager

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> 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<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