From 7bf45d1794a0576a64bf058847913eac692a2f65 Mon Sep 17 00:00:00 2001 From: Ankur Oberoi Date: Fri, 23 Mar 2018 14:42:00 -0700 Subject: [PATCH 1/2] WIP v4.1.0 --- docs/_posts/2018-03-23-v4.1.0.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 docs/_posts/2018-03-23-v4.1.0.md diff --git a/docs/_posts/2018-03-23-v4.1.0.md b/docs/_posts/2018-03-23-v4.1.0.md new file mode 100644 index 000000000..3f69a497f --- /dev/null +++ b/docs/_posts/2018-03-23-v4.1.0.md @@ -0,0 +1,11 @@ +--- +layout: changelog +--- + +- `IncomingWebhook.send()` works with both callbacks and Promises (#508) - thanks @clavin +- Completes type defintions for all `WebClient` method arguments (#512) - thanks @clavin +- Allows `files.upload` to work with Buffers (in addition to ReadableStreams) (#500) - thanks @KharitonOff +- Allows any WebClient methods argument to work with binary types (#519) - thanks @clavin and @aoberoi +- Fixes TypeScript compile errors in node >=6 <=8 related to `callbackify` (#518) - thanks @aoberoi +- Fixes mismatched parenthesis in RTMClient usage example documentation (#511) - thanks @parthsr +- Adds `examples` directory back to the repository (#520) - thanks @aoberoi diff --git a/package.json b/package.json index f01ad26fe..14de9e3ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@slack/client", - "version": "4.0.1", + "version": "4.1.0", "description": "Slack Developer Kit - official clients for the Web API, RTM API, and Incoming Webhooks", "author": "Slack Technologies, Inc.", "license": "MIT", From 8f541d12603463573631e55e886828fa8fd3706e Mon Sep 17 00:00:00 2001 From: Ankur Oberoi Date: Fri, 23 Mar 2018 16:20:51 -0700 Subject: [PATCH 2/2] v4.1.0 --- .github/maintainers_guide.md | 3 +- docs/_posts/2018-03-23-v4.1.0.md | 1 + docs/_reference/IncomingWebhook.md | 29 +++++++++++++- docs/_reference/RTMClient.md | 2 +- .../@slack-client-dist-IncomingWebhook.js | 38 +++++++++++++++++++ support/jsdoc/@slack-client-dist-methods.js | 10 +++++ support/jsdoc/@slack-client.js | 19 +++++++++- 7 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 support/jsdoc/@slack-client-dist-IncomingWebhook.js diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index 77647d334..296b78086 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -33,7 +33,8 @@ script. These two commands should be run each time an API changes to keep the do ### Releasing 0. Update generated content - * Reference docs are updated using `npm run docs:jsdoc`, `npm run docs` + * Reference docs are updated using `npm run docs:jsdoc`, delete the `@property` tagged method aliases from + `support/jsdoc/@slack-client.js`, then `npm run docs` 1. Create the commit for the release: * Bump the version number in adherence to [Semantic Versioning](http://semver.org/) in `package.json`. diff --git a/docs/_posts/2018-03-23-v4.1.0.md b/docs/_posts/2018-03-23-v4.1.0.md index 3f69a497f..ccb5033f2 100644 --- a/docs/_posts/2018-03-23-v4.1.0.md +++ b/docs/_posts/2018-03-23-v4.1.0.md @@ -6,6 +6,7 @@ layout: changelog - Completes type defintions for all `WebClient` method arguments (#512) - thanks @clavin - Allows `files.upload` to work with Buffers (in addition to ReadableStreams) (#500) - thanks @KharitonOff - Allows any WebClient methods argument to work with binary types (#519) - thanks @clavin and @aoberoi +- Fails when `WebClient.apiCall()` options don't look like the right type (#522) - thanks @aoberoi - Fixes TypeScript compile errors in node >=6 <=8 related to `callbackify` (#518) - thanks @aoberoi - Fixes mismatched parenthesis in RTMClient usage example documentation (#511) - thanks @parthsr - Adds `examples` directory back to the repository (#520) - thanks @aoberoi diff --git a/docs/_reference/IncomingWebhook.md b/docs/_reference/IncomingWebhook.md index 8587d03ee..305f90fe7 100644 --- a/docs/_reference/IncomingWebhook.md +++ b/docs/_reference/IncomingWebhook.md @@ -6,9 +6,15 @@ permalink: /reference/IncomingWebhook A client for Slack's Incoming Webhooks **Kind**: static class of [@slack/client](#module_@slack/client) + +* [.IncomingWebhook](#module_@slack/client.IncomingWebhook) + * [.send(message)](#module_@slack/client.IncomingWebhook+send) ⇒ Promise.<module:@slack/client/dist/IncomingWebhook.IncomingWebhookResult> + * [.send(message, callback)](#module_@slack/client.IncomingWebhook+send) + * [.send(message, callback)](#module_@slack/client.IncomingWebhook+send) + -### incomingWebhook.send(message, callback) +### incomingWebhook.send(message) ⇒ Promise.<module:@slack/client/dist/IncomingWebhook.IncomingWebhookResult> Send a notification to a conversation **Kind**: instance method of [IncomingWebhook](#module_@slack/client.IncomingWebhook) @@ -16,5 +22,24 @@ Send a notification to a conversation | Param | Type | Description | | --- | --- | --- | | message | string \| [IncomingWebhookSendArguments](#module_@slack/client.IncomingWebhookSendArguments) | the message (a simple string, or an object describing the message) | -| callback | [IncomingWebhookResultCallback](#module_@slack/client.IncomingWebhookResultCallback) | | + + + +### incomingWebhook.send(message, callback) +**Kind**: instance method of [IncomingWebhook](#module_@slack/client.IncomingWebhook) + +| Param | Type | +| --- | --- | +| message | string \| [IncomingWebhookSendArguments](#module_@slack/client.IncomingWebhookSendArguments) | +| callback | [IncomingWebhookResultCallback](#module_@slack/client.IncomingWebhookResultCallback) | + + + +### incomingWebhook.send(message, callback) +**Kind**: instance method of [IncomingWebhook](#module_@slack/client.IncomingWebhook) + +| Param | Type | +| --- | --- | +| message | string \| [IncomingWebhookSendArguments](#module_@slack/client.IncomingWebhookSendArguments) | +| callback | [IncomingWebhookResultCallback](#module_@slack/client.IncomingWebhookResultCallback) | diff --git a/docs/_reference/RTMClient.md b/docs/_reference/RTMClient.md index ab07aaf56..1c7c94fe2 100644 --- a/docs/_reference/RTMClient.md +++ b/docs/_reference/RTMClient.md @@ -155,7 +155,7 @@ be sent or received. | Param | Type | | --- | --- | -| options | module:@slack/client/dist/methods.TokenOverridable \| module:@slack/client/dist/methods.TokenOverridable | +| options | module:@slack/client/dist/methods.TokenOverridable \| module:@slack/client/dist/methods.LocaleAware \| module:@slack/client/dist/methods.__type \| module:@slack/client/dist/methods.TokenOverridable \| module:@slack/client/dist/methods.__type | diff --git a/support/jsdoc/@slack-client-dist-IncomingWebhook.js b/support/jsdoc/@slack-client-dist-IncomingWebhook.js new file mode 100644 index 000000000..2a90acb00 --- /dev/null +++ b/support/jsdoc/@slack-client-dist-IncomingWebhook.js @@ -0,0 +1,38 @@ +/** + * @module @slack/client/dist/IncomingWebhook + */ + +/** + * @interface module:@slack/client/dist/IncomingWebhook.IncomingWebhookHTTPError + * @extends module:@slack/client.CodedError + * @property {"slackclient_incomingwebhook_http_error"} code + * @property {Error} original + */ +export class IncomingWebhookHTTPError { +} + +/** + * @interface module:@slack/client/dist/IncomingWebhook.IncomingWebhookReadError + * @extends module:@slack/client.CodedError + * @property {"slackclient_incomingwebhook_read_error"} code + * @property {Error} original + */ +export class IncomingWebhookReadError { +} + +/** + * @interface module:@slack/client/dist/IncomingWebhook.IncomingWebhookRequestError + * @extends module:@slack/client.CodedError + * @property {"slackclient_incomingwebhook_request_error"} code + * @property {Error} original + */ +export class IncomingWebhookRequestError { +} + +/** + * @interface module:@slack/client/dist/IncomingWebhook.IncomingWebhookResult + * @property {string} text + */ +export class IncomingWebhookResult { +} + diff --git a/support/jsdoc/@slack-client-dist-methods.js b/support/jsdoc/@slack-client-dist-methods.js index 81a422971..00ca0e0b1 100644 --- a/support/jsdoc/@slack-client-dist-methods.js +++ b/support/jsdoc/@slack-client-dist-methods.js @@ -16,6 +16,16 @@ export class AuxiliaryArguments { export class CursorPaginationEnabled { } +/** + * @interface module:@slack/client/dist/methods.Dialog + * @property {string} title + * @property {string} callback_id + * @property {Array} elements + * @property {string} [submit_label] + */ +export class Dialog { +} + /** * @interface module:@slack/client/dist/methods.LinkUnfurls */ diff --git a/support/jsdoc/@slack-client.js b/support/jsdoc/@slack-client.js index eded26636..66ac330b4 100644 --- a/support/jsdoc/@slack-client.js +++ b/support/jsdoc/@slack-client.js @@ -18,6 +18,9 @@ * @property KeepAliveConfigError * @property KeepAliveClientNotConnected * @property KeepAliveInconsistentState + * @property IncomingWebhookRequestError + * @property IncomingWebhookReadError + * @property IncomingWebhookHTTPError */ export var ErrorCode /** @@ -46,6 +49,20 @@ export class IncomingWebhook { /** * Send a notification to a conversation * @param {string | module:@slack/client.IncomingWebhookSendArguments} message the message (a simple string, or an object describing the message) + * @function module:@slack/client.IncomingWebhook#send + * @returns {Promise} + */ + send() {} + + /** + * @param {string | module:@slack/client.IncomingWebhookSendArguments} message + * @param {module:@slack/client.IncomingWebhookResultCallback} callback + * @function module:@slack/client.IncomingWebhook#send + */ + send() {} + + /** + * @param {string | module:@slack/client.IncomingWebhookSendArguments} message * @param {module:@slack/client.IncomingWebhookResultCallback} callback * @function module:@slack/client.IncomingWebhook#send */ @@ -215,7 +232,7 @@ Promise. /** * Begin an RTM session using the provided options. This method must be called before any messages can * be sent or received. - * @param {module:@slack/client/dist/methods.TokenOverridable | module:@slack/client/dist/methods.TokenOverridable} options + * @param {module:@slack/client/dist/methods.TokenOverridable | module:@slack/client/dist/methods.LocaleAware | module:@slack/client/dist/methods.__type | module:@slack/client/dist/methods.TokenOverridable | module:@slack/client/dist/methods.__type} options * @function module:@slack/client.RTMClient#start */ start() {}