Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions json-logs/samples/api/oauth.v2.completeShortTokenRotation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ok": false,
"error": "",
"needed": "",
"provided": "",
"response_metadata": {
"messages": [
""
]
},
"token": "",
"warning": ""
}
1 change: 1 addition & 0 deletions metadata/web-api/rate_limit_tiers.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
"oauth.token": "Tier4",
"oauth.v2.access": "Tier4",
"oauth.v2.beginShortTokenRotation": "Tier2",
"oauth.v2.completeShortTokenRotation": "Tier2",
"oauth.v2.exchange": "Tier3",
"openid.connect.token": "Tier4",
"openid.connect.userInfo": "Tier3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
import com.slack.api.methods.request.oauth.OAuthTokenRequest;
import com.slack.api.methods.request.oauth.OAuthV2AccessRequest;
import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2CompleteShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2ExchangeRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectTokenRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectUserInfoRequest;
Expand Down Expand Up @@ -278,6 +279,7 @@
import com.slack.api.methods.response.oauth.OAuthTokenResponse;
import com.slack.api.methods.response.oauth.OAuthV2AccessResponse;
import com.slack.api.methods.response.oauth.OAuthV2BeginShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2CompleteShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2ExchangeResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectTokenResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectUserInfoResponse;
Expand Down Expand Up @@ -1487,6 +1489,10 @@ CompletableFuture<AdminConversationsWhitelistListGroupsLinkedToChannelResponse>

CompletableFuture<OAuthV2BeginShortTokenRotationResponse> oauthV2BeginShortTokenRotation(RequestConfigurator<OAuthV2BeginShortTokenRotationRequest.OAuthV2BeginShortTokenRotationRequestBuilder> req);

CompletableFuture<OAuthV2CompleteShortTokenRotationResponse> oauthV2CompleteShortTokenRotation(OAuthV2CompleteShortTokenRotationRequest req);

CompletableFuture<OAuthV2CompleteShortTokenRotationResponse> oauthV2CompleteShortTokenRotation(RequestConfigurator<OAuthV2CompleteShortTokenRotationRequest.OAuthV2CompleteShortTokenRotationRequestBuilder> req);

CompletableFuture<OAuthV2ExchangeResponse> oauthV2Exchange(OAuthV2ExchangeRequest req);

CompletableFuture<OAuthV2ExchangeResponse> oauthV2Exchange(RequestConfigurator<OAuthV2ExchangeRequest.OAuthV2ExchangeRequestBuilder> req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ private Methods() {
public static final String OAUTH_ACCESS = "oauth.access";
public static final String OAUTH_V2_ACCESS = "oauth.v2.access";
public static final String OAUTH_V2_BEGIN_SHORT_TOKEN_ROTATION = "oauth.v2.beginShortTokenRotation";
public static final String OAUTH_V2_COMPLETE_SHORT_TOKEN_ROTATION = "oauth.v2.completeShortTokenRotation";
public static final String OAUTH_V2_EXCHANGE = "oauth.v2.exchange";
public static final String OAUTH_TOKEN = "oauth.token";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
import com.slack.api.methods.request.oauth.OAuthTokenRequest;
import com.slack.api.methods.request.oauth.OAuthV2AccessRequest;
import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2CompleteShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2ExchangeRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectTokenRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectUserInfoRequest;
Expand Down Expand Up @@ -303,6 +304,7 @@
import com.slack.api.methods.response.oauth.OAuthTokenResponse;
import com.slack.api.methods.response.oauth.OAuthV2AccessResponse;
import com.slack.api.methods.response.oauth.OAuthV2BeginShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2CompleteShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2ExchangeResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectTokenResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectUserInfoResponse;
Expand Down Expand Up @@ -2602,6 +2604,13 @@ OAuthV2BeginShortTokenRotationResponse oauthV2BeginShortTokenRotation(
RequestConfigurator<OAuthV2BeginShortTokenRotationRequest.OAuthV2BeginShortTokenRotationRequestBuilder> req)
throws IOException, SlackApiException;

OAuthV2CompleteShortTokenRotationResponse oauthV2CompleteShortTokenRotation(OAuthV2CompleteShortTokenRotationRequest req)
throws IOException, SlackApiException;

OAuthV2CompleteShortTokenRotationResponse oauthV2CompleteShortTokenRotation(
RequestConfigurator<OAuthV2CompleteShortTokenRotationRequest.OAuthV2CompleteShortTokenRotationRequestBuilder> req)
throws IOException, SlackApiException;

OAuthV2ExchangeResponse oauthV2Exchange(OAuthV2ExchangeRequest req) throws IOException, SlackApiException;

OAuthV2ExchangeResponse oauthV2Exchange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ public static void setRateLimitTier(String methodName, MethodsRateLimitTier tier
setRateLimitTier(OAUTH_TOKEN, Tier4);
setRateLimitTier(OAUTH_V2_ACCESS, Tier4);
setRateLimitTier(OAUTH_V2_BEGIN_SHORT_TOKEN_ROTATION, Tier2);
setRateLimitTier(OAUTH_V2_COMPLETE_SHORT_TOKEN_ROTATION, Tier2);
setRateLimitTier(OAUTH_V2_EXCHANGE, Tier3);

setRateLimitTier(OPENID_CONNECT_TOKEN, Tier4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
import com.slack.api.methods.request.oauth.OAuthAccessRequest;
import com.slack.api.methods.request.oauth.OAuthTokenRequest;
import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2CompleteShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2ExchangeRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectUserInfoRequest;
import com.slack.api.methods.request.pins.PinsAddRequest;
Expand Down Expand Up @@ -2910,6 +2911,14 @@ public static FormBody.Builder toForm(OAuthV2BeginShortTokenRotationRequest req)
return form;
}

public static FormBody.Builder toForm(OAuthV2CompleteShortTokenRotationRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("client_id", req.getClientId(), form);
setIfNotNull("client_secret", req.getClientSecret(), form);
setIfNotNull("new_token", req.getNewToken(), form);
return form;
}

public static FormBody.Builder toForm(OAuthV2ExchangeRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("client_id", req.getClientId(), form);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
import com.slack.api.methods.request.oauth.OAuthTokenRequest;
import com.slack.api.methods.request.oauth.OAuthV2AccessRequest;
import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2CompleteShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2ExchangeRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectTokenRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectUserInfoRequest;
Expand Down Expand Up @@ -282,6 +283,7 @@
import com.slack.api.methods.response.oauth.OAuthTokenResponse;
import com.slack.api.methods.response.oauth.OAuthV2AccessResponse;
import com.slack.api.methods.response.oauth.OAuthV2BeginShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2CompleteShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2ExchangeResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectTokenResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectUserInfoResponse;
Expand Down Expand Up @@ -2639,6 +2641,16 @@ public CompletableFuture<OAuthV2BeginShortTokenRotationResponse> oauthV2BeginSho
return oauthV2BeginShortTokenRotation(req.configure(OAuthV2BeginShortTokenRotationRequest.builder()).build());
}

@Override
public CompletableFuture<OAuthV2CompleteShortTokenRotationResponse> oauthV2CompleteShortTokenRotation(OAuthV2CompleteShortTokenRotationRequest req) {
return executor.execute(OAUTH_V2_COMPLETE_SHORT_TOKEN_ROTATION, toMap(req), () -> methods.oauthV2CompleteShortTokenRotation(req));
}

@Override
public CompletableFuture<OAuthV2CompleteShortTokenRotationResponse> oauthV2CompleteShortTokenRotation(RequestConfigurator<OAuthV2CompleteShortTokenRotationRequest.OAuthV2CompleteShortTokenRotationRequestBuilder> req) {
return oauthV2CompleteShortTokenRotation(req.configure(OAuthV2CompleteShortTokenRotationRequest.builder()).build());
}

@Override
public CompletableFuture<OAuthV2ExchangeResponse> oauthV2Exchange(OAuthV2ExchangeRequest req) {
return executor.execute(OAUTH_V2_EXCHANGE, toMap(req), () -> methods.oauthV2Exchange(req));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
import com.slack.api.methods.request.oauth.OAuthTokenRequest;
import com.slack.api.methods.request.oauth.OAuthV2AccessRequest;
import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2CompleteShortTokenRotationRequest;
import com.slack.api.methods.request.oauth.OAuthV2ExchangeRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectTokenRequest;
import com.slack.api.methods.request.openid.connect.OpenIDConnectUserInfoRequest;
Expand Down Expand Up @@ -305,6 +306,7 @@
import com.slack.api.methods.response.oauth.OAuthTokenResponse;
import com.slack.api.methods.response.oauth.OAuthV2AccessResponse;
import com.slack.api.methods.response.oauth.OAuthV2BeginShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2CompleteShortTokenRotationResponse;
import com.slack.api.methods.response.oauth.OAuthV2ExchangeResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectTokenResponse;
import com.slack.api.methods.response.openid.connect.OpenIDConnectUserInfoResponse;
Expand Down Expand Up @@ -3291,6 +3293,16 @@ public OAuthV2BeginShortTokenRotationResponse oauthV2BeginShortTokenRotation(Req
return oauthV2BeginShortTokenRotation(req.configure(OAuthV2BeginShortTokenRotationRequest.builder()).build());
}

@Override
public OAuthV2CompleteShortTokenRotationResponse oauthV2CompleteShortTokenRotation(OAuthV2CompleteShortTokenRotationRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.OAUTH_V2_COMPLETE_SHORT_TOKEN_ROTATION, getToken(req), OAuthV2CompleteShortTokenRotationResponse.class);
}

@Override
public OAuthV2CompleteShortTokenRotationResponse oauthV2CompleteShortTokenRotation(RequestConfigurator<OAuthV2CompleteShortTokenRotationRequest.OAuthV2CompleteShortTokenRotationRequestBuilder> req) throws IOException, SlackApiException {
return oauthV2CompleteShortTokenRotation(req.configure(OAuthV2CompleteShortTokenRotationRequest.builder()).build());
}

@Override
public OAuthV2ExchangeResponse oauthV2Exchange(OAuthV2ExchangeRequest req) throws IOException, SlackApiException {
return postFormAndParseResponse(toForm(req), Methods.OAUTH_V2_EXCHANGE, OAuthV2ExchangeResponse.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.slack.api.methods.request.oauth;

import com.slack.api.methods.SlackApiRequest;
import lombok.Builder;
import lombok.Data;

/**
* https://docs.slack.dev/reference/methods/oauth.v2.completeShortTokenRotation
*/
@Data
@Builder
public class OAuthV2CompleteShortTokenRotationRequest implements SlackApiRequest {

/**
* Issued when you created your application. Must be the app the token being rotated was issued to.
*/
private String clientId;

/**
* Issued when you created your application.
*/
private String clientSecret;

/**
* The original short xoxp token being rotated (the one passed to oauth.v2.beginShortTokenRotation). Authenticates the request.
*/
private String token;

/**
* The new xoxp token returned by oauth.v2.beginShortTokenRotation.
*/
private String newToken;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.slack.api.methods.response.oauth;

import com.slack.api.methods.SlackApiTextResponse;
import com.slack.api.model.ErrorResponseMetadata;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
* https://docs.slack.dev/reference/methods/oauth.v2.completeShortTokenRotation
*/
@Data
public class OAuthV2CompleteShortTokenRotationResponse implements SlackApiTextResponse {

private boolean ok;
private String warning;
private String error;
private String needed;
private String provided;
private transient Map<String, List<String>> httpResponseHeaders;

private String token;
private ErrorResponseMetadata responseMetadata;
}
Loading
Loading