//! `cargo run --package xt-oss --example api_bucket_style_put` //! //! 调用PutStyle接口新增图片样式。一个图片样式中可以包含单个或多个图片处理参数 //! //! - [official docs](https://help.aliyun.com/zh/oss/developer-reference/putstyle) //! - [xtoss example](https://github.com/isme-sun/xt_oss/blob/main/examples/api_bucket_style_put.rs) use dotenv; use std::process; use xt_oss::prelude::*; #[tokio::main] async fn main() -> Result<(), Box> { dotenv::dotenv().ok(); let options = util::options_from_env(); let client = oss::Client::new(options); let result = client .PutStyle() .with_name("avatar") .with_content("image/resize,p_50") .execute() .await .unwrap_or_else(|reqwest_error| { println!("reqwest error: {}", reqwest_error); process::exit(-1); }); match result { Ok(oss_data) => { println!("{:#?}", oss_data.headers()); } Err(error_message) => { println!("{}", error_message.content()) } } Ok(()) }