Skip to content

Commit

Permalink
fix(rbx_api): replace the deprecated place creation API with the repl…
Browse files Browse the repository at this point in the history
…acement API (#220)

* Replace the place creation API endpoint

* Add json macro

* Fix linter and remove unused header

* Fix json response casing
  • Loading branch information
Etheroit authored Jul 10, 2024
1 parent 861c56f commit 9a7910c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions mantle/rbx_api/src/places/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ pub mod models;

use std::{fs, path::PathBuf};

use reqwest::{header, Body, StatusCode};
use reqwest::{Body, StatusCode};
use serde_json::json;

use crate::{
errors::{RobloxApiError, RobloxApiResult},
Expand Down Expand Up @@ -153,14 +154,15 @@ impl RobloxApi {
) -> RobloxApiResult<CreatePlaceResponse> {
let req = self
.client
.post("https://www.roblox.com/ide/places/createV2")
.header(header::CONTENT_LENGTH, 0)
.query(&[
("universeId", &experience_id.to_string()),
("templatePlaceIdToUse", &95206881.to_string()),
]);
.post(format!(
"https://apis.roblox.com/universes/v1/user/universes/{}/places",
experience_id
))
.json(&json!({
"templatePlaceId": 95206881
}));

handle_as_json_with_status(req).await
handle_as_json(req).await
}

pub async fn configure_place(
Expand Down
2 changes: 1 addition & 1 deletion mantle/rbx_api/src/places/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::models::{AssetId, SocialSlotType};
pub const DEFAULT_PLACE_NAME: &str = "Untitled Game";

#[derive(Deserialize)]
#[serde(rename_all = "PascalCase")]
#[serde(rename_all = "camelCase")]
pub struct CreatePlaceResponse {
pub place_id: AssetId,
}
Expand Down

0 comments on commit 9a7910c

Please sign in to comment.