|
2 | 2 |
|
3 | 3 | import { APIResource } from '../core/resource'; |
4 | 4 | import { APIPromise } from '../core/api-promise'; |
5 | | -import { buildHeaders } from '../internal/headers'; |
6 | 5 | import { RequestOptions } from '../internal/request-options'; |
7 | 6 |
|
8 | 7 | export class Contacts extends APIResource { |
9 | 8 | /** |
10 | 9 | * Retrieves a paginated list of contacts for the authenticated customer. Supports |
11 | 10 | * server-side pagination with configurable page size. The customer ID is extracted |
12 | 11 | * from the authentication token. |
13 | | - * |
14 | | - * @example |
15 | | - * ```ts |
16 | | - * const contacts = await client.contacts.list({ |
17 | | - * page: 0, |
18 | | - * pageSize: 0, |
19 | | - * 'x-api-key': '', |
20 | | - * 'x-sender-id': '00000000-0000-0000-0000-000000000000', |
21 | | - * }); |
22 | | - * ``` |
23 | | - */ |
24 | | - list(params: ContactListParams, options?: RequestOptions): APIPromise<ContactListResponse> { |
25 | | - const { 'x-api-key': xAPIKey, 'x-sender-id': xSenderID, ...query } = params; |
26 | | - return this._client.get('/v2/contacts', { |
27 | | - query, |
28 | | - ...options, |
29 | | - headers: buildHeaders([{ 'x-api-key': xAPIKey, 'x-sender-id': xSenderID }, options?.headers]), |
30 | | - }); |
| 12 | + */ |
| 13 | + list(query: ContactListParams, options?: RequestOptions): APIPromise<ContactListResponse> { |
| 14 | + return this._client.get('/v2/contacts', { query, ...options }); |
31 | 15 | } |
32 | 16 |
|
33 | 17 | /** |
34 | 18 | * Retrieves a contact by their phone number for the authenticated customer. Phone |
35 | 19 | * number should be in international format (e.g., +1234567890). The customer ID is |
36 | 20 | * extracted from the authentication token. |
37 | | - * |
38 | | - * @example |
39 | | - * ```ts |
40 | | - * const contactListItem = |
41 | | - * await client.contacts.retrieveByPhone({ |
42 | | - * phoneNumber: 'phoneNumber', |
43 | | - * 'x-api-key': '', |
44 | | - * 'x-sender-id': '00000000-0000-0000-0000-000000000000', |
45 | | - * }); |
46 | | - * ``` |
47 | 21 | */ |
48 | 22 | retrieveByPhone( |
49 | | - params: ContactRetrieveByPhoneParams, |
| 23 | + query: ContactRetrieveByPhoneParams, |
50 | 24 | options?: RequestOptions, |
51 | 25 | ): APIPromise<ContactListItem> { |
52 | | - const { 'x-api-key': xAPIKey, 'x-sender-id': xSenderID, ...query } = params; |
53 | | - return this._client.get('/v2/contacts/phone', { |
54 | | - query, |
55 | | - ...options, |
56 | | - headers: buildHeaders([{ 'x-api-key': xAPIKey, 'x-sender-id': xSenderID }, options?.headers]), |
57 | | - }); |
| 26 | + return this._client.get('/v2/contacts/phone', { query, ...options }); |
58 | 27 | } |
59 | 28 |
|
60 | 29 | /** |
61 | 30 | * Retrieves a specific contact by their unique identifier for the authenticated |
62 | 31 | * customer. The customer ID is extracted from the authentication token. Returns |
63 | 32 | * detailed contact information including phone number and creation timestamp. |
64 | | - * |
65 | | - * @example |
66 | | - * ```ts |
67 | | - * const contactListItem = await client.contacts.retrieveID({ |
68 | | - * id: 'id', |
69 | | - * 'x-api-key': '', |
70 | | - * 'x-sender-id': '00000000-0000-0000-0000-000000000000', |
71 | | - * }); |
72 | | - * ``` |
73 | | - */ |
74 | | - retrieveID(params: ContactRetrieveIDParams, options?: RequestOptions): APIPromise<ContactListItem> { |
75 | | - const { 'x-api-key': xAPIKey, 'x-sender-id': xSenderID, ...query } = params; |
76 | | - return this._client.get('/v2/contacts/id', { |
77 | | - query, |
78 | | - ...options, |
79 | | - headers: buildHeaders([{ 'x-api-key': xAPIKey, 'x-sender-id': xSenderID }, options?.headers]), |
80 | | - }); |
| 33 | + */ |
| 34 | + retrieveID(query: ContactRetrieveIDParams, options?: RequestOptions): APIPromise<ContactListItem> { |
| 35 | + return this._client.get('/v2/contacts/id', { query, ...options }); |
81 | 36 | } |
82 | 37 | } |
83 | 38 |
|
@@ -152,58 +107,28 @@ export interface ContactListResponse { |
152 | 107 |
|
153 | 108 | export interface ContactListParams { |
154 | 109 | /** |
155 | | - * Query param: The page number (zero-indexed). Default is 0. |
| 110 | + * The page number (zero-indexed). Default is 0. |
156 | 111 | */ |
157 | 112 | page: number; |
158 | 113 |
|
159 | 114 | /** |
160 | | - * Query param: The number of items per page. Default is 20. |
| 115 | + * The number of items per page. Default is 20. |
161 | 116 | */ |
162 | 117 | pageSize: number; |
163 | | - |
164 | | - /** |
165 | | - * Header param |
166 | | - */ |
167 | | - 'x-api-key': string; |
168 | | - |
169 | | - /** |
170 | | - * Header param |
171 | | - */ |
172 | | - 'x-sender-id': string; |
173 | 118 | } |
174 | 119 |
|
175 | 120 | export interface ContactRetrieveByPhoneParams { |
176 | 121 | /** |
177 | | - * Query param: The phone number in international format (e.g., +1234567890) |
| 122 | + * The phone number in international format (e.g., +1234567890) |
178 | 123 | */ |
179 | 124 | phoneNumber: string; |
180 | | - |
181 | | - /** |
182 | | - * Header param |
183 | | - */ |
184 | | - 'x-api-key': string; |
185 | | - |
186 | | - /** |
187 | | - * Header param |
188 | | - */ |
189 | | - 'x-sender-id': string; |
190 | 125 | } |
191 | 126 |
|
192 | 127 | export interface ContactRetrieveIDParams { |
193 | 128 | /** |
194 | | - * Query param: The unique identifier (GUID) of the resource to retrieve |
| 129 | + * The unique identifier (GUID) of the resource to retrieve |
195 | 130 | */ |
196 | 131 | id: string; |
197 | | - |
198 | | - /** |
199 | | - * Header param |
200 | | - */ |
201 | | - 'x-api-key': string; |
202 | | - |
203 | | - /** |
204 | | - * Header param |
205 | | - */ |
206 | | - 'x-sender-id': string; |
207 | 132 | } |
208 | 133 |
|
209 | 134 | export declare namespace Contacts { |
|
0 commit comments