pub async fn compose(
        bucket: &str,
        req: &ComposeRequest,
        destination_object: &str,
    ) -> crate::Result<Self> {
        let url = format!(
            "{}/b/{}/o/{}/compose",
            crate::BASE_URL,
            percent_encode(&bucket),
            percent_encode(&destination_object)
        );
        let result: GoogleResponse<Self> = crate::CLIENT
            .post(&url)
            .headers(crate::get_headers().await?)
            .json(req)
            .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::{Object, ComposeRequest, SourceObject};
///
/// let obj1 = Object::read("my_bucket", "file1").await?;
/// let obj2 = Object::read("my_bucket", "file2").await?;
/// let compose_request = ComposeRequest {
///     kind: "storage#composeRequest".to_string(),
///     source_objects: vec![
///         SourceObject {
///             name: obj1.name.clone(),
///             generation: None,
///             object_preconditions: None,
///         },
///         SourceObject {
///             name: obj2.name.clone(),
///             generation: None,
///             object_preconditions: None,
///         },
///     ],
///     destination: None,
/// };
/// let obj3 = Object::compose("my_bucket", &compose_request, "test-concatted-file").await?;
/// // obj3 is now a file with the content of obj1 and obj2 concatted together.
/// # 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 compose(
        bucket: &str,
        req: &ComposeRequest,
        destination_object: &str,
    ) -> crate::Result<Self> {
        let url = format!(
            "{}/b/{}/o/{}/compose",
            crate::BASE_URL,
            percent_encode(&bucket),
            percent_encode(&destination_object)
        );
        let result: GoogleResponse<Self> = crate::CLIENT
            .post(&url)
            .headers(crate::get_headers().await?)
            .json(req)
            .send()
            .await?
            .json()
            .await?;
        match result {
            GoogleResponse::Success(s) => Ok(s),
            GoogleResponse::Error(e) => Err(e.into()),
        }
    }
pub async fn compose ( bucket : & str , req : & ComposeRequest , destination_object : & str , ) -> crate :: Result < Self > { let url = format ! ( " " crate BASE_URL percent_encode ( bucket ) percent_encode ( destination_object ) ) ; let result : GoogleResponse < Self > = crate :: CLIENT . post ( & url ) . headers ( crate :: get_headers ( ) . await ? ) . json ( req ) . 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
req
&ComposeRequest
destination_object
&str
example
None
#[tokio::main]
None
async fn main() -> result<(), box<dyn std::error::error>> {
use cloud_storage::object::{Object, ComposeRequest, SourceObject}.

let obj1 = Object::read("my_bucket", "file1").await?;
let obj2 = Object::read("my_bucket", "file2").await?;
let compose_request = ComposeRequest {
kind: "storage#composeRequest".to_string(),
source_objects: vec![
SourceObject {
name: obj1.name.clone(),
generation: None,
object_preconditions: None,
},
SourceObject {
name: obj2.name.clone(),
generation: None,
object_preconditions: None,
},
],
destination: None,
};
let obj3 = Object::compose("my_bucket", &compose_request, "test-concatted-file").await?;
obj3 is now a file with the content of obj1 and obj2 concatted together.
use cloud_storage :: object :: { Object ComposeRequest SourceObject } . let obj1 = Object :: read ( " my_bucket " " file1 " ) . await? ; let obj2 = Object :: read ( " my_bucket " " file2 " ) . await? ; let compose_request = ComposeRequest { kind : " storage#composeRequest " . to_string () source_objects : vec! [ SourceObject { name : obj1 . name . clone () generation : None object_preconditions : None } SourceObject { name : obj2 . name . clone () generation : None object_preconditions : None } ] destination : None } ; let obj3 = Object :: compose ( " my_bucket " &compose_request " test - concatted - file " ) . await? ; obj3 is now a file with the content of obj1 and obj2 concatted together .
ok(())
None
}
None