sendblue 3.16.0 → 3.17.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/groups.d.mts +12 -1
  11. package/resources/groups.d.mts.map +1 -1
  12. package/resources/groups.d.ts +12 -1
  13. package/resources/groups.d.ts.map +1 -1
  14. package/resources/index.d.mts +1 -1
  15. package/resources/index.d.mts.map +1 -1
  16. package/resources/index.d.ts +1 -1
  17. package/resources/index.d.ts.map +1 -1
  18. package/resources/index.js.map +1 -1
  19. package/resources/index.mjs.map +1 -1
  20. package/resources/lookups.d.mts +10 -5
  21. package/resources/lookups.d.mts.map +1 -1
  22. package/resources/lookups.d.ts +10 -5
  23. package/resources/lookups.d.ts.map +1 -1
  24. package/resources/lookups.js +7 -2
  25. package/resources/lookups.js.map +1 -1
  26. package/resources/lookups.mjs +7 -2
  27. package/resources/lookups.mjs.map +1 -1
  28. package/resources/v2/groups.d.mts +90 -5
  29. package/resources/v2/groups.d.mts.map +1 -1
  30. package/resources/v2/groups.d.ts +90 -5
  31. package/resources/v2/groups.d.ts.map +1 -1
  32. package/resources/v2/groups.js +42 -1
  33. package/resources/v2/groups.js.map +1 -1
  34. package/resources/v2/groups.mjs +42 -1
  35. package/resources/v2/groups.mjs.map +1 -1
  36. package/resources/v2/index.d.mts +1 -1
  37. package/resources/v2/index.d.mts.map +1 -1
  38. package/resources/v2/index.d.ts +1 -1
  39. package/resources/v2/index.d.ts.map +1 -1
  40. package/resources/v2/index.js.map +1 -1
  41. package/resources/v2/index.mjs.map +1 -1
  42. package/resources/v2/v2.d.mts +2 -2
  43. package/resources/v2/v2.d.mts.map +1 -1
  44. package/resources/v2/v2.d.ts +2 -2
  45. package/resources/v2/v2.d.ts.map +1 -1
  46. package/resources/v2/v2.js.map +1 -1
  47. package/resources/v2/v2.mjs +1 -1
  48. package/resources/v2/v2.mjs.map +1 -1
  49. package/src/client.ts +8 -1
  50. package/src/resources/groups.ts +14 -0
  51. package/src/resources/index.ts +1 -0
  52. package/src/resources/lookups.ts +10 -5
  53. package/src/resources/v2/groups.ts +111 -4
  54. package/src/resources/v2/index.ts +2 -0
  55. package/src/resources/v2/v2.ts +10 -1
  56. package/src/version.ts +1 -1
  57. package/version.d.mts +1 -1
  58. package/version.d.ts +1 -1
  59. package/version.js +1 -1
  60. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -18,7 +18,13 @@ import * as Uploads from './core/uploads';
18
18
  import * as API from './resources/index';
19
19
  import { APIPromise } from './core/api-promise';
20
20
  import { AccountEvent, EventStreamParams, Events } from './resources/events';
21
- import { GroupModifyParams, GroupModifyResponse, GroupSendMessageParams, Groups } from './resources/groups';
21
+ import {
22
+ GroupModifyParams,
23
+ GroupModifyResponse,
24
+ GroupPhoto,
25
+ GroupSendMessageParams,
26
+ Groups,
27
+ } from './resources/groups';
22
28
  import {
23
29
  Location,
24
30
  LocationListParams,
@@ -944,6 +950,7 @@ export declare namespace SendblueAPI {
944
950
 
945
951
  export {
946
952
  Groups as Groups,
953
+ type GroupPhoto as GroupPhoto,
947
954
  type GroupModifyResponse as GroupModifyResponse,
948
955
  type GroupModifyParams as GroupModifyParams,
949
956
  type GroupSendMessageParams as GroupSendMessageParams,
@@ -49,6 +49,19 @@ export class Groups extends APIResource {
49
49
  }
50
50
  }
51
51
 
52
+ export interface GroupPhoto {
53
+ /**
54
+ * Device-verified identifier of the current Apple group photo
55
+ */
56
+ photo_guid: string;
57
+
58
+ /**
59
+ * Direct URL for downloading the current photo; anyone with the exact URL can
60
+ * download it while the image exists
61
+ */
62
+ url: string;
63
+ }
64
+
52
65
  export interface GroupModifyResponse {
53
66
  error?: string | null;
54
67
 
@@ -158,6 +171,7 @@ export namespace GroupSendMessageParams {
158
171
 
159
172
  export declare namespace Groups {
160
173
  export {
174
+ type GroupPhoto as GroupPhoto,
161
175
  type GroupModifyResponse as GroupModifyResponse,
162
176
  type GroupModifyParams as GroupModifyParams,
163
177
  type GroupSendMessageParams as GroupSendMessageParams,
@@ -21,6 +21,7 @@ export {
21
21
  export { Events, type AccountEvent, type EventStreamParams } from './events';
22
22
  export {
23
23
  Groups,
24
+ type GroupPhoto,
24
25
  type GroupModifyResponse,
25
26
  type GroupModifyParams,
26
27
  type GroupSendMessageParams,
@@ -9,8 +9,13 @@ import { RequestOptions } from '../internal/request-options';
9
9
  */
10
10
  export class Lookups extends APIResource {
11
11
  /**
12
- * Determine if a phone number supports iMessage or SMS. Useful for checking if a
13
- * number is an iPhone, if it is real, or which provider to use.
12
+ * Check iMessage support for a phone number or email address. A successful result
13
+ * does not guarantee delivery. For email addresses, SMS means iMessage was not
14
+ * detected; it does not mean the address can receive SMS. The from_number query
15
+ * parameter does not select a sending line for this endpoint. Email results
16
+ * indicating no iMessage support are not cached. An inconclusive lookup returns a
17
+ * retryable error. Limit retries and use backoff after an inconclusive response. A
18
+ * lookup does not guarantee that upstream availability data was freshly refreshed.
14
19
  */
15
20
  lookupNumber(
16
21
  query: LookupLookupNumberParams,
@@ -22,19 +27,19 @@ export class Lookups extends APIResource {
22
27
 
23
28
  export interface LookupLookupNumberResponse {
24
29
  /**
25
- * The number you evaluated in E.164 format
30
+ * The normalized phone number or email address evaluated
26
31
  */
27
32
  number?: string;
28
33
 
29
34
  /**
30
- * The service the number supports
35
+ * Whether iMessage support was detected
31
36
  */
32
37
  service?: 'iMessage' | 'SMS';
33
38
  }
34
39
 
35
40
  export interface LookupLookupNumberParams {
36
41
  /**
37
- * The number you want to evaluate in E.164 format
42
+ * The phone number in E.164 format or email address to evaluate
38
43
  */
39
44
  number: string;
40
45
  }
@@ -1,8 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as GroupsAPI from '../groups';
4
5
  import { APIPromise } from '../../core/api-promise';
5
6
  import { RequestOptions } from '../../internal/request-options';
7
+ import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
6
8
  import { path } from '../../internal/utils/path';
7
9
 
8
10
  /**
@@ -33,11 +35,17 @@ export class Groups extends APIResource {
33
35
  * must be online and support group name changes. Failed requests are not replayed
34
36
  * automatically; retrying the same desired state is safe.
35
37
  *
38
+ * By default an eligible Sendblue line in the group is selected automatically.
39
+ * Pass `from_number` to require a specific Sendblue line: it must have an iMessage
40
+ * mapping for this group, and if that line cannot act the request fails without
41
+ * falling back to another line. The success response reports the line that
42
+ * performed the change as `from_number`.
43
+ *
36
44
  * @example
37
45
  * ```ts
38
46
  * const response = await client.v2.groups.rename(
39
47
  * 'sb_group_608acc54-d0d7-4b41-8092-9ff6e1e70455',
40
- * { name: 'Project Falcon' },
48
+ * { group_name: 'Project Falcon' },
41
49
  * );
42
50
  * ```
43
51
  */
@@ -48,6 +56,48 @@ export class Groups extends APIResource {
48
56
  ): APIPromise<GroupRenameResponse> {
49
57
  return this._client.post(path`/api/v2/groups/${groupID}/name`, { body, ...options });
50
58
  }
59
+
60
+ /**
61
+ * Sets the Apple-visible photo of an existing iMessage group and waits for the
62
+ * Sendblue line to verify the resulting device state. Pass `null` to clear the
63
+ * photo. A set is verified only when the device-created photo transfer becomes the
64
+ * chat's current photo; the verified photo is then persisted with the group and
65
+ * returned on group retrieval with an image URL.
66
+ *
67
+ * Set the photo with either a JSON `photo_url` or raw image bytes in the `file`
68
+ * field of a multipart form. Images must be JPEG, PNG, or GIF, at most 5 MB, and
69
+ * no more than 25 million aggregate decoded pixels. URL images must use a direct,
70
+ * publicly resolvable https URL; redirects are not followed. Replacing or clearing
71
+ * the photo replaces the current stored reference and attempts to delete the
72
+ * superseded object; no history is exposed through the API. Supported line types
73
+ * are checked automatically; ineligible lines return `unsupported_line`. Failed
74
+ * requests are not replayed automatically; retrying the same desired state is
75
+ * safe.
76
+ *
77
+ * By default an eligible Sendblue line in the group is selected automatically.
78
+ * Pass `from_number` to require a specific Sendblue line: it must have an iMessage
79
+ * mapping for this group, and if that line cannot act the request fails without
80
+ * falling back to another line. The success response reports the line that
81
+ * performed the change as `from_number`.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const response = await client.v2.groups.setPhoto(
86
+ * 'sb_group_608acc54-d0d7-4b41-8092-9ff6e1e70455',
87
+ * { photo_url: 'https://example.com/team-photo.png' },
88
+ * );
89
+ * ```
90
+ */
91
+ setPhoto(
92
+ groupID: string,
93
+ body: GroupSetPhotoParams,
94
+ options?: RequestOptions,
95
+ ): APIPromise<GroupSetPhotoResponse> {
96
+ return this._client.post(
97
+ path`/api/v2/groups/${groupID}/photo`,
98
+ maybeMultipartFormRequestOptions({ body, ...options }, this._client),
99
+ );
100
+ }
51
101
  }
52
102
 
53
103
  export interface GroupRetrieveResponse {
@@ -64,6 +114,12 @@ export namespace GroupRetrieveResponse {
64
114
 
65
115
  group_name?: string;
66
116
 
117
+ /**
118
+ * Device-verified current group photo metadata; null when the group has no
119
+ * verified photo
120
+ */
121
+ group_photo?: GroupsAPI.GroupPhoto | null;
122
+
67
123
  latest_comm_at?: string | null;
68
124
 
69
125
  latest_message_id?: string | null;
@@ -134,28 +190,79 @@ export interface GroupRenameResponse {
134
190
 
135
191
  export namespace GroupRenameResponse {
136
192
  export interface Data {
193
+ /**
194
+ * Sendblue line that performed the change
195
+ */
196
+ from_number: string | null;
197
+
137
198
  group_id: string;
138
199
 
139
200
  /**
140
201
  * Device-verified name; empty when cleared
141
202
  */
142
203
  group_name: string;
204
+ }
205
+ }
143
206
 
144
- service: 'iMessage';
207
+ export interface GroupSetPhotoResponse {
208
+ data: GroupSetPhotoResponse.Data;
209
+
210
+ status: 'OK';
211
+ }
212
+
213
+ export namespace GroupSetPhotoResponse {
214
+ export interface Data {
215
+ /**
216
+ * Sendblue line that performed the change
217
+ */
218
+ from_number: string | null;
219
+
220
+ group_id: string;
221
+
222
+ /**
223
+ * Device-verified current photo; null after a verified clear
224
+ */
225
+ group_photo: GroupsAPI.GroupPhoto | null;
145
226
  }
146
227
  }
147
228
 
148
229
  export interface GroupRenameParams {
149
230
  /**
150
- * New group name, or null/empty string to clear it
231
+ * New group name; whitespace-only values are rejected, while null or an empty
232
+ * string clears it
233
+ */
234
+ group_name: string | null;
235
+
236
+ /**
237
+ * Sendblue line that must perform the change; it must have an iMessage mapping for
238
+ * this group, and no other line is used if it cannot act. Omit or pass null for
239
+ * automatic selection
240
+ */
241
+ from_number?: string | null;
242
+ }
243
+
244
+ export interface GroupSetPhotoParams {
245
+ /**
246
+ * Direct, publicly resolvable https URL of the image to set (JPEG, PNG, or GIF, at
247
+ * most 5 MB and 25 million aggregate decoded pixels; redirects are not followed);
248
+ * null clears the group photo
249
+ */
250
+ photo_url: string | null;
251
+
252
+ /**
253
+ * Sendblue line that must perform the change; it must have an iMessage mapping for
254
+ * this group, and no other line is used if it cannot act. Omit or pass null for
255
+ * automatic selection
151
256
  */
152
- name: string | null;
257
+ from_number?: string | null;
153
258
  }
154
259
 
155
260
  export declare namespace Groups {
156
261
  export {
157
262
  type GroupRetrieveResponse as GroupRetrieveResponse,
158
263
  type GroupRenameResponse as GroupRenameResponse,
264
+ type GroupSetPhotoResponse as GroupSetPhotoResponse,
159
265
  type GroupRenameParams as GroupRenameParams,
266
+ type GroupSetPhotoParams as GroupSetPhotoParams,
160
267
  };
161
268
  }
@@ -4,7 +4,9 @@ export {
4
4
  Groups,
5
5
  type GroupRetrieveResponse,
6
6
  type GroupRenameResponse,
7
+ type GroupSetPhotoResponse,
7
8
  type GroupRenameParams,
9
+ type GroupSetPhotoParams,
8
10
  } from './groups';
9
11
  export {
10
12
  Seats,
@@ -2,7 +2,14 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as GroupsAPI from './groups';
5
- import { GroupRenameParams, GroupRenameResponse, GroupRetrieveResponse, Groups } from './groups';
5
+ import {
6
+ GroupRenameParams,
7
+ GroupRenameResponse,
8
+ GroupRetrieveResponse,
9
+ GroupSetPhotoParams,
10
+ GroupSetPhotoResponse,
11
+ Groups,
12
+ } from './groups';
6
13
  import * as SeatsAPI from './seats';
7
14
  import {
8
15
  SeatCountParams,
@@ -41,6 +48,8 @@ export declare namespace V2 {
41
48
  Groups as Groups,
42
49
  type GroupRetrieveResponse as GroupRetrieveResponse,
43
50
  type GroupRenameResponse as GroupRenameResponse,
51
+ type GroupSetPhotoResponse as GroupSetPhotoResponse,
44
52
  type GroupRenameParams as GroupRenameParams,
53
+ type GroupSetPhotoParams as GroupSetPhotoParams,
45
54
  };
46
55
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.16.0'; // x-release-please-version
1
+ export const VERSION = '3.17.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.16.0";
1
+ export declare const VERSION = "3.17.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.16.0";
1
+ export declare const VERSION = "3.17.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.16.0'; // x-release-please-version
4
+ exports.VERSION = '3.17.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.16.0'; // x-release-please-version
1
+ export const VERSION = '3.17.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map