@sentroy-co/client-sdk 2.5.2 → 2.6.1

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/src/types.ts CHANGED
@@ -322,3 +322,164 @@ export interface StorageUsage {
322
322
  buckets: StorageUsageBucket[]
323
323
  byType: StorageUsageByType[]
324
324
  }
325
+
326
+ // ── Audience / Contacts ───────────────────────────────────────────────────
327
+
328
+ export type ContactStatus = "active" | "unsubscribed" | "bounced"
329
+
330
+ export interface Contact {
331
+ id: string
332
+ companyId: string
333
+ email: string
334
+ name?: string
335
+ tags: string[]
336
+ status: ContactStatus
337
+ metadata: Record<string, unknown>
338
+ lastEmailedAt?: string | null
339
+ createdAt: string
340
+ updatedAt: string
341
+ }
342
+
343
+ export interface ContactList {
344
+ id: string
345
+ companyId: string
346
+ name: string
347
+ description?: string
348
+ memberCount?: number
349
+ createdAt: string
350
+ updatedAt: string
351
+ }
352
+
353
+ export interface CreateContactParams {
354
+ email: string
355
+ name?: string
356
+ tags?: string[]
357
+ metadata?: Record<string, unknown>
358
+ }
359
+
360
+ export interface UpdateContactParams {
361
+ email?: string
362
+ name?: string
363
+ tags?: string[]
364
+ status?: ContactStatus
365
+ metadata?: Record<string, unknown>
366
+ }
367
+
368
+ export interface ContactListParams {
369
+ page?: number
370
+ limit?: number
371
+ status?: ContactStatus
372
+ /** Comma-joined when sent over the wire — pass an array, the SDK joins. */
373
+ tags?: string[]
374
+ }
375
+
376
+ export interface ContactListResult {
377
+ contacts: Contact[]
378
+ total: number
379
+ page: number
380
+ limit: number
381
+ }
382
+
383
+ export interface CreateAudienceListParams {
384
+ name: string
385
+ description?: string
386
+ }
387
+
388
+ // ── Suppressions ──────────────────────────────────────────────────────────
389
+
390
+ export interface Suppression {
391
+ id: string
392
+ email: string
393
+ reason: string
394
+ domainId: string
395
+ createdAt: string
396
+ domain?: { domain: string }
397
+ }
398
+
399
+ export interface AddSuppressionParams {
400
+ email: string
401
+ /** Free-form label (e.g. "manual", "complaint"). Defaults backend-side. */
402
+ reason?: string
403
+ domainId: string
404
+ }
405
+
406
+ export interface SuppressionListParams {
407
+ page?: number
408
+ limit?: number
409
+ domainId?: string
410
+ reason?: string
411
+ }
412
+
413
+ // ── Webhooks ──────────────────────────────────────────────────────────────
414
+
415
+ export type WebhookEvent =
416
+ | "sent"
417
+ | "bounced"
418
+ | "failed"
419
+ | "opened"
420
+ | "clicked"
421
+ | "unsubscribed"
422
+
423
+ export interface Webhook {
424
+ id: string
425
+ url: string
426
+ events: string[]
427
+ active: boolean
428
+ domainId: string
429
+ /** Returned only on create — used to verify HMAC signatures of deliveries. */
430
+ secret?: string
431
+ createdAt: string
432
+ updatedAt: string
433
+ }
434
+
435
+ export interface CreateWebhookParams {
436
+ url: string
437
+ events: WebhookEvent[] | string[]
438
+ domainId: string
439
+ }
440
+
441
+ export interface UpdateWebhookParams {
442
+ url?: string
443
+ events?: WebhookEvent[] | string[]
444
+ active?: boolean
445
+ }
446
+
447
+ // ── Logs ──────────────────────────────────────────────────────────────────
448
+
449
+ export type MailLogStatus =
450
+ | "queued"
451
+ | "processing"
452
+ | "sent"
453
+ | "bounced"
454
+ | "failed"
455
+
456
+ export interface MailLog {
457
+ id: string
458
+ to: string
459
+ from: string
460
+ subject: string
461
+ status: MailLogStatus
462
+ messageId: string | null
463
+ domainId: string
464
+ domain?: { domain: string }
465
+ templateId: string | null
466
+ variables: Record<string, unknown> | null
467
+ scheduledAt?: string | null
468
+ sentAt: string | null
469
+ bouncedAt: string | null
470
+ openedAt?: string | null
471
+ clickedAt?: string | null
472
+ error: string | null
473
+ createdAt: string
474
+ }
475
+
476
+ export interface LogListParams {
477
+ page?: number
478
+ limit?: number
479
+ status?: MailLogStatus
480
+ domainId?: string
481
+ /** ISO timestamp lower bound (inclusive). */
482
+ from?: string
483
+ /** ISO timestamp upper bound (inclusive). */
484
+ to?: string
485
+ }