sendblue 3.10.1 → 3.11.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 +33 -0
- package/README.md +7 -7
- package/client.d.mts +37 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +37 -4
- package/client.d.ts.map +1 -1
- package/client.js +33 -0
- package/client.js.map +1 -1
- package/client.mjs +33 -0
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts +33 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +33 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +263 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +258 -0
- package/core/streaming.mjs.map +1 -0
- package/internal/decoders/line.d.mts +17 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +17 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +113 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +108 -0
- package/internal/decoders/line.mjs.map +1 -0
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +10 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +10 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +2 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +2 -0
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/package.json +11 -1
- package/resources/auth/auth.d.mts +10 -0
- package/resources/auth/auth.d.mts.map +1 -0
- package/resources/auth/auth.d.ts +10 -0
- package/resources/auth/auth.d.ts.map +1 -0
- package/resources/auth/auth.js +17 -0
- package/resources/auth/auth.js.map +1 -0
- package/resources/auth/auth.mjs +12 -0
- package/resources/auth/auth.mjs.map +1 -0
- package/resources/auth/index.d.mts +3 -0
- package/resources/auth/index.d.mts.map +1 -0
- package/resources/auth/index.d.ts +3 -0
- package/resources/auth/index.d.ts.map +1 -0
- package/resources/auth/index.js +9 -0
- package/resources/auth/index.js.map +1 -0
- package/resources/auth/index.mjs +4 -0
- package/resources/auth/index.mjs.map +1 -0
- package/resources/auth/tokens.d.mts +77 -0
- package/resources/auth/tokens.d.mts.map +1 -0
- package/resources/auth/tokens.d.ts +77 -0
- package/resources/auth/tokens.d.ts.map +1 -0
- package/resources/auth/tokens.js +51 -0
- package/resources/auth/tokens.js.map +1 -0
- package/resources/auth/tokens.mjs +47 -0
- package/resources/auth/tokens.mjs.map +1 -0
- package/resources/auth.d.mts +2 -0
- package/resources/auth.d.mts.map +1 -0
- package/resources/auth.d.ts +2 -0
- package/resources/auth.d.ts.map +1 -0
- package/resources/auth.js +6 -0
- package/resources/auth.js.map +1 -0
- package/resources/auth.mjs +3 -0
- package/resources/auth.mjs.map +1 -0
- package/resources/contacts/contacts.d.mts +8 -0
- package/resources/contacts/contacts.d.mts.map +1 -1
- package/resources/contacts/contacts.d.ts +8 -0
- package/resources/contacts/contacts.d.ts.map +1 -1
- package/resources/contacts/contacts.js.map +1 -1
- package/resources/contacts/contacts.mjs.map +1 -1
- package/resources/events.d.mts +45 -0
- package/resources/events.d.mts.map +1 -0
- package/resources/events.d.ts +45 -0
- package/resources/events.d.ts.map +1 -0
- package/resources/events.js +37 -0
- package/resources/events.js.map +1 -0
- package/resources/events.mjs +33 -0
- package/resources/events.mjs.map +1 -0
- package/resources/groups.d.mts +25 -0
- package/resources/groups.d.mts.map +1 -1
- package/resources/groups.d.ts +25 -0
- package/resources/groups.d.ts.map +1 -1
- package/resources/index.d.mts +8 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +8 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +13 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +6 -0
- package/resources/index.mjs.map +1 -1
- package/resources/lines/call-forwarding.d.mts +3 -0
- package/resources/lines/call-forwarding.d.mts.map +1 -1
- package/resources/lines/call-forwarding.d.ts +3 -0
- package/resources/lines/call-forwarding.d.ts.map +1 -1
- package/resources/lines/call-forwarding.js +3 -0
- package/resources/lines/call-forwarding.js.map +1 -1
- package/resources/lines/call-forwarding.mjs +3 -0
- package/resources/lines/call-forwarding.mjs.map +1 -1
- package/resources/lines/index.d.mts +1 -1
- package/resources/lines/index.d.mts.map +1 -1
- package/resources/lines/index.d.ts +1 -1
- package/resources/lines/index.d.ts.map +1 -1
- package/resources/lines/index.js.map +1 -1
- package/resources/lines/index.mjs.map +1 -1
- package/resources/lines/lines.d.mts +30 -0
- package/resources/lines/lines.d.mts.map +1 -1
- package/resources/lines/lines.d.ts +30 -0
- package/resources/lines/lines.d.ts.map +1 -1
- package/resources/lines/lines.js +15 -0
- package/resources/lines/lines.js.map +1 -1
- package/resources/lines/lines.mjs +15 -0
- package/resources/lines/lines.mjs.map +1 -1
- package/resources/location.d.mts +156 -0
- package/resources/location.d.mts.map +1 -0
- package/resources/location.d.ts +156 -0
- package/resources/location.d.ts.map +1 -0
- package/resources/location.js +57 -0
- package/resources/location.js.map +1 -0
- package/resources/location.mjs +53 -0
- package/resources/location.mjs.map +1 -0
- package/resources/messages.d.mts +507 -9
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +507 -9
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +16 -2
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +16 -2
- package/resources/messages.mjs.map +1 -1
- package/resources/request-location.d.mts +54 -0
- package/resources/request-location.d.mts.map +1 -0
- package/resources/request-location.d.ts +54 -0
- package/resources/request-location.d.ts.map +1 -0
- package/resources/request-location.js +30 -0
- package/resources/request-location.js.map +1 -0
- package/resources/request-location.mjs +26 -0
- package/resources/request-location.mjs.map +1 -0
- package/resources/send-carousel.d.mts +67 -0
- package/resources/send-carousel.d.mts.map +1 -1
- package/resources/send-carousel.d.ts +67 -0
- package/resources/send-carousel.d.ts.map +1 -1
- package/resources/v2/groups.d.mts +82 -0
- package/resources/v2/groups.d.mts.map +1 -0
- package/resources/v2/groups.d.ts +82 -0
- package/resources/v2/groups.d.ts.map +1 -0
- package/resources/v2/groups.js +27 -0
- package/resources/v2/groups.js.map +1 -0
- package/resources/v2/groups.mjs +23 -0
- package/resources/v2/groups.mjs.map +1 -0
- package/resources/v2/index.d.mts +1 -0
- package/resources/v2/index.d.mts.map +1 -1
- package/resources/v2/index.d.ts +1 -0
- package/resources/v2/index.d.ts.map +1 -1
- package/resources/v2/index.js +3 -1
- package/resources/v2/index.js.map +1 -1
- package/resources/v2/index.mjs +1 -0
- package/resources/v2/index.mjs.map +1 -1
- package/resources/v2/v2.d.mts +4 -0
- package/resources/v2/v2.d.mts.map +1 -1
- package/resources/v2/v2.d.ts +4 -0
- package/resources/v2/v2.d.ts.map +1 -1
- package/resources/v2/v2.js +4 -0
- package/resources/v2/v2.js.map +1 -1
- package/resources/v2/v2.mjs +4 -0
- package/resources/v2/v2.mjs.map +1 -1
- package/resources/verified-contacts.d.mts +152 -0
- package/resources/verified-contacts.d.mts.map +1 -0
- package/resources/verified-contacts.d.ts +152 -0
- package/resources/verified-contacts.d.ts.map +1 -0
- package/resources/verified-contacts.js +56 -0
- package/resources/verified-contacts.js.map +1 -0
- package/resources/verified-contacts.mjs +52 -0
- package/resources/verified-contacts.mjs.map +1 -0
- package/resources/verify/index.d.mts +3 -0
- package/resources/verify/index.d.mts.map +1 -0
- package/resources/verify/index.d.ts +3 -0
- package/resources/verify/index.d.ts.map +1 -0
- package/resources/verify/index.js +9 -0
- package/resources/verify/index.js.map +1 -0
- package/resources/verify/index.mjs +4 -0
- package/resources/verify/index.mjs.map +1 -0
- package/resources/verify/verifications.d.mts +45 -0
- package/resources/verify/verifications.d.mts.map +1 -0
- package/resources/verify/verifications.d.ts +45 -0
- package/resources/verify/verifications.d.ts.map +1 -0
- package/resources/verify/verifications.js +19 -0
- package/resources/verify/verifications.js.map +1 -0
- package/resources/verify/verifications.mjs +15 -0
- package/resources/verify/verifications.mjs.map +1 -0
- package/resources/verify/verify.d.mts +10 -0
- package/resources/verify/verify.d.mts.map +1 -0
- package/resources/verify/verify.d.ts +10 -0
- package/resources/verify/verify.d.ts.map +1 -0
- package/resources/verify/verify.js +17 -0
- package/resources/verify/verify.js.map +1 -0
- package/resources/verify/verify.mjs +12 -0
- package/resources/verify/verify.mjs.map +1 -0
- package/resources/verify.d.mts +2 -0
- package/resources/verify.d.mts.map +1 -0
- package/resources/verify.d.ts +2 -0
- package/resources/verify.d.ts.map +1 -0
- package/resources/verify.js +6 -0
- package/resources/verify.js.map +1 -0
- package/resources/verify.mjs +3 -0
- package/resources/verify.mjs.map +1 -0
- package/resources/webhooks.d.mts +26 -10
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +26 -10
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +13 -2
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +13 -2
- package/resources/webhooks.mjs.map +1 -1
- package/src/client.ts +85 -2
- package/src/core/streaming.ts +319 -0
- package/src/internal/decoders/line.ts +135 -0
- package/src/internal/parse.ts +14 -0
- package/src/internal/request-options.ts +2 -0
- package/src/resources/auth/auth.ts +19 -0
- package/src/resources/auth/index.ts +4 -0
- package/src/resources/auth/tokens.ts +101 -0
- package/src/resources/auth.ts +3 -0
- package/src/resources/contacts/contacts.ts +10 -0
- package/src/resources/events.ts +75 -0
- package/src/resources/groups.ts +28 -0
- package/src/resources/index.ts +26 -1
- package/src/resources/lines/call-forwarding.ts +3 -0
- package/src/resources/lines/index.ts +1 -1
- package/src/resources/lines/lines.ts +44 -0
- package/src/resources/location.ts +237 -0
- package/src/resources/messages.ts +634 -9
- package/src/resources/request-location.ts +72 -0
- package/src/resources/send-carousel.ts +76 -0
- package/src/resources/v2/groups.ts +106 -0
- package/src/resources/v2/index.ts +1 -0
- package/src/resources/v2/v2.ts +6 -0
- package/src/resources/verified-contacts.ts +204 -0
- package/src/resources/verify/index.ts +9 -0
- package/src/resources/verify/verifications.ts +75 -0
- package/src/resources/verify/verify.ts +25 -0
- package/src/resources/verify.ts +3 -0
- package/src/resources/webhooks.ts +27 -10
- package/src/streaming.ts +2 -0
- package/src/version.ts +1 -1
- package/streaming.d.mts +3 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +3 -0
- package/streaming.d.ts.map +1 -0
- package/streaming.js +6 -0
- package/streaming.js.map +1 -0
- package/streaming.mjs +3 -0
- package/streaming.mjs.map +1 -0
- 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,237 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { Stream } from '../core/streaming';
|
|
6
|
+
import { buildHeaders } from '../internal/headers';
|
|
7
|
+
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Operations for sending and managing messages
|
|
12
|
+
*/
|
|
13
|
+
export class Location extends APIResource {
|
|
14
|
+
/**
|
|
15
|
+
* Read the current Find My location for one contact if that contact already shares
|
|
16
|
+
* with a dedicated Mac-backed Sendblue number. Shared lines cannot use this
|
|
17
|
+
* endpoint.
|
|
18
|
+
*/
|
|
19
|
+
retrieve(
|
|
20
|
+
number: string,
|
|
21
|
+
query: LocationRetrieveParams,
|
|
22
|
+
options?: RequestOptions,
|
|
23
|
+
): APIPromise<LocationRetrieveResponse> {
|
|
24
|
+
return this._client.get(path`/api/location/${number}`, { query, ...options });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Read the current Find My locations already shared with a dedicated Mac-backed
|
|
29
|
+
* Sendblue number. Shared lines cannot use this endpoint.
|
|
30
|
+
*/
|
|
31
|
+
list(query: LocationListParams, options?: RequestOptions): APIPromise<LocationListResponse> {
|
|
32
|
+
return this._client.get('/api/location', { query, ...options });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Open a Server-Sent Events (SSE) stream for live Find My updates from one contact
|
|
37
|
+
* sharing with a dedicated Mac-backed Sendblue number. Shared lines cannot use
|
|
38
|
+
* this endpoint.
|
|
39
|
+
*
|
|
40
|
+
* The stream has no client-visible duration. It remains open while the client is
|
|
41
|
+
* connected, authorized, and the worker is available. Comment heartbeats are sent
|
|
42
|
+
* every 15 seconds. Clients should reconnect with their normal credentials after a
|
|
43
|
+
* network interruption or a `worker_disconnected` completion. Location events are
|
|
44
|
+
* live-only and may repeat across internal native-watch renewals.
|
|
45
|
+
*
|
|
46
|
+
* Named events and their JSON `data` payloads:
|
|
47
|
+
*
|
|
48
|
+
* - `ready`: the native watch is active.
|
|
49
|
+
* - `location`: a location state or fix.
|
|
50
|
+
* - `complete`: the watch ended normally. Known reasons are `sharing_ended`,
|
|
51
|
+
* `authorization_revoked`, `worker_disconnected`, and `watch_ended`. Clients
|
|
52
|
+
* should tolerate additional completion reasons.
|
|
53
|
+
* - `error`: the watch failed after the SSE response started.
|
|
54
|
+
*/
|
|
55
|
+
watch(
|
|
56
|
+
number: string,
|
|
57
|
+
query: LocationWatchParams,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): APIPromise<Stream<LocationWatchResponse>> {
|
|
60
|
+
return this._client.get(path`/api/location/${number}/watch`, {
|
|
61
|
+
query,
|
|
62
|
+
...options,
|
|
63
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
64
|
+
stream: true,
|
|
65
|
+
}) as APIPromise<Stream<LocationWatchResponse>>;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface LocationRetrieveResponse {
|
|
70
|
+
from_number?: string;
|
|
71
|
+
|
|
72
|
+
location?: LocationRetrieveResponse.Location;
|
|
73
|
+
|
|
74
|
+
number?: string;
|
|
75
|
+
|
|
76
|
+
state?: 'not_shared' | 'shared_no_fix_yet' | 'shared_with_fix';
|
|
77
|
+
|
|
78
|
+
status?: 'OK';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export namespace LocationRetrieveResponse {
|
|
82
|
+
export interface Location {
|
|
83
|
+
accuracy?: number;
|
|
84
|
+
|
|
85
|
+
address?: string | null;
|
|
86
|
+
|
|
87
|
+
altitude?: number;
|
|
88
|
+
|
|
89
|
+
expiresAt?: string;
|
|
90
|
+
|
|
91
|
+
latitude?: number;
|
|
92
|
+
|
|
93
|
+
locationType?: 'shallow' | 'live' | 'legacy' | 'unknown';
|
|
94
|
+
|
|
95
|
+
longitude?: number;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Present when cached data is returned after a refresh error
|
|
99
|
+
*/
|
|
100
|
+
refreshError?: string;
|
|
101
|
+
|
|
102
|
+
timestamp?: string;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface LocationListResponse {
|
|
107
|
+
from_number?: string;
|
|
108
|
+
|
|
109
|
+
locations?: Array<LocationListResponse.Location>;
|
|
110
|
+
|
|
111
|
+
status?: 'OK';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export namespace LocationListResponse {
|
|
115
|
+
export interface Location {
|
|
116
|
+
location?: Location.Location;
|
|
117
|
+
|
|
118
|
+
number?: string;
|
|
119
|
+
|
|
120
|
+
state?: 'not_shared' | 'shared_no_fix_yet' | 'shared_with_fix';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export namespace Location {
|
|
124
|
+
export interface Location {
|
|
125
|
+
accuracy?: number;
|
|
126
|
+
|
|
127
|
+
address?: string | null;
|
|
128
|
+
|
|
129
|
+
altitude?: number;
|
|
130
|
+
|
|
131
|
+
expiresAt?: string;
|
|
132
|
+
|
|
133
|
+
latitude?: number;
|
|
134
|
+
|
|
135
|
+
locationType?: 'shallow' | 'live' | 'legacy' | 'unknown';
|
|
136
|
+
|
|
137
|
+
longitude?: number;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Present when cached data is returned after a refresh error
|
|
141
|
+
*/
|
|
142
|
+
refreshError?: string;
|
|
143
|
+
|
|
144
|
+
timestamp?: string;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* JSON data payload from one named event in a live-location SSE stream
|
|
151
|
+
*/
|
|
152
|
+
export interface LocationWatchResponse {
|
|
153
|
+
/**
|
|
154
|
+
* Sendblue line receiving the shared location
|
|
155
|
+
*/
|
|
156
|
+
from_number?: string;
|
|
157
|
+
|
|
158
|
+
location?: LocationWatchResponse.Location;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Human-readable watch failure
|
|
162
|
+
*/
|
|
163
|
+
message?: string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Contact whose location is being watched or changed
|
|
167
|
+
*/
|
|
168
|
+
number?: string;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Why the stream ended normally. Known values are `sharing_ended`,
|
|
172
|
+
* `authorization_revoked`, `worker_disconnected`, and `watch_ended`. Clients
|
|
173
|
+
* should tolerate additional values.
|
|
174
|
+
*/
|
|
175
|
+
reason?: string;
|
|
176
|
+
|
|
177
|
+
state?: 'not_shared' | 'shared_no_fix_yet' | 'shared_with_fix';
|
|
178
|
+
|
|
179
|
+
status?: 'OK' | 'ERROR';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export namespace LocationWatchResponse {
|
|
183
|
+
export interface Location {
|
|
184
|
+
accuracy?: number;
|
|
185
|
+
|
|
186
|
+
address?: string | null;
|
|
187
|
+
|
|
188
|
+
altitude?: number;
|
|
189
|
+
|
|
190
|
+
expiresAt?: string;
|
|
191
|
+
|
|
192
|
+
latitude?: number;
|
|
193
|
+
|
|
194
|
+
locationType?: 'shallow' | 'live' | 'legacy' | 'unknown';
|
|
195
|
+
|
|
196
|
+
longitude?: number;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Present when cached data is returned after a refresh error
|
|
200
|
+
*/
|
|
201
|
+
refreshError?: string;
|
|
202
|
+
|
|
203
|
+
timestamp?: string;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface LocationRetrieveParams {
|
|
208
|
+
/**
|
|
209
|
+
* Your Sendblue number in E.164 format
|
|
210
|
+
*/
|
|
211
|
+
from_number: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface LocationListParams {
|
|
215
|
+
/**
|
|
216
|
+
* Your Sendblue number in E.164 format
|
|
217
|
+
*/
|
|
218
|
+
from_number: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface LocationWatchParams {
|
|
222
|
+
/**
|
|
223
|
+
* Your supported Sendblue number in E.164 format
|
|
224
|
+
*/
|
|
225
|
+
from_number: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export declare namespace Location {
|
|
229
|
+
export {
|
|
230
|
+
type LocationRetrieveResponse as LocationRetrieveResponse,
|
|
231
|
+
type LocationListResponse as LocationListResponse,
|
|
232
|
+
type LocationWatchResponse as LocationWatchResponse,
|
|
233
|
+
type LocationRetrieveParams as LocationRetrieveParams,
|
|
234
|
+
type LocationListParams as LocationListParams,
|
|
235
|
+
type LocationWatchParams as LocationWatchParams,
|
|
236
|
+
};
|
|
237
|
+
}
|