Skip to content

Commit

Permalink
minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JR-1991 committed Jun 25, 2024
1 parent 302217b commit e9ed4c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/native_api/collection/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ pub fn create_collection(
parent: &String,
body: &CollectionCreateBody,
) -> Result<Response<CollectionCreateResponse>, String> {
// Endpoint metadata
let url = format!("api/dataverses/{}/datasets", parent.as_str());

// Build body
let body = serde_json::to_string(&body).unwrap();

// Send request
let context = RequestType::JSON { body: body.clone() };
let response = client.post(
&format!("api/dataverses/{}", parent.as_str()),
None,
&context,
);
let response = client.post(url.as_str(), None, &context);

evaluate_response::<CollectionCreateResponse>(response)
}
3 changes: 1 addition & 2 deletions src/native_api/dataset/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub fn upload_file_to_dataset(

// Build hash maps for the request
let file = HashMap::from([("file".to_string(), fpath.clone())]);

let body = match body {
Some(body) => Some(HashMap::from([(
"jsonData".to_string(),
Expand All @@ -48,7 +47,7 @@ pub fn upload_file_to_dataset(
Some(HashMap::from([("persistentId".to_string(), id.clone())])),
&context,
),
Identifier::Id(id) => client.post(&format!("api/files/{}", id), None, &context),
Identifier::Id(_) => client.post(path.as_str(), None, &context),
};

evaluate_response::<UploadResponse>(response)
Expand Down

0 comments on commit e9ed4c7

Please sign in to comment.