Skip to content

Commit

Permalink
Change callbackURL to webhookURL (#189)
Browse files Browse the repository at this point in the history
Calling callbackURL will result in a webhook verification failure

https://nylas.atlassian.net/browse/TW-2474

# License
<!-- Your PR comment must contain the following line for us to merge the
PR. -->
I confirm that this contribution is made under the terms of the MIT
license and that I have the authority necessary to make this
contribution on behalf of its copyright owner.
  • Loading branch information
atejada authored Jan 26, 2024
1 parent 26038be commit 2d19f3c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/com/nylas/models/CreateWebhookRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data class CreateWebhookRequest(
/**
* The url to send webhooks to.
*/
@Json(name = "callback_url")
val callbackUrl: String,
@Json(name = "webhook_url")
val webhookUrl: String,
/**
* A human-readable description of the webhook destination.
*/
Expand All @@ -30,11 +30,11 @@ data class CreateWebhookRequest(
/**
* A builder for creating a [CreateWebhookRequest].
* @param triggerTypes Select the event that triggers the webhook.
* @param callbackUrl The url to send webhooks to.
* @param webhookUrl The url to send webhooks to.
*/
data class Builder(
private val triggerTypes: List<WebhookTriggers>,
private val callbackUrl: String,
private val webhookUrl: String,
) {
private var description: String? = null
private var notificationEmailAddress: String? = null
Expand All @@ -57,6 +57,6 @@ data class CreateWebhookRequest(
* Build the [CreateWebhookRequest].
* @return The created [CreateWebhookRequest].
*/
fun build() = CreateWebhookRequest(triggerTypes, callbackUrl, description, notificationEmailAddress)
fun build() = CreateWebhookRequest(triggerTypes, webhookUrl, description, notificationEmailAddress)
}
}
12 changes: 6 additions & 6 deletions src/main/kotlin/com/nylas/models/UpdateWebhookRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data class UpdateWebhookRequest(
/**
* The url to send webhooks to.
*/
@Json(name = "callback_url")
val callbackUrl: String? = null,
@Json(name = "webhook_url")
val webhookUrl: String? = null,
/**
* A human-readable description of the webhook destination.
*/
Expand All @@ -32,7 +32,7 @@ data class UpdateWebhookRequest(
*/
class Builder {
private var triggerTypes: List<WebhookTriggers>? = null
private var callbackUrl: String? = null
private var webhookUrl: String? = null
private var description: String? = null
private var notificationEmailAddress: String? = null

Expand All @@ -45,10 +45,10 @@ data class UpdateWebhookRequest(

/**
* Set the url to send webhooks to.
* @param callbackUrl The url to send webhooks to.
* @param webhookUrl The url to send webhooks to.
* @return The builder.
*/
fun callbackUrl(callbackUrl: String?) = apply { this.callbackUrl = callbackUrl }
fun webhookUrl(webhookUrl: String?) = apply { this.webhookUrl = webhookUrl }

/**
* Set a human-readable description of the webhook destination.
Expand All @@ -68,6 +68,6 @@ data class UpdateWebhookRequest(
* Build the [UpdateWebhookRequest].
* @return The created [UpdateWebhookRequest].
*/
fun build() = UpdateWebhookRequest(triggerTypes, callbackUrl, description, notificationEmailAddress)
fun build() = UpdateWebhookRequest(triggerTypes, webhookUrl, description, notificationEmailAddress)
}
}
4 changes: 2 additions & 2 deletions src/main/kotlin/com/nylas/models/Webhook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data class Webhook(
/**
* The url to send webhooks to.
*/
@Json(name = "callback_url")
val callbackUrl: String,
@Json(name = "webhook_url")
val webhookUrl: String,
/**
* Select the event that triggers the webhook.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/nylas/models/WebhookWithSecret.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data class WebhookWithSecret(
/**
* The url to send webhooks to.
*/
@Json(name = "callback_url")
val callbackUrl: String,
@Json(name = "webhook_url")
val webhookUrl: String,
/**
* A secret value used to encode the X-Nylas-Signature header on webhook requests.
*/
Expand Down

0 comments on commit 2d19f3c

Please sign in to comment.