@geekapps/post-fastify 0.1.1 → 0.1.3
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/dist/index.d.ts +541 -21
- package/dist/index.js +453 -16
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/http.ts +88 -88
- package/src/index.ts +0 -5
- package/src/plugin.ts +87 -9
- package/tsup.config.ts +10 -0
- package/dist/client.d.ts +0 -31
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -29
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts +0 -11
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -24
- package/dist/errors.js.map +0 -1
- package/dist/http.d.ts +0 -21
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -56
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/nextjs.d.ts +0 -22
- package/dist/nextjs.d.ts.map +0 -1
- package/dist/nextjs.js +0 -15
- package/dist/nextjs.js.map +0 -1
- package/dist/plugin.d.ts +0 -17
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -17
- package/dist/plugin.js.map +0 -1
- package/dist/resources/domains.d.ts +0 -14
- package/dist/resources/domains.d.ts.map +0 -1
- package/dist/resources/domains.js +0 -21
- package/dist/resources/domains.js.map +0 -1
- package/dist/resources/history.d.ts +0 -9
- package/dist/resources/history.d.ts.map +0 -1
- package/dist/resources/history.js +0 -26
- package/dist/resources/history.js.map +0 -1
- package/dist/resources/managed-numbers.d.ts +0 -28
- package/dist/resources/managed-numbers.d.ts.map +0 -1
- package/dist/resources/managed-numbers.js +0 -24
- package/dist/resources/managed-numbers.js.map +0 -1
- package/dist/resources/messages.d.ts +0 -8
- package/dist/resources/messages.d.ts.map +0 -1
- package/dist/resources/messages.js +0 -9
- package/dist/resources/messages.js.map +0 -1
- package/dist/resources/plans.d.ts +0 -10
- package/dist/resources/plans.d.ts.map +0 -1
- package/dist/resources/plans.js +0 -15
- package/dist/resources/plans.js.map +0 -1
- package/dist/resources/smtp.d.ts +0 -14
- package/dist/resources/smtp.d.ts.map +0 -1
- package/dist/resources/smtp.js +0 -18
- package/dist/resources/smtp.js.map +0 -1
- package/dist/resources/statistics.d.ts +0 -8
- package/dist/resources/statistics.d.ts.map +0 -1
- package/dist/resources/statistics.js +0 -17
- package/dist/resources/statistics.js.map +0 -1
- package/dist/resources/templates.d.ts +0 -17
- package/dist/resources/templates.d.ts.map +0 -1
- package/dist/resources/templates.js +0 -33
- package/dist/resources/templates.js.map +0 -1
- package/dist/resources/webhooks.d.ts +0 -13
- package/dist/resources/webhooks.d.ts.map +0 -1
- package/dist/resources/webhooks.js +0 -24
- package/dist/resources/webhooks.js.map +0 -1
- package/dist/resources/whatsapp-numbers.d.ts +0 -23
- package/dist/resources/whatsapp-numbers.d.ts.map +0 -1
- package/dist/resources/whatsapp-numbers.js +0 -56
- package/dist/resources/whatsapp-numbers.js.map +0 -1
- package/dist/resources/whatsapp-templates.d.ts +0 -12
- package/dist/resources/whatsapp-templates.d.ts.map +0 -1
- package/dist/resources/whatsapp-templates.js +0 -21
- package/dist/resources/whatsapp-templates.js.map +0 -1
- package/dist/service-account.d.ts +0 -38
- package/dist/service-account.d.ts.map +0 -1
- package/dist/service-account.js +0 -87
- package/dist/service-account.js.map +0 -1
- package/dist/types.d.ts +0 -346
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/src/service-account.ts +0 -127
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,541 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { FastifyPluginAsync } from 'fastify';
|
|
2
|
+
|
|
3
|
+
type TokenResolver = string | (() => string | Promise<string>);
|
|
4
|
+
interface HttpClientOptions {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
token: TokenResolver;
|
|
7
|
+
organizationId?: string | (() => string | Promise<string>);
|
|
8
|
+
}
|
|
9
|
+
declare class HttpClient {
|
|
10
|
+
private readonly baseUrl;
|
|
11
|
+
private readonly token;
|
|
12
|
+
private readonly organizationId?;
|
|
13
|
+
constructor(options: HttpClientOptions);
|
|
14
|
+
private resolveToken;
|
|
15
|
+
private resolveOrgId;
|
|
16
|
+
request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
|
|
17
|
+
get<T>(path: string): Promise<T>;
|
|
18
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
19
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
20
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
21
|
+
delete<T = void>(path: string): Promise<T>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type MessageType = "email" | "sms" | "whatsapp";
|
|
25
|
+
type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced" | "opened" | "clicked";
|
|
26
|
+
type DomainType = "sending" | "tracking";
|
|
27
|
+
type DomainStatus = "pending" | "verified" | "failed";
|
|
28
|
+
type PlanTier = "free" | "starter" | "pro" | "enterprise";
|
|
29
|
+
type WhatsappTemplateCategory = "MARKETING" | "UTILITY" | "AUTHENTICATION";
|
|
30
|
+
type WhatsappTemplateStatus = "APPROVED" | "PENDING" | "REJECTED" | "DISABLED" | "PAUSED";
|
|
31
|
+
type WebhookEvent = "message_sent" | "message_delivered" | "message_failed" | "message_bounced" | "message_opened" | "message_clicked";
|
|
32
|
+
type WabaStatus = "active" | "token_expired" | "disconnected";
|
|
33
|
+
type WhatsappNumberStatus = "pending_verification" | "active" | "inactive" | "failed";
|
|
34
|
+
type ManagedNumberStatus = "provisioning" | "active" | "waiting_whatsapp_verification" | "whatsapp_active" | "suspended" | "canceled" | "failed";
|
|
35
|
+
interface MessageTemplate {
|
|
36
|
+
id: string;
|
|
37
|
+
orgId: string;
|
|
38
|
+
name: string;
|
|
39
|
+
type: MessageType;
|
|
40
|
+
subject: string | null;
|
|
41
|
+
body: string;
|
|
42
|
+
variables: string[];
|
|
43
|
+
description: string | null;
|
|
44
|
+
isActive: boolean;
|
|
45
|
+
draftBody: string | null;
|
|
46
|
+
draftSubject: string | null;
|
|
47
|
+
draftName: string | null;
|
|
48
|
+
draftBlocks: unknown[] | null;
|
|
49
|
+
draftUpdatedAt: string | null;
|
|
50
|
+
metaTemplateId: string | null;
|
|
51
|
+
metaStatus: string | null;
|
|
52
|
+
metaWabaId: string | null;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
}
|
|
56
|
+
interface WhatsappTemplate {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
templateName: string;
|
|
60
|
+
category: WhatsappTemplateCategory;
|
|
61
|
+
language: string;
|
|
62
|
+
header: string | null;
|
|
63
|
+
footer: string | null;
|
|
64
|
+
body: string;
|
|
65
|
+
variables: string[];
|
|
66
|
+
isActive: boolean;
|
|
67
|
+
metaTemplateId: string | null;
|
|
68
|
+
metaStatus: string | null;
|
|
69
|
+
metaWabaId: string | null;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
updatedAt: string;
|
|
72
|
+
}
|
|
73
|
+
interface MessageLog {
|
|
74
|
+
id: string;
|
|
75
|
+
type: MessageType;
|
|
76
|
+
status: MessageStatus;
|
|
77
|
+
from: string | null;
|
|
78
|
+
to: string;
|
|
79
|
+
subject: string | null;
|
|
80
|
+
templateId: string | null;
|
|
81
|
+
provider: string | null;
|
|
82
|
+
externalId: string | null;
|
|
83
|
+
error: string | null;
|
|
84
|
+
sentAt: string | null;
|
|
85
|
+
deliveredAt: string | null;
|
|
86
|
+
openedAt: string | null;
|
|
87
|
+
clickedAt: string | null;
|
|
88
|
+
createdAt: string;
|
|
89
|
+
}
|
|
90
|
+
interface MessageLogDetail extends MessageLog {
|
|
91
|
+
body: string;
|
|
92
|
+
variables: Array<{
|
|
93
|
+
name: string;
|
|
94
|
+
value: string;
|
|
95
|
+
}> | null;
|
|
96
|
+
template: MessageTemplate | null;
|
|
97
|
+
}
|
|
98
|
+
interface OrgDomain {
|
|
99
|
+
id: string;
|
|
100
|
+
domain: string;
|
|
101
|
+
type: DomainType;
|
|
102
|
+
status: DomainStatus;
|
|
103
|
+
dkimSelector: string | null;
|
|
104
|
+
dkimPublicKey: string | null;
|
|
105
|
+
spfRecord: string | null;
|
|
106
|
+
trackingCname: string | null;
|
|
107
|
+
verifiedAt: string | null;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
}
|
|
110
|
+
interface DnsRecord {
|
|
111
|
+
type: "TXT" | "CNAME";
|
|
112
|
+
name: string;
|
|
113
|
+
value: string | null | undefined;
|
|
114
|
+
}
|
|
115
|
+
interface OrgWebhook {
|
|
116
|
+
id: string;
|
|
117
|
+
url: string;
|
|
118
|
+
events: WebhookEvent[];
|
|
119
|
+
isActive: boolean;
|
|
120
|
+
createdAt: string;
|
|
121
|
+
updatedAt: string;
|
|
122
|
+
}
|
|
123
|
+
interface OrgWebhookWithSecret extends OrgWebhook {
|
|
124
|
+
secret: string;
|
|
125
|
+
}
|
|
126
|
+
interface WebhookDelivery {
|
|
127
|
+
id: string;
|
|
128
|
+
webhookId: string;
|
|
129
|
+
event: string;
|
|
130
|
+
statusCode: number | null;
|
|
131
|
+
response: string | null;
|
|
132
|
+
success: boolean;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
}
|
|
135
|
+
interface SmtpConfig {
|
|
136
|
+
id: string;
|
|
137
|
+
host: string;
|
|
138
|
+
port: number;
|
|
139
|
+
secure: boolean;
|
|
140
|
+
user: string;
|
|
141
|
+
createdAt: string;
|
|
142
|
+
updatedAt: string;
|
|
143
|
+
}
|
|
144
|
+
interface OrgPlan {
|
|
145
|
+
tier: PlanTier;
|
|
146
|
+
monthlyEmails: number;
|
|
147
|
+
monthlySms: number;
|
|
148
|
+
monthlyWhatsapp: number;
|
|
149
|
+
}
|
|
150
|
+
interface OrgUsage {
|
|
151
|
+
email: number;
|
|
152
|
+
sms: number;
|
|
153
|
+
whatsapp: number;
|
|
154
|
+
period: string;
|
|
155
|
+
}
|
|
156
|
+
interface OrgWaba {
|
|
157
|
+
id: string;
|
|
158
|
+
orgId: string;
|
|
159
|
+
wabaId: string;
|
|
160
|
+
tokenExpiresAt: string | null;
|
|
161
|
+
businessName: string | null;
|
|
162
|
+
status: WabaStatus;
|
|
163
|
+
connectedAt: string;
|
|
164
|
+
updatedAt: string;
|
|
165
|
+
}
|
|
166
|
+
interface WhatsappNumberProfile {
|
|
167
|
+
about: string | null;
|
|
168
|
+
description: string | null;
|
|
169
|
+
email: string | null;
|
|
170
|
+
websites: string[];
|
|
171
|
+
vertical: string | null;
|
|
172
|
+
profilePictureUrl: string | null;
|
|
173
|
+
}
|
|
174
|
+
interface WhatsappNumber {
|
|
175
|
+
id: string;
|
|
176
|
+
orgId: string;
|
|
177
|
+
orgWabaId: string;
|
|
178
|
+
displayName: string;
|
|
179
|
+
phoneNumber: string;
|
|
180
|
+
phoneNumberId: string;
|
|
181
|
+
mode: string;
|
|
182
|
+
status: WhatsappNumberStatus;
|
|
183
|
+
qualityRating: string | null;
|
|
184
|
+
nameStatus: string | null;
|
|
185
|
+
profile: WhatsappNumberProfile;
|
|
186
|
+
createdAt: string;
|
|
187
|
+
updatedAt: string;
|
|
188
|
+
}
|
|
189
|
+
interface ManagedNumber {
|
|
190
|
+
id: string;
|
|
191
|
+
orgId: string;
|
|
192
|
+
phoneNumber: string;
|
|
193
|
+
areaCode: string;
|
|
194
|
+
status: ManagedNumberStatus;
|
|
195
|
+
salvyId: string | null;
|
|
196
|
+
metaPhoneNumberId: string | null;
|
|
197
|
+
createdAt: string;
|
|
198
|
+
updatedAt: string;
|
|
199
|
+
}
|
|
200
|
+
interface AreaCode {
|
|
201
|
+
areaCode: string;
|
|
202
|
+
state: string;
|
|
203
|
+
available: boolean;
|
|
204
|
+
}
|
|
205
|
+
interface SendMessageInput {
|
|
206
|
+
type: MessageType;
|
|
207
|
+
to: string;
|
|
208
|
+
from?: string;
|
|
209
|
+
title?: string;
|
|
210
|
+
preview?: string;
|
|
211
|
+
template?: string;
|
|
212
|
+
subject?: string;
|
|
213
|
+
body?: string;
|
|
214
|
+
variables?: Array<{
|
|
215
|
+
name: string;
|
|
216
|
+
value: string;
|
|
217
|
+
}>;
|
|
218
|
+
}
|
|
219
|
+
interface CreateTemplateInput {
|
|
220
|
+
name: string;
|
|
221
|
+
type: MessageType;
|
|
222
|
+
subject?: string;
|
|
223
|
+
body: string;
|
|
224
|
+
description?: string;
|
|
225
|
+
isActive?: boolean;
|
|
226
|
+
}
|
|
227
|
+
interface UpdateTemplateInput extends Partial<CreateTemplateInput> {
|
|
228
|
+
}
|
|
229
|
+
interface SaveDraftInput {
|
|
230
|
+
draftBody: string;
|
|
231
|
+
draftSubject?: string;
|
|
232
|
+
draftName?: string;
|
|
233
|
+
draftBlocks?: unknown[];
|
|
234
|
+
}
|
|
235
|
+
interface CreateWhatsappTemplateInput {
|
|
236
|
+
name: string;
|
|
237
|
+
templateName: string;
|
|
238
|
+
category: WhatsappTemplateCategory;
|
|
239
|
+
language: string;
|
|
240
|
+
body: string;
|
|
241
|
+
header?: string;
|
|
242
|
+
footer?: string;
|
|
243
|
+
description?: string;
|
|
244
|
+
}
|
|
245
|
+
interface UpdateWhatsappTemplateInput extends Partial<CreateWhatsappTemplateInput> {
|
|
246
|
+
}
|
|
247
|
+
interface CreateDomainInput {
|
|
248
|
+
domain: string;
|
|
249
|
+
type: DomainType;
|
|
250
|
+
}
|
|
251
|
+
interface CreateWebhookInput {
|
|
252
|
+
url: string;
|
|
253
|
+
events: WebhookEvent[];
|
|
254
|
+
isActive?: boolean;
|
|
255
|
+
}
|
|
256
|
+
interface UpdateWebhookInput extends Partial<CreateWebhookInput> {
|
|
257
|
+
}
|
|
258
|
+
interface UpsertSmtpConfigInput {
|
|
259
|
+
host: string;
|
|
260
|
+
port: number;
|
|
261
|
+
secure?: boolean;
|
|
262
|
+
user: string;
|
|
263
|
+
password: string;
|
|
264
|
+
}
|
|
265
|
+
interface UpdatePlanInput {
|
|
266
|
+
tier?: PlanTier;
|
|
267
|
+
monthlyEmails?: number;
|
|
268
|
+
monthlySms?: number;
|
|
269
|
+
monthlyWhatsapp?: number;
|
|
270
|
+
}
|
|
271
|
+
interface ListHistoryParams {
|
|
272
|
+
type?: MessageType;
|
|
273
|
+
status?: MessageStatus;
|
|
274
|
+
from?: string;
|
|
275
|
+
to?: string;
|
|
276
|
+
page?: number;
|
|
277
|
+
limit?: number;
|
|
278
|
+
}
|
|
279
|
+
interface StatisticsParams {
|
|
280
|
+
from?: string;
|
|
281
|
+
to?: string;
|
|
282
|
+
groupBy?: "day" | "month";
|
|
283
|
+
}
|
|
284
|
+
interface ConnectWabaInput {
|
|
285
|
+
code: string;
|
|
286
|
+
}
|
|
287
|
+
interface ConnectWhatsappNumberInput {
|
|
288
|
+
phoneNumberId: string;
|
|
289
|
+
wabaId: string;
|
|
290
|
+
}
|
|
291
|
+
interface RegisterWhatsappNumberInput {
|
|
292
|
+
displayName: string;
|
|
293
|
+
phoneNumber: string;
|
|
294
|
+
method?: "SMS" | "VOICE";
|
|
295
|
+
wabaId?: string;
|
|
296
|
+
}
|
|
297
|
+
interface UpdateWhatsappProfileInput {
|
|
298
|
+
about?: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
email?: string;
|
|
301
|
+
websites?: string[];
|
|
302
|
+
vertical?: string;
|
|
303
|
+
}
|
|
304
|
+
interface SendMessageResult {
|
|
305
|
+
id: string;
|
|
306
|
+
status: MessageStatus;
|
|
307
|
+
}
|
|
308
|
+
interface PaginatedResult<T> {
|
|
309
|
+
data: T[];
|
|
310
|
+
pagination: {
|
|
311
|
+
total: number;
|
|
312
|
+
page: number;
|
|
313
|
+
limit: number;
|
|
314
|
+
pages: number;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
interface StatisticsResult {
|
|
318
|
+
totals: Record<string, {
|
|
319
|
+
sent: number;
|
|
320
|
+
delivered: number;
|
|
321
|
+
failed: number;
|
|
322
|
+
opened: number;
|
|
323
|
+
clicked: number;
|
|
324
|
+
}>;
|
|
325
|
+
currentPeriod: {
|
|
326
|
+
period: string;
|
|
327
|
+
usage: {
|
|
328
|
+
email: number;
|
|
329
|
+
sms: number;
|
|
330
|
+
whatsapp: number;
|
|
331
|
+
};
|
|
332
|
+
limits: {
|
|
333
|
+
email: number;
|
|
334
|
+
sms: number;
|
|
335
|
+
whatsapp: number;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
interface PlansResult {
|
|
340
|
+
plan: OrgPlan;
|
|
341
|
+
usage: OrgUsage;
|
|
342
|
+
}
|
|
343
|
+
interface AvailablePlan extends OrgPlan {
|
|
344
|
+
tier: PlanTier;
|
|
345
|
+
}
|
|
346
|
+
interface CreateDomainResult {
|
|
347
|
+
id: string;
|
|
348
|
+
domain: string;
|
|
349
|
+
type: DomainType;
|
|
350
|
+
status: DomainStatus;
|
|
351
|
+
dnsRecords: DnsRecord[];
|
|
352
|
+
}
|
|
353
|
+
interface SyncWhatsappTemplatesResult {
|
|
354
|
+
created: number;
|
|
355
|
+
skipped: number;
|
|
356
|
+
}
|
|
357
|
+
interface RotateSecretResult {
|
|
358
|
+
secret: string;
|
|
359
|
+
}
|
|
360
|
+
interface WabaHealthResult {
|
|
361
|
+
health: unknown;
|
|
362
|
+
}
|
|
363
|
+
interface PhoneNumberStatusResult {
|
|
364
|
+
status: unknown;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
declare class DomainsResource {
|
|
368
|
+
private readonly http;
|
|
369
|
+
constructor(http: HttpClient);
|
|
370
|
+
list(): Promise<OrgDomain[]>;
|
|
371
|
+
get(id: string): Promise<OrgDomain>;
|
|
372
|
+
create(input: CreateDomainInput): Promise<CreateDomainResult>;
|
|
373
|
+
verify(id: string): Promise<{
|
|
374
|
+
status: "verified" | "failed";
|
|
375
|
+
}>;
|
|
376
|
+
delete(id: string): Promise<void>;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
declare class HistoryResource {
|
|
380
|
+
private readonly http;
|
|
381
|
+
constructor(http: HttpClient);
|
|
382
|
+
list(params?: ListHistoryParams): Promise<PaginatedResult<MessageLog>>;
|
|
383
|
+
get(id: string): Promise<MessageLogDetail>;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface ProvisionManagedNumberInput {
|
|
387
|
+
areaCode: number;
|
|
388
|
+
name?: string;
|
|
389
|
+
displayName: string;
|
|
390
|
+
otpMethod?: "SMS" | "VOICE";
|
|
391
|
+
otpLanguage?: string;
|
|
392
|
+
pin?: string;
|
|
393
|
+
orgWabaId?: string;
|
|
394
|
+
wabaId?: string;
|
|
395
|
+
accessToken?: string;
|
|
396
|
+
}
|
|
397
|
+
interface RetryVerificationInput {
|
|
398
|
+
otpMethod?: "SMS" | "VOICE";
|
|
399
|
+
otpLanguage?: string;
|
|
400
|
+
}
|
|
401
|
+
declare class ManagedNumbersResource {
|
|
402
|
+
private readonly http;
|
|
403
|
+
constructor(http: HttpClient);
|
|
404
|
+
listAreaCodes(): Promise<AreaCode[]>;
|
|
405
|
+
list(): Promise<ManagedNumber[]>;
|
|
406
|
+
get(id: string): Promise<ManagedNumber>;
|
|
407
|
+
provision(input: ProvisionManagedNumberInput): Promise<ManagedNumber>;
|
|
408
|
+
retryVerification(id: string, input?: RetryVerificationInput): Promise<ManagedNumber>;
|
|
409
|
+
cancel(id: string): Promise<ManagedNumber>;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
declare class MessagesResource {
|
|
413
|
+
private readonly http;
|
|
414
|
+
constructor(http: HttpClient);
|
|
415
|
+
send(input: SendMessageInput): Promise<SendMessageResult>;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare class PlansResource {
|
|
419
|
+
private readonly http;
|
|
420
|
+
constructor(http: HttpClient);
|
|
421
|
+
get(): Promise<PlansResult>;
|
|
422
|
+
update(input: UpdatePlanInput): Promise<OrgPlan>;
|
|
423
|
+
listAvailable(): Promise<AvailablePlan[]>;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
declare class SmtpResource {
|
|
427
|
+
private readonly http;
|
|
428
|
+
constructor(http: HttpClient);
|
|
429
|
+
get(): Promise<SmtpConfig>;
|
|
430
|
+
upsert(input: UpsertSmtpConfigInput): Promise<SmtpConfig>;
|
|
431
|
+
delete(): Promise<void>;
|
|
432
|
+
test(to: string): Promise<{
|
|
433
|
+
success: boolean;
|
|
434
|
+
error?: string;
|
|
435
|
+
}>;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare class StatisticsResource {
|
|
439
|
+
private readonly http;
|
|
440
|
+
constructor(http: HttpClient);
|
|
441
|
+
get(params?: StatisticsParams): Promise<StatisticsResult>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
declare class TemplatesResource {
|
|
445
|
+
private readonly http;
|
|
446
|
+
constructor(http: HttpClient);
|
|
447
|
+
list(params?: {
|
|
448
|
+
type?: MessageType;
|
|
449
|
+
isActive?: boolean;
|
|
450
|
+
}): Promise<MessageTemplate[]>;
|
|
451
|
+
get(id: string): Promise<MessageTemplate>;
|
|
452
|
+
create(input: CreateTemplateInput): Promise<MessageTemplate>;
|
|
453
|
+
update(id: string, input: UpdateTemplateInput): Promise<MessageTemplate>;
|
|
454
|
+
saveDraft(id: string, input: SaveDraftInput): Promise<MessageTemplate>;
|
|
455
|
+
publish(id: string): Promise<MessageTemplate>;
|
|
456
|
+
delete(id: string): Promise<void>;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
declare class WebhooksResource {
|
|
460
|
+
private readonly http;
|
|
461
|
+
constructor(http: HttpClient);
|
|
462
|
+
list(): Promise<OrgWebhook[]>;
|
|
463
|
+
create(input: CreateWebhookInput): Promise<OrgWebhookWithSecret>;
|
|
464
|
+
update(id: string, input: UpdateWebhookInput): Promise<OrgWebhook>;
|
|
465
|
+
delete(id: string): Promise<void>;
|
|
466
|
+
listDeliveries(id: string): Promise<WebhookDelivery[]>;
|
|
467
|
+
rotateSecret(id: string): Promise<RotateSecretResult>;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
declare class WhatsappNumbersResource {
|
|
471
|
+
private readonly http;
|
|
472
|
+
constructor(http: HttpClient);
|
|
473
|
+
listWabas(): Promise<OrgWaba[]>;
|
|
474
|
+
connectWaba(input: ConnectWabaInput): Promise<OrgWaba>;
|
|
475
|
+
reconnectWaba(id: string): Promise<OrgWaba>;
|
|
476
|
+
disconnectWaba(id: string): Promise<void>;
|
|
477
|
+
getWabaHealth(id: string): Promise<WabaHealthResult>;
|
|
478
|
+
listNumbers(): Promise<WhatsappNumber[]>;
|
|
479
|
+
connectNumber(input: ConnectWhatsappNumberInput): Promise<WhatsappNumber>;
|
|
480
|
+
registerNumber(input: RegisterWhatsappNumberInput): Promise<WhatsappNumber>;
|
|
481
|
+
verifyCode(id: string, code: string): Promise<WhatsappNumber>;
|
|
482
|
+
resendCode(id: string): Promise<void>;
|
|
483
|
+
getProfile(id: string): Promise<WhatsappNumberProfile>;
|
|
484
|
+
updateProfile(id: string, input: UpdateWhatsappProfileInput): Promise<WhatsappNumberProfile>;
|
|
485
|
+
updateDisplayName(id: string, displayName: string): Promise<WhatsappNumber>;
|
|
486
|
+
getStatus(id: string): Promise<PhoneNumberStatusResult>;
|
|
487
|
+
refreshNumbers(): Promise<WhatsappNumber[]>;
|
|
488
|
+
deleteNumber(id: string): Promise<void>;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
declare class WhatsappTemplatesResource {
|
|
492
|
+
private readonly http;
|
|
493
|
+
constructor(http: HttpClient);
|
|
494
|
+
list(): Promise<WhatsappTemplate[]>;
|
|
495
|
+
create(input: CreateWhatsappTemplateInput): Promise<WhatsappTemplate>;
|
|
496
|
+
update(id: string, input: UpdateWhatsappTemplateInput): Promise<WhatsappTemplate>;
|
|
497
|
+
sync(): Promise<SyncWhatsappTemplatesResult>;
|
|
498
|
+
delete(id: string): Promise<void>;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare class PostClient {
|
|
502
|
+
private readonly http;
|
|
503
|
+
readonly messages: MessagesResource;
|
|
504
|
+
readonly templates: TemplatesResource;
|
|
505
|
+
readonly whatsappTemplates: WhatsappTemplatesResource;
|
|
506
|
+
readonly whatsappNumbers: WhatsappNumbersResource;
|
|
507
|
+
readonly domains: DomainsResource;
|
|
508
|
+
readonly webhooks: WebhooksResource;
|
|
509
|
+
readonly smtp: SmtpResource;
|
|
510
|
+
readonly plans: PlansResource;
|
|
511
|
+
readonly history: HistoryResource;
|
|
512
|
+
readonly statistics: StatisticsResource;
|
|
513
|
+
readonly managedNumbers: ManagedNumbersResource;
|
|
514
|
+
constructor(options: HttpClientOptions);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
declare class PostApiError extends Error {
|
|
518
|
+
readonly status: number;
|
|
519
|
+
readonly detail?: string | undefined;
|
|
520
|
+
constructor(status: number, message: string, detail?: string | undefined);
|
|
521
|
+
get isNotFound(): boolean;
|
|
522
|
+
get isUnauthorized(): boolean;
|
|
523
|
+
get isForbidden(): boolean;
|
|
524
|
+
get isRateLimited(): boolean;
|
|
525
|
+
get isValidationError(): boolean;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
interface PostPluginOptions {
|
|
529
|
+
issuerUrl: string;
|
|
530
|
+
clientId: string;
|
|
531
|
+
clientSecret: string;
|
|
532
|
+
baseUrl?: string;
|
|
533
|
+
}
|
|
534
|
+
declare module "fastify" {
|
|
535
|
+
interface FastifyInstance {
|
|
536
|
+
postClient: PostClient;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
declare const _default: FastifyPluginAsync<PostPluginOptions>;
|
|
540
|
+
|
|
541
|
+
export { type AreaCode, type AvailablePlan, type ConnectWabaInput, type ConnectWhatsappNumberInput, type CreateDomainInput, type CreateDomainResult, type CreateTemplateInput, type CreateWebhookInput, type CreateWhatsappTemplateInput, type DnsRecord, type DomainStatus, type DomainType, DomainsResource, HistoryResource, type ListHistoryParams, type ManagedNumber, type ManagedNumberStatus, ManagedNumbersResource, type MessageLog, type MessageLogDetail, type MessageStatus, type MessageTemplate, type MessageType, MessagesResource, type OrgDomain, type OrgPlan, type OrgUsage, type OrgWaba, type OrgWebhook, type OrgWebhookWithSecret, type PaginatedResult, type PhoneNumberStatusResult, type PlanTier, PlansResource, type PlansResult, PostApiError, PostClient, type PostPluginOptions, type RegisterWhatsappNumberInput, type RotateSecretResult, type SaveDraftInput, type SendMessageInput, type SendMessageResult, type SmtpConfig, SmtpResource, type StatisticsParams, StatisticsResource, type StatisticsResult, type SyncWhatsappTemplatesResult, TemplatesResource, type UpdatePlanInput, type UpdateTemplateInput, type UpdateWebhookInput, type UpdateWhatsappProfileInput, type UpdateWhatsappTemplateInput, type UpsertSmtpConfigInput, type WabaStatus, type WebhookDelivery, type WebhookEvent, WebhooksResource, type WhatsappNumber, type WhatsappNumberProfile, type WhatsappNumberStatus, WhatsappNumbersResource, type WhatsappTemplate, type WhatsappTemplateCategory, type WhatsappTemplateStatus, WhatsappTemplatesResource, _default as postPlugin };
|