HydrusFile

Struct HydrusFile 

Source
pub struct HydrusFile {
    pub id: FileIdentifier,
    pub status: FileStatus,
    /* private fields */
}

Fields§

§id: FileIdentifier§status: FileStatus

Implementations§

Source§

impl HydrusFile

Source

pub async fn update(&mut self) -> Result<()>

Deletes the internally stored metadata about the file retrieves it again

Source

pub async fn hash(&mut self) -> Result<String>

Returns the hash of the file if the file identifier is an id it calls hydrus to resolve the file

Source

pub async fn size(&mut self) -> Result<Option<u64>>

Returns the file size in bytes

Source

pub async fn mime(&mut self) -> Result<Mime>

Returns the mime of the file

Source

pub async fn ext(&mut self) -> Result<String>

Return the file extension

Source

pub async fn dimensions(&mut self) -> Result<Option<(u32, u32)>>

Returns the dimensions of the file in pixels

Source

pub async fn duration(&mut self) -> Result<Option<u64>>

Returns the duration of the file in seconds if it’s a video

Source

pub async fn num_frames(&mut self) -> Result<Option<u64>>

Returns the number of frames of the file if it’s a video

Source

pub async fn has_audio(&mut self) -> Result<bool>

Returns if the file has audio

Source

pub async fn in_inbox(&mut self) -> Result<bool>

Returns if the file is currently in the inbox

Source

pub async fn stored_locally(&mut self) -> Result<bool>

Returns if the file is stored locally

Source

pub async fn moved_to_trashed(&mut self) -> Result<bool>

Returns if the file has been moved to the trash

Source

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

Returns all urls associated with the file

Source

pub async fn time_modified(&mut self) -> Result<Option<NaiveDateTime>>

Returns the modified time of the file

Source

pub async fn time_imported<S: AsRef<str>>( &mut self, service_key: S, ) -> Result<Option<NaiveDateTime>>

Returns the imported time of the file for a given file service key

Source

pub async fn time_deleted<S: AsRef<str>>( &mut self, service_key: S, ) -> Result<Option<NaiveDateTime>>

Returns the time the file was deleted for a specified file service

Source

pub fn delete(&mut self) -> DeleteFilesBuilder

Creates a request builder to delete the file

Source

pub async fn undelete( &mut self, service_selection: FileServiceSelection, ) -> Result<()>

Undeletes the file for the given service or all services if FileServiceSelection::none is passed

Source

pub async fn archive( &mut self, service_selection: FileServiceSelection, ) -> Result<()>

Archives the file in all passed file services or all configured services if no selection is passed

Source

pub async fn unarchive( &mut self, service_selection: FileServiceSelection, ) -> Result<()>

Unarchives the file for the given services

Source

pub async fn associate_urls(&mut self, urls: Vec<String>) -> Result<()>

Associates the file with a list of urls

Source

pub async fn disassociate_urls(&mut self, urls: Vec<String>) -> Result<()>

Disassociates the file with a list of urls

Source

pub async fn service_names_with_tags( &mut self, ) -> Result<HashMap<ServiceIdentifier, Vec<Tag>>>

👎Deprecated: Deprecated in the official API. Use services_with_tags instead.

Returns map mapping lists of tags to services.

Deprecation: Use HydrusFile::services_with_tags instead.

Source

pub async fn services_with_tags( &mut self, ) -> Result<HashMap<ServiceIdentifier, Vec<Tag>>>

Returns a mapping with service ids mapped to tags

Source

pub async fn tags(&mut self) -> Result<Vec<Tag>>

Returns a list of all tags assigned to the file

Source

pub async fn add_tags( &mut self, service_key: String, tags: Vec<Tag>, ) -> Result<()>

Adds tags for a specific service to the file

Source

pub async fn modify_tags( &mut self, service_key: String, action: TagAction, tags: Vec<Tag>, ) -> Result<()>

Allows modification of tags by using the defined tag actions

Source

pub fn add_notes(&self) -> AddNotesBuilder

Creates a builder to add notes to the file

Source

pub async fn delete_note<S1: ToString>(&self, name: S1) -> Result<()>

Deletes a single note from the file

Source

pub async fn delete_notes<I: IntoIterator<Item = S>, S: ToString>( &self, names: I, ) -> Result<()>

Deletes multiple notes from the file

Source

pub async fn retrieve(&self) -> Result<FileRecord>

Retrieves the file record bytes

Trait Implementations§

Source§

impl Clone for HydrusFile

Source§

fn clone(&self) -> HydrusFile

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

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> 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