sendblue 3.7.0 → 3.9.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 +32 -0
- package/client.d.mts +3 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -0
- package/client.d.ts.map +1 -1
- package/client.js +14 -0
- package/client.js.map +1 -1
- package/client.mjs +14 -0
- package/client.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/lines/call-forwarding.d.mts +94 -0
- package/resources/lines/call-forwarding.d.mts.map +1 -0
- package/resources/lines/call-forwarding.d.ts +94 -0
- package/resources/lines/call-forwarding.d.ts.map +1 -0
- package/resources/lines/call-forwarding.js +65 -0
- package/resources/lines/call-forwarding.js.map +1 -0
- package/resources/lines/call-forwarding.mjs +61 -0
- package/resources/lines/call-forwarding.mjs.map +1 -0
- package/resources/lines/index.d.mts +3 -0
- package/resources/lines/index.d.mts.map +1 -0
- package/resources/lines/index.d.ts +3 -0
- package/resources/lines/index.d.ts.map +1 -0
- package/resources/lines/index.js +9 -0
- package/resources/lines/index.js.map +1 -0
- package/resources/lines/index.mjs +4 -0
- package/resources/lines/index.mjs.map +1 -0
- package/resources/lines/lines.d.mts +10 -0
- package/resources/lines/lines.d.mts.map +1 -0
- package/resources/lines/lines.d.ts +10 -0
- package/resources/lines/lines.d.ts.map +1 -0
- package/resources/lines/lines.js +17 -0
- package/resources/lines/lines.js.map +1 -0
- package/resources/lines/lines.mjs +12 -0
- package/resources/lines/lines.mjs.map +1 -0
- package/resources/lines.d.mts +2 -0
- package/resources/lines.d.mts.map +1 -0
- package/resources/lines.d.ts +2 -0
- package/resources/lines.d.ts.map +1 -0
- package/resources/lines.js +6 -0
- package/resources/lines.js.map +1 -0
- package/resources/lines.mjs +3 -0
- package/resources/lines.mjs.map +1 -0
- package/src/client.ts +17 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/index.ts +1 -0
- package/src/resources/lines/call-forwarding.ts +122 -0
- package/src/resources/lines/index.ts +10 -0
- package/src/resources/lines/lines.ts +27 -0
- package/src/resources/lines.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
4
|
+
export declare class CallForwarding extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Returns the current call forwarding number for a dedicated phone line.
|
|
7
|
+
*
|
|
8
|
+
* Per-line forwarding takes priority over the company default forwarding number
|
|
9
|
+
* but is overridden by seat-level forwarding when a seat has a forwarding number
|
|
10
|
+
* set.
|
|
11
|
+
*
|
|
12
|
+
* **Priority order:** seat forwarding → per-line forwarding → company default
|
|
13
|
+
* forwarding
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const callForwarding =
|
|
18
|
+
* await client.lines.callForwarding.retrieve(
|
|
19
|
+
* '+12125550101',
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
retrieve(sendblueNumber: string, options?: RequestOptions): APIPromise<CallForwardingRetrieveResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Sets a call forwarding number for a specific dedicated phone line. Inbound calls
|
|
26
|
+
* to this line will be forwarded to the specified number.
|
|
27
|
+
*
|
|
28
|
+
* The `forwarding_number` is normalized to E.164 format before storage. US numbers
|
|
29
|
+
* can be supplied in local format (e.g. `2125550199`).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const callForwarding =
|
|
34
|
+
* await client.lines.callForwarding.update('+12125550101', {
|
|
35
|
+
* forwarding_number: '+16692138010',
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
update(sendblueNumber: string, body: CallForwardingUpdateParams, options?: RequestOptions): APIPromise<CallForwardingUpdateResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Removes the per-line call forwarding number. After clearing, inbound calls will
|
|
42
|
+
* fall back to the company default forwarding number (if configured).
|
|
43
|
+
*
|
|
44
|
+
* This operation is idempotent — calling it on a line with no forwarding set
|
|
45
|
+
* returns 200 with `forwarding_number: null`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const callForwarding =
|
|
50
|
+
* await client.lines.callForwarding.delete('+12125550101');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
delete(sendblueNumber: string, options?: RequestOptions): APIPromise<CallForwardingDeleteResponse>;
|
|
54
|
+
}
|
|
55
|
+
export interface CallForwardingRetrieveResponse {
|
|
56
|
+
/**
|
|
57
|
+
* The number calls are forwarded to, or null if not set
|
|
58
|
+
*/
|
|
59
|
+
forwarding_number: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* The Sendblue phone number (E.164)
|
|
62
|
+
*/
|
|
63
|
+
sendblue_number: string;
|
|
64
|
+
}
|
|
65
|
+
export interface CallForwardingUpdateResponse {
|
|
66
|
+
/**
|
|
67
|
+
* The number calls are forwarded to, or null if not set
|
|
68
|
+
*/
|
|
69
|
+
forwarding_number: string | null;
|
|
70
|
+
/**
|
|
71
|
+
* The Sendblue phone number (E.164)
|
|
72
|
+
*/
|
|
73
|
+
sendblue_number: string;
|
|
74
|
+
}
|
|
75
|
+
export interface CallForwardingDeleteResponse {
|
|
76
|
+
/**
|
|
77
|
+
* The number calls are forwarded to, or null if not set
|
|
78
|
+
*/
|
|
79
|
+
forwarding_number: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* The Sendblue phone number (E.164)
|
|
82
|
+
*/
|
|
83
|
+
sendblue_number: string;
|
|
84
|
+
}
|
|
85
|
+
export interface CallForwardingUpdateParams {
|
|
86
|
+
/**
|
|
87
|
+
* Phone number to forward calls to (E.164 or US local format)
|
|
88
|
+
*/
|
|
89
|
+
forwarding_number: string;
|
|
90
|
+
}
|
|
91
|
+
export declare namespace CallForwarding {
|
|
92
|
+
export { type CallForwardingRetrieveResponse as CallForwardingRetrieveResponse, type CallForwardingUpdateResponse as CallForwardingUpdateResponse, type CallForwardingDeleteResponse as CallForwardingDeleteResponse, type CallForwardingUpdateParams as CallForwardingUpdateParams, };
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=call-forwarding.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-forwarding.d.mts","sourceRoot":"","sources":["../../src/resources/lines/call-forwarding.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,8BAA8B,CAAC;IAItG;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;IAI3C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC;CAGnG;AAED,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,WAAW,cAAc,CAAC;IACtC,OAAO,EACL,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
4
|
+
export declare class CallForwarding extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Returns the current call forwarding number for a dedicated phone line.
|
|
7
|
+
*
|
|
8
|
+
* Per-line forwarding takes priority over the company default forwarding number
|
|
9
|
+
* but is overridden by seat-level forwarding when a seat has a forwarding number
|
|
10
|
+
* set.
|
|
11
|
+
*
|
|
12
|
+
* **Priority order:** seat forwarding → per-line forwarding → company default
|
|
13
|
+
* forwarding
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const callForwarding =
|
|
18
|
+
* await client.lines.callForwarding.retrieve(
|
|
19
|
+
* '+12125550101',
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
retrieve(sendblueNumber: string, options?: RequestOptions): APIPromise<CallForwardingRetrieveResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Sets a call forwarding number for a specific dedicated phone line. Inbound calls
|
|
26
|
+
* to this line will be forwarded to the specified number.
|
|
27
|
+
*
|
|
28
|
+
* The `forwarding_number` is normalized to E.164 format before storage. US numbers
|
|
29
|
+
* can be supplied in local format (e.g. `2125550199`).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const callForwarding =
|
|
34
|
+
* await client.lines.callForwarding.update('+12125550101', {
|
|
35
|
+
* forwarding_number: '+16692138010',
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
update(sendblueNumber: string, body: CallForwardingUpdateParams, options?: RequestOptions): APIPromise<CallForwardingUpdateResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Removes the per-line call forwarding number. After clearing, inbound calls will
|
|
42
|
+
* fall back to the company default forwarding number (if configured).
|
|
43
|
+
*
|
|
44
|
+
* This operation is idempotent — calling it on a line with no forwarding set
|
|
45
|
+
* returns 200 with `forwarding_number: null`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const callForwarding =
|
|
50
|
+
* await client.lines.callForwarding.delete('+12125550101');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
delete(sendblueNumber: string, options?: RequestOptions): APIPromise<CallForwardingDeleteResponse>;
|
|
54
|
+
}
|
|
55
|
+
export interface CallForwardingRetrieveResponse {
|
|
56
|
+
/**
|
|
57
|
+
* The number calls are forwarded to, or null if not set
|
|
58
|
+
*/
|
|
59
|
+
forwarding_number: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* The Sendblue phone number (E.164)
|
|
62
|
+
*/
|
|
63
|
+
sendblue_number: string;
|
|
64
|
+
}
|
|
65
|
+
export interface CallForwardingUpdateResponse {
|
|
66
|
+
/**
|
|
67
|
+
* The number calls are forwarded to, or null if not set
|
|
68
|
+
*/
|
|
69
|
+
forwarding_number: string | null;
|
|
70
|
+
/**
|
|
71
|
+
* The Sendblue phone number (E.164)
|
|
72
|
+
*/
|
|
73
|
+
sendblue_number: string;
|
|
74
|
+
}
|
|
75
|
+
export interface CallForwardingDeleteResponse {
|
|
76
|
+
/**
|
|
77
|
+
* The number calls are forwarded to, or null if not set
|
|
78
|
+
*/
|
|
79
|
+
forwarding_number: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* The Sendblue phone number (E.164)
|
|
82
|
+
*/
|
|
83
|
+
sendblue_number: string;
|
|
84
|
+
}
|
|
85
|
+
export interface CallForwardingUpdateParams {
|
|
86
|
+
/**
|
|
87
|
+
* Phone number to forward calls to (E.164 or US local format)
|
|
88
|
+
*/
|
|
89
|
+
forwarding_number: string;
|
|
90
|
+
}
|
|
91
|
+
export declare namespace CallForwarding {
|
|
92
|
+
export { type CallForwardingRetrieveResponse as CallForwardingRetrieveResponse, type CallForwardingUpdateResponse as CallForwardingUpdateResponse, type CallForwardingDeleteResponse as CallForwardingDeleteResponse, type CallForwardingUpdateParams as CallForwardingUpdateParams, };
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=call-forwarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-forwarding.d.ts","sourceRoot":"","sources":["../../src/resources/lines/call-forwarding.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,8BAA8B,CAAC;IAItG;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;IAI3C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC;CAGnG;AAED,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,WAAW,cAAc,CAAC;IACtC,OAAO,EACL,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.CallForwarding = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
7
|
+
class CallForwarding extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Returns the current call forwarding number for a dedicated phone line.
|
|
10
|
+
*
|
|
11
|
+
* Per-line forwarding takes priority over the company default forwarding number
|
|
12
|
+
* but is overridden by seat-level forwarding when a seat has a forwarding number
|
|
13
|
+
* set.
|
|
14
|
+
*
|
|
15
|
+
* **Priority order:** seat forwarding → per-line forwarding → company default
|
|
16
|
+
* forwarding
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const callForwarding =
|
|
21
|
+
* await client.lines.callForwarding.retrieve(
|
|
22
|
+
* '+12125550101',
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
retrieve(sendblueNumber, options) {
|
|
27
|
+
return this._client.get((0, path_1.path) `/api/lines/${sendblueNumber}/call-forwarding`, options);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Sets a call forwarding number for a specific dedicated phone line. Inbound calls
|
|
31
|
+
* to this line will be forwarded to the specified number.
|
|
32
|
+
*
|
|
33
|
+
* The `forwarding_number` is normalized to E.164 format before storage. US numbers
|
|
34
|
+
* can be supplied in local format (e.g. `2125550199`).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const callForwarding =
|
|
39
|
+
* await client.lines.callForwarding.update('+12125550101', {
|
|
40
|
+
* forwarding_number: '+16692138010',
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
update(sendblueNumber, body, options) {
|
|
45
|
+
return this._client.put((0, path_1.path) `/api/lines/${sendblueNumber}/call-forwarding`, { body, ...options });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Removes the per-line call forwarding number. After clearing, inbound calls will
|
|
49
|
+
* fall back to the company default forwarding number (if configured).
|
|
50
|
+
*
|
|
51
|
+
* This operation is idempotent — calling it on a line with no forwarding set
|
|
52
|
+
* returns 200 with `forwarding_number: null`.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const callForwarding =
|
|
57
|
+
* await client.lines.callForwarding.delete('+12125550101');
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
delete(sendblueNumber, options) {
|
|
61
|
+
return this._client.delete((0, path_1.path) `/api/lines/${sendblueNumber}/call-forwarding`, options);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.CallForwarding = CallForwarding;
|
|
65
|
+
//# sourceMappingURL=call-forwarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-forwarding.js","sourceRoot":"","sources":["../../src/resources/lines/call-forwarding.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAiD;AAEjD,MAAa,cAAe,SAAQ,sBAAW;IAC7C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,cAAc,cAAc,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,cAAsB,EACtB,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,cAAc,cAAc,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpG,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,cAAc,cAAc,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;CACF;AA9DD,wCA8DC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 CallForwarding extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Returns the current call forwarding number for a dedicated phone line.
|
|
7
|
+
*
|
|
8
|
+
* Per-line forwarding takes priority over the company default forwarding number
|
|
9
|
+
* but is overridden by seat-level forwarding when a seat has a forwarding number
|
|
10
|
+
* set.
|
|
11
|
+
*
|
|
12
|
+
* **Priority order:** seat forwarding → per-line forwarding → company default
|
|
13
|
+
* forwarding
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const callForwarding =
|
|
18
|
+
* await client.lines.callForwarding.retrieve(
|
|
19
|
+
* '+12125550101',
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
retrieve(sendblueNumber, options) {
|
|
24
|
+
return this._client.get(path `/api/lines/${sendblueNumber}/call-forwarding`, options);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets a call forwarding number for a specific dedicated phone line. Inbound calls
|
|
28
|
+
* to this line will be forwarded to the specified number.
|
|
29
|
+
*
|
|
30
|
+
* The `forwarding_number` is normalized to E.164 format before storage. US numbers
|
|
31
|
+
* can be supplied in local format (e.g. `2125550199`).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const callForwarding =
|
|
36
|
+
* await client.lines.callForwarding.update('+12125550101', {
|
|
37
|
+
* forwarding_number: '+16692138010',
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
update(sendblueNumber, body, options) {
|
|
42
|
+
return this._client.put(path `/api/lines/${sendblueNumber}/call-forwarding`, { body, ...options });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Removes the per-line call forwarding number. After clearing, inbound calls will
|
|
46
|
+
* fall back to the company default forwarding number (if configured).
|
|
47
|
+
*
|
|
48
|
+
* This operation is idempotent — calling it on a line with no forwarding set
|
|
49
|
+
* returns 200 with `forwarding_number: null`.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const callForwarding =
|
|
54
|
+
* await client.lines.callForwarding.delete('+12125550101');
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
delete(sendblueNumber, options) {
|
|
58
|
+
return this._client.delete(path `/api/lines/${sendblueNumber}/call-forwarding`, options);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=call-forwarding.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-forwarding.mjs","sourceRoot":"","sources":["../../src/resources/lines/call-forwarding.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,cAAc,cAAc,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,cAAsB,EACtB,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,cAAc,cAAc,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpG,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,cAAc,cAAc,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/lines/index.ts"],"names":[],"mappings":"OAEO,EACL,cAAc,EACd,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,GAChC;OACM,EAAE,KAAK,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/lines/index.ts"],"names":[],"mappings":"OAEO,EACL,cAAc,EACd,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,GAChC;OACM,EAAE,KAAK,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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.Lines = exports.CallForwarding = void 0;
|
|
5
|
+
var call_forwarding_1 = require("./call-forwarding.js");
|
|
6
|
+
Object.defineProperty(exports, "CallForwarding", { enumerable: true, get: function () { return call_forwarding_1.CallForwarding; } });
|
|
7
|
+
var lines_1 = require("./lines.js");
|
|
8
|
+
Object.defineProperty(exports, "Lines", { enumerable: true, get: function () { return lines_1.Lines; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/lines/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAM2B;AALzB,iHAAA,cAAc,OAAA;AAMhB,oCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/lines/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,cAAc,GAKf;OACM,EAAE,KAAK,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as CallForwardingAPI from "./call-forwarding.mjs";
|
|
3
|
+
import { CallForwarding, CallForwardingDeleteResponse, CallForwardingRetrieveResponse, CallForwardingUpdateParams, CallForwardingUpdateResponse } from "./call-forwarding.mjs";
|
|
4
|
+
export declare class Lines extends APIResource {
|
|
5
|
+
callForwarding: CallForwardingAPI.CallForwarding;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace Lines {
|
|
8
|
+
export { CallForwarding as CallForwarding, type CallForwardingRetrieveResponse as CallForwardingRetrieveResponse, type CallForwardingUpdateResponse as CallForwardingUpdateResponse, type CallForwardingDeleteResponse as CallForwardingDeleteResponse, type CallForwardingUpdateParams as CallForwardingUpdateParams, };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=lines.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.d.mts","sourceRoot":"","sources":["../../src/resources/lines/lines.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,iBAAiB;OACtB,EACL,cAAc,EACd,4BAA4B,EAC5B,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAC7B;AAED,qBAAa,KAAM,SAAQ,WAAW;IACpC,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAsD;CACvG;AAID,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,cAAc,IAAI,cAAc,EAChC,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import * as CallForwardingAPI from "./call-forwarding.js";
|
|
3
|
+
import { CallForwarding, CallForwardingDeleteResponse, CallForwardingRetrieveResponse, CallForwardingUpdateParams, CallForwardingUpdateResponse } from "./call-forwarding.js";
|
|
4
|
+
export declare class Lines extends APIResource {
|
|
5
|
+
callForwarding: CallForwardingAPI.CallForwarding;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace Lines {
|
|
8
|
+
export { CallForwarding as CallForwarding, type CallForwardingRetrieveResponse as CallForwardingRetrieveResponse, type CallForwardingUpdateResponse as CallForwardingUpdateResponse, type CallForwardingDeleteResponse as CallForwardingDeleteResponse, type CallForwardingUpdateParams as CallForwardingUpdateParams, };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../src/resources/lines/lines.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,iBAAiB;OACtB,EACL,cAAc,EACd,4BAA4B,EAC5B,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAC7B;AAED,qBAAa,KAAM,SAAQ,WAAW;IACpC,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAsD;CACvG;AAID,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,cAAc,IAAI,cAAc,EAChC,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.Lines = void 0;
|
|
5
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../../core/resource.js");
|
|
7
|
+
const CallForwardingAPI = tslib_1.__importStar(require("./call-forwarding.js"));
|
|
8
|
+
const call_forwarding_1 = require("./call-forwarding.js");
|
|
9
|
+
class Lines extends resource_1.APIResource {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.callForwarding = new CallForwardingAPI.CallForwarding(this._client);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Lines = Lines;
|
|
16
|
+
Lines.CallForwarding = call_forwarding_1.CallForwarding;
|
|
17
|
+
//# sourceMappingURL=lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.js","sourceRoot":"","sources":["../../src/resources/lines/lines.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,gFAAuD;AACvD,0DAM2B;AAE3B,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxG,CAAC;CAAA;AAFD,sBAEC;AAED,KAAK,CAAC,cAAc,GAAG,gCAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import * as CallForwardingAPI from "./call-forwarding.mjs";
|
|
4
|
+
import { CallForwarding, } from "./call-forwarding.mjs";
|
|
5
|
+
export class Lines extends APIResource {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.callForwarding = new CallForwardingAPI.CallForwarding(this._client);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
Lines.CallForwarding = CallForwarding;
|
|
12
|
+
//# sourceMappingURL=lines.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.mjs","sourceRoot":"","sources":["../../src/resources/lines/lines.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,iBAAiB;OACtB,EACL,cAAc,GAKf;AAED,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxG,CAAC;CAAA;AAED,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.d.mts","sourceRoot":"","sources":["../src/resources/lines.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../src/resources/lines.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./lines/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.js","sourceRoot":"","sources":["../src/resources/lines.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.mjs","sourceRoot":"","sources":["../src/resources/lines.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/src/client.ts
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
ContactVerifyResponse,
|
|
65
65
|
Contacts,
|
|
66
66
|
} from './resources/contacts/contacts';
|
|
67
|
+
import { Lines } from './resources/lines/lines';
|
|
67
68
|
import { V2 } from './resources/v2/v2';
|
|
68
69
|
import { type Fetch } from './internal/builtin-types';
|
|
69
70
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
@@ -229,6 +230,18 @@ export class SendblueAPI {
|
|
|
229
230
|
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
230
231
|
this.#encoder = Opts.FallbackEncoder;
|
|
231
232
|
|
|
233
|
+
const customHeadersEnv = readEnv('SENDBLUE_API_CUSTOM_HEADERS');
|
|
234
|
+
if (customHeadersEnv) {
|
|
235
|
+
const parsed: Record<string, string> = {};
|
|
236
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
237
|
+
const colon = line.indexOf(':');
|
|
238
|
+
if (colon >= 0) {
|
|
239
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
243
|
+
}
|
|
244
|
+
|
|
232
245
|
this._options = options;
|
|
233
246
|
|
|
234
247
|
this.apiKey = apiKey;
|
|
@@ -822,6 +835,7 @@ export class SendblueAPI {
|
|
|
822
835
|
*/
|
|
823
836
|
sendCarousel: API.SendCarousel = new API.SendCarousel(this);
|
|
824
837
|
v2: API.V2 = new API.V2(this);
|
|
838
|
+
lines: API.Lines = new API.Lines(this);
|
|
825
839
|
}
|
|
826
840
|
|
|
827
841
|
SendblueAPI.Messages = Messages;
|
|
@@ -833,6 +847,7 @@ SendblueAPI.Contacts = Contacts;
|
|
|
833
847
|
SendblueAPI.Webhooks = Webhooks;
|
|
834
848
|
SendblueAPI.SendCarousel = SendCarousel;
|
|
835
849
|
SendblueAPI.V2 = V2;
|
|
850
|
+
SendblueAPI.Lines = Lines;
|
|
836
851
|
|
|
837
852
|
export declare namespace SendblueAPI {
|
|
838
853
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -910,4 +925,6 @@ export declare namespace SendblueAPI {
|
|
|
910
925
|
};
|
|
911
926
|
|
|
912
927
|
export { V2 as V2 };
|
|
928
|
+
|
|
929
|
+
export { Lines as Lines };
|
|
913
930
|
}
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export const readEnv = (env: string): string | undefined => {
|
|
11
11
|
if (typeof (globalThis as any).process !== 'undefined') {
|
|
12
|
-
return (globalThis as any).process.env?.[env]?.trim()
|
|
12
|
+
return (globalThis as any).process.env?.[env]?.trim() || undefined;
|
|
13
13
|
}
|
|
14
14
|
if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
15
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
15
|
+
return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
};
|
package/src/resources/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ export {
|
|
|
23
23
|
type GroupModifyParams,
|
|
24
24
|
type GroupSendMessageParams,
|
|
25
25
|
} from './groups';
|
|
26
|
+
export { Lines } from './lines/lines';
|
|
26
27
|
export { Lookups, type LookupLookupNumberResponse, type LookupLookupNumberParams } from './lookups';
|
|
27
28
|
export { MediaObjects, type MediaObjectUploadResponse, type MediaObjectUploadParams } from './media-objects';
|
|
28
29
|
export {
|