File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ public protocol OAuth20API {
4343 func postOAuth2RefreshToken(
4444 _ request: PostOAuth2RefreshTokenRequestV2
4545 ) -> TwitterAPISessionSpecializedTask < TwitterOAuth2AccessToken >
46+
47+ func postOAuth2RevokeToken(
48+ _ request: PostOAuth2RevokeTokenRequestV2
49+ ) -> TwitterAPISessionDataTask
4650}
4751
4852extension TwitterAPIKit . TwitterAuthAPIImpl : OAuth20API {
@@ -112,4 +116,10 @@ extension TwitterAPIKit.TwitterAuthAPIImpl: OAuth20API {
112116 return postOAuth2RefreshTokenData ( request)
113117 . specialized { try TwitterOAuth2AccessToken . fromResponse ( data: $0) }
114118 }
119+
120+ func postOAuth2RevokeToken(
121+ _ request: PostOAuth2RevokeTokenRequestV2
122+ ) -> TwitterAPISessionDataTask {
123+ return session. send ( request)
124+ }
115125}
Original file line number Diff line number Diff line change 1+ import Foundation
2+
3+ /// https://developer.twitter.com/en/docs/authentication/oauth-2-0/user-access-token
4+ open class PostOAuth2RevokeTokenRequestV2 : TwitterAPIRequest {
5+
6+ public let token : String
7+ /// Required for Public Client.
8+ public let clientID : String ?
9+
10+ public var method : HTTPMethod {
11+ return . post
12+ }
13+
14+ public var path : String {
15+ return " /2/oauth2/revoke "
16+ }
17+
18+ open var parameters : [ String : Any ] {
19+ var p = [ String: String] ( )
20+ p [ " token " ] = token
21+ clientID. map { p [ " client_id " ] = $0 }
22+ return p
23+ }
24+
25+ public init (
26+ token: String ,
27+ clientID: String ? = . none
28+ ) {
29+ self . token = token
30+ self . clientID = clientID
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments