| 1 | package slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.16 context/" |
| 5 | "net/urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/" |
| 6 | ) |
| 7 | |
| 8 | // AuthRevokeResponse contains our Auth response from the auth.revoke endpoint |
| 9 | type AuthRevokeResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse# struct { |
| 10 | SlackResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse#SlackResponse. // Contains the "ok", and "Error", if any |
| 11 | Revokedscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse#Revoked. bool `json:"revoked,omitempty"` |
| 12 | } |
| 13 | |
| 14 | // authRequest sends the actual request, and unmarshals the response |
| 15 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) authRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#authRequest().(ctx contextscip-go gomod github.com/golang/go/src go1.16 context/.Contextscip-go gomod github.com/golang/go/src go1.16 context/Context#, path string, values urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#) (*AuthRevokeResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse#, error) { |
| 16 | response := &AuthRevokeResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse#{} |
| 17 | err := api.postMethodscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#postMethod().(ctx, path, values, response) |
| 18 | if err != nil { |
| 19 | return nil, err |
| 20 | } |
| 21 | |
| 22 | return response, response.Errscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Err().() |
| 23 | } |
| 24 | |
| 25 | // SendAuthRevoke will send a revocation for our token |
| 26 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) SendAuthRevokescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#SendAuthRevoke().(token string) (*AuthRevokeResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse#, error) { |
| 27 | return api.SendAuthRevokeContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#SendAuthRevokeContext().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), token) |
| 28 | } |
| 29 | |
| 30 | // SendAuthRevokeContext will send a revocation request for our token to api.revoke with context |
| 31 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) SendAuthRevokeContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#SendAuthRevokeContext().(ctx contextscip-go gomod github.com/golang/go/src go1.16 context/.Contextscip-go gomod github.com/golang/go/src go1.16 context/Context#, token string) (*AuthRevokeResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/AuthRevokeResponse#, error) { |
| 32 | if token == "" { |
| 33 | token = api.tokenscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#token. |
| 34 | } |
| 35 | values := urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#{ |
| 36 | "token": {token}, |
| 37 | } |
| 38 | |
| 39 | return api.authRequestscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#authRequest().(ctx, "auth.revoke", values) |
| 40 | } |