Skip to content

Commit

Permalink
Update Webhooks Rotate Secret path (#212)
Browse files Browse the repository at this point in the history
The Rotate Secret call should webhooks/rotate-secret/id not
webhooks/id/rotate-secret

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

# License
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.

Co-authored-by: Mostafa Rashed <[email protected]>
  • Loading branch information
atejada and mrashed-dev authored Feb 21, 2024
1 parent 7e03603 commit 0b823ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nylas/resources/Webhooks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Webhooks(client: NylasClient) : Resource<Webhook>(client, Webhook::class.j
* @returns The updated webhook destination
*/
fun rotateSecret(webhookId: String): Response<WebhookWithSecret> {
val path = String.format("v3/webhooks/%s/rotate-secret", webhookId)
val path = String.format("v3/webhooks/rotate-secret/%s", webhookId)
val responseType = Types.newParameterizedType(Response::class.java, WebhookWithSecret::class.java)
return client.executePost(path, responseType)
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/com/nylas/resources/WebhooksTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class WebhooksTests {
queryParamCaptor.capture(),
)

assertEquals("v3/webhooks/$webhookId/rotate-secret", pathCaptor.firstValue)
assertEquals("v3/webhooks/rotate-secret/$webhookId", pathCaptor.firstValue)
assertEquals(Types.newParameterizedType(Response::class.java, WebhookWithSecret::class.java), typeCaptor.firstValue)
assertNull(requestBodyCaptor.firstValue)
}
Expand Down

0 comments on commit 0b823ca

Please sign in to comment.