pub async fn read(bucket: &str, file_name: &str) -> crate::Result<Self> {
        let url = format!(
            "{}/b/{}/o/{}",
            crate::BASE_URL,
            percent_encode(bucket),
            percent_encode(file_name),
        );
        let result: GoogleResponse<Self> = crate::CLIENT
            .get(&url)
            .headers(crate::get_headers().await?)
            .send()
            .await?
            .json()
            .await?;
        match result {
            GoogleResponse::Success(s) => Ok(s),
            GoogleResponse::Error(e) => Err(e.into()),
        }
    }
/// Obtains a single object with the specified name in the specified bucket.
/// ### Example
/// ```no_run
/// # #[tokio::main]
/// # async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// use cloud_storage::Object;
///
/// let object = Object::read("my_bucket", "path/to/my/file.png").await?;
/// # Ok(())
/// # }
/// ```
Obtains a single object with the specified name in the specified bucket.
Obtains a single object with the specified name in the specified bucket .
pub async fn read(bucket: &str, file_name: &str) -> crate::Result<Self> {
        let url = format!(
            "{}/b/{}/o/{}",
            crate::BASE_URL,
            percent_encode(bucket),
            percent_encode(file_name),
        );
        let result: GoogleResponse<Self> = crate::CLIENT
            .get(&url)
            .headers(crate::get_headers().await?)
            .send()
            .await?
            .json()
            .await?;
        match result {
            GoogleResponse::Success(s) => Ok(s),
            GoogleResponse::Error(e) => Err(e.into()),
        }
    }
pub async fn read ( bucket : & str , file_name : & str ) -> crate :: Result < Self > { let url = format ! ( " " crate BASE_URL percent_encode ( bucket ) percent_encode ( file_name ) ) ; let result : GoogleResponse < Self > = crate :: CLIENT . get ( & url ) . headers ( crate :: get_headers ( ) . await ? ) . send ( ) . await ? . json ( ) . await ? ; match result { GoogleResponse :: Success ( s ) => Ok ( s ) , GoogleResponse :: Error ( e ) => Err ( e . into ( ) ) , } }
Obtains a single object with the specified name in the specified bucket.
Obtains a single object with the specified name in the specified bucket .
bucket
&str
file_name
&str
example
None
#[tokio::main]
None
async fn main() -> result<(), box<dyn std::error::error>> {
use cloud_storage::Object.

let object = Object::read("my_bucket", "path/to/my/file.png").await?.
use cloud_storage :: Object . let object = Object :: read ( " my_bucket " " path / to / my / file . png " ) . await? .
ok(())
None
}
None