sendblue 1.1.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -0
- package/LICENSE +201 -21
- package/README.md +349 -38
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +203 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +203 -0
- package/client.d.ts.map +1 -0
- package/client.js +489 -0
- package/client.js.map +1 -0
- package/client.mjs +485 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -78
- package/index.d.ts.map +1 -0
- package/index.js +28 -104
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +87 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +81 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +129 -39
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/contacts/bulk.d.mts +61 -0
- package/resources/contacts/bulk.d.mts.map +1 -0
- package/resources/contacts/bulk.d.ts +61 -0
- package/resources/contacts/bulk.d.ts.map +1 -0
- package/resources/contacts/bulk.js +35 -0
- package/resources/contacts/bulk.js.map +1 -0
- package/resources/contacts/bulk.mjs +31 -0
- package/resources/contacts/bulk.mjs.map +1 -0
- package/resources/contacts/contacts.d.mts +239 -0
- package/resources/contacts/contacts.d.mts.map +1 -0
- package/resources/contacts/contacts.d.ts +239 -0
- package/resources/contacts/contacts.d.ts.map +1 -0
- package/resources/contacts/contacts.js +101 -0
- package/resources/contacts/contacts.js.map +1 -0
- package/resources/contacts/contacts.mjs +96 -0
- package/resources/contacts/contacts.mjs.map +1 -0
- package/resources/contacts/index.d.mts +3 -0
- package/resources/contacts/index.d.mts.map +1 -0
- package/resources/contacts/index.d.ts +3 -0
- package/resources/contacts/index.d.ts.map +1 -0
- package/resources/contacts/index.js +9 -0
- package/resources/contacts/index.js.map +1 -0
- package/resources/contacts/index.mjs +4 -0
- package/resources/contacts/index.mjs.map +1 -0
- package/resources/contacts.d.mts +2 -0
- package/resources/contacts.d.mts.map +1 -0
- package/resources/contacts.d.ts +2 -0
- package/resources/contacts.d.ts.map +1 -0
- package/resources/contacts.js +6 -0
- package/resources/contacts.js.map +1 -0
- package/resources/contacts.mjs +3 -0
- package/resources/contacts.mjs.map +1 -0
- package/resources/groups.d.mts +77 -0
- package/resources/groups.d.mts.map +1 -0
- package/resources/groups.d.ts +77 -0
- package/resources/groups.d.ts.map +1 -0
- package/resources/groups.js +38 -0
- package/resources/groups.js.map +1 -0
- package/resources/groups.mjs +34 -0
- package/resources/groups.mjs.map +1 -0
- package/resources/index.d.mts +7 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +17 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +8 -0
- package/resources/index.mjs.map +1 -0
- package/resources/lookups.d.mts +30 -0
- package/resources/lookups.d.mts.map +1 -0
- package/resources/lookups.d.ts +30 -0
- package/resources/lookups.d.ts.map +1 -0
- package/resources/lookups.js +16 -0
- package/resources/lookups.js.map +1 -0
- package/resources/lookups.mjs +12 -0
- package/resources/lookups.mjs.map +1 -0
- package/resources/media-objects.d.mts +31 -0
- package/resources/media-objects.d.mts.map +1 -0
- package/resources/media-objects.d.ts +31 -0
- package/resources/media-objects.d.ts.map +1 -0
- package/resources/media-objects.js +22 -0
- package/resources/media-objects.js.map +1 -0
- package/resources/media-objects.mjs +18 -0
- package/resources/media-objects.mjs.map +1 -0
- package/resources/messages.d.mts +487 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +487 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +64 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +60 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/typing-indicators.d.mts +42 -0
- package/resources/typing-indicators.d.mts.map +1 -0
- package/resources/typing-indicators.d.ts +42 -0
- package/resources/typing-indicators.d.ts.map +1 -0
- package/resources/typing-indicators.js +24 -0
- package/resources/typing-indicators.js.map +1 -0
- package/resources/typing-indicators.mjs +20 -0
- package/resources/typing-indicators.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +840 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +128 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +2 -0
- package/src/resources/contacts/bulk.ts +85 -0
- package/src/resources/contacts/contacts.ts +338 -0
- package/src/resources/contacts/index.ts +24 -0
- package/src/resources/contacts.ts +3 -0
- package/src/resources/groups.ts +102 -0
- package/src/resources/index.ts +40 -0
- package/src/resources/lookups.ts +44 -0
- package/src/resources/media-objects.ts +43 -0
- package/src/resources/messages.ts +720 -0
- package/src/resources/typing-indicators.ts +54 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/.env +0 -5
- package/.prettierrc +0 -1
- package/config.js +0 -31
- package/dist/base/Message.d.ts +0 -43
- package/dist/base/Message.js +0 -30
- package/dist/base/RequestClient.d.ts +0 -27
- package/dist/base/RequestClient.js +0 -138
- package/dist/base/SendblueClient.d.ts +0 -18
- package/dist/base/SendblueClient.js +0 -33
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -4
- package/dist/rest/group-message/index.d.ts +0 -23
- package/dist/rest/group-message/index.js +0 -73
- package/dist/rest/message/index.d.ts +0 -14
- package/dist/rest/message/index.js +0 -66
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
- package/test/basic.test.js +0 -47
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
export class TypingIndicators extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Send an indication that you are typing to a user. This shows up as the animated
|
|
10
|
+
* three dots on the recipient's device. Only available for existing chats and not
|
|
11
|
+
* supported in group chats.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const response = await client.typingIndicators.send({
|
|
16
|
+
* number: '+19998887777',
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
send(body: TypingIndicatorSendParams, options?: RequestOptions): APIPromise<TypingIndicatorSendResponse> {
|
|
21
|
+
return this._client.post('/api/send-typing-indicator', { body, ...options });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TypingIndicatorSendResponse {
|
|
26
|
+
/**
|
|
27
|
+
* The error message if the status is ERROR
|
|
28
|
+
*/
|
|
29
|
+
error_message?: string | null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The number you evaluated in E.164 format
|
|
33
|
+
*/
|
|
34
|
+
number?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The status of the typing indicator you tried to send
|
|
38
|
+
*/
|
|
39
|
+
status?: 'SENT' | 'ERROR';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TypingIndicatorSendParams {
|
|
43
|
+
/**
|
|
44
|
+
* The number you want to send a typing indicator to (E.164 format)
|
|
45
|
+
*/
|
|
46
|
+
number: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export declare namespace TypingIndicators {
|
|
50
|
+
export {
|
|
51
|
+
type TypingIndicatorSendResponse as TypingIndicatorSendResponse,
|
|
52
|
+
type TypingIndicatorSendParams as TypingIndicatorSendParams,
|
|
53
|
+
};
|
|
54
|
+
}
|
package/src/resources.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './resources/index';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
// this config is included in the published src directory to prevent TS errors
|
|
3
|
+
// from appearing when users go to source, and VSCode opens the source .ts file
|
|
4
|
+
// via declaration maps
|
|
5
|
+
"include": ["index.ts"],
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
"target": "ES2015",
|
|
8
|
+
"lib": ["DOM", "DOM.Iterable", "ES2018"],
|
|
9
|
+
"moduleResolution": "node"
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/uploads.ts
ADDED
package/src/version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VERSION = '2.0.1'; // x-release-please-version
|
package/uploads.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
|
package/uploads.d.ts
ADDED
package/uploads.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
|
package/uploads.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
4
|
+
/** @deprecated Import from ./core/uploads instead */
|
|
5
|
+
tslib_1.__exportStar(require("./core/uploads.js"), exports);
|
|
6
|
+
//# sourceMappingURL=uploads.js.map
|
package/uploads.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,4DAA+B"}
|
package/uploads.mjs
ADDED
package/uploads.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
|
package/version.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/version.d.ts
ADDED
package/version.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/version.js
ADDED
package/version.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
|
package/version.mjs
ADDED
package/version.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
|
package/.env
DELETED
package/.prettierrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/config.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const DEFAULT_ENGINE = 'davinci';
|
|
2
|
-
const ORIGIN = 'https://api.openai.com';
|
|
3
|
-
const API_VERSION = 'v1';
|
|
4
|
-
const OPEN_AI_URL = `${ORIGIN}/${API_VERSION}`;
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
completionURL(engine) {
|
|
8
|
-
return `${OPEN_AI_URL}/engines/${engine}/completions`;
|
|
9
|
-
},
|
|
10
|
-
searchURL(engine) {
|
|
11
|
-
return `${OPEN_AI_URL}/engines/${engine}/search`;
|
|
12
|
-
},
|
|
13
|
-
enginesUrl() {
|
|
14
|
-
return `${OPEN_AI_URL}/engines`;
|
|
15
|
-
},
|
|
16
|
-
engineUrl(engine) {
|
|
17
|
-
return `${OPEN_AI_URL}/engines/${engine}`;
|
|
18
|
-
},
|
|
19
|
-
classificationsUrl() {
|
|
20
|
-
return `${OPEN_AI_URL}/classifications`;
|
|
21
|
-
},
|
|
22
|
-
filesUrl() {
|
|
23
|
-
return `${OPEN_AI_URL}/files`;
|
|
24
|
-
},
|
|
25
|
-
answersUrl() {
|
|
26
|
-
return `${OPEN_AI_URL}/answers`;
|
|
27
|
-
},
|
|
28
|
-
embeddingsUrl(engine) {
|
|
29
|
-
return `${OPEN_AI_URL}/engines/${engine}/embeddings`;
|
|
30
|
-
}
|
|
31
|
-
};
|
package/dist/base/Message.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare type MessageTypes = 'group' | 'message';
|
|
2
|
-
export interface Message {
|
|
3
|
-
accountEmail?: string;
|
|
4
|
-
content?: string;
|
|
5
|
-
is_outbound?: boolean;
|
|
6
|
-
status?: string;
|
|
7
|
-
error_code?: string;
|
|
8
|
-
error_message?: string;
|
|
9
|
-
message_handle?: string;
|
|
10
|
-
date_sent?: Date;
|
|
11
|
-
date_updated?: Date;
|
|
12
|
-
from_number?: string;
|
|
13
|
-
number?: string;
|
|
14
|
-
to_number?: string;
|
|
15
|
-
was_downgraded?: boolean;
|
|
16
|
-
plan?: string;
|
|
17
|
-
media_url?: string;
|
|
18
|
-
message_type?: string;
|
|
19
|
-
group_id?: string;
|
|
20
|
-
participants?: string[];
|
|
21
|
-
}
|
|
22
|
-
export declare class MessageImpl {
|
|
23
|
-
accountEmail: string | undefined;
|
|
24
|
-
content: string | undefined;
|
|
25
|
-
is_outbound: boolean | undefined;
|
|
26
|
-
status: string | undefined;
|
|
27
|
-
error_code: string | undefined;
|
|
28
|
-
error_message: string | undefined;
|
|
29
|
-
message_handle: string | undefined;
|
|
30
|
-
date_sent: Date | undefined;
|
|
31
|
-
date_updated: Date | undefined;
|
|
32
|
-
from_number: string | undefined;
|
|
33
|
-
number: string | undefined;
|
|
34
|
-
to_number: string | undefined;
|
|
35
|
-
was_downgraded: boolean | undefined;
|
|
36
|
-
plan: string | undefined;
|
|
37
|
-
media_url: string | undefined;
|
|
38
|
-
message_type: string | undefined;
|
|
39
|
-
group_id: string | undefined;
|
|
40
|
-
participants: string[] | undefined;
|
|
41
|
-
constructor(message: Message);
|
|
42
|
-
static from(data: Message): MessageImpl;
|
|
43
|
-
}
|
package/dist/base/Message.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageImpl = void 0;
|
|
4
|
-
var MessageImpl = /** @class */ (function () {
|
|
5
|
-
function MessageImpl(message) {
|
|
6
|
-
this.accountEmail = message.accountEmail;
|
|
7
|
-
this.content = message.content;
|
|
8
|
-
this.is_outbound = message.is_outbound;
|
|
9
|
-
this.status = message.status;
|
|
10
|
-
this.error_code = message.error_code;
|
|
11
|
-
this.error_message = message.error_message;
|
|
12
|
-
this.message_handle = message.message_handle;
|
|
13
|
-
this.date_sent = message.date_sent;
|
|
14
|
-
this.date_updated = message.date_updated;
|
|
15
|
-
this.from_number = message.from_number;
|
|
16
|
-
this.number = message.number;
|
|
17
|
-
this.to_number = message.to_number;
|
|
18
|
-
this.was_downgraded = message.was_downgraded;
|
|
19
|
-
this.plan = message.plan;
|
|
20
|
-
this.media_url = message.media_url;
|
|
21
|
-
this.message_type = message.message_type;
|
|
22
|
-
this.group_id = message.group_id;
|
|
23
|
-
this.participants = message.participants;
|
|
24
|
-
}
|
|
25
|
-
MessageImpl.from = function (data) {
|
|
26
|
-
return new MessageImpl(data);
|
|
27
|
-
};
|
|
28
|
-
return MessageImpl;
|
|
29
|
-
}());
|
|
30
|
-
exports.MessageImpl = MessageImpl;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Agent, AgentOptions } from 'https';
|
|
3
|
-
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
4
|
-
export interface RequestClientOptions {
|
|
5
|
-
timeout?: number;
|
|
6
|
-
keepAlive?: boolean;
|
|
7
|
-
keepAliveMsecs?: number;
|
|
8
|
-
maxSockets?: number;
|
|
9
|
-
maxTotalSockets?: number;
|
|
10
|
-
maxFreeSockets?: number;
|
|
11
|
-
scheduling?: 'fifo' | 'lifo';
|
|
12
|
-
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
13
|
-
}
|
|
14
|
-
export interface RequestClientRequestOptions {
|
|
15
|
-
logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
16
|
-
}
|
|
17
|
-
export declare class RequestClient {
|
|
18
|
-
defaultTimeout: number;
|
|
19
|
-
agentOpts: AgentOptions;
|
|
20
|
-
agent: Agent;
|
|
21
|
-
axios: AxiosInstance;
|
|
22
|
-
logLevel: string;
|
|
23
|
-
constructor(opts: RequestClientOptions, apiKey: string, apiSecret: string);
|
|
24
|
-
request(opts: AxiosRequestConfig & RequestClientRequestOptions): Promise<any>;
|
|
25
|
-
filterLoggingHeaders(headers: any): string[];
|
|
26
|
-
logRequest(options: AxiosRequestConfig): void;
|
|
27
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.RequestClient = void 0;
|
|
40
|
-
var https_1 = require("https");
|
|
41
|
-
var axios_1 = require("axios");
|
|
42
|
-
var DEFAULT_CONTENT_TYPE = 'application/json';
|
|
43
|
-
var DEFAULT_TIMEOUT = 30000;
|
|
44
|
-
var RequestClient = /** @class */ (function () {
|
|
45
|
-
function RequestClient(opts, apiKey, apiSecret) {
|
|
46
|
-
this.defaultTimeout = DEFAULT_TIMEOUT;
|
|
47
|
-
this.defaultTimeout = opts.timeout || DEFAULT_TIMEOUT;
|
|
48
|
-
this.logLevel = opts.logLevel || 'info';
|
|
49
|
-
this.agentOpts = {
|
|
50
|
-
keepAlive: opts.keepAlive || false,
|
|
51
|
-
keepAliveMsecs: opts.keepAliveMsecs || 1000,
|
|
52
|
-
maxSockets: opts.maxSockets || 256,
|
|
53
|
-
maxTotalSockets: opts.maxTotalSockets || 256,
|
|
54
|
-
maxFreeSockets: opts.maxFreeSockets || 256,
|
|
55
|
-
scheduling: opts.scheduling || 'fifo'
|
|
56
|
-
};
|
|
57
|
-
this.agent = new https_1.Agent(this.agentOpts);
|
|
58
|
-
this.axios = axios_1.default.create({
|
|
59
|
-
httpsAgent: this.agent,
|
|
60
|
-
baseURL: 'https://api.sendblue.co'
|
|
61
|
-
});
|
|
62
|
-
this.axios.defaults.headers.post['Content-Type'] = DEFAULT_CONTENT_TYPE;
|
|
63
|
-
this.axios.defaults.headers.post['sb-api-key-id'] = apiKey;
|
|
64
|
-
this.axios.defaults.headers.post['sb-api-secret-key'] = apiSecret;
|
|
65
|
-
}
|
|
66
|
-
RequestClient.prototype.request = function (opts) {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
-
var options, response, err_1;
|
|
69
|
-
return __generator(this, function (_a) {
|
|
70
|
-
switch (_a.label) {
|
|
71
|
-
case 0:
|
|
72
|
-
options = {
|
|
73
|
-
method: opts.method,
|
|
74
|
-
baseURL: opts.baseURL || this.axios.defaults.baseURL,
|
|
75
|
-
url: opts.url,
|
|
76
|
-
headers: opts.headers,
|
|
77
|
-
params: opts.params,
|
|
78
|
-
data: opts.data,
|
|
79
|
-
timeout: opts.timeout || this.defaultTimeout,
|
|
80
|
-
maxRedirects: opts.maxRedirects ? 10 : 0,
|
|
81
|
-
validateStatus: function (status) {
|
|
82
|
-
return status >= 200 && status < 300;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
if (opts.logLevel === 'debug' || this.logLevel === 'debug') {
|
|
86
|
-
this.logRequest(options);
|
|
87
|
-
}
|
|
88
|
-
_a.label = 1;
|
|
89
|
-
case 1:
|
|
90
|
-
_a.trys.push([1, 3, , 4]);
|
|
91
|
-
return [4 /*yield*/, this.axios.request(options)];
|
|
92
|
-
case 2:
|
|
93
|
-
response = _a.sent();
|
|
94
|
-
if (opts.logLevel === 'debug') {
|
|
95
|
-
console.log("response.statusCode: ".concat(response.status));
|
|
96
|
-
console.log("response.headers: ".concat(JSON.stringify(response.headers)));
|
|
97
|
-
}
|
|
98
|
-
return [2 /*return*/, response.data];
|
|
99
|
-
case 3:
|
|
100
|
-
err_1 = _a.sent();
|
|
101
|
-
if (err_1.response) {
|
|
102
|
-
throw new Error(JSON.stringify(err_1.response.data, null, 2));
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
throw new Error(err_1.message);
|
|
106
|
-
}
|
|
107
|
-
return [3 /*break*/, 4];
|
|
108
|
-
case 4: return [2 /*return*/];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
RequestClient.prototype.filterLoggingHeaders = function (headers) {
|
|
114
|
-
return Object.keys(headers).filter(function (header) {
|
|
115
|
-
return (!'authorization'.includes(header.toLowerCase()) &&
|
|
116
|
-
!'sb-api-key-id'.includes(header.toLowerCase()) &&
|
|
117
|
-
!'sb-api-secret-key'.includes(header.toLowerCase()));
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
RequestClient.prototype.logRequest = function (options) {
|
|
121
|
-
console.log('-- BEGIN Sendblue API Request --');
|
|
122
|
-
console.log("".concat(options.method, " ").concat(options.baseURL).concat(options.url));
|
|
123
|
-
if (options.params) {
|
|
124
|
-
console.log('Querystring:');
|
|
125
|
-
console.log(options.params);
|
|
126
|
-
}
|
|
127
|
-
if (options.headers) {
|
|
128
|
-
console.log('Headers:');
|
|
129
|
-
var filteredHeaderKeys = this.filterLoggingHeaders(options.headers);
|
|
130
|
-
filteredHeaderKeys.forEach(function (header) {
|
|
131
|
-
return console.log("".concat(header, ": ").concat(options.headers[header]));
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
console.log('-- END Sendblue API Request --');
|
|
135
|
-
};
|
|
136
|
-
return RequestClient;
|
|
137
|
-
}());
|
|
138
|
-
exports.RequestClient = RequestClient;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { GroupMessageOptions, Groups } from '../rest/group-message';
|
|
3
|
-
import { MessageOptions, Messages } from '../rest/message';
|
|
4
|
-
import { RequestClient, RequestClientOptions, RequestClientRequestOptions } from './RequestClient';
|
|
5
|
-
export interface SendblueClientOptions {
|
|
6
|
-
axiosClientOptions?: RequestClientOptions;
|
|
7
|
-
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
8
|
-
}
|
|
9
|
-
export declare class SendblueClient {
|
|
10
|
-
axiosClient: RequestClient;
|
|
11
|
-
groups: Groups;
|
|
12
|
-
messages: Messages;
|
|
13
|
-
logLevel: 'debug' | 'info' | 'warn' | 'error';
|
|
14
|
-
constructor(apiKey: string, apiSecret: string, options?: SendblueClientOptions);
|
|
15
|
-
request(options: AxiosRequestConfig & RequestClientRequestOptions): Promise<any>;
|
|
16
|
-
sendGroupMessage(options: GroupMessageOptions): Promise<import("./Message").MessageImpl>;
|
|
17
|
-
sendMessage(options: MessageOptions): Promise<import("./Message").MessageImpl>;
|
|
18
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SendblueClient = void 0;
|
|
4
|
-
var group_message_1 = require("../rest/group-message");
|
|
5
|
-
var message_1 = require("../rest/message");
|
|
6
|
-
var RequestClient_1 = require("./RequestClient");
|
|
7
|
-
var SendblueClient = /** @class */ (function () {
|
|
8
|
-
function SendblueClient(apiKey, apiSecret, options) {
|
|
9
|
-
if (options === void 0) { options = {}; }
|
|
10
|
-
var _a;
|
|
11
|
-
this.logLevel = 'info';
|
|
12
|
-
if (options.logLevel !== ((_a = options === null || options === void 0 ? void 0 : options.axiosClientOptions) === null || _a === void 0 ? void 0 : _a.logLevel)) {
|
|
13
|
-
if (!options.axiosClientOptions)
|
|
14
|
-
options.axiosClientOptions = {};
|
|
15
|
-
options.axiosClientOptions.logLevel = options.logLevel;
|
|
16
|
-
}
|
|
17
|
-
this.logLevel = options.logLevel || 'info';
|
|
18
|
-
this.axiosClient = new RequestClient_1.RequestClient((options === null || options === void 0 ? void 0 : options.axiosClientOptions) || {}, apiKey, apiSecret);
|
|
19
|
-
this.groups = new group_message_1.Groups(this);
|
|
20
|
-
this.messages = new message_1.Messages(this);
|
|
21
|
-
}
|
|
22
|
-
SendblueClient.prototype.request = function (options) {
|
|
23
|
-
return this.axiosClient.request(options);
|
|
24
|
-
};
|
|
25
|
-
SendblueClient.prototype.sendGroupMessage = function (options) {
|
|
26
|
-
return this.groups.sendGroupMessage(options);
|
|
27
|
-
};
|
|
28
|
-
SendblueClient.prototype.sendMessage = function (options) {
|
|
29
|
-
return this.messages.sendMessage(options);
|
|
30
|
-
};
|
|
31
|
-
return SendblueClient;
|
|
32
|
-
}());
|
|
33
|
-
exports.SendblueClient = SendblueClient;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MessageImpl } from '../../base/Message';
|
|
2
|
-
import { SendblueClient } from '../../base/SendblueClient';
|
|
3
|
-
import { ExpressiveSendStyles } from '../../types';
|
|
4
|
-
export interface GroupMessageOptions {
|
|
5
|
-
numbers?: string[];
|
|
6
|
-
groupId?: string;
|
|
7
|
-
content?: string;
|
|
8
|
-
media_url?: string;
|
|
9
|
-
send_style?: ExpressiveSendStyles;
|
|
10
|
-
status_callback?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class Groups {
|
|
13
|
-
private client;
|
|
14
|
-
constructor(client: SendblueClient);
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @param {GroupMessageOptions} options Group message options
|
|
18
|
-
* @returns {Message} message
|
|
19
|
-
*
|
|
20
|
-
* @throws {Error} if the request fails
|
|
21
|
-
*/
|
|
22
|
-
sendGroupMessage(options: GroupMessageOptions): Promise<MessageImpl>;
|
|
23
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Groups = void 0;
|
|
40
|
-
var Message_1 = require("../../base/Message");
|
|
41
|
-
var Groups = /** @class */ (function () {
|
|
42
|
-
function Groups(client) {
|
|
43
|
-
this.client = client;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {GroupMessageOptions} options Group message options
|
|
48
|
-
* @returns {Message} message
|
|
49
|
-
*
|
|
50
|
-
* @throws {Error} if the request fails
|
|
51
|
-
*/
|
|
52
|
-
Groups.prototype.sendGroupMessage = function (options) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var responseData;
|
|
55
|
-
return __generator(this, function (_a) {
|
|
56
|
-
switch (_a.label) {
|
|
57
|
-
case 0: return [4 /*yield*/, this.client.request({
|
|
58
|
-
method: 'POST',
|
|
59
|
-
url: '/api/send-group-message',
|
|
60
|
-
data: options
|
|
61
|
-
})];
|
|
62
|
-
case 1:
|
|
63
|
-
responseData = _a.sent();
|
|
64
|
-
if (this.client.logLevel === 'debug')
|
|
65
|
-
console.log('Response:', responseData);
|
|
66
|
-
return [2 /*return*/, Message_1.MessageImpl.from(responseData)];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return Groups;
|
|
72
|
-
}());
|
|
73
|
-
exports.Groups = Groups;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MessageImpl } from '../../base/Message';
|
|
2
|
-
import { SendblueClient } from '../../base/SendblueClient';
|
|
3
|
-
export interface MessageOptions {
|
|
4
|
-
number: string;
|
|
5
|
-
content?: string;
|
|
6
|
-
media_url?: string;
|
|
7
|
-
status_callback?: string;
|
|
8
|
-
send_style?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare class Messages {
|
|
11
|
-
private client;
|
|
12
|
-
constructor(client: SendblueClient);
|
|
13
|
-
sendMessage(options: MessageOptions): Promise<MessageImpl>;
|
|
14
|
-
}
|