From 0b823ca4e8c5f1dedb269c8ef771ccb2a49a2b41 Mon Sep 17 00:00:00 2001 From: Blag Date: Wed, 21 Feb 2024 12:33:28 -0500 Subject: [PATCH] Update Webhooks Rotate Secret path (#212) 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 <17770919+mrashed-dev@users.noreply.github.com> --- src/main/kotlin/com/nylas/resources/Webhooks.kt | 2 +- src/test/kotlin/com/nylas/resources/WebhooksTests.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/nylas/resources/Webhooks.kt b/src/main/kotlin/com/nylas/resources/Webhooks.kt index 5e6d1819..c58fb9ab 100644 --- a/src/main/kotlin/com/nylas/resources/Webhooks.kt +++ b/src/main/kotlin/com/nylas/resources/Webhooks.kt @@ -78,7 +78,7 @@ class Webhooks(client: NylasClient) : Resource(client, Webhook::class.j * @returns The updated webhook destination */ fun rotateSecret(webhookId: String): Response { - 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) } diff --git a/src/test/kotlin/com/nylas/resources/WebhooksTests.kt b/src/test/kotlin/com/nylas/resources/WebhooksTests.kt index ed45decc..a4a29f4e 100644 --- a/src/test/kotlin/com/nylas/resources/WebhooksTests.kt +++ b/src/test/kotlin/com/nylas/resources/WebhooksTests.kt @@ -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) }