messaging-api-slack
Advanced tools
Comparing version 1.0.0-beta.24 to 1.0.0-beta.25
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SlackTypes = exports.SlackWebhookClient = exports.SlackOAuthClient = void 0; | ||
const SlackOAuthClient_1 = __importDefault(require("./SlackOAuthClient")); | ||
@@ -14,0 +27,0 @@ exports.SlackOAuthClient = SlackOAuthClient_1.default; |
@@ -28,2 +28,5 @@ import { AxiosInstance } from 'axios'; | ||
}; | ||
/** | ||
* @deprecated Use `new SlackOAuthClient(...)` instead. | ||
*/ | ||
static connect(accessTokenOrConfig: string | Types.ClientConfig): SlackOAuthClient; | ||
@@ -30,0 +33,0 @@ constructor(accessTokenOrConfig: string | Types.ClientConfig); |
@@ -74,3 +74,7 @@ "use strict"; | ||
} | ||
/** | ||
* @deprecated Use `new SlackOAuthClient(...)` instead. | ||
*/ | ||
static connect(accessTokenOrConfig) { | ||
warning_1.default(false, '`SlackOAuthClient.connect(...)` is deprecated. Use `new SlackOAuthClient(...)` instead.'); | ||
return new SlackOAuthClient(accessTokenOrConfig); | ||
@@ -77,0 +81,0 @@ } |
@@ -11,2 +11,5 @@ import { AxiosInstance } from 'axios'; | ||
_onRequest: OnRequestFunction | undefined; | ||
/** | ||
* @deprecated Use `new SlackWebhookClient(...)` instead. | ||
*/ | ||
static connect(urlOrConfig: string | ClientConfig): SlackWebhookClient; | ||
@@ -13,0 +16,0 @@ constructor(urlOrConfig: string | ClientConfig); |
@@ -7,2 +7,3 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const warning_1 = __importDefault(require("warning")); | ||
const messaging_api_common_1 = require("messaging-api-common"); | ||
@@ -28,3 +29,7 @@ class SlackWebhookClient { | ||
} | ||
/** | ||
* @deprecated Use `new SlackWebhookClient(...)` instead. | ||
*/ | ||
static connect(urlOrConfig) { | ||
warning_1.default(false, '`SlackWebhookClient.connect(...)` is deprecated. Use `new SlackWebhookClient(...)` instead.'); | ||
return new SlackWebhookClient(urlOrConfig); | ||
@@ -31,0 +36,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "1.0.0-beta.24", | ||
"version": "1.0.0-beta.25", | ||
"main": "dist/index.js", | ||
@@ -28,3 +28,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "18258941a920ed2aabf7b12f17e10e8c14238c15" | ||
"gitHead": "5cca124548cbd6d36cafbdfb3ce6856fd338dbe3" | ||
} |
@@ -44,3 +44,3 @@ # messaging-api-slack | ||
// https://api.slack.com/docs/oauth | ||
const client = SlackOAuthClient.connect( | ||
const client = new SlackOAuthClient( | ||
'xoxb-000000000000-xxxxxxxxxxxxxxxxxxxxxxxx' | ||
@@ -446,3 +446,3 @@ ); | ||
// https://my.slack.com/services/new/incoming-webhook/ | ||
const client = SlackWebhookClient.connect( | ||
const client = new SlackWebhookClient( | ||
'https://hooks.slack.com/services/XXXXXXXX/YYYYYYYY/zzzzzZZZZZ' | ||
@@ -572,3 +572,3 @@ ); | ||
// for SlackOAuthClient | ||
const client = SlackOAuthClient.connect({ | ||
const client = new SlackOAuthClient({ | ||
accessToken: ACCESS_TOKEN, | ||
@@ -581,3 +581,3 @@ onRequest: ({ method, url, headers, body }) => { | ||
// for SlackWebhookClient | ||
const client = SlackWebhookClient.connect({ | ||
const client = new SlackWebhookClient({ | ||
url: URL, | ||
@@ -599,3 +599,3 @@ onRequest: ({ method, url, headers, body }) => { | ||
const client = SlackOAuthClient.connect({ | ||
const client = new SlackOAuthClient({ | ||
accessToken: ACCESS_TOKEN, | ||
@@ -602,0 +602,0 @@ origin: 'https://mydummytestserver.com', |
@@ -7,3 +7,3 @@ import MockAdapter from 'axios-mock-adapter'; | ||
const createMock = () => { | ||
const createMock = (): { client: SlackWebhookClient; mock: MockAdapter } => { | ||
const client = new SlackWebhookClient(URL); | ||
@@ -10,0 +10,0 @@ const mock = new MockAdapter(client.axios); |
@@ -83,5 +83,12 @@ import querystring from 'querystring'; | ||
/** | ||
* @deprecated Use `new SlackOAuthClient(...)` instead. | ||
*/ | ||
static connect( | ||
accessTokenOrConfig: string | Types.ClientConfig | ||
): SlackOAuthClient { | ||
warning( | ||
false, | ||
'`SlackOAuthClient.connect(...)` is deprecated. Use `new SlackOAuthClient(...)` instead.' | ||
); | ||
return new SlackOAuthClient(accessTokenOrConfig); | ||
@@ -88,0 +95,0 @@ } |
import axios, { AxiosInstance } from 'axios'; | ||
import warning from 'warning'; | ||
import { | ||
@@ -20,3 +21,10 @@ OnRequestFunction, | ||
/** | ||
* @deprecated Use `new SlackWebhookClient(...)` instead. | ||
*/ | ||
static connect(urlOrConfig: string | ClientConfig): SlackWebhookClient { | ||
warning( | ||
false, | ||
'`SlackWebhookClient.connect(...)` is deprecated. Use `new SlackWebhookClient(...)` instead.' | ||
); | ||
return new SlackWebhookClient(urlOrConfig); | ||
@@ -23,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
324910
5333