pub struct FileId { /* private fields */ }Expand description
A struct that holds the data for a single file.
Implementations§
Source§impl FileId
impl FileId
Sourcepub fn from_raw(asset_ids: Vec<u32>, repo: String) -> Self
pub fn from_raw(asset_ids: Vec<u32>, repo: String) -> Self
Creates a new FileId from raw asset_ids and a repo.
This usually isn’t used, instead use Self::upload.
Sourcepub async fn upload<S: Into<String> + Send + Sync>(
file_name: S,
file_data: impl Read + Send + Sync,
repo: impl Into<String> + Send + Sync,
token: impl AsRef<str> + Send + Sync,
) -> Result<Self, Error>
pub async fn upload<S: Into<String> + Send + Sync>( file_name: S, file_data: impl Read + Send + Sync, repo: impl Into<String> + Send + Sync, token: impl AsRef<str> + Send + Sync, ) -> Result<Self, Error>
Uploads a file to the GitHub repository’s releases.
The token must have read and write access to the repository.
repo must be in the format owner/repo.
§Errors
Returns an [Error::InvalidRepo] if repo is not in the correct format, it doesn’t exist,
or if the token does not have read/write access to the repository.
Sourcepub async fn get<T: Into<String> + Sync + Send>(
&self,
token: Option<T>,
) -> Result<(Vec<u8>, String), Error>
pub async fn get<T: Into<String> + Sync + Send>( &self, token: Option<T>, ) -> Result<(Vec<u8>, String), Error>
Downloads the file from the GitHub repository’s releases.
The token must have read access to the repository.
§Errors
Returns an Error::Unauthorized if the token does not have read access to the repository
or if the file doesn’t exist.
Returns an Error::Reqwest if there was a network error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileId
impl<'de> Deserialize<'de> for FileId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FileId
impl RefUnwindSafe for FileId
impl Send for FileId
impl Sync for FileId
impl Unpin for FileId
impl UnwindSafe for FileId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more