@surgeapi/node 0.25.7 → 0.27.0
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 +42 -0
- package/LICENSE +201 -21
- package/README.md +318 -115
- 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 +208 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +208 -0
- package/client.d.ts.map +1 -0
- package/client.js +476 -0
- package/client.js.map +1 -0
- package/client.mjs +472 -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 -4
- package/index.d.ts.map +1 -0
- package/index.js +28 -42
- 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/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.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 +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -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 +139 -44
- 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/accounts.d.mts +627 -0
- package/resources/accounts.d.mts.map +1 -0
- package/resources/accounts.d.ts +627 -0
- package/resources/accounts.d.ts.map +1 -0
- package/resources/accounts.js +49 -0
- package/resources/accounts.js.map +1 -0
- package/resources/accounts.mjs +45 -0
- package/resources/accounts.mjs.map +1 -0
- package/resources/blasts.d.mts +89 -0
- package/resources/blasts.d.mts.map +1 -0
- package/resources/blasts.d.ts +89 -0
- package/resources/blasts.d.ts.map +1 -0
- package/resources/blasts.js +23 -0
- package/resources/blasts.js.map +1 -0
- package/resources/blasts.mjs +19 -0
- package/resources/blasts.mjs.map +1 -0
- package/resources/campaigns.d.mts +244 -0
- package/resources/campaigns.d.mts.map +1 -0
- package/resources/campaigns.d.ts +244 -0
- package/resources/campaigns.d.ts.map +1 -0
- package/resources/campaigns.js +41 -0
- package/resources/campaigns.js.map +1 -0
- package/resources/campaigns.mjs +37 -0
- package/resources/campaigns.mjs.map +1 -0
- package/resources/contacts.d.mts +124 -0
- package/resources/contacts.d.mts.map +1 -0
- package/resources/contacts.d.ts +124 -0
- package/resources/contacts.d.ts.map +1 -0
- package/resources/contacts.js +52 -0
- package/resources/contacts.js.map +1 -0
- package/resources/contacts.mjs +48 -0
- package/resources/contacts.mjs.map +1 -0
- package/resources/index.d.mts +11 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +11 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +25 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +12 -0
- package/resources/index.mjs.map +1 -0
- package/resources/messages.d.mts +231 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +231 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +52 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +48 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/phone-numbers.d.mts +60 -0
- package/resources/phone-numbers.d.mts.map +1 -0
- package/resources/phone-numbers.d.ts +60 -0
- package/resources/phone-numbers.d.ts.map +1 -0
- package/resources/phone-numbers.js +24 -0
- package/resources/phone-numbers.js.map +1 -0
- package/resources/phone-numbers.mjs +20 -0
- package/resources/phone-numbers.mjs.map +1 -0
- package/resources/shared.d.mts +20 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +20 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/users.d.mts +138 -0
- package/resources/users.d.mts.map +1 -0
- package/resources/users.d.ts +138 -0
- package/resources/users.d.ts.map +1 -0
- package/resources/users.js +65 -0
- package/resources/users.js.map +1 -0
- package/resources/users.mjs +61 -0
- package/resources/users.mjs.map +1 -0
- package/resources/verifications.d.mts +78 -0
- package/resources/verifications.d.mts.map +1 -0
- package/resources/verifications.d.ts +78 -0
- package/resources/verifications.d.ts.map +1 -0
- package/resources/verifications.js +37 -0
- package/resources/verifications.js.map +1 -0
- package/resources/verifications.mjs +33 -0
- package/resources/verifications.mjs.map +1 -0
- package/resources/webhooks.d.mts +503 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +503 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +20 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +16 -0
- package/resources/webhooks.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 +843 -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/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -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 +126 -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/accounts.ts +969 -0
- package/src/resources/blasts.ts +109 -0
- package/src/resources/campaigns.ts +291 -0
- package/src/resources/contacts.ts +150 -0
- package/src/resources/index.ts +45 -0
- package/src/resources/messages.ts +269 -0
- package/src/resources/phone-numbers.ts +77 -0
- package/src/resources/shared.ts +21 -0
- package/src/resources/users.ts +172 -0
- package/src/resources/verifications.ts +100 -0
- package/src/resources/webhooks.ts +638 -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 -1
- package/version.d.ts.map +1 -0
- package/version.js +3 -2
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/Client.d.ts +0 -49
- package/Client.js +0 -47
- package/api/errors/ConflictError.d.ts +0 -9
- package/api/errors/ConflictError.js +0 -52
- package/api/errors/UnprocessableEntityError.d.ts +0 -9
- package/api/errors/UnprocessableEntityError.js +0 -52
- package/api/errors/index.d.ts +0 -2
- package/api/errors/index.js +0 -18
- package/api/index.d.ts +0 -3
- package/api/index.js +0 -19
- package/api/resources/accounts/client/Client.d.ts +0 -59
- package/api/resources/accounts/client/Client.js +0 -179
- package/api/resources/accounts/client/index.d.ts +0 -1
- package/api/resources/accounts/client/index.js +0 -17
- package/api/resources/accounts/client/requests/CreateAccountRequest.d.ts +0 -16
- package/api/resources/accounts/client/requests/CreateAccountRequest.js +0 -5
- package/api/resources/accounts/client/requests/UpdateAccountRequest.d.ts +0 -16
- package/api/resources/accounts/client/requests/UpdateAccountRequest.js +0 -5
- package/api/resources/accounts/client/requests/index.d.ts +0 -2
- package/api/resources/accounts/client/requests/index.js +0 -2
- package/api/resources/accounts/index.d.ts +0 -1
- package/api/resources/accounts/index.js +0 -17
- package/api/resources/blasts/client/Client.d.ts +0 -50
- package/api/resources/blasts/client/Client.js +0 -128
- package/api/resources/blasts/client/index.d.ts +0 -1
- package/api/resources/blasts/client/index.js +0 -17
- package/api/resources/blasts/client/requests/BlastRequest.d.ts +0 -31
- package/api/resources/blasts/client/requests/BlastRequest.js +0 -5
- package/api/resources/blasts/client/requests/index.d.ts +0 -1
- package/api/resources/blasts/client/requests/index.js +0 -2
- package/api/resources/blasts/index.d.ts +0 -1
- package/api/resources/blasts/index.js +0 -17
- package/api/resources/contacts/client/Client.d.ts +0 -81
- package/api/resources/contacts/client/Client.js +0 -242
- package/api/resources/contacts/client/index.d.ts +0 -1
- package/api/resources/contacts/client/index.js +0 -2
- package/api/resources/contacts/index.d.ts +0 -1
- package/api/resources/contacts/index.js +0 -17
- package/api/resources/index.d.ts +0 -14
- package/api/resources/index.js +0 -53
- package/api/resources/messages/client/Client.d.ts +0 -54
- package/api/resources/messages/client/Client.js +0 -132
- package/api/resources/messages/client/index.d.ts +0 -1
- package/api/resources/messages/client/index.js +0 -17
- package/api/resources/messages/client/requests/MessageRequest.d.ts +0 -28
- package/api/resources/messages/client/requests/MessageRequest.js +0 -5
- package/api/resources/messages/client/requests/index.d.ts +0 -1
- package/api/resources/messages/client/requests/index.js +0 -2
- package/api/resources/messages/index.d.ts +0 -1
- package/api/resources/messages/index.js +0 -17
- package/api/resources/phoneNumbers/client/Client.d.ts +0 -45
- package/api/resources/phoneNumbers/client/Client.js +0 -123
- package/api/resources/phoneNumbers/client/index.d.ts +0 -1
- package/api/resources/phoneNumbers/client/index.js +0 -17
- package/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.d.ts +0 -17
- package/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.js +0 -5
- package/api/resources/phoneNumbers/client/requests/index.d.ts +0 -1
- package/api/resources/phoneNumbers/client/requests/index.js +0 -2
- package/api/resources/phoneNumbers/index.d.ts +0 -2
- package/api/resources/phoneNumbers/index.js +0 -18
- package/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.d.ts +0 -11
- package/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.js +0 -10
- package/api/resources/phoneNumbers/types/index.d.ts +0 -1
- package/api/resources/phoneNumbers/types/index.js +0 -17
- package/api/resources/users/client/Client.d.ts +0 -61
- package/api/resources/users/client/Client.js +0 -180
- package/api/resources/users/client/index.d.ts +0 -1
- package/api/resources/users/client/index.js +0 -17
- package/api/resources/users/client/requests/UserRequest.d.ts +0 -25
- package/api/resources/users/client/requests/UserRequest.js +0 -5
- package/api/resources/users/client/requests/index.d.ts +0 -1
- package/api/resources/users/client/requests/index.js +0 -2
- package/api/resources/users/index.d.ts +0 -1
- package/api/resources/users/index.js +0 -17
- package/api/resources/verifications/client/Client.d.ts +0 -60
- package/api/resources/verifications/client/Client.js +0 -188
- package/api/resources/verifications/client/index.d.ts +0 -1
- package/api/resources/verifications/client/index.js +0 -17
- package/api/resources/verifications/client/requests/VerificationCheckRequest.d.ts +0 -13
- package/api/resources/verifications/client/requests/VerificationCheckRequest.js +0 -5
- package/api/resources/verifications/client/requests/VerificationRequest.d.ts +0 -13
- package/api/resources/verifications/client/requests/VerificationRequest.js +0 -5
- package/api/resources/verifications/client/requests/index.d.ts +0 -2
- package/api/resources/verifications/client/requests/index.js +0 -2
- package/api/resources/verifications/index.d.ts +0 -1
- package/api/resources/verifications/index.js +0 -17
- package/api/types/AccountResponse.d.ts +0 -14
- package/api/types/AccountResponse.js +0 -5
- package/api/types/AttachmentParams.d.ts +0 -10
- package/api/types/AttachmentParams.js +0 -5
- package/api/types/AttachmentResponse.d.ts +0 -14
- package/api/types/AttachmentResponse.js +0 -5
- package/api/types/BlastResponse.d.ts +0 -18
- package/api/types/BlastResponse.js +0 -5
- package/api/types/BlastResponseAttachmentsItem.d.ts +0 -7
- package/api/types/BlastResponseAttachmentsItem.js +0 -5
- package/api/types/Contact.d.ts +0 -16
- package/api/types/Contact.js +0 -5
- package/api/types/ContactRequest.d.ts +0 -18
- package/api/types/ContactRequest.js +0 -5
- package/api/types/ContactResponse.d.ts +0 -20
- package/api/types/ContactResponse.js +0 -5
- package/api/types/Conversation.d.ts +0 -13
- package/api/types/Conversation.js +0 -5
- package/api/types/ConversationPhoneNumber.d.ts +0 -15
- package/api/types/ConversationPhoneNumber.js +0 -5
- package/api/types/ConversationPhoneNumberType.d.ts +0 -13
- package/api/types/ConversationPhoneNumberType.js +0 -12
- package/api/types/MessageConversationContactParams.d.ts +0 -14
- package/api/types/MessageConversationContactParams.js +0 -5
- package/api/types/MessageConversationParams.d.ts +0 -12
- package/api/types/MessageConversationParams.js +0 -5
- package/api/types/MessageResponse.d.ts +0 -15
- package/api/types/MessageResponse.js +0 -5
- package/api/types/PhoneNumber.d.ts +0 -15
- package/api/types/PhoneNumber.js +0 -5
- package/api/types/PhoneNumberType.d.ts +0 -11
- package/api/types/PhoneNumberType.js +0 -10
- package/api/types/UserResponse.d.ts +0 -18
- package/api/types/UserResponse.js +0 -5
- package/api/types/Verification.d.ts +0 -17
- package/api/types/Verification.js +0 -5
- package/api/types/VerificationCheckAlreadyVerifiedResponse.d.ts +0 -12
- package/api/types/VerificationCheckAlreadyVerifiedResponse.js +0 -5
- package/api/types/VerificationCheckAlreadyVerifiedResponseResult.d.ts +0 -14
- package/api/types/VerificationCheckAlreadyVerifiedResponseResult.js +0 -13
- package/api/types/VerificationCheckIncorrectResponse.d.ts +0 -12
- package/api/types/VerificationCheckIncorrectResponse.js +0 -5
- package/api/types/VerificationCheckIncorrectResponseResult.d.ts +0 -12
- package/api/types/VerificationCheckIncorrectResponseResult.js +0 -11
- package/api/types/VerificationCheckOkResponse.d.ts +0 -21
- package/api/types/VerificationCheckOkResponse.js +0 -5
- package/api/types/VerificationCheckOkResponseResult.d.ts +0 -21
- package/api/types/VerificationCheckOkResponseResult.js +0 -13
- package/api/types/VerificationStatus.d.ts +0 -13
- package/api/types/VerificationStatus.js +0 -12
- package/api/types/index.d.ts +0 -25
- package/api/types/index.js +0 -41
- package/core/auth/BasicAuth.d.ts +0 -8
- package/core/auth/BasicAuth.js +0 -26
- package/core/auth/BearerToken.d.ts +0 -5
- package/core/auth/BearerToken.js +0 -15
- package/core/auth/index.d.ts +0 -2
- package/core/auth/index.js +0 -7
- package/core/fetcher/APIResponse.d.ts +0 -20
- package/core/fetcher/APIResponse.js +0 -2
- package/core/fetcher/Fetcher.d.ts +0 -39
- package/core/fetcher/Fetcher.js +0 -107
- package/core/fetcher/Headers.d.ts +0 -2
- package/core/fetcher/Headers.js +0 -84
- package/core/fetcher/HttpResponsePromise.d.ts +0 -58
- package/core/fetcher/HttpResponsePromise.js +0 -103
- package/core/fetcher/RawResponse.d.ts +0 -29
- package/core/fetcher/RawResponse.js +0 -44
- package/core/fetcher/Supplier.d.ts +0 -4
- package/core/fetcher/Supplier.js +0 -22
- package/core/fetcher/createRequestUrl.d.ts +0 -1
- package/core/fetcher/createRequestUrl.js +0 -12
- package/core/fetcher/getFetchFn.d.ts +0 -4
- package/core/fetcher/getFetchFn.js +0 -68
- package/core/fetcher/getHeader.d.ts +0 -1
- package/core/fetcher/getHeader.js +0 -11
- package/core/fetcher/getRequestBody.d.ts +0 -7
- package/core/fetcher/getRequestBody.js +0 -23
- package/core/fetcher/getResponseBody.d.ts +0 -1
- package/core/fetcher/getResponseBody.js +0 -54
- package/core/fetcher/index.d.ts +0 -8
- package/core/fetcher/index.js +0 -15
- package/core/fetcher/makeRequest.d.ts +0 -1
- package/core/fetcher/makeRequest.js +0 -42
- package/core/fetcher/requestWithRetries.d.ts +0 -1
- package/core/fetcher/requestWithRetries.js +0 -40
- package/core/fetcher/signals.d.ts +0 -11
- package/core/fetcher/signals.js +0 -36
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/core/index.d.ts +0 -3
- package/core/index.js +0 -19
- package/core/json.d.ts +0 -15
- package/core/json.js +0 -24
- package/core/runtime/index.d.ts +0 -1
- package/core/runtime/index.js +0 -5
- package/core/runtime/runtime.d.ts +0 -9
- package/core/runtime/runtime.js +0 -103
- package/dist/Client.d.ts +0 -49
- package/dist/Client.js +0 -47
- package/dist/api/errors/ConflictError.d.ts +0 -9
- package/dist/api/errors/ConflictError.js +0 -52
- package/dist/api/errors/UnprocessableEntityError.d.ts +0 -9
- package/dist/api/errors/UnprocessableEntityError.js +0 -52
- package/dist/api/errors/index.d.ts +0 -2
- package/dist/api/errors/index.js +0 -18
- package/dist/api/index.d.ts +0 -3
- package/dist/api/index.js +0 -19
- package/dist/api/resources/accounts/client/Client.d.ts +0 -59
- package/dist/api/resources/accounts/client/Client.js +0 -179
- package/dist/api/resources/accounts/client/index.d.ts +0 -1
- package/dist/api/resources/accounts/client/index.js +0 -17
- package/dist/api/resources/accounts/client/requests/CreateAccountRequest.d.ts +0 -16
- package/dist/api/resources/accounts/client/requests/CreateAccountRequest.js +0 -5
- package/dist/api/resources/accounts/client/requests/UpdateAccountRequest.d.ts +0 -16
- package/dist/api/resources/accounts/client/requests/UpdateAccountRequest.js +0 -5
- package/dist/api/resources/accounts/client/requests/index.d.ts +0 -2
- package/dist/api/resources/accounts/client/requests/index.js +0 -2
- package/dist/api/resources/accounts/index.d.ts +0 -1
- package/dist/api/resources/accounts/index.js +0 -17
- package/dist/api/resources/blasts/client/Client.d.ts +0 -50
- package/dist/api/resources/blasts/client/Client.js +0 -128
- package/dist/api/resources/blasts/client/index.d.ts +0 -1
- package/dist/api/resources/blasts/client/index.js +0 -17
- package/dist/api/resources/blasts/client/requests/BlastRequest.d.ts +0 -31
- package/dist/api/resources/blasts/client/requests/BlastRequest.js +0 -5
- package/dist/api/resources/blasts/client/requests/index.d.ts +0 -1
- package/dist/api/resources/blasts/client/requests/index.js +0 -2
- package/dist/api/resources/blasts/index.d.ts +0 -1
- package/dist/api/resources/blasts/index.js +0 -17
- package/dist/api/resources/contacts/client/Client.d.ts +0 -81
- package/dist/api/resources/contacts/client/Client.js +0 -242
- package/dist/api/resources/contacts/client/index.d.ts +0 -1
- package/dist/api/resources/contacts/client/index.js +0 -2
- package/dist/api/resources/contacts/index.d.ts +0 -1
- package/dist/api/resources/contacts/index.js +0 -17
- package/dist/api/resources/index.d.ts +0 -14
- package/dist/api/resources/index.js +0 -53
- package/dist/api/resources/messages/client/Client.d.ts +0 -54
- package/dist/api/resources/messages/client/Client.js +0 -132
- package/dist/api/resources/messages/client/index.d.ts +0 -1
- package/dist/api/resources/messages/client/index.js +0 -17
- package/dist/api/resources/messages/client/requests/MessageRequest.d.ts +0 -28
- package/dist/api/resources/messages/client/requests/MessageRequest.js +0 -5
- package/dist/api/resources/messages/client/requests/index.d.ts +0 -1
- package/dist/api/resources/messages/client/requests/index.js +0 -2
- package/dist/api/resources/messages/index.d.ts +0 -1
- package/dist/api/resources/messages/index.js +0 -17
- package/dist/api/resources/phoneNumbers/client/Client.d.ts +0 -45
- package/dist/api/resources/phoneNumbers/client/Client.js +0 -123
- package/dist/api/resources/phoneNumbers/client/index.d.ts +0 -1
- package/dist/api/resources/phoneNumbers/client/index.js +0 -17
- package/dist/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.d.ts +0 -17
- package/dist/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.js +0 -5
- package/dist/api/resources/phoneNumbers/client/requests/index.d.ts +0 -1
- package/dist/api/resources/phoneNumbers/client/requests/index.js +0 -2
- package/dist/api/resources/phoneNumbers/index.d.ts +0 -2
- package/dist/api/resources/phoneNumbers/index.js +0 -18
- package/dist/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.d.ts +0 -11
- package/dist/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.js +0 -10
- package/dist/api/resources/phoneNumbers/types/index.d.ts +0 -1
- package/dist/api/resources/phoneNumbers/types/index.js +0 -17
- package/dist/api/resources/users/client/Client.d.ts +0 -61
- package/dist/api/resources/users/client/Client.js +0 -180
- package/dist/api/resources/users/client/index.d.ts +0 -1
- package/dist/api/resources/users/client/index.js +0 -17
- package/dist/api/resources/users/client/requests/UserRequest.d.ts +0 -25
- package/dist/api/resources/users/client/requests/UserRequest.js +0 -5
- package/dist/api/resources/users/client/requests/index.d.ts +0 -1
- package/dist/api/resources/users/client/requests/index.js +0 -2
- package/dist/api/resources/users/index.d.ts +0 -1
- package/dist/api/resources/users/index.js +0 -17
- package/dist/api/resources/verifications/client/Client.d.ts +0 -60
- package/dist/api/resources/verifications/client/Client.js +0 -188
- package/dist/api/resources/verifications/client/index.d.ts +0 -1
- package/dist/api/resources/verifications/client/index.js +0 -17
- package/dist/api/resources/verifications/client/requests/VerificationCheckRequest.d.ts +0 -13
- package/dist/api/resources/verifications/client/requests/VerificationCheckRequest.js +0 -5
- package/dist/api/resources/verifications/client/requests/VerificationRequest.d.ts +0 -13
- package/dist/api/resources/verifications/client/requests/VerificationRequest.js +0 -5
- package/dist/api/resources/verifications/client/requests/index.d.ts +0 -2
- package/dist/api/resources/verifications/client/requests/index.js +0 -2
- package/dist/api/resources/verifications/index.d.ts +0 -1
- package/dist/api/resources/verifications/index.js +0 -17
- package/dist/api/types/AccountResponse.d.ts +0 -14
- package/dist/api/types/AccountResponse.js +0 -5
- package/dist/api/types/AttachmentParams.d.ts +0 -10
- package/dist/api/types/AttachmentParams.js +0 -5
- package/dist/api/types/AttachmentResponse.d.ts +0 -14
- package/dist/api/types/AttachmentResponse.js +0 -5
- package/dist/api/types/BlastResponse.d.ts +0 -18
- package/dist/api/types/BlastResponse.js +0 -5
- package/dist/api/types/BlastResponseAttachmentsItem.d.ts +0 -7
- package/dist/api/types/BlastResponseAttachmentsItem.js +0 -5
- package/dist/api/types/Contact.d.ts +0 -16
- package/dist/api/types/Contact.js +0 -5
- package/dist/api/types/ContactRequest.d.ts +0 -18
- package/dist/api/types/ContactRequest.js +0 -5
- package/dist/api/types/ContactResponse.d.ts +0 -20
- package/dist/api/types/ContactResponse.js +0 -5
- package/dist/api/types/Conversation.d.ts +0 -13
- package/dist/api/types/Conversation.js +0 -5
- package/dist/api/types/ConversationPhoneNumber.d.ts +0 -15
- package/dist/api/types/ConversationPhoneNumber.js +0 -5
- package/dist/api/types/ConversationPhoneNumberType.d.ts +0 -13
- package/dist/api/types/ConversationPhoneNumberType.js +0 -12
- package/dist/api/types/MessageConversationContactParams.d.ts +0 -14
- package/dist/api/types/MessageConversationContactParams.js +0 -5
- package/dist/api/types/MessageConversationParams.d.ts +0 -12
- package/dist/api/types/MessageConversationParams.js +0 -5
- package/dist/api/types/MessageResponse.d.ts +0 -15
- package/dist/api/types/MessageResponse.js +0 -5
- package/dist/api/types/PhoneNumber.d.ts +0 -15
- package/dist/api/types/PhoneNumber.js +0 -5
- package/dist/api/types/PhoneNumberType.d.ts +0 -11
- package/dist/api/types/PhoneNumberType.js +0 -10
- package/dist/api/types/UserResponse.d.ts +0 -18
- package/dist/api/types/UserResponse.js +0 -5
- package/dist/api/types/Verification.d.ts +0 -17
- package/dist/api/types/Verification.js +0 -5
- package/dist/api/types/VerificationCheckAlreadyVerifiedResponse.d.ts +0 -12
- package/dist/api/types/VerificationCheckAlreadyVerifiedResponse.js +0 -5
- package/dist/api/types/VerificationCheckAlreadyVerifiedResponseResult.d.ts +0 -14
- package/dist/api/types/VerificationCheckAlreadyVerifiedResponseResult.js +0 -13
- package/dist/api/types/VerificationCheckIncorrectResponse.d.ts +0 -12
- package/dist/api/types/VerificationCheckIncorrectResponse.js +0 -5
- package/dist/api/types/VerificationCheckIncorrectResponseResult.d.ts +0 -12
- package/dist/api/types/VerificationCheckIncorrectResponseResult.js +0 -11
- package/dist/api/types/VerificationCheckOkResponse.d.ts +0 -21
- package/dist/api/types/VerificationCheckOkResponse.js +0 -5
- package/dist/api/types/VerificationCheckOkResponseResult.d.ts +0 -21
- package/dist/api/types/VerificationCheckOkResponseResult.js +0 -13
- package/dist/api/types/VerificationStatus.d.ts +0 -13
- package/dist/api/types/VerificationStatus.js +0 -12
- package/dist/api/types/index.d.ts +0 -25
- package/dist/api/types/index.js +0 -41
- package/dist/core/auth/BasicAuth.d.ts +0 -8
- package/dist/core/auth/BasicAuth.js +0 -26
- package/dist/core/auth/BearerToken.d.ts +0 -5
- package/dist/core/auth/BearerToken.js +0 -15
- package/dist/core/auth/index.d.ts +0 -2
- package/dist/core/auth/index.js +0 -7
- package/dist/core/fetcher/APIResponse.d.ts +0 -20
- package/dist/core/fetcher/APIResponse.js +0 -2
- package/dist/core/fetcher/Fetcher.d.ts +0 -39
- package/dist/core/fetcher/Fetcher.js +0 -107
- package/dist/core/fetcher/Headers.d.ts +0 -2
- package/dist/core/fetcher/Headers.js +0 -84
- package/dist/core/fetcher/HttpResponsePromise.d.ts +0 -58
- package/dist/core/fetcher/HttpResponsePromise.js +0 -103
- package/dist/core/fetcher/RawResponse.d.ts +0 -29
- package/dist/core/fetcher/RawResponse.js +0 -44
- package/dist/core/fetcher/Supplier.d.ts +0 -4
- package/dist/core/fetcher/Supplier.js +0 -22
- package/dist/core/fetcher/createRequestUrl.d.ts +0 -1
- package/dist/core/fetcher/createRequestUrl.js +0 -12
- package/dist/core/fetcher/getFetchFn.d.ts +0 -4
- package/dist/core/fetcher/getFetchFn.js +0 -68
- package/dist/core/fetcher/getHeader.d.ts +0 -1
- package/dist/core/fetcher/getHeader.js +0 -11
- package/dist/core/fetcher/getRequestBody.d.ts +0 -7
- package/dist/core/fetcher/getRequestBody.js +0 -23
- package/dist/core/fetcher/getResponseBody.d.ts +0 -1
- package/dist/core/fetcher/getResponseBody.js +0 -54
- package/dist/core/fetcher/index.d.ts +0 -8
- package/dist/core/fetcher/index.js +0 -15
- package/dist/core/fetcher/makeRequest.d.ts +0 -1
- package/dist/core/fetcher/makeRequest.js +0 -42
- package/dist/core/fetcher/requestWithRetries.d.ts +0 -1
- package/dist/core/fetcher/requestWithRetries.js +0 -40
- package/dist/core/fetcher/signals.d.ts +0 -11
- package/dist/core/fetcher/signals.js +0 -36
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.js +0 -19
- package/dist/core/json.d.ts +0 -15
- package/dist/core/json.js +0 -24
- package/dist/core/runtime/index.d.ts +0 -1
- package/dist/core/runtime/index.js +0 -5
- package/dist/core/runtime/runtime.d.ts +0 -9
- package/dist/core/runtime/runtime.js +0 -103
- package/dist/environments.d.ts +0 -7
- package/dist/environments.js +0 -9
- package/dist/errors/SurgeError.d.ts +0 -15
- package/dist/errors/SurgeError.js +0 -30
- package/dist/errors/SurgeTimeoutError.d.ts +0 -6
- package/dist/errors/SurgeTimeoutError.js +0 -13
- package/dist/errors/index.d.ts +0 -2
- package/dist/errors/index.js +0 -7
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -44
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -4
- package/environments.d.ts +0 -7
- package/environments.js +0 -9
- package/errors/SurgeError.d.ts +0 -15
- package/errors/SurgeError.js +0 -30
- package/errors/SurgeTimeoutError.d.ts +0 -6
- package/errors/SurgeTimeoutError.js +0 -13
- package/errors/index.d.ts +0 -2
- package/errors/index.js +0 -7
- package/jest.config.mjs +0 -8
- package/reference.md +0 -896
- package/scripts/rename-to-esm-files.js +0 -115
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { path } from "../internal/utils/path.mjs";
|
|
4
|
+
export class Contacts extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new Contact object.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const contact = await client.contacts.create(
|
|
11
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
12
|
+
* { phone_number: '+18015551234' },
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
create(accountID, body, options) {
|
|
17
|
+
return this._client.post(path `/accounts/${accountID}/contacts`, { body, ...options });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a Contact object.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const contact = await client.contacts.retrieve(
|
|
25
|
+
* 'ctc_01j9dy8mdzfn3r0e8x1tbdrdrf',
|
|
26
|
+
* );
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
retrieve(id, options) {
|
|
30
|
+
return this._client.get(path `/contacts/${id}`, options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Updates the specified contact by setting the values of the parameters passed.
|
|
34
|
+
* Any parameters not provided will be left unchanged.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const contact = await client.contacts.update(
|
|
39
|
+
* 'ctc_01j9dy8mdzfn3r0e8x1tbdrdrf',
|
|
40
|
+
* { phone_number: '+18015551234' },
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
update(id, body, options) {
|
|
45
|
+
return this._client.patch(path `/contacts/${id}`, { body, ...options });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=contacts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.mjs","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAU,EAAE,IAAyB,EAAE,OAAwB;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,aAAa,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./shared.mjs";
|
|
2
|
+
export { Accounts, type Account, type AccountStatus, type Organization, type AccountCreateParams, type AccountUpdateParams, type AccountRetrieveStatusParams, } from "./accounts.mjs";
|
|
3
|
+
export { Blasts, type Blast, type BlastCreateParams } from "./blasts.mjs";
|
|
4
|
+
export { Campaigns, type Campaign, type CampaignCreateParams } from "./campaigns.mjs";
|
|
5
|
+
export { Contacts, type Contact, type ContactCreateParams, type ContactUpdateParams } from "./contacts.mjs";
|
|
6
|
+
export { Messages, type Message, type MessageCreateParams } from "./messages.mjs";
|
|
7
|
+
export { PhoneNumbers, type PhoneNumber, type PhoneNumberPurchaseParams } from "./phone-numbers.mjs";
|
|
8
|
+
export { Users, type User, type UserTokenResponse, type UserCreateParams, type UserUpdateParams, type UserCreateTokenParams, } from "./users.mjs";
|
|
9
|
+
export { Verifications, type Verification, type VerificationCheck, type VerificationCreateParams, type VerificationCheckParams, } from "./verifications.mjs";
|
|
10
|
+
export { Webhooks, type CallEndedWebhookEvent, type CampaignApprovedWebhookEvent, type ContactOptedInWebhookEvent, type ContactOptedOutWebhookEvent, type ConversationCreatedWebhookEvent, type MessageDeliveredWebhookEvent, type MessageFailedWebhookEvent, type MessageReceivedWebhookEvent, type MessageSentWebhookEvent, type UnwrapWebhookEvent, } from "./webhooks.mjs";
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,GACjC;OACM,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,iBAAiB,EAAE;OAC9C,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,oBAAoB,EAAE;OACvD,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE;OAC9E,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE;OACpD,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,yBAAyB,EAAE;OAClE,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B;OACM,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B;OACM,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./shared.js";
|
|
2
|
+
export { Accounts, type Account, type AccountStatus, type Organization, type AccountCreateParams, type AccountUpdateParams, type AccountRetrieveStatusParams, } from "./accounts.js";
|
|
3
|
+
export { Blasts, type Blast, type BlastCreateParams } from "./blasts.js";
|
|
4
|
+
export { Campaigns, type Campaign, type CampaignCreateParams } from "./campaigns.js";
|
|
5
|
+
export { Contacts, type Contact, type ContactCreateParams, type ContactUpdateParams } from "./contacts.js";
|
|
6
|
+
export { Messages, type Message, type MessageCreateParams } from "./messages.js";
|
|
7
|
+
export { PhoneNumbers, type PhoneNumber, type PhoneNumberPurchaseParams } from "./phone-numbers.js";
|
|
8
|
+
export { Users, type User, type UserTokenResponse, type UserCreateParams, type UserUpdateParams, type UserCreateTokenParams, } from "./users.js";
|
|
9
|
+
export { Verifications, type Verification, type VerificationCheck, type VerificationCreateParams, type VerificationCheckParams, } from "./verifications.js";
|
|
10
|
+
export { Webhooks, type CallEndedWebhookEvent, type CampaignApprovedWebhookEvent, type ContactOptedInWebhookEvent, type ContactOptedOutWebhookEvent, type ConversationCreatedWebhookEvent, type MessageDeliveredWebhookEvent, type MessageFailedWebhookEvent, type MessageReceivedWebhookEvent, type MessageSentWebhookEvent, type UnwrapWebhookEvent, } from "./webhooks.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,GACjC;OACM,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,iBAAiB,EAAE;OAC9C,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,oBAAoB,EAAE;OACvD,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAE;OAC9E,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE;OACpD,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,yBAAyB,EAAE;OAClE,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B;OACM,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B;OACM,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Webhooks = exports.Verifications = exports.Users = exports.PhoneNumbers = exports.Messages = exports.Contacts = exports.Campaigns = exports.Blasts = exports.Accounts = void 0;
|
|
5
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
6
|
+
tslib_1.__exportStar(require("./shared.js"), exports);
|
|
7
|
+
var accounts_1 = require("./accounts.js");
|
|
8
|
+
Object.defineProperty(exports, "Accounts", { enumerable: true, get: function () { return accounts_1.Accounts; } });
|
|
9
|
+
var blasts_1 = require("./blasts.js");
|
|
10
|
+
Object.defineProperty(exports, "Blasts", { enumerable: true, get: function () { return blasts_1.Blasts; } });
|
|
11
|
+
var campaigns_1 = require("./campaigns.js");
|
|
12
|
+
Object.defineProperty(exports, "Campaigns", { enumerable: true, get: function () { return campaigns_1.Campaigns; } });
|
|
13
|
+
var contacts_1 = require("./contacts.js");
|
|
14
|
+
Object.defineProperty(exports, "Contacts", { enumerable: true, get: function () { return contacts_1.Contacts; } });
|
|
15
|
+
var messages_1 = require("./messages.js");
|
|
16
|
+
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_1.Messages; } });
|
|
17
|
+
var phone_numbers_1 = require("./phone-numbers.js");
|
|
18
|
+
Object.defineProperty(exports, "PhoneNumbers", { enumerable: true, get: function () { return phone_numbers_1.PhoneNumbers; } });
|
|
19
|
+
var users_1 = require("./users.js");
|
|
20
|
+
Object.defineProperty(exports, "Users", { enumerable: true, get: function () { return users_1.Users; } });
|
|
21
|
+
var verifications_1 = require("./verifications.js");
|
|
22
|
+
Object.defineProperty(exports, "Verifications", { enumerable: true, get: function () { return verifications_1.Verifications; } });
|
|
23
|
+
var webhooks_1 = require("./webhooks.js");
|
|
24
|
+
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return webhooks_1.Webhooks; } });
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,0CAQoB;AAPlB,oGAAA,QAAQ,OAAA;AAQV,sCAAsE;AAA7D,gGAAA,MAAM,OAAA;AACf,4CAAkF;AAAzE,sGAAA,SAAS,OAAA;AAClB,0CAAwG;AAA/F,oGAAA,QAAQ,OAAA;AACjB,0CAA8E;AAArE,oGAAA,QAAQ,OAAA;AACjB,oDAAiG;AAAxF,6GAAA,YAAY,OAAA;AACrB,oCAOiB;AANf,8FAAA,KAAK,OAAA;AAOP,oDAMyB;AALvB,8GAAA,aAAa,OAAA;AAMf,0CAYoB;AAXlB,oGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export * from "./shared.mjs";
|
|
3
|
+
export { Accounts, } from "./accounts.mjs";
|
|
4
|
+
export { Blasts } from "./blasts.mjs";
|
|
5
|
+
export { Campaigns } from "./campaigns.mjs";
|
|
6
|
+
export { Contacts } from "./contacts.mjs";
|
|
7
|
+
export { Messages } from "./messages.mjs";
|
|
8
|
+
export { PhoneNumbers } from "./phone-numbers.mjs";
|
|
9
|
+
export { Users, } from "./users.mjs";
|
|
10
|
+
export { Verifications, } from "./verifications.mjs";
|
|
11
|
+
export { Webhooks, } from "./webhooks.mjs";
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,EACL,QAAQ,GAOT;OACM,EAAE,MAAM,EAAsC;OAC9C,EAAE,SAAS,EAA4C;OACvD,EAAE,QAAQ,EAAoE;OAC9E,EAAE,QAAQ,EAA0C;OACpD,EAAE,YAAY,EAAoD;OAClE,EACL,KAAK,GAMN;OACM,EACL,aAAa,GAKd;OACM,EACL,QAAQ,GAWT"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as ContactsAPI from "./contacts.mjs";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
+
export declare class Messages extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates and enqueues a new message to be sent.
|
|
8
|
+
*
|
|
9
|
+
* Messages are always sent asynchronously. When you hit this endpoint, the message
|
|
10
|
+
* will be created within Surge's system and enqueued for sending, and then the id
|
|
11
|
+
* for the new message will be returned. When the message is actually sent, a
|
|
12
|
+
* `message.sent` webhook event will be triggered and sent to any webhook endpoints
|
|
13
|
+
* that you have subscribed to this event type. Then a `message.delivered` webhook
|
|
14
|
+
* event will be triggered when the carrier sends us a delivery receipt.
|
|
15
|
+
*
|
|
16
|
+
* By default all messages will be sent immediately. If you would like to schedule
|
|
17
|
+
* sending for some time up to 60 days in the future, you can do that by providing
|
|
18
|
+
* a value for the `send_at` field. This should be formatted as an ISO8601 datetime
|
|
19
|
+
* like `2028-10-14T18:06:00Z`.
|
|
20
|
+
*
|
|
21
|
+
* You must include either a `body` or `attachments` field (or both) in the request
|
|
22
|
+
* body. The `body` field should contain the text of the message you want to send,
|
|
23
|
+
* and the `attachments` field should be an array of objects with a `url` field
|
|
24
|
+
* pointing to the file you want to attach. Surge will download these files and
|
|
25
|
+
* send them as attachments in the message.
|
|
26
|
+
*
|
|
27
|
+
* You can provide either a `conversation` object or a `to` field to specify the
|
|
28
|
+
* intended recipient of the message, but an error will be returned if both fields
|
|
29
|
+
* are provided. Similarly the `from` field cannot be used together with the
|
|
30
|
+
* `conversation` field, and `conversation.phone_number` should be specified
|
|
31
|
+
* instead.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const message = await client.messages.create(
|
|
36
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
37
|
+
* {
|
|
38
|
+
* conversation: {
|
|
39
|
+
* contact: { phone_number: '+18015551234' },
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
create(accountID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise<Message>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A Message is a communication sent to a Contact.
|
|
49
|
+
*/
|
|
50
|
+
export interface Message {
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for the object.
|
|
53
|
+
*/
|
|
54
|
+
id?: string;
|
|
55
|
+
attachments?: Array<Message.Attachment>;
|
|
56
|
+
/**
|
|
57
|
+
* The message body.
|
|
58
|
+
*/
|
|
59
|
+
body?: string;
|
|
60
|
+
/**
|
|
61
|
+
* A conversation with a Contact
|
|
62
|
+
*/
|
|
63
|
+
conversation?: Message.Conversation;
|
|
64
|
+
}
|
|
65
|
+
export declare namespace Message {
|
|
66
|
+
/**
|
|
67
|
+
* An Attachment is a file that can be sent with a message.
|
|
68
|
+
*/
|
|
69
|
+
interface Attachment {
|
|
70
|
+
/**
|
|
71
|
+
* Unique identifier for the object.
|
|
72
|
+
*/
|
|
73
|
+
id?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The type of attachment.
|
|
76
|
+
*/
|
|
77
|
+
type?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The URL of the attachment.
|
|
80
|
+
*/
|
|
81
|
+
url?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A conversation with a Contact
|
|
85
|
+
*/
|
|
86
|
+
interface Conversation {
|
|
87
|
+
/**
|
|
88
|
+
* Unique identifier for the object.
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
91
|
+
/**
|
|
92
|
+
* A contact who has consented to receive messages
|
|
93
|
+
*/
|
|
94
|
+
contact: ContactsAPI.Contact;
|
|
95
|
+
/**
|
|
96
|
+
* This is the phone number tied to the Surge account.
|
|
97
|
+
*/
|
|
98
|
+
phone_number?: Conversation.PhoneNumber;
|
|
99
|
+
}
|
|
100
|
+
namespace Conversation {
|
|
101
|
+
/**
|
|
102
|
+
* This is the phone number tied to the Surge account.
|
|
103
|
+
*/
|
|
104
|
+
interface PhoneNumber {
|
|
105
|
+
/**
|
|
106
|
+
* Unique identifier for the phone number
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
/**
|
|
110
|
+
* The canonical format of the phone number.
|
|
111
|
+
*/
|
|
112
|
+
number: string;
|
|
113
|
+
/**
|
|
114
|
+
* Whether the phone number is local, toll-free, or short code
|
|
115
|
+
*/
|
|
116
|
+
type: 'local' | 'toll_free' | 'short_code' | 'demo';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export type MessageCreateParams = MessageCreateParams.MessageParamsWithConversation | MessageCreateParams.SimpleMessageParams;
|
|
121
|
+
export declare namespace MessageCreateParams {
|
|
122
|
+
interface MessageParamsWithConversation {
|
|
123
|
+
/**
|
|
124
|
+
* Params for selecting or creating a new conversation. Either the id or the
|
|
125
|
+
* Contact must be given.
|
|
126
|
+
*/
|
|
127
|
+
conversation: MessageParamsWithConversation.Conversation;
|
|
128
|
+
attachments?: Array<MessageParamsWithConversation.Attachment>;
|
|
129
|
+
/**
|
|
130
|
+
* The message body.
|
|
131
|
+
*/
|
|
132
|
+
body?: string;
|
|
133
|
+
/**
|
|
134
|
+
* An optional datetime for scheduling message up to a couple of months in the
|
|
135
|
+
* future.
|
|
136
|
+
*/
|
|
137
|
+
send_at?: string;
|
|
138
|
+
}
|
|
139
|
+
namespace MessageParamsWithConversation {
|
|
140
|
+
/**
|
|
141
|
+
* Params for selecting or creating a new conversation. Either the id or the
|
|
142
|
+
* Contact must be given.
|
|
143
|
+
*/
|
|
144
|
+
interface Conversation {
|
|
145
|
+
/**
|
|
146
|
+
* Parameters for creating a contact
|
|
147
|
+
*/
|
|
148
|
+
contact: Conversation.Contact;
|
|
149
|
+
/**
|
|
150
|
+
* The phone number from which to send the message. This can be either the phone
|
|
151
|
+
* number in E.164 format or a Surge phone number id.
|
|
152
|
+
*/
|
|
153
|
+
phone_number?: string;
|
|
154
|
+
}
|
|
155
|
+
namespace Conversation {
|
|
156
|
+
/**
|
|
157
|
+
* Parameters for creating a contact
|
|
158
|
+
*/
|
|
159
|
+
interface Contact {
|
|
160
|
+
/**
|
|
161
|
+
* The contact's phone number in E.164 format.
|
|
162
|
+
*/
|
|
163
|
+
phone_number: string;
|
|
164
|
+
/**
|
|
165
|
+
* The contact's email address.
|
|
166
|
+
*/
|
|
167
|
+
email?: string;
|
|
168
|
+
/**
|
|
169
|
+
* The contact's first name.
|
|
170
|
+
*/
|
|
171
|
+
first_name?: string;
|
|
172
|
+
/**
|
|
173
|
+
* The contact's last name.
|
|
174
|
+
*/
|
|
175
|
+
last_name?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Set of key-value pairs that will be stored with the object.
|
|
178
|
+
*/
|
|
179
|
+
metadata?: {
|
|
180
|
+
[key: string]: string;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Params for creating an attachment
|
|
186
|
+
*/
|
|
187
|
+
interface Attachment {
|
|
188
|
+
/**
|
|
189
|
+
* The URL of the attachment.
|
|
190
|
+
*/
|
|
191
|
+
url: string;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
interface SimpleMessageParams {
|
|
195
|
+
/**
|
|
196
|
+
* The recipient's phone number in E.164 format. Cannot be used together with
|
|
197
|
+
* 'conversation'.
|
|
198
|
+
*/
|
|
199
|
+
to: string;
|
|
200
|
+
attachments?: Array<SimpleMessageParams.Attachment>;
|
|
201
|
+
/**
|
|
202
|
+
* The message body.
|
|
203
|
+
*/
|
|
204
|
+
body?: string;
|
|
205
|
+
/**
|
|
206
|
+
* The sender's phone number in E.164 format or phone number ID. If omitted, uses
|
|
207
|
+
* the account's default phone number. Cannot be used together with 'conversation'.
|
|
208
|
+
*/
|
|
209
|
+
from?: string;
|
|
210
|
+
/**
|
|
211
|
+
* An optional datetime for scheduling message up to a couple of months in the
|
|
212
|
+
* future.
|
|
213
|
+
*/
|
|
214
|
+
send_at?: string;
|
|
215
|
+
}
|
|
216
|
+
namespace SimpleMessageParams {
|
|
217
|
+
/**
|
|
218
|
+
* Params for creating an attachment
|
|
219
|
+
*/
|
|
220
|
+
interface Attachment {
|
|
221
|
+
/**
|
|
222
|
+
* The URL of the attachment.
|
|
223
|
+
*/
|
|
224
|
+
url: string;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export declare namespace Messages {
|
|
229
|
+
export { type Message as Message, type MessageCreateParams as MessageCreateParams };
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=messages.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.mts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import * as ContactsAPI from "./contacts.js";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
export declare class Messages extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates and enqueues a new message to be sent.
|
|
8
|
+
*
|
|
9
|
+
* Messages are always sent asynchronously. When you hit this endpoint, the message
|
|
10
|
+
* will be created within Surge's system and enqueued for sending, and then the id
|
|
11
|
+
* for the new message will be returned. When the message is actually sent, a
|
|
12
|
+
* `message.sent` webhook event will be triggered and sent to any webhook endpoints
|
|
13
|
+
* that you have subscribed to this event type. Then a `message.delivered` webhook
|
|
14
|
+
* event will be triggered when the carrier sends us a delivery receipt.
|
|
15
|
+
*
|
|
16
|
+
* By default all messages will be sent immediately. If you would like to schedule
|
|
17
|
+
* sending for some time up to 60 days in the future, you can do that by providing
|
|
18
|
+
* a value for the `send_at` field. This should be formatted as an ISO8601 datetime
|
|
19
|
+
* like `2028-10-14T18:06:00Z`.
|
|
20
|
+
*
|
|
21
|
+
* You must include either a `body` or `attachments` field (or both) in the request
|
|
22
|
+
* body. The `body` field should contain the text of the message you want to send,
|
|
23
|
+
* and the `attachments` field should be an array of objects with a `url` field
|
|
24
|
+
* pointing to the file you want to attach. Surge will download these files and
|
|
25
|
+
* send them as attachments in the message.
|
|
26
|
+
*
|
|
27
|
+
* You can provide either a `conversation` object or a `to` field to specify the
|
|
28
|
+
* intended recipient of the message, but an error will be returned if both fields
|
|
29
|
+
* are provided. Similarly the `from` field cannot be used together with the
|
|
30
|
+
* `conversation` field, and `conversation.phone_number` should be specified
|
|
31
|
+
* instead.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const message = await client.messages.create(
|
|
36
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
37
|
+
* {
|
|
38
|
+
* conversation: {
|
|
39
|
+
* contact: { phone_number: '+18015551234' },
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
create(accountID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise<Message>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A Message is a communication sent to a Contact.
|
|
49
|
+
*/
|
|
50
|
+
export interface Message {
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for the object.
|
|
53
|
+
*/
|
|
54
|
+
id?: string;
|
|
55
|
+
attachments?: Array<Message.Attachment>;
|
|
56
|
+
/**
|
|
57
|
+
* The message body.
|
|
58
|
+
*/
|
|
59
|
+
body?: string;
|
|
60
|
+
/**
|
|
61
|
+
* A conversation with a Contact
|
|
62
|
+
*/
|
|
63
|
+
conversation?: Message.Conversation;
|
|
64
|
+
}
|
|
65
|
+
export declare namespace Message {
|
|
66
|
+
/**
|
|
67
|
+
* An Attachment is a file that can be sent with a message.
|
|
68
|
+
*/
|
|
69
|
+
interface Attachment {
|
|
70
|
+
/**
|
|
71
|
+
* Unique identifier for the object.
|
|
72
|
+
*/
|
|
73
|
+
id?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The type of attachment.
|
|
76
|
+
*/
|
|
77
|
+
type?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The URL of the attachment.
|
|
80
|
+
*/
|
|
81
|
+
url?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A conversation with a Contact
|
|
85
|
+
*/
|
|
86
|
+
interface Conversation {
|
|
87
|
+
/**
|
|
88
|
+
* Unique identifier for the object.
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
91
|
+
/**
|
|
92
|
+
* A contact who has consented to receive messages
|
|
93
|
+
*/
|
|
94
|
+
contact: ContactsAPI.Contact;
|
|
95
|
+
/**
|
|
96
|
+
* This is the phone number tied to the Surge account.
|
|
97
|
+
*/
|
|
98
|
+
phone_number?: Conversation.PhoneNumber;
|
|
99
|
+
}
|
|
100
|
+
namespace Conversation {
|
|
101
|
+
/**
|
|
102
|
+
* This is the phone number tied to the Surge account.
|
|
103
|
+
*/
|
|
104
|
+
interface PhoneNumber {
|
|
105
|
+
/**
|
|
106
|
+
* Unique identifier for the phone number
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
/**
|
|
110
|
+
* The canonical format of the phone number.
|
|
111
|
+
*/
|
|
112
|
+
number: string;
|
|
113
|
+
/**
|
|
114
|
+
* Whether the phone number is local, toll-free, or short code
|
|
115
|
+
*/
|
|
116
|
+
type: 'local' | 'toll_free' | 'short_code' | 'demo';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export type MessageCreateParams = MessageCreateParams.MessageParamsWithConversation | MessageCreateParams.SimpleMessageParams;
|
|
121
|
+
export declare namespace MessageCreateParams {
|
|
122
|
+
interface MessageParamsWithConversation {
|
|
123
|
+
/**
|
|
124
|
+
* Params for selecting or creating a new conversation. Either the id or the
|
|
125
|
+
* Contact must be given.
|
|
126
|
+
*/
|
|
127
|
+
conversation: MessageParamsWithConversation.Conversation;
|
|
128
|
+
attachments?: Array<MessageParamsWithConversation.Attachment>;
|
|
129
|
+
/**
|
|
130
|
+
* The message body.
|
|
131
|
+
*/
|
|
132
|
+
body?: string;
|
|
133
|
+
/**
|
|
134
|
+
* An optional datetime for scheduling message up to a couple of months in the
|
|
135
|
+
* future.
|
|
136
|
+
*/
|
|
137
|
+
send_at?: string;
|
|
138
|
+
}
|
|
139
|
+
namespace MessageParamsWithConversation {
|
|
140
|
+
/**
|
|
141
|
+
* Params for selecting or creating a new conversation. Either the id or the
|
|
142
|
+
* Contact must be given.
|
|
143
|
+
*/
|
|
144
|
+
interface Conversation {
|
|
145
|
+
/**
|
|
146
|
+
* Parameters for creating a contact
|
|
147
|
+
*/
|
|
148
|
+
contact: Conversation.Contact;
|
|
149
|
+
/**
|
|
150
|
+
* The phone number from which to send the message. This can be either the phone
|
|
151
|
+
* number in E.164 format or a Surge phone number id.
|
|
152
|
+
*/
|
|
153
|
+
phone_number?: string;
|
|
154
|
+
}
|
|
155
|
+
namespace Conversation {
|
|
156
|
+
/**
|
|
157
|
+
* Parameters for creating a contact
|
|
158
|
+
*/
|
|
159
|
+
interface Contact {
|
|
160
|
+
/**
|
|
161
|
+
* The contact's phone number in E.164 format.
|
|
162
|
+
*/
|
|
163
|
+
phone_number: string;
|
|
164
|
+
/**
|
|
165
|
+
* The contact's email address.
|
|
166
|
+
*/
|
|
167
|
+
email?: string;
|
|
168
|
+
/**
|
|
169
|
+
* The contact's first name.
|
|
170
|
+
*/
|
|
171
|
+
first_name?: string;
|
|
172
|
+
/**
|
|
173
|
+
* The contact's last name.
|
|
174
|
+
*/
|
|
175
|
+
last_name?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Set of key-value pairs that will be stored with the object.
|
|
178
|
+
*/
|
|
179
|
+
metadata?: {
|
|
180
|
+
[key: string]: string;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Params for creating an attachment
|
|
186
|
+
*/
|
|
187
|
+
interface Attachment {
|
|
188
|
+
/**
|
|
189
|
+
* The URL of the attachment.
|
|
190
|
+
*/
|
|
191
|
+
url: string;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
interface SimpleMessageParams {
|
|
195
|
+
/**
|
|
196
|
+
* The recipient's phone number in E.164 format. Cannot be used together with
|
|
197
|
+
* 'conversation'.
|
|
198
|
+
*/
|
|
199
|
+
to: string;
|
|
200
|
+
attachments?: Array<SimpleMessageParams.Attachment>;
|
|
201
|
+
/**
|
|
202
|
+
* The message body.
|
|
203
|
+
*/
|
|
204
|
+
body?: string;
|
|
205
|
+
/**
|
|
206
|
+
* The sender's phone number in E.164 format or phone number ID. If omitted, uses
|
|
207
|
+
* the account's default phone number. Cannot be used together with 'conversation'.
|
|
208
|
+
*/
|
|
209
|
+
from?: string;
|
|
210
|
+
/**
|
|
211
|
+
* An optional datetime for scheduling message up to a couple of months in the
|
|
212
|
+
* future.
|
|
213
|
+
*/
|
|
214
|
+
send_at?: string;
|
|
215
|
+
}
|
|
216
|
+
namespace SimpleMessageParams {
|
|
217
|
+
/**
|
|
218
|
+
* Params for creating an attachment
|
|
219
|
+
*/
|
|
220
|
+
interface Attachment {
|
|
221
|
+
/**
|
|
222
|
+
* The URL of the attachment.
|
|
223
|
+
*/
|
|
224
|
+
url: string;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export declare namespace Messages {
|
|
229
|
+
export { type Message as Message, type MessageCreateParams as MessageCreateParams };
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Messages = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const path_1 = require("../internal/utils/path.js");
|
|
7
|
+
class Messages extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Creates and enqueues a new message to be sent.
|
|
10
|
+
*
|
|
11
|
+
* Messages are always sent asynchronously. When you hit this endpoint, the message
|
|
12
|
+
* will be created within Surge's system and enqueued for sending, and then the id
|
|
13
|
+
* for the new message will be returned. When the message is actually sent, a
|
|
14
|
+
* `message.sent` webhook event will be triggered and sent to any webhook endpoints
|
|
15
|
+
* that you have subscribed to this event type. Then a `message.delivered` webhook
|
|
16
|
+
* event will be triggered when the carrier sends us a delivery receipt.
|
|
17
|
+
*
|
|
18
|
+
* By default all messages will be sent immediately. If you would like to schedule
|
|
19
|
+
* sending for some time up to 60 days in the future, you can do that by providing
|
|
20
|
+
* a value for the `send_at` field. This should be formatted as an ISO8601 datetime
|
|
21
|
+
* like `2028-10-14T18:06:00Z`.
|
|
22
|
+
*
|
|
23
|
+
* You must include either a `body` or `attachments` field (or both) in the request
|
|
24
|
+
* body. The `body` field should contain the text of the message you want to send,
|
|
25
|
+
* and the `attachments` field should be an array of objects with a `url` field
|
|
26
|
+
* pointing to the file you want to attach. Surge will download these files and
|
|
27
|
+
* send them as attachments in the message.
|
|
28
|
+
*
|
|
29
|
+
* You can provide either a `conversation` object or a `to` field to specify the
|
|
30
|
+
* intended recipient of the message, but an error will be returned if both fields
|
|
31
|
+
* are provided. Similarly the `from` field cannot be used together with the
|
|
32
|
+
* `conversation` field, and `conversation.phone_number` should be specified
|
|
33
|
+
* instead.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const message = await client.messages.create(
|
|
38
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
39
|
+
* {
|
|
40
|
+
* conversation: {
|
|
41
|
+
* contact: { phone_number: '+18015551234' },
|
|
42
|
+
* },
|
|
43
|
+
* },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
create(accountID, body, options) {
|
|
48
|
+
return this._client.post((0, path_1.path) `/accounts/${accountID}/messages`, { body, ...options });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Messages = Messages;
|
|
52
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;CACF;AA3CD,4BA2CC"}
|