Skip to content

Commit

Permalink
v4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane DeWael committed Aug 30, 2018
1 parent d76a7be commit 38b4ca8
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
7 changes: 7 additions & 0 deletions docs/_posts/2018-08-30-v4.6.0.md
@@ -0,0 +1,7 @@
---
layout: changelog
---

## New Features

- Adds support for short lived tokens and automatic token refresh (#617) - thanks @aoberoi and @shanedewael
5 changes: 4 additions & 1 deletion docs/_reference/WebClient.md
Expand Up @@ -14,7 +14,10 @@ a convenience wrapper for calling the [WebClient#apiCall](WebClient#apiCall) met

| Name | Type | Description |
| --- | --- | --- |
| [token] | <code>string</code> | Authentication and authorization token for accessing Slack Web API (usually begins with `xoxp`, `xoxb`, or `xoxa`) |
| token | <code>string</code> \| <code>undefined</code> | Authentication and authorization token for accessing Slack Web API (usually begins with `xoxa`, xoxp`, or `xoxb`) |
| [refreshToken] | <code>string</code> | OAuth 2.0 refresh token used to automatically create new access tokens (`token`) when the current is expired. |
| [clientId] | <code>string</code> | OAuth 2.0 client identifier |
| [clientSecret] | <code>string</code> | OAuth 2.0 client secret |
| [slackApiUrl] | <code>string</code> | The base URL for reaching Slack's Web API. Consider changing this value for testing purposes. |


Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@slack/client",
"version": "4.5.0",
"version": "4.6.0",
"description": "Slack Developer Kit - official clients for the Web API, RTM API, and Incoming Webhooks",
"author": "Slack Technologies, Inc.",
"license": "MIT",
Expand Down
13 changes: 0 additions & 13 deletions support/jsdoc/@slack-client-dist-WebClient.js

This file was deleted.

45 changes: 40 additions & 5 deletions support/jsdoc/@slack-client.js
@@ -1,4 +1,4 @@
/**
/**
* @module @slack/client
*/

Expand All @@ -11,6 +11,7 @@
* @property HTTPError
* @property PlatformError
* @property RateLimitedError
* @property RefreshFailedError
* @property RTMSendWhileDisconnectedError
* @property RTMSendWhileNotReadyError
* @property RTMSendMessagePlatformError
Expand Down Expand Up @@ -158,12 +159,12 @@ export class RTMClient {
* Generic method for sending an outgoing message of an arbitrary type. This method guards the higher-level methods
* from concern of which state the client is in, because it places all messages into a queue. The tasks on the queue
* will buffer until the client is in a state where they can be sent.
*
*
* If the awaitReply parameter is set to true, then the returned Promise is resolved with the platform's
* acknowledgement response. Not all message types will result in an acknowledgement response, so use this carefully.
* This promise may be rejected with an error containing code=RTMNoReplyReceivedError if the client disconnects or
* reconnects before recieving the acknowledgement response.
*
*
* If the awaitReply parameter is set to false, then the returned Promise is resolved as soon as the message is sent
* from the websocket.
* @param {"undefined"} awaitReply whether to wait for an acknowledgement response from the platform before resolving the returned
Expand Down Expand Up @@ -302,6 +303,16 @@ export class RTMWebsocketError {
export class TLSOptions {
}

/**
* @interface module:@slack/client.TokenRefreshedEvent
* @property {string} access_token
* @property {number} expires_in
* @property {string} team_id
* @property {string} [enterprise_id]
*/
export class TokenRefreshedEvent {
}

/**
* @interface module:@slack/client.WebAPICallOptions
*/
Expand Down Expand Up @@ -342,6 +353,15 @@ export class WebAPIHTTPError {
export class WebAPIPlatformError {
}

/**
* @interface module:@slack/client.WebAPIRateLimitedError
* @extends module:@slack/client.CodedError
* @property {"slackclient_rate_limited_error"} code
* @property {number} retryAfter
*/
export class WebAPIRateLimitedError {
}

/**
* @interface module:@slack/client.WebAPIReadError
* @extends module:@slack/client.CodedError
Expand All @@ -351,6 +371,15 @@ export class WebAPIPlatformError {
export class WebAPIReadError {
}

/**
* @interface module:@slack/client.WebAPIRefreshFailedError
* @extends module:@slack/client.CodedError
* @property {"slackclient_refresh_failed_error"} code
* @property {Error} original
*/
export class WebAPIRefreshFailedError {
}

/**
* @interface module:@slack/client.WebAPIRequestError
* @extends module:@slack/client.CodedError
Expand All @@ -368,11 +397,14 @@ export class WebAPIResultCallback {

/**
* A client for Slack's Web API
*
*
* This client provides an alias for each {@link https://api.slack.com/methods|Web API method}. Each method is
* a convenience wrapper for calling the {@link WebClient#apiCall} method using the method name as the first parameter.
* @extends EventEmitter
* @property {string} [token] Authentication and authorization token for accessing Slack Web API (usually begins with `xoxp`, `xoxb`, or `xoxa`)
* @property {string | undefined} token Authentication and authorization token for accessing Slack Web API (usually begins with `xoxa`, xoxp`, or `xoxb`)
* @property {string} [refreshToken] OAuth 2.0 refresh token used to automatically create new access tokens (`token`) when the current is expired.
* @property {string} [clientId] OAuth 2.0 client identifier
* @property {string} [clientSecret] OAuth 2.0 client secret
* @property {string} [slackApiUrl] The base URL for reaching Slack's Web API. Consider changing this value for testing purposes.
*/
export class WebClient {
Expand Down Expand Up @@ -413,6 +445,9 @@ export class WebClient {
* @property {module:@slack/client.TLSOptions} [tls]
* @property {number} [pageSize]
* @property {boolean} [rejectRateLimitedCalls]
* @property {string} [clientId]
* @property {string} [clientSecret]
* @property {string} [refreshToken]
*/
export class WebClientOptions {
}
Expand Down

0 comments on commit 38b4ca8

Please sign in to comment.