@fonderie/client 0.1.0 → 0.2.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/dist/index.d.cts CHANGED
@@ -11,6 +11,7 @@ interface IRequestOptions {
11
11
  body?: unknown;
12
12
  token?: string | undefined;
13
13
  cookie?: string | undefined;
14
+ workspaceId?: string | undefined;
14
15
  }
15
16
  declare class HttpClient {
16
17
  private baseUrl;
@@ -18,6 +19,13 @@ declare class HttpClient {
18
19
  request<T>(opts: IRequestOptions): Promise<T>;
19
20
  }
20
21
 
22
+ declare class TokenStore {
23
+ private token;
24
+ constructor(initial?: string);
25
+ get(): string | undefined;
26
+ set(token: string | undefined): void;
27
+ }
28
+
21
29
  interface IApiResponse<T = undefined> {
22
30
  reason: string;
23
31
  explanation: string;
@@ -103,9 +111,410 @@ interface IMfaEnabledResult {
103
111
  tokens: ITokens;
104
112
  user: IUserDTO;
105
113
  }
106
- interface IPhoneVerifyResult {
107
- tokens: ITokens;
108
- user: IUserDTO;
114
+ interface IPlanFeature {
115
+ name: string;
116
+ description: string;
117
+ enabled: boolean;
118
+ limit?: number;
119
+ }
120
+ interface IPlanDTO {
121
+ id: string;
122
+ planId: string;
123
+ name: string;
124
+ description: string;
125
+ tier: number;
126
+ seats: number | null;
127
+ trialDays: number;
128
+ pricing: {
129
+ monthly: number;
130
+ yearly: number;
131
+ currency: string;
132
+ };
133
+ features: IPlanFeature[];
134
+ metadata: Record<string, unknown>;
135
+ }
136
+ type SubscriberType = 'user' | 'workspace';
137
+ interface ISubscriptionDTO {
138
+ id: string;
139
+ subscriberType: SubscriberType;
140
+ subscriberId: string;
141
+ plan: string;
142
+ interval: string;
143
+ status: string;
144
+ cancelAtPeriodEnd: boolean;
145
+ currentPeriodStart: string | null;
146
+ currentPeriodEnd: string | null;
147
+ trialEndsAt: string | null;
148
+ createdAt: string;
149
+ }
150
+ interface IPlanListResult {
151
+ plans: IPlanDTO[];
152
+ }
153
+ interface IPlanResult {
154
+ plan: IPlanDTO;
155
+ }
156
+ interface ISubscriptionResult {
157
+ subscription: ISubscriptionDTO;
158
+ }
159
+ interface ICheckoutUrlResult {
160
+ url: string;
161
+ }
162
+ interface IPortalUrlResult {
163
+ url: string;
164
+ }
165
+ interface IUsageResult {
166
+ metric: string;
167
+ total: number;
168
+ since: string;
169
+ }
170
+ interface IWorkspaceAddressDTO {
171
+ line1: string;
172
+ line2: string;
173
+ city: string;
174
+ state: string;
175
+ zip: string;
176
+ country: string;
177
+ }
178
+ interface IWorkspaceDTO {
179
+ id: string;
180
+ name: string;
181
+ slug: string;
182
+ type: string;
183
+ description: string;
184
+ motto: string;
185
+ phone: string;
186
+ businessType: string;
187
+ address: IWorkspaceAddressDTO;
188
+ plan: string;
189
+ ownerId: string;
190
+ isPersonal: boolean;
191
+ isArchived: boolean;
192
+ archivedAt: string;
193
+ createdAt: string;
194
+ updatedAt: string;
195
+ }
196
+ interface IRoleDTO {
197
+ id: string;
198
+ name: string;
199
+ isSystem: boolean;
200
+ active: boolean;
201
+ description: string;
202
+ workspaceId: string;
203
+ }
204
+ interface IMemberDTO {
205
+ userId: string;
206
+ workspaceId: string;
207
+ roleId: string;
208
+ roleName: string;
209
+ confirmed: boolean;
210
+ createdAt: string;
211
+ }
212
+ interface IInvitationDTO {
213
+ id: string;
214
+ workspaceId: string;
215
+ email: string;
216
+ roleId: string;
217
+ token: string;
218
+ status: string;
219
+ expiresAt: string;
220
+ createdAt: string;
221
+ }
222
+ interface IWorkspaceSettingsDTO {
223
+ locale: string;
224
+ timezone: string;
225
+ currency: string;
226
+ dateFormat: string;
227
+ timeFormat: string;
228
+ }
229
+ interface IWorkspaceListResult {
230
+ workspaces: IWorkspaceDTO[];
231
+ }
232
+ interface IWorkspaceResult {
233
+ workspace: IWorkspaceDTO;
234
+ }
235
+ interface IMemberListResult {
236
+ members: IMemberDTO[];
237
+ }
238
+ interface IRoleListResult {
239
+ roles: IRoleDTO[];
240
+ }
241
+ interface IRoleResult {
242
+ role: IRoleDTO;
243
+ }
244
+ interface IInvitationListResult {
245
+ invitations: IInvitationDTO[];
246
+ }
247
+ interface IInviteResult {
248
+ invitations: Array<{
249
+ invitationId: string;
250
+ email: string;
251
+ }>;
252
+ }
253
+ interface IAcceptInvitationResult {
254
+ workspaceId: string;
255
+ }
256
+ interface IWorkspaceSettingsResult {
257
+ settings: IWorkspaceSettingsDTO;
258
+ }
259
+ interface ITemplateEntry {
260
+ type: string;
261
+ locale: string | null;
262
+ subject: string | null;
263
+ html: string | null;
264
+ text: string;
265
+ active: boolean;
266
+ version: number;
267
+ updatedBy: string | null;
268
+ updatedAt: string;
269
+ }
270
+ interface ITemplateRevision {
271
+ type: string;
272
+ locale: string | null;
273
+ subject: string | null;
274
+ html: string | null;
275
+ text: string;
276
+ version: number;
277
+ actor: string | null;
278
+ createdAt: string;
279
+ }
280
+ interface IConfigEntry {
281
+ key: string;
282
+ value: unknown;
283
+ environment: string;
284
+ description: string | null;
285
+ active: boolean;
286
+ version: number;
287
+ updatedBy: string | null;
288
+ updatedAt: string;
289
+ }
290
+ interface IConfigRevision {
291
+ key: string;
292
+ environment: string;
293
+ value: unknown;
294
+ version: number;
295
+ actor: string | null;
296
+ createdAt: string;
297
+ }
298
+ interface ISecretEntry {
299
+ key: string;
300
+ environment: string;
301
+ description: string | null;
302
+ active: boolean;
303
+ version: number;
304
+ updatedBy: string | null;
305
+ updatedAt: string;
306
+ }
307
+ interface ISecretRevision {
308
+ key: string;
309
+ environment: string;
310
+ version: number;
311
+ actor: string | null;
312
+ createdAt: string;
313
+ }
314
+ interface IRevealSecretResult {
315
+ value: string;
316
+ }
317
+ interface IAuditEventDTO {
318
+ id: string;
319
+ type: string;
320
+ actorId: string | null;
321
+ requestId: string | null;
322
+ payload: Record<string, unknown>;
323
+ createdAt: string;
324
+ }
325
+ interface IAuditPageResult {
326
+ events: IAuditEventDTO[];
327
+ nextCursor: string | null;
328
+ }
329
+ interface IWebhookEndpointDTO {
330
+ id: string;
331
+ url: string;
332
+ events: string[];
333
+ enabled: boolean;
334
+ createdAt: string;
335
+ }
336
+ interface IWebhookEndpointCreatedDTO extends IWebhookEndpointDTO {
337
+ secret: string;
338
+ }
339
+ interface IWebhookDeliveryDTO {
340
+ id: string;
341
+ eventId: string;
342
+ eventType: string;
343
+ status: string;
344
+ attempts: number;
345
+ responseStatus: number | null;
346
+ deliveredAt: string | null;
347
+ createdAt: string;
348
+ }
349
+ interface IWebhookEndpointListResult {
350
+ endpoints: IWebhookEndpointDTO[];
351
+ }
352
+ interface IWebhookDeliveryListResult {
353
+ deliveries: IWebhookDeliveryDTO[];
354
+ }
355
+ interface ITestWebhookResult {
356
+ status: number | null;
357
+ ok: boolean;
358
+ error?: string;
359
+ }
360
+ type CustomerType = 'individual' | 'business';
361
+ type CustomerSex = 'UNKNOWN' | 'MALE' | 'FEMALE';
362
+ type CustomerLabelType = 'phone' | 'email' | 'address';
363
+ interface ICustomerDTO {
364
+ id: string;
365
+ type: string;
366
+ sex: CustomerSex;
367
+ firstName: string;
368
+ lastName: string;
369
+ companyName: string;
370
+ avatarUrl: string;
371
+ locale: string;
372
+ referenceCode: string;
373
+ referralCode: string;
374
+ referredBy: string | null;
375
+ blacklisted: {
376
+ status: boolean;
377
+ reason: string | null;
378
+ };
379
+ createdBy: string;
380
+ createdAt: string;
381
+ updatedAt: string;
382
+ }
383
+ interface ICustomerEmailDTO {
384
+ id: string;
385
+ email: string;
386
+ label: string;
387
+ isPrimary: boolean;
388
+ createdAt: string;
389
+ }
390
+ interface ICustomerPhoneDTO {
391
+ id: string;
392
+ phone: string;
393
+ label: string;
394
+ isPrimary: boolean;
395
+ createdAt: string;
396
+ }
397
+ interface IAddressDTO {
398
+ countryIso: string;
399
+ subdivision1Iso: string;
400
+ subdivision2Iso: string;
401
+ zipPostalCode: string;
402
+ unit: string;
403
+ line1: string;
404
+ line2: string;
405
+ }
406
+ interface ICustomerAddressDTO {
407
+ id: string;
408
+ label: string;
409
+ isPrimary: boolean;
410
+ address: IAddressDTO;
411
+ }
412
+ interface ICustomerNoteDTO {
413
+ id: string;
414
+ authorId: string;
415
+ body: string;
416
+ createdAt: string;
417
+ updatedAt: string;
418
+ }
419
+ interface ICustomerRelationshipDTO {
420
+ id: string;
421
+ relatedId: string;
422
+ relationship: string;
423
+ isPrimary: boolean;
424
+ createdAt: string;
425
+ }
426
+ type ICustomerRelationshipExpandedDTO = Omit<ICustomerShallowDTO, 'id'> & {
427
+ id: string;
428
+ customerId: string;
429
+ relationship: string;
430
+ isPrimary: boolean;
431
+ };
432
+ type ICustomerRelationshipExpandedD2DTO = ICustomerRelationshipExpandedDTO & {
433
+ relationships: ICustomerRelationshipExpandedDTO[];
434
+ };
435
+ interface ICustomerShallowDTO extends ICustomerDTO {
436
+ emails: ICustomerEmailDTO[];
437
+ phones: ICustomerPhoneDTO[];
438
+ addresses: ICustomerAddressDTO[];
439
+ notes: ICustomerNoteDTO[];
440
+ tags: string[];
441
+ }
442
+ interface ICustomerDetailDTO extends ICustomerDTO {
443
+ emails: ICustomerEmailDTO[];
444
+ phones: ICustomerPhoneDTO[];
445
+ addresses: ICustomerAddressDTO[];
446
+ notes: ICustomerNoteDTO[];
447
+ relationships: ICustomerRelationshipExpandedDTO[];
448
+ tags: string[];
449
+ }
450
+ interface ICustomerDetailD2DTO extends Omit<ICustomerDetailDTO, 'relationships'> {
451
+ relationships: ICustomerRelationshipExpandedD2DTO[];
452
+ }
453
+ interface ICustomerLabelDTO {
454
+ id: string;
455
+ type: CustomerLabelType;
456
+ value: string;
457
+ createdAt: string;
458
+ }
459
+ interface ICustomerListResult {
460
+ customers: ICustomerDTO[];
461
+ }
462
+ interface ICustomerResult {
463
+ customer: ICustomerDTO;
464
+ }
465
+ interface ICustomerEmailListResult {
466
+ emails: ICustomerEmailDTO[];
467
+ }
468
+ interface ICustomerEmailResult {
469
+ email: ICustomerEmailDTO;
470
+ }
471
+ interface ICustomerPhoneListResult {
472
+ phones: ICustomerPhoneDTO[];
473
+ }
474
+ interface ICustomerPhoneResult {
475
+ phone: ICustomerPhoneDTO;
476
+ }
477
+ interface ICustomerAddressListResult {
478
+ addresses: ICustomerAddressDTO[];
479
+ }
480
+ interface ICustomerAddressResult {
481
+ address: ICustomerAddressDTO;
482
+ }
483
+ interface ICustomerNoteListResult {
484
+ notes: ICustomerNoteDTO[];
485
+ }
486
+ interface ICustomerNoteResult {
487
+ note: ICustomerNoteDTO;
488
+ }
489
+ interface ICustomerTagListResult {
490
+ tags: string[];
491
+ }
492
+ interface ICustomerRelationshipListResult {
493
+ relationships: ICustomerRelationshipDTO[];
494
+ }
495
+ interface ICustomerRelationshipResult {
496
+ relationship: ICustomerRelationshipDTO;
497
+ }
498
+ interface ICustomerLabelListResult {
499
+ labels: ICustomerLabelDTO[];
500
+ }
501
+
502
+ interface IListAuditEventsInput {
503
+ type?: string;
504
+ actorId?: string;
505
+ from?: Date;
506
+ to?: Date;
507
+ limit?: number;
508
+ cursor?: string;
509
+ }
510
+ declare class AuditClient {
511
+ private http;
512
+ private tokens;
513
+ private workspaceId;
514
+ constructor(http: HttpClient, tokens: TokenStore);
515
+ setAccessToken(token: string | undefined): void;
516
+ setWorkspaceId(workspaceId: string | undefined): void;
517
+ listEvents(input?: IListAuditEventsInput): Promise<IApiResponse<IAuditPageResult>>;
109
518
  }
110
519
 
111
520
  interface IRegisterInput {
@@ -119,60 +528,387 @@ interface ILoginInput {
119
528
  password: string;
120
529
  }
121
530
  interface IResetPasswordInput {
122
- resetToken: string;
531
+ pin: string;
123
532
  password: string;
124
533
  }
125
- interface IUpdateUserInput {
534
+ interface IUpdateProfileInput {
126
535
  firstName?: string;
127
536
  lastName?: string;
128
- phoneNumber?: string;
129
537
  avatarUrl?: string;
538
+ }
539
+ interface IUpdatePreferencesInput {
130
540
  locale?: string;
131
541
  timezone?: string;
132
- preferences?: Record<string, unknown>;
542
+ notifications?: unknown;
543
+ emailDigest?: unknown;
544
+ dateFormat?: unknown;
545
+ timeFormat?: unknown;
133
546
  }
134
- declare class PhoneClient {
135
- private http;
136
- constructor(http: HttpClient);
137
- sendVerification(phone: string): Promise<IApiResponse<undefined>>;
138
- verify(phone: string, otp: string): Promise<IApiResponse<IPhoneVerifyResult>>;
547
+ interface IChangePasswordInput {
548
+ currentPassword: string;
549
+ newPassword: string;
139
550
  }
140
551
  declare class MfaClient {
141
552
  private http;
142
553
  private token;
143
554
  constructor(http: HttpClient, token: () => string | undefined);
144
555
  setup(): Promise<IApiResponse<IMfaSetupResult>>;
145
- verify(code: string): Promise<IApiResponse<IMfaEnabledResult>>;
146
- disable(code: string): Promise<IApiResponse<undefined>>;
556
+ verify(token: string): Promise<IApiResponse<IMfaEnabledResult>>;
557
+ disable(token: string): Promise<IApiResponse<undefined>>;
558
+ regenerateBackupCodes(token: string): Promise<IApiResponse<{
559
+ backupCodes: string[];
560
+ }>>;
147
561
  }
148
562
  declare class AuthClient {
149
563
  private http;
150
- private accessToken?;
151
- readonly phone: PhoneClient;
564
+ private tokens;
152
565
  readonly mfa: MfaClient;
153
- constructor(http: HttpClient, accessToken?: string | undefined);
566
+ constructor(http: HttpClient, tokens: TokenStore);
154
567
  setAccessToken(token: string | undefined): void;
155
568
  register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>;
156
569
  login(input: ILoginInput): Promise<IApiResponse<ILoginResult>>;
157
570
  refreshTokens(refreshToken?: string): Promise<IApiResponse<IRefreshResult>>;
158
571
  forgotPassword(email: string): Promise<IApiResponse<undefined>>;
159
572
  resetPassword(input: IResetPasswordInput): Promise<IApiResponse<undefined>>;
160
- verifyEmail(pin: string): Promise<IApiResponse<IVerifyEmailResult>>;
573
+ verifyEmail(token: string): Promise<IApiResponse<IVerifyEmailResult>>;
161
574
  logout(refreshToken?: string): Promise<IApiResponse<undefined>>;
162
575
  sendVerificationEmail(): Promise<IApiResponse<IResendVerificationResult>>;
163
576
  getUser(): Promise<IApiResponse<IMeResult>>;
164
- updateUser(input: IUpdateUserInput): Promise<IApiResponse<IMeResult>>;
577
+ updateProfile(input: IUpdateProfileInput): Promise<IApiResponse<IMeResult>>;
578
+ updatePreferences(input: IUpdatePreferencesInput): Promise<IApiResponse<IMeResult>>;
579
+ updateEmail(email: string): Promise<IApiResponse<unknown>>;
580
+ updatePhone(phone: string): Promise<IApiResponse<unknown>>;
581
+ changePassword(input: IChangePasswordInput): Promise<IApiResponse<undefined>>;
582
+ exportData(): Promise<IApiResponse<unknown>>;
165
583
  deleteUser(): Promise<IApiResponse<undefined>>;
166
584
  }
167
585
 
586
+ interface ICheckoutInput {
587
+ plan: string;
588
+ interval?: 'month' | 'year';
589
+ }
590
+ interface IRecordUsageInput {
591
+ metric: string;
592
+ quantity?: number;
593
+ }
594
+ interface ICreatePlanInput {
595
+ name: string;
596
+ description?: string | null;
597
+ tier?: number;
598
+ seats?: number | null;
599
+ trialDays?: number;
600
+ monthlyAmount?: number | null;
601
+ monthlyPriceId?: string | null;
602
+ yearlyAmount?: number | null;
603
+ yearlyPriceId?: string | null;
604
+ features?: unknown;
605
+ metadata?: unknown;
606
+ }
607
+ type IUpdatePlanInput = Partial<ICreatePlanInput>;
608
+ declare class BillingClient {
609
+ private http;
610
+ private tokens;
611
+ private workspaceId;
612
+ constructor(http: HttpClient, tokens: TokenStore);
613
+ setAccessToken(token: string | undefined): void;
614
+ setWorkspaceId(workspaceId: string | undefined): void;
615
+ listPlans(): Promise<IApiResponse<IPlanListResult>>;
616
+ getPlan(planId: string): Promise<IApiResponse<IPlanResult>>;
617
+ createPlan(input: ICreatePlanInput): Promise<IApiResponse<IPlanResult>>;
618
+ updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
619
+ deletePlan(planId: string): Promise<IApiResponse<undefined>>;
620
+ getSubscription(): Promise<IApiResponse<ISubscriptionResult>>;
621
+ createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
622
+ createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
623
+ recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
624
+ getUsage(metric: string): Promise<IApiResponse<IUsageResult>>;
625
+ }
626
+
627
+ interface IListCustomersInput {
628
+ search?: string;
629
+ blacklisted?: boolean;
630
+ limit?: number;
631
+ offset?: number;
632
+ }
633
+ interface IGetCustomerInput {
634
+ depth?: 1 | 2;
635
+ }
636
+ interface ICreateCustomerInput {
637
+ type?: CustomerType;
638
+ sex?: CustomerSex;
639
+ firstName?: string | null;
640
+ lastName?: string | null;
641
+ companyName?: string | null;
642
+ avatarUrl?: string | null;
643
+ locale?: string | null;
644
+ referenceCode?: string | null;
645
+ referralCode?: string | null;
646
+ referredByCode?: string | null;
647
+ }
648
+ type IUpdateCustomerInput = ICreateCustomerInput;
649
+ interface IBlacklistCustomerInput {
650
+ reason?: string;
651
+ }
652
+ interface IAddEmailInput {
653
+ email: string;
654
+ label?: string;
655
+ isPrimary?: boolean;
656
+ }
657
+ interface IAddPhoneInput {
658
+ phone: string;
659
+ label?: string;
660
+ isPrimary?: boolean;
661
+ }
662
+ interface IAddAddressInput {
663
+ countryIso: string;
664
+ zipPostalCode: string;
665
+ subdivision1Iso?: string | null;
666
+ subdivision2Iso?: string | null;
667
+ unit?: string | null;
668
+ line1?: string | null;
669
+ line2?: string | null;
670
+ label?: string;
671
+ isPrimary?: boolean;
672
+ }
673
+ interface IAddRelationshipInput {
674
+ relatedId: string;
675
+ relationship?: string;
676
+ isPrimary?: boolean;
677
+ }
678
+ declare class CustomersClient {
679
+ private http;
680
+ private tokens;
681
+ private workspaceId;
682
+ constructor(http: HttpClient, tokens: TokenStore);
683
+ setAccessToken(token: string | undefined): void;
684
+ setWorkspaceId(workspaceId: string | undefined): void;
685
+ listCustomers(input?: IListCustomersInput): Promise<IApiResponse<ICustomerListResult>>;
686
+ createCustomer(input?: ICreateCustomerInput): Promise<IApiResponse<ICustomerResult>>;
687
+ getCustomer(customerId: string, input?: IGetCustomerInput): Promise<IApiResponse<ICustomerDetailDTO | ICustomerDetailD2DTO>>;
688
+ updateCustomer(customerId: string, input: IUpdateCustomerInput): Promise<IApiResponse<ICustomerResult>>;
689
+ deleteCustomer(customerId: string): Promise<IApiResponse<undefined>>;
690
+ blacklistCustomer(customerId: string, input?: IBlacklistCustomerInput): Promise<IApiResponse<undefined>>;
691
+ unblacklistCustomer(customerId: string): Promise<IApiResponse<undefined>>;
692
+ listEmails(customerId: string): Promise<IApiResponse<ICustomerEmailListResult>>;
693
+ addEmail(customerId: string, input: IAddEmailInput): Promise<IApiResponse<ICustomerEmailResult>>;
694
+ updateEmailLabel(customerId: string, emailId: string, label: string): Promise<IApiResponse<ICustomerEmailResult>>;
695
+ setPrimaryEmail(customerId: string, emailId: string): Promise<IApiResponse<undefined>>;
696
+ removeEmail(customerId: string, emailId: string): Promise<IApiResponse<undefined>>;
697
+ listPhones(customerId: string): Promise<IApiResponse<ICustomerPhoneListResult>>;
698
+ addPhone(customerId: string, input: IAddPhoneInput): Promise<IApiResponse<ICustomerPhoneResult>>;
699
+ updatePhoneLabel(customerId: string, phoneId: string, label: string): Promise<IApiResponse<ICustomerPhoneResult>>;
700
+ setPrimaryPhone(customerId: string, phoneId: string): Promise<IApiResponse<undefined>>;
701
+ removePhone(customerId: string, phoneId: string): Promise<IApiResponse<undefined>>;
702
+ listAddresses(customerId: string): Promise<IApiResponse<ICustomerAddressListResult>>;
703
+ addAddress(customerId: string, input: IAddAddressInput): Promise<IApiResponse<ICustomerAddressResult>>;
704
+ updateAddressLabel(customerId: string, addrId: string, label: string): Promise<IApiResponse<ICustomerAddressResult>>;
705
+ setPrimaryAddress(customerId: string, addrId: string): Promise<IApiResponse<undefined>>;
706
+ removeAddress(customerId: string, addrId: string): Promise<IApiResponse<undefined>>;
707
+ listNotes(customerId: string): Promise<IApiResponse<ICustomerNoteListResult>>;
708
+ createNote(customerId: string, body: string): Promise<IApiResponse<ICustomerNoteResult>>;
709
+ updateNote(customerId: string, noteId: string, body: string): Promise<IApiResponse<ICustomerNoteResult>>;
710
+ deleteNote(customerId: string, noteId: string): Promise<IApiResponse<undefined>>;
711
+ listTags(customerId: string): Promise<IApiResponse<ICustomerTagListResult>>;
712
+ addTag(customerId: string, tag: string): Promise<IApiResponse<undefined>>;
713
+ removeTag(customerId: string, tag: string): Promise<IApiResponse<undefined>>;
714
+ listRelationships(customerId: string): Promise<IApiResponse<ICustomerRelationshipListResult>>;
715
+ addRelationship(customerId: string, input: IAddRelationshipInput): Promise<IApiResponse<ICustomerRelationshipResult>>;
716
+ setPrimaryRelationship(customerId: string, relatedId: string): Promise<IApiResponse<undefined>>;
717
+ removeRelationship(customerId: string, relatedId: string): Promise<IApiResponse<undefined>>;
718
+ listLabels(type: CustomerLabelType): Promise<IApiResponse<ICustomerLabelListResult>>;
719
+ removeLabel(labelId: string): Promise<IApiResponse<undefined>>;
720
+ }
721
+
722
+ interface ICreateWebhookEndpointInput {
723
+ url: string;
724
+ events?: string[];
725
+ }
726
+ interface IUpdateWebhookEndpointInput {
727
+ url?: string;
728
+ events?: string[];
729
+ enabled?: boolean;
730
+ }
731
+ declare class WebhooksClient {
732
+ private http;
733
+ private tokens;
734
+ private workspaceId;
735
+ constructor(http: HttpClient, tokens: TokenStore);
736
+ setAccessToken(token: string | undefined): void;
737
+ setWorkspaceId(workspaceId: string | undefined): void;
738
+ listEndpoints(): Promise<IApiResponse<IWebhookEndpointListResult>>;
739
+ createEndpoint(input: ICreateWebhookEndpointInput): Promise<IApiResponse<IWebhookEndpointCreatedDTO>>;
740
+ getEndpoint(endpointId: string): Promise<IApiResponse<IWebhookEndpointDTO>>;
741
+ updateEndpoint(endpointId: string, input: IUpdateWebhookEndpointInput): Promise<IApiResponse<IWebhookEndpointDTO>>;
742
+ deleteEndpoint(endpointId: string): Promise<undefined>;
743
+ listDeliveries(endpointId: string): Promise<IApiResponse<IWebhookDeliveryListResult>>;
744
+ testEndpoint(endpointId: string): Promise<IApiResponse<ITestWebhookResult>>;
745
+ }
746
+
747
+ interface ICreateWorkspaceInput {
748
+ name: string;
749
+ description?: string;
750
+ type?: string;
751
+ }
752
+ interface IUpdateWorkspaceInput {
753
+ name?: string;
754
+ description?: string | null;
755
+ motto?: string | null;
756
+ phone?: string | null;
757
+ businessType?: string | null;
758
+ address?: {
759
+ line1?: string;
760
+ line2?: string;
761
+ city?: string;
762
+ state?: string;
763
+ zip?: string;
764
+ country?: string;
765
+ } | null;
766
+ }
767
+ interface IInviteEntry {
768
+ email: string;
769
+ roleId?: string;
770
+ }
771
+ interface IUpdateSettingsInput {
772
+ locale?: string;
773
+ timezone?: string;
774
+ currency?: string;
775
+ dateFormat?: string;
776
+ timeFormat?: string;
777
+ }
778
+ interface ICreateRoleInput {
779
+ name: string;
780
+ description?: string;
781
+ }
782
+ interface IUpdateRoleInput {
783
+ name?: string;
784
+ description?: string | null;
785
+ active?: boolean;
786
+ }
787
+ interface IRolePermissionInput {
788
+ permissionKey: string;
789
+ canCreate?: boolean;
790
+ canRead?: boolean;
791
+ canUpdate?: boolean;
792
+ canDelete?: boolean;
793
+ }
794
+ interface IRolePermission {
795
+ permissionKey: string;
796
+ canCreate: boolean;
797
+ canRead: boolean;
798
+ canUpdate: boolean;
799
+ canDelete: boolean;
800
+ }
801
+ interface IRolePermissionsResult {
802
+ permissions: IRolePermission[];
803
+ }
804
+ declare class WorkspacesClient {
805
+ private http;
806
+ private tokens;
807
+ private workspaceId;
808
+ constructor(http: HttpClient, tokens: TokenStore);
809
+ setAccessToken(token: string | undefined): void;
810
+ setWorkspaceId(workspaceId: string | undefined): void;
811
+ listWorkspaces(): Promise<IApiResponse<IWorkspaceListResult>>;
812
+ createWorkspace(input: ICreateWorkspaceInput): Promise<IApiResponse<IWorkspaceResult>>;
813
+ getWorkspace(id: string): Promise<IApiResponse<IWorkspaceResult>>;
814
+ updateWorkspace(input: IUpdateWorkspaceInput): Promise<IApiResponse<IWorkspaceResult>>;
815
+ archiveWorkspace(): Promise<IApiResponse<undefined>>;
816
+ restoreWorkspace(): Promise<IApiResponse<undefined>>;
817
+ listRoles(): Promise<IApiResponse<IRoleListResult>>;
818
+ createRole(input: ICreateRoleInput): Promise<IApiResponse<IRoleResult>>;
819
+ getRole(roleId: string): Promise<IApiResponse<IRoleResult>>;
820
+ updateRole(roleId: string, input: IUpdateRoleInput): Promise<IApiResponse<IRoleResult>>;
821
+ removeRole(roleId: string): Promise<IApiResponse<undefined>>;
822
+ getRolePermissions(roleId: string): Promise<IApiResponse<IRolePermissionsResult>>;
823
+ setRolePermissions(roleId: string, permissions: IRolePermissionInput[]): Promise<IApiResponse<undefined>>;
824
+ listMembers(): Promise<IApiResponse<IMemberListResult>>;
825
+ removeMember(userId: string): Promise<IApiResponse<undefined>>;
826
+ getMemberRoles(userId: string): Promise<IApiResponse<IRoleListResult>>;
827
+ addMemberRole(userId: string, roleId: string): Promise<IApiResponse<undefined>>;
828
+ removeMemberRole(userId: string, roleId: string): Promise<IApiResponse<undefined>>;
829
+ listInvitations(): Promise<IApiResponse<IInvitationListResult>>;
830
+ invite(entries: IInviteEntry | IInviteEntry[]): Promise<IApiResponse<IInviteResult>>;
831
+ cancelInvitation(inviteId: string): Promise<IApiResponse<undefined>>;
832
+ acceptInvitation(pin: string): Promise<IApiResponse<IAcceptInvitationResult>>;
833
+ getSettings(): Promise<IApiResponse<IWorkspaceSettingsResult>>;
834
+ updateSettings(input: IUpdateSettingsInput): Promise<IApiResponse<IWorkspaceSettingsResult>>;
835
+ }
836
+
168
837
  interface IFonderieClientOptions {
169
838
  baseUrl: string;
170
839
  accessToken?: string;
171
840
  }
172
841
  declare class FonderieClient {
173
842
  readonly auth: AuthClient;
843
+ readonly billing: BillingClient;
844
+ readonly workspaces: WorkspacesClient;
845
+ readonly audit: AuditClient;
846
+ readonly webhooks: WebhooksClient;
847
+ readonly customers: CustomersClient;
174
848
  private http;
175
849
  constructor(opts: IFonderieClientOptions);
176
850
  }
177
851
 
178
- export { AuthClient, FonderieApiError, FonderieClient, type IApiError, type IApiResponse, type IFonderieClientOptions, type ILoginInput, type ILoginResult, type IMeResult, type IMfaEnabledResult, type IMfaSetupResult, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IResendVerificationResult, type IResetPasswordInput, type ITokens, type IUpdateUserInput, type IUserDTO, type IUserPreferences, type IUserSkill, type IVerifyEmailResult };
852
+ interface ISetConfigInput {
853
+ value: unknown;
854
+ description?: string;
855
+ ifVersion?: number;
856
+ }
857
+ interface ISetSecretInput {
858
+ value: string;
859
+ description?: string;
860
+ ifVersion?: number;
861
+ }
862
+ interface IRollbackInput {
863
+ toVersion: number;
864
+ }
865
+ interface IConfigAdminClientOptions {
866
+ baseUrl: string;
867
+ adminToken: string;
868
+ }
869
+ declare class ConfigAdminClient {
870
+ private http;
871
+ private adminToken;
872
+ constructor(opts: IConfigAdminClientOptions);
873
+ listConfig(environment?: string): Promise<IApiResponse<IConfigEntry[]>>;
874
+ getConfig(key: string, environment?: string): Promise<IApiResponse<IConfigEntry>>;
875
+ setConfig(key: string, input: ISetConfigInput, environment?: string): Promise<IApiResponse<IConfigEntry>>;
876
+ deleteConfig(key: string, environment?: string): Promise<IApiResponse<undefined>>;
877
+ listConfigRevisions(key: string, environment?: string): Promise<IApiResponse<IConfigRevision[]>>;
878
+ rollbackConfig(key: string, input: IRollbackInput, environment?: string): Promise<IApiResponse<IConfigEntry>>;
879
+ listSecrets(environment?: string): Promise<IApiResponse<ISecretEntry[]>>;
880
+ getSecret(key: string, environment?: string): Promise<IApiResponse<ISecretEntry>>;
881
+ setSecret(key: string, input: ISetSecretInput, environment?: string): Promise<IApiResponse<ISecretEntry>>;
882
+ deleteSecret(key: string, environment?: string): Promise<IApiResponse<undefined>>;
883
+ listSecretRevisions(key: string, environment?: string): Promise<IApiResponse<ISecretRevision[]>>;
884
+ rollbackSecret(key: string, input: IRollbackInput, environment?: string): Promise<IApiResponse<ISecretEntry>>;
885
+ revealSecret(key: string, environment?: string): Promise<IApiResponse<IRevealSecretResult>>;
886
+ }
887
+
888
+ interface ISetTemplateInput {
889
+ text: string;
890
+ subject?: string;
891
+ html?: string;
892
+ active?: boolean;
893
+ ifVersion?: number;
894
+ }
895
+ interface IRollbackTemplateInput {
896
+ toVersion: number;
897
+ }
898
+ interface ICourierAdminClientOptions {
899
+ baseUrl: string;
900
+ adminToken: string;
901
+ }
902
+ declare class CourierAdminClient {
903
+ private http;
904
+ private adminToken;
905
+ constructor(opts: ICourierAdminClientOptions);
906
+ listTemplates(): Promise<IApiResponse<ITemplateEntry[]>>;
907
+ getTemplate(type: string, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
908
+ setTemplate(type: string, input: ISetTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
909
+ deleteTemplate(type: string, locale?: string | null): Promise<IApiResponse<undefined>>;
910
+ listRevisions(type: string, locale?: string | null): Promise<IApiResponse<ITemplateRevision[]>>;
911
+ rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
912
+ }
913
+
914
+ export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMfaEnabledResult, type IMfaSetupResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IUserSkill, type IVerifyEmailResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient };