Skip to content

Commit

Permalink
feat: add api_key to SuccinctClient (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani authored Nov 10, 2023
1 parent aab74a1 commit 55bb561
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ pub struct SuccinctClient {
client: Client,
/// The base url for the Succinct X API. (ex. https://alpha.succinct.xyz/api)
base_url: String,
/// API key for the Succinct X API.
api_key: String,
}

impl SuccinctClient {
pub fn new(base_url: String) -> Self {
pub fn new(base_url: String, api_key: String) -> Self {
Self {
client: Client::new(),
base_url,
api_key,
}
}

Expand Down Expand Up @@ -67,6 +70,7 @@ impl SuccinctClient {
.client
.post(request_url)
.header("Content-Type", "application/json")
.bearer_auth(self.api_key.clone())
.body(serialized_data)
.send()
.await
Expand Down

0 comments on commit 55bb561

Please sign in to comment.