Skip to content

Commit

Permalink
Merge pull request #69 from fekie/dev-main
Browse files Browse the repository at this point in the history
v0.34.4
  • Loading branch information
fekie authored May 20, 2024
2 parents efa46cb + 8368b26 commit 1d4686c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT"
name = "roboat"
readme = "README.md"
repository = "https://github.com/Chloe-Woahie/roboat"
version = "0.34.3"
version = "0.34.4"

[dependencies]
reqwest = { version = "0.11.14", default-features = false, features = [
Expand Down
14 changes: 13 additions & 1 deletion src/bedev2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,26 @@ pub enum PurchaseNonTradableLimitedError {
UnknownRobloxErrorMsg(String),
}

/// Used to specify the type of classic clothing being uploaded.
///
/// This is used in [`Client::upload_classic_clothing_to_group`].
#[allow(missing_docs)]
#[derive(
Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Serialize, Deserialize, Copy,
)]
pub enum ClassicClothingType {
#[default]
Shirt,
Pants,
TShirt,
}

impl std::fmt::Display for ClassicClothingType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ClassicClothingType::Shirt => write!(f, "Shirt"),
ClassicClothingType::Pants => write!(f, "Pants"),
ClassicClothingType::TShirt => write!(f, "T-Shirt"),
}
}
}
Expand Down Expand Up @@ -621,9 +627,15 @@ mod internal {
.map(|x| x.to_string_lossy().to_string())
.ok_or(RoboatError::InvalidPath(image_path.clone()))?;

let asset_name_patch = match classic_clothing_type {
ClassicClothingType::Shirt => "Shirt",
ClassicClothingType::Pants => "Pants",
ClassicClothingType::TShirt => "Tshirt",
};

let form = reqwest::multipart::Form::new()
.part("fileContent", reqwest::multipart::Part::bytes(tokio::fs::read(image_path).await?).file_name(filename))
.text("request", format!("{{\"displayName\":\"{}\",\"description\":\"{}\",\"assetType\":\"{}\",\"creationContext\":{{\"creator\":{{\"groupId\":{}}},\"expectedPrice\":10}}}}", name, description, classic_clothing_type, group_id));
.text("request", format!("{{\"displayName\":\"{}\",\"description\":\"{}\",\"assetType\":\"{}\",\"creationContext\":{{\"creator\":{{\"groupId\":{}}},\"expectedPrice\":10}}}}", name, description, asset_name_patch, group_id));

let cookie_string = self.cookie_string()?;
let xcsrf = self.xcsrf().await;
Expand Down

0 comments on commit 1d4686c

Please sign in to comment.