Skip to content

Commit

Permalink
Pass user ID, party ID for status update in payload, not URL
Browse files Browse the repository at this point in the history
  • Loading branch information
homeworkprod committed Jul 31, 2024
1 parent ed82f49 commit 6548b3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

## 0.5.0 (unreleased)

- Changed way of passing user ID and party ID on status updates from
URL parameters to JSON payload.

- Raised minimum supported Rust version to 1.78.0.

- Updated clap to v4.5.11.
Expand Down
8 changes: 6 additions & 2 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@ impl ApiClient {
}

pub(crate) fn update_status(&self, user_id: &str, whereabouts_name: &str) -> Result<()> {
let url = format!("{}/statuses/{}/{}", self.base_url, user_id, self.party_id);
let url = format!("{}/statuses", self.base_url);
let authz_value = format!("Bearer {}", self.auth_token);

ureq::post(&url)
.timeout(self.timeout)
.set("Authorization", &authz_value)
.send_json(ureq::json!({"whereabouts_name": whereabouts_name}))
.send_json(ureq::json!({
"user_id": user_id,
"party_id": self.party_id,
"whereabouts_name": whereabouts_name,
}))
.map_err(|e| anyhow!("Network error: {}", e))
.map(|_| Ok(()))?
}
Expand Down

0 comments on commit 6548b3c

Please sign in to comment.