From 5bb3a97eb673fad68d33c8fd10eea7c75b10dcdd Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 17 Nov 2026 22:15:05 -0800 Subject: [PATCH] feat(methods): add oauth.v2.beginShortTokenRotation method example --- methods/README.md | 4 +++ .../v2/OAuthV2BeginShortTokenRotation.java | 27 +++++++++++++++++++ methods/src/main/java/oauth/v2/manifest.json | 16 +++++++++++ 3 files changed, 47 insertions(+) create mode 100644 methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java create mode 100644 methods/src/main/java/oauth/v2/manifest.json diff --git a/methods/README.md b/methods/README.md index f4186f9..0626cc1 100644 --- a/methods/README.md +++ b/methods/README.md @@ -53,6 +53,10 @@ $ mvn compile exec:java -Dexec.mainClass=chat.ChatPostMessage # Make the reques - **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/main/java/chat/ChatPostMessage.java). +### oauth + +- **[oauth.v2.beginShortTokenRotation](https://docs.slack.dev/reference/methods/oauth.v2.beginShortTokenRotation)**: Begins rotating the secret on an API token with a short secret. [Implementation](./src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java). + ### slackbot - **[slackbot.skills.create](https://docs.slack.dev/reference/methods/slackbot.skills.create)**: Creates a skill from markdown instructions, or turns an existing canvas the caller owns into a skill. [Implementation](./src/main/java/slackbot/skills/SlackbotSkillsCreate.java). diff --git a/methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java b/methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java new file mode 100644 index 0000000..ca2cebc --- /dev/null +++ b/methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java @@ -0,0 +1,27 @@ +package oauth.v2; + +import com.slack.api.Slack; +import com.slack.api.methods.MethodsClient; +import com.slack.api.methods.SlackApiException; +import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest; +import com.slack.api.methods.response.oauth.OAuthV2BeginShortTokenRotationResponse; +import java.io.IOException; + +public class OAuthV2BeginShortTokenRotation { + + public static void main(String[] args) throws IOException, SlackApiException { + // Initialize + MethodsClient methods = Slack.getInstance().methods(); + + // Call the oauth.v2.beginShortTokenRotation method + OAuthV2BeginShortTokenRotationRequest request = OAuthV2BeginShortTokenRotationRequest.builder() + .clientId("4123121235.9872358710") + .clientSecret("e1b9e11dfcd19c1982d5de12921e17e8c") + .token("xoxp-12345-67890-1928471-abcdefg") + .build(); + OAuthV2BeginShortTokenRotationResponse response = methods.oauthV2BeginShortTokenRotation(request); + + // Inspect the response + System.out.println(response); + } +} diff --git a/methods/src/main/java/oauth/v2/manifest.json b/methods/src/main/java/oauth/v2/manifest.json new file mode 100644 index 0000000..0a93feb --- /dev/null +++ b/methods/src/main/java/oauth/v2/manifest.json @@ -0,0 +1,16 @@ +{ + "display_information": { + "name": "Slack API Methods", + "description": "Example implementations to call \"oauth.v2\" methods" + }, + "oauth_config": { + "scopes": { + "user": [] + } + }, + "settings": { + "org_deploy_enabled": true, + "socket_mode_enabled": false, + "token_rotation_enabled": false + } +}