Skip to content

Commit

Permalink
Merge pull request #27 from helius-labs/fix/url-formatting-issues
Browse files Browse the repository at this point in the history
fix(webhooks): Update URL Formatting
  • Loading branch information
0xIchigo authored May 21, 2024
2 parents 8de4d6f + fb28887 commit b9e3374
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Helius {
/// A `Result` wrapping a `Webhook` if the webhook is successfully created, or a `HeliusError` if creation fails
pub async fn create_webhook(&self, request: CreateWebhookRequest) -> Result<Webhook> {
let url: String = format!(
"{}v0/webhooks/?api-key={}",
"{}v0/webhooks?api-key={}",
self.config.endpoints.api, self.config.api_key
);
let parsed_url: Url = Url::parse(&url).expect("Failed to parse URL");
Expand All @@ -34,7 +34,7 @@ impl Helius {
/// A `Result` wrapping the updated `Webhook`, or a `HeliusError` if the edit request fails
pub async fn edit_webhook(&self, request: EditWebhookRequest) -> Result<Webhook> {
let url: String = format!(
"{}v0/webhooks/{}/?api-key={}",
"{}v0/webhooks/{}?api-key={}",
self.config.endpoints.api, request.webhook_id, self.config.api_key
);
let parsed_url: Url = Url::parse(&url).expect("Failed to parse URL");
Expand Down Expand Up @@ -111,7 +111,7 @@ impl Helius {
/// A `Result` wrapping the `Webhook` queried, if it exists
pub async fn get_webhook_by_id(&self, webhook_id: &str) -> Result<Webhook> {
let url: String = format!(
"{}v0/webhooks/{}/?api-key={}",
"{}v0/webhooks/{}?api-key={}",
self.config.endpoints.api, webhook_id, self.config.api_key
);
let parsed_url: Url = Url::parse(&url).expect("Failed to parse URL");
Expand All @@ -127,7 +127,7 @@ impl Helius {
/// A `Result` containing a vector of `Webhook` representing all configured webhooks for a given account
pub async fn get_all_webhooks(&self) -> Result<Vec<Webhook>> {
let url: String = format!(
"{}v0/webhooks/?api-key={}",
"{}v0/webhooks?api-key={}",
self.config.endpoints.api, self.config.api_key
);
let parsed_url: Url = Url::parse(&url).expect("Failed to parse URL");
Expand All @@ -144,7 +144,7 @@ impl Helius {
/// A unit since there isn't any response
pub async fn delete_webhook(&self, webhook_id: &str) -> Result<()> {
let url: String = format!(
"{}v0/webhooks/{}/?api-key={}",
"{}v0/webhooks/{}?api-key={}",
self.config.endpoints.api, webhook_id, self.config.api_key
);
let parsed_url: Url = Url::parse(&url).expect("Failed to parse URL");
Expand Down

0 comments on commit b9e3374

Please sign in to comment.