@naturalpay/sdk 0.4.0 → 0.7.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 (118) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/client.d.mts +7 -16
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -16
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -12
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -12
  9. package/client.mjs.map +1 -1
  10. package/internal/tslib.js +17 -17
  11. package/internal/utils/query.d.mts +3 -0
  12. package/internal/utils/query.d.mts.map +1 -1
  13. package/internal/utils/query.d.ts +3 -0
  14. package/internal/utils/query.d.ts.map +1 -1
  15. package/internal/utils/query.js +16 -3
  16. package/internal/utils/query.js.map +1 -1
  17. package/internal/utils/query.mjs +16 -2
  18. package/internal/utils/query.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/resources/agents.d.mts +435 -260
  21. package/resources/agents.d.mts.map +1 -1
  22. package/resources/agents.d.ts +435 -260
  23. package/resources/agents.d.ts.map +1 -1
  24. package/resources/agents.js +72 -20
  25. package/resources/agents.js.map +1 -1
  26. package/resources/agents.mjs +72 -20
  27. package/resources/agents.mjs.map +1 -1
  28. package/resources/customers.d.mts +243 -114
  29. package/resources/customers.d.mts.map +1 -1
  30. package/resources/customers.d.ts +243 -114
  31. package/resources/customers.d.ts.map +1 -1
  32. package/resources/customers.js +6 -7
  33. package/resources/customers.js.map +1 -1
  34. package/resources/customers.mjs +6 -7
  35. package/resources/customers.mjs.map +1 -1
  36. package/resources/index.d.mts +2 -4
  37. package/resources/index.d.mts.map +1 -1
  38. package/resources/index.d.ts +2 -4
  39. package/resources/index.d.ts.map +1 -1
  40. package/resources/index.js +1 -5
  41. package/resources/index.js.map +1 -1
  42. package/resources/index.mjs +0 -2
  43. package/resources/index.mjs.map +1 -1
  44. package/src/client.ts +23 -60
  45. package/src/internal/utils/query.ts +18 -2
  46. package/src/resources/agents.ts +541 -294
  47. package/src/resources/customers.ts +273 -132
  48. package/src/resources/index.ts +10 -24
  49. package/src/version.ts +1 -1
  50. package/version.d.mts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
  54. package/internal/qs/formats.d.mts +0 -7
  55. package/internal/qs/formats.d.mts.map +0 -1
  56. package/internal/qs/formats.d.ts +0 -7
  57. package/internal/qs/formats.d.ts.map +0 -1
  58. package/internal/qs/formats.js +0 -13
  59. package/internal/qs/formats.js.map +0 -1
  60. package/internal/qs/formats.mjs +0 -9
  61. package/internal/qs/formats.mjs.map +0 -1
  62. package/internal/qs/index.d.mts +0 -10
  63. package/internal/qs/index.d.mts.map +0 -1
  64. package/internal/qs/index.d.ts +0 -10
  65. package/internal/qs/index.d.ts.map +0 -1
  66. package/internal/qs/index.js +0 -14
  67. package/internal/qs/index.js.map +0 -1
  68. package/internal/qs/index.mjs +0 -10
  69. package/internal/qs/index.mjs.map +0 -1
  70. package/internal/qs/stringify.d.mts +0 -3
  71. package/internal/qs/stringify.d.mts.map +0 -1
  72. package/internal/qs/stringify.d.ts +0 -3
  73. package/internal/qs/stringify.d.ts.map +0 -1
  74. package/internal/qs/stringify.js +0 -277
  75. package/internal/qs/stringify.js.map +0 -1
  76. package/internal/qs/stringify.mjs +0 -274
  77. package/internal/qs/stringify.mjs.map +0 -1
  78. package/internal/qs/types.d.mts +0 -57
  79. package/internal/qs/types.d.mts.map +0 -1
  80. package/internal/qs/types.d.ts +0 -57
  81. package/internal/qs/types.d.ts.map +0 -1
  82. package/internal/qs/types.js +0 -3
  83. package/internal/qs/types.js.map +0 -1
  84. package/internal/qs/types.mjs +0 -2
  85. package/internal/qs/types.mjs.map +0 -1
  86. package/internal/qs/utils.d.mts +0 -15
  87. package/internal/qs/utils.d.mts.map +0 -1
  88. package/internal/qs/utils.d.ts +0 -15
  89. package/internal/qs/utils.d.ts.map +0 -1
  90. package/internal/qs/utils.js +0 -230
  91. package/internal/qs/utils.js.map +0 -1
  92. package/internal/qs/utils.mjs +0 -217
  93. package/internal/qs/utils.mjs.map +0 -1
  94. package/resources/delegations.d.mts +0 -458
  95. package/resources/delegations.d.mts.map +0 -1
  96. package/resources/delegations.d.ts +0 -458
  97. package/resources/delegations.d.ts.map +0 -1
  98. package/resources/delegations.js +0 -47
  99. package/resources/delegations.js.map +0 -1
  100. package/resources/delegations.mjs +0 -43
  101. package/resources/delegations.mjs.map +0 -1
  102. package/resources/escalations.d.mts +0 -1124
  103. package/resources/escalations.d.mts.map +0 -1
  104. package/resources/escalations.d.ts +0 -1124
  105. package/resources/escalations.d.ts.map +0 -1
  106. package/resources/escalations.js +0 -110
  107. package/resources/escalations.js.map +0 -1
  108. package/resources/escalations.mjs +0 -106
  109. package/resources/escalations.mjs.map +0 -1
  110. package/src/internal/qs/LICENSE.md +0 -13
  111. package/src/internal/qs/README.md +0 -3
  112. package/src/internal/qs/formats.ts +0 -10
  113. package/src/internal/qs/index.ts +0 -13
  114. package/src/internal/qs/stringify.ts +0 -385
  115. package/src/internal/qs/types.ts +0 -71
  116. package/src/internal/qs/utils.ts +0 -265
  117. package/src/resources/delegations.ts +0 -580
  118. package/src/resources/escalations.ts +0 -1422
@@ -105,34 +105,34 @@ export class Agents extends APIResource {
105
105
  }
106
106
 
107
107
  /**
108
- * Developer-only. Creates one invitation per agent and sends a single Resend email
109
- * to the customer.
108
+ * Add or invite customer relationships for this agent.
110
109
  *
111
110
  * @example
112
111
  * ```ts
113
- * const response = await client.agents.createInvitations({
114
- * agents: [
115
- * {
116
- * agentId: 'agt_ecc2efdd09bd231a9ad9bd2aada37aa7',
117
- * permissions: ['string'],
118
- * },
119
- * ],
120
- * customerEmail: 'dev@stainless.com',
121
- * 'Idempotency-Key': 'Idempotency-Key',
122
- * });
112
+ * const response = await client.agents.createCustomer(
113
+ * 'agt_ecc2efdd09bd231a9ad9bd2aada37aa7',
114
+ * {
115
+ * permissions: ['string'],
116
+ * recipients: [
117
+ * { type: 'type', value: 'dev@stainless.com' },
118
+ * ],
119
+ * 'Idempotency-Key': 'Idempotency-Key',
120
+ * },
121
+ * );
123
122
  * ```
124
123
  */
125
- createInvitations(
126
- params: AgentCreateInvitationsParams,
124
+ createCustomer(
125
+ agentID: string,
126
+ params: AgentCreateCustomerParams,
127
127
  options?: RequestOptions,
128
- ): APIPromise<AgentCreateInvitationsResponse> {
128
+ ): APIPromise<AgentCreateCustomerResponse> {
129
129
  const {
130
130
  'Idempotency-Key': idempotencyKey,
131
131
  'X-Agent-ID': xAgentID,
132
132
  'X-Instance-ID': xInstanceID,
133
133
  ...body
134
134
  } = params;
135
- return this._client.post('/agents/invitations', {
135
+ return this._client.post(path`/agents/${agentID}/customers`, {
136
136
  body,
137
137
  ...options,
138
138
  headers: buildHeaders([
@@ -175,20 +175,51 @@ export class Agents extends APIResource {
175
175
  }
176
176
 
177
177
  /**
178
- * List agent delegation invitations
178
+ * Get a specific customer invitation for this agent.
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * const response = await client.agents.getCustomer(
183
+ * 'pty_ecc2efdd09bd231a9ad9bd2aada37aa7',
184
+ * { agentId: 'agt_ecc2efdd09bd231a9ad9bd2aada37aa7' },
185
+ * );
186
+ * ```
187
+ */
188
+ getCustomer(
189
+ customerID: string,
190
+ params: AgentGetCustomerParams,
191
+ options?: RequestOptions,
192
+ ): APIPromise<AgentGetCustomerResponse> {
193
+ const { agentId, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params;
194
+ return this._client.get(path`/agents/${agentId}/customers/${customerID}`, {
195
+ ...options,
196
+ headers: buildHeaders([
197
+ {
198
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
199
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
200
+ },
201
+ options?.headers,
202
+ ]),
203
+ });
204
+ }
205
+
206
+ /**
207
+ * List customer invitations for this agent.
179
208
  *
180
209
  * @example
181
210
  * ```ts
182
- * const response =
183
- * await client.agents.listInvitationsForDeveloper();
211
+ * const response = await client.agents.listCustomers(
212
+ * 'agt_ecc2efdd09bd231a9ad9bd2aada37aa7',
213
+ * );
184
214
  * ```
185
215
  */
186
- listInvitationsForDeveloper(
187
- params: AgentListInvitationsForDeveloperParams | null | undefined = {},
216
+ listCustomers(
217
+ agentID: string,
218
+ params: AgentListCustomersParams | null | undefined = {},
188
219
  options?: RequestOptions,
189
- ): APIPromise<AgentListInvitationsForDeveloperResponse> {
220
+ ): APIPromise<AgentListCustomersResponse> {
190
221
  const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
191
- return this._client.get('/agents/invitations', {
222
+ return this._client.get(path`/agents/${agentID}/customers`, {
192
223
  query,
193
224
  ...options,
194
225
  headers: buildHeaders([
@@ -202,7 +233,7 @@ export class Agents extends APIResource {
202
233
  }
203
234
 
204
235
  /**
205
- * Revoke an agent.
236
+ * Delete an agent. Deleting an agent revokes it and cleans up active access.
206
237
  *
207
238
  * @example
208
239
  * ```ts
@@ -234,6 +265,44 @@ export class Agents extends APIResource {
234
265
  ]),
235
266
  });
236
267
  }
268
+
269
+ /**
270
+ * Revoke this customer invitation so the agent can no longer act for the customer.
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * const response = await client.agents.removeCustomer(
275
+ * 'pty_ecc2efdd09bd231a9ad9bd2aada37aa7',
276
+ * {
277
+ * agentId: 'agt_ecc2efdd09bd231a9ad9bd2aada37aa7',
278
+ * 'Idempotency-Key': 'Idempotency-Key',
279
+ * },
280
+ * );
281
+ * ```
282
+ */
283
+ removeCustomer(
284
+ customerID: string,
285
+ params: AgentRemoveCustomerParams,
286
+ options?: RequestOptions,
287
+ ): APIPromise<AgentRemoveCustomerResponse> {
288
+ const {
289
+ agentId,
290
+ 'Idempotency-Key': idempotencyKey,
291
+ 'X-Agent-ID': xAgentID,
292
+ 'X-Instance-ID': xInstanceID,
293
+ } = params;
294
+ return this._client.delete(path`/agents/${agentId}/customers/${customerID}`, {
295
+ ...options,
296
+ headers: buildHeaders([
297
+ {
298
+ 'Idempotency-Key': idempotencyKey,
299
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
300
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
301
+ },
302
+ options?.headers,
303
+ ]),
304
+ });
305
+ }
237
306
  }
238
307
 
239
308
  export interface AgentCreateResponse {
@@ -595,32 +664,32 @@ export namespace AgentListResponse {
595
664
  }
596
665
  }
597
666
 
598
- export interface AgentCreateInvitationsResponse {
667
+ export interface AgentCreateCustomerResponse {
599
668
  /**
600
- * Successfully created invitation resources
669
+ * Created customer invitation resources
601
670
  */
602
- data: Array<AgentCreateInvitationsResponse.Data>;
671
+ data: Array<AgentCreateCustomerResponse.Data>;
603
672
 
604
673
  /**
605
674
  * Batch invitation metadata
606
675
  */
607
- meta: AgentCreateInvitationsResponse.Meta;
676
+ meta: AgentCreateCustomerResponse.Meta;
608
677
  }
609
678
 
610
- export namespace AgentCreateInvitationsResponse {
679
+ export namespace AgentCreateCustomerResponse {
611
680
  export interface Data {
612
681
  /**
613
- * Invitation ID (adi\_\*)
682
+ * Customer invitation ID (adi\_\*)
614
683
  */
615
684
  id: string;
616
685
 
617
686
  /**
618
- * Resource attributes
687
+ * Invitation attributes
619
688
  */
620
689
  attributes: Data.Attributes;
621
690
 
622
691
  /**
623
- * Related resource identifiers
692
+ * Related agent and customer party
624
693
  */
625
694
  relationships: Data.Relationships;
626
695
 
@@ -632,78 +701,48 @@ export namespace AgentCreateInvitationsResponse {
632
701
 
633
702
  export namespace Data {
634
703
  /**
635
- * Resource attributes
704
+ * Invitation attributes
636
705
  */
637
706
  export interface Attributes {
638
- /**
639
- * When this invitation was accepted
640
- */
641
- acceptedAt: string | null;
642
-
643
- /**
644
- * Display name of the agent being delegated
645
- */
646
- agentName: string;
647
-
648
- /**
649
- * Why the invitation was cancelled
650
- */
651
- cancelReason: 'AGENT_RETIRED' | 'DEVELOPER_RETIRED' | null;
652
-
653
707
  /**
654
708
  * When this invitation was created
655
709
  */
656
710
  createdAt: string;
657
711
 
658
- /**
659
- * When this invitation was declined
660
- */
661
- declinedAt: string | null;
662
-
663
- /**
664
- * Display name of the developer party
665
- */
666
- developerName: string;
667
-
668
- /**
669
- * Status after applying expiry and cancel-reason overlays
670
- */
671
- effectiveStatus: 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED';
672
-
673
- /**
674
- * Customer email the invitation was sent to
675
- */
676
- email: string;
677
-
678
712
  /**
679
713
  * When this invitation expires
680
714
  */
681
715
  expiresAt: string;
682
716
 
683
717
  /**
684
- * Per-agent transaction limits
718
+ * Requested per-agent customer limits
685
719
  */
686
720
  limits: Attributes.Limits | null;
687
721
 
688
722
  /**
689
- * Permissions the agent will hold on accept
723
+ * Permissions requested for this agent invitation
690
724
  */
691
725
  permissions: Array<string>;
692
726
 
693
727
  /**
694
- * Raw persisted status
728
+ * Recipient identifier used to create the invitation
729
+ */
730
+ recipient: Attributes.UnionMember0 | Attributes.UnionMember1 | Attributes.UnionMember2;
731
+
732
+ /**
733
+ * Current invitation status
695
734
  */
696
- status: 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED';
735
+ status: 'ACTIVE' | 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED' | 'REVOKED';
697
736
 
698
737
  /**
699
738
  * When this invitation was last updated
700
739
  */
701
- updatedAt: string;
740
+ updatedAt: string | null;
702
741
  }
703
742
 
704
743
  export namespace Attributes {
705
744
  /**
706
- * Per-agent transaction limits
745
+ * Requested per-agent customer limits
707
746
  */
708
747
  export interface Limits {
709
748
  /**
@@ -711,119 +750,112 @@ export namespace AgentCreateInvitationsResponse {
711
750
  */
712
751
  perTransaction?: number | null;
713
752
  }
753
+
754
+ export interface UnionMember0 {
755
+ type: string;
756
+
757
+ /**
758
+ * Email address
759
+ */
760
+ value: string;
761
+ }
762
+
763
+ export interface UnionMember1 {
764
+ type: string;
765
+
766
+ /**
767
+ * Phone number in E.164 format
768
+ */
769
+ value: string;
770
+ }
771
+
772
+ export interface UnionMember2 {
773
+ type: string;
774
+
775
+ /**
776
+ * Natural party ID (pty\_\*)
777
+ */
778
+ value: string;
779
+ }
714
780
  }
715
781
 
716
782
  /**
717
- * Related resource identifiers
783
+ * Related agent and customer party
718
784
  */
719
785
  export interface Relationships {
720
786
  /**
721
- * Agent being delegated
787
+ * Agent attached to this invitation
722
788
  */
723
789
  agent: Relationships.Agent;
724
790
 
725
791
  /**
726
- * Resulting agent delegation once accepted; currently null on public create/list
727
- * responses
728
- */
729
- agentDelegation: Relationships.AgentDelegation;
730
-
731
- /**
732
- * Customer party the invitation was accepted on (null until accept)
792
+ * Customer party when the recipient is an existing party or once the invitation is
793
+ * accepted
733
794
  */
734
795
  customerParty: Relationships.CustomerParty;
735
-
736
- /**
737
- * Developer party that issued the invitation
738
- */
739
- developerParty: Relationships.DeveloperParty;
740
796
  }
741
797
 
742
798
  export namespace Relationships {
743
799
  /**
744
- * Agent being delegated
800
+ * Agent attached to this invitation
745
801
  */
746
802
  export interface Agent {
747
- /**
748
- * Related resource identifier
749
- */
750
803
  data: Agent.Data;
751
804
  }
752
805
 
753
806
  export namespace Agent {
754
- /**
755
- * Related resource identifier
756
- */
757
807
  export interface Data {
808
+ /**
809
+ * Agent ID (agt\_\*)
810
+ */
758
811
  id: string;
759
812
 
760
813
  /**
761
- * Resource type
814
+ * Agent attributes
762
815
  */
763
- type: string;
764
- }
765
- }
766
-
767
- /**
768
- * Resulting agent delegation once accepted; currently null on public create/list
769
- * responses
770
- */
771
- export interface AgentDelegation {
772
- /**
773
- * Related resource identifier
774
- */
775
- data: AgentDelegation.Data | null;
776
- }
777
-
778
- export namespace AgentDelegation {
779
- /**
780
- * Related resource identifier
781
- */
782
- export interface Data {
783
- id: string;
816
+ attributes: Data.Attributes;
784
817
 
785
818
  /**
786
819
  * Resource type
787
820
  */
788
821
  type: string;
789
822
  }
790
- }
791
-
792
- /**
793
- * Customer party the invitation was accepted on (null until accept)
794
- */
795
- export interface CustomerParty {
796
- /**
797
- * Related resource identifier
798
- */
799
- data: CustomerParty.Data | null;
800
- }
801
-
802
- export namespace CustomerParty {
803
- /**
804
- * Related resource identifier
805
- */
806
- export interface Data {
807
- id: string;
808
823
 
824
+ export namespace Data {
809
825
  /**
810
- * Resource type
826
+ * Agent attributes
811
827
  */
812
- type: string;
828
+ export interface Attributes {
829
+ /**
830
+ * Agent description
831
+ */
832
+ description: string | null;
833
+
834
+ /**
835
+ * Agent display name
836
+ */
837
+ name: string | null;
838
+
839
+ /**
840
+ * Agent status
841
+ */
842
+ status: 'ACTIVE' | 'REVOKED';
843
+ }
813
844
  }
814
845
  }
815
846
 
816
847
  /**
817
- * Developer party that issued the invitation
848
+ * Customer party when the recipient is an existing party or once the invitation is
849
+ * accepted
818
850
  */
819
- export interface DeveloperParty {
851
+ export interface CustomerParty {
820
852
  /**
821
853
  * Related resource identifier
822
854
  */
823
- data: DeveloperParty.Data;
855
+ data: CustomerParty.Data | null;
824
856
  }
825
857
 
826
- export namespace DeveloperParty {
858
+ export namespace CustomerParty {
827
859
  /**
828
860
  * Related resource identifier
829
861
  */
@@ -966,26 +998,24 @@ export namespace AgentGetResponse {
966
998
  }
967
999
  }
968
1000
 
969
- export interface AgentListInvitationsForDeveloperResponse {
970
- data: Array<AgentListInvitationsForDeveloperResponse.Data>;
971
-
972
- meta: AgentListInvitationsForDeveloperResponse.Meta;
1001
+ export interface AgentGetCustomerResponse {
1002
+ data: AgentGetCustomerResponse.Data;
973
1003
  }
974
1004
 
975
- export namespace AgentListInvitationsForDeveloperResponse {
1005
+ export namespace AgentGetCustomerResponse {
976
1006
  export interface Data {
977
1007
  /**
978
- * Invitation ID (adi\_\*)
1008
+ * Customer party ID when known; otherwise the lowercased customer email
979
1009
  */
980
1010
  id: string;
981
1011
 
982
1012
  /**
983
- * Resource attributes
1013
+ * Customer party and invitation attributes
984
1014
  */
985
1015
  attributes: Data.Attributes;
986
1016
 
987
1017
  /**
988
- * Related resource identifiers
1018
+ * Related agent details
989
1019
  */
990
1020
  relationships: Data.Relationships;
991
1021
 
@@ -997,78 +1027,182 @@ export namespace AgentListInvitationsForDeveloperResponse {
997
1027
 
998
1028
  export namespace Data {
999
1029
  /**
1000
- * Resource attributes
1030
+ * Customer party and invitation attributes
1001
1031
  */
1002
1032
  export interface Attributes {
1003
1033
  /**
1004
- * When this invitation was accepted
1034
+ * When this agent-customer relationship was created
1005
1035
  */
1006
- acceptedAt: string | null;
1036
+ createdAt: string;
1007
1037
 
1008
1038
  /**
1009
- * Display name of the agent being delegated
1039
+ * Customer email, when known
1010
1040
  */
1011
- agentName: string;
1041
+ email: string | null;
1012
1042
 
1013
1043
  /**
1014
- * Why the invitation was cancelled
1044
+ * Per-agent customer transaction limits
1015
1045
  */
1016
- cancelReason: 'AGENT_RETIRED' | 'DEVELOPER_RETIRED' | null;
1046
+ limits: Attributes.Limits | null;
1017
1047
 
1018
1048
  /**
1019
- * When this invitation was created
1049
+ * Customer party display name, when known
1020
1050
  */
1021
- createdAt: string;
1051
+ name: string | null;
1022
1052
 
1023
1053
  /**
1024
- * When this invitation was declined
1054
+ * Permissions granted or requested for this agent
1025
1055
  */
1026
- declinedAt: string | null;
1056
+ permissions: Array<string>;
1027
1057
 
1028
1058
  /**
1029
- * Display name of the developer party
1059
+ * Current agent-customer relationship status
1030
1060
  */
1031
- developerName: string;
1061
+ status: 'ACTIVE' | 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED' | 'REVOKED';
1032
1062
 
1033
1063
  /**
1034
- * Status after applying expiry and cancel-reason overlays
1064
+ * When this agent-customer relationship was last updated
1035
1065
  */
1036
- effectiveStatus: 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED';
1066
+ updatedAt: string | null;
1067
+ }
1037
1068
 
1069
+ export namespace Attributes {
1038
1070
  /**
1039
- * Customer email the invitation was sent to
1071
+ * Per-agent customer transaction limits
1040
1072
  */
1041
- email: string;
1073
+ export interface Limits {
1074
+ /**
1075
+ * Per-transaction cap, integer cents (USD).
1076
+ */
1077
+ perTransaction?: number | null;
1078
+ }
1079
+ }
1042
1080
 
1081
+ /**
1082
+ * Related agent details
1083
+ */
1084
+ export interface Relationships {
1043
1085
  /**
1044
- * When this invitation expires
1086
+ * Agent attached to this customer
1045
1087
  */
1046
- expiresAt: string;
1088
+ agent: Relationships.Agent;
1089
+ }
1047
1090
 
1091
+ export namespace Relationships {
1048
1092
  /**
1049
- * Per-agent transaction limits
1093
+ * Agent attached to this customer
1094
+ */
1095
+ export interface Agent {
1096
+ data: Agent.Data;
1097
+ }
1098
+
1099
+ export namespace Agent {
1100
+ export interface Data {
1101
+ /**
1102
+ * Agent ID (agt\_\*)
1103
+ */
1104
+ id: string;
1105
+
1106
+ /**
1107
+ * Agent attributes
1108
+ */
1109
+ attributes: Data.Attributes;
1110
+
1111
+ /**
1112
+ * Resource type
1113
+ */
1114
+ type: string;
1115
+ }
1116
+
1117
+ export namespace Data {
1118
+ /**
1119
+ * Agent attributes
1120
+ */
1121
+ export interface Attributes {
1122
+ /**
1123
+ * Agent display name
1124
+ */
1125
+ name: string | null;
1126
+ }
1127
+ }
1128
+ }
1129
+ }
1130
+ }
1131
+ }
1132
+
1133
+ export interface AgentListCustomersResponse {
1134
+ data: Array<AgentListCustomersResponse.Data>;
1135
+
1136
+ meta: AgentListCustomersResponse.Meta;
1137
+ }
1138
+
1139
+ export namespace AgentListCustomersResponse {
1140
+ export interface Data {
1141
+ /**
1142
+ * Customer party ID when known; otherwise the lowercased customer email
1143
+ */
1144
+ id: string;
1145
+
1146
+ /**
1147
+ * Customer party and invitation attributes
1148
+ */
1149
+ attributes: Data.Attributes;
1150
+
1151
+ /**
1152
+ * Related agent details
1153
+ */
1154
+ relationships: Data.Relationships;
1155
+
1156
+ /**
1157
+ * Resource type
1158
+ */
1159
+ type: string;
1160
+ }
1161
+
1162
+ export namespace Data {
1163
+ /**
1164
+ * Customer party and invitation attributes
1165
+ */
1166
+ export interface Attributes {
1167
+ /**
1168
+ * When this agent-customer relationship was created
1169
+ */
1170
+ createdAt: string;
1171
+
1172
+ /**
1173
+ * Customer email, when known
1174
+ */
1175
+ email: string | null;
1176
+
1177
+ /**
1178
+ * Per-agent customer transaction limits
1050
1179
  */
1051
1180
  limits: Attributes.Limits | null;
1052
1181
 
1053
1182
  /**
1054
- * Permissions the agent will hold on accept
1183
+ * Customer party display name, when known
1184
+ */
1185
+ name: string | null;
1186
+
1187
+ /**
1188
+ * Permissions granted or requested for this agent
1055
1189
  */
1056
1190
  permissions: Array<string>;
1057
1191
 
1058
1192
  /**
1059
- * Raw persisted status
1193
+ * Current agent-customer relationship status
1060
1194
  */
1061
- status: 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED';
1195
+ status: 'ACTIVE' | 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED' | 'REVOKED';
1062
1196
 
1063
1197
  /**
1064
- * When this invitation was last updated
1198
+ * When this agent-customer relationship was last updated
1065
1199
  */
1066
- updatedAt: string;
1200
+ updatedAt: string | null;
1067
1201
  }
1068
1202
 
1069
1203
  export namespace Attributes {
1070
1204
  /**
1071
- * Per-agent transaction limits
1205
+ * Per-agent customer transaction limits
1072
1206
  */
1073
1207
  export interface Limits {
1074
1208
  /**
@@ -1079,126 +1213,51 @@ export namespace AgentListInvitationsForDeveloperResponse {
1079
1213
  }
1080
1214
 
1081
1215
  /**
1082
- * Related resource identifiers
1216
+ * Related agent details
1083
1217
  */
1084
1218
  export interface Relationships {
1085
1219
  /**
1086
- * Agent being delegated
1220
+ * Agent attached to this customer
1087
1221
  */
1088
1222
  agent: Relationships.Agent;
1089
-
1090
- /**
1091
- * Resulting agent delegation once accepted; currently null on public create/list
1092
- * responses
1093
- */
1094
- agentDelegation: Relationships.AgentDelegation;
1095
-
1096
- /**
1097
- * Customer party the invitation was accepted on (null until accept)
1098
- */
1099
- customerParty: Relationships.CustomerParty;
1100
-
1101
- /**
1102
- * Developer party that issued the invitation
1103
- */
1104
- developerParty: Relationships.DeveloperParty;
1105
1223
  }
1106
1224
 
1107
1225
  export namespace Relationships {
1108
1226
  /**
1109
- * Agent being delegated
1227
+ * Agent attached to this customer
1110
1228
  */
1111
1229
  export interface Agent {
1112
- /**
1113
- * Related resource identifier
1114
- */
1115
1230
  data: Agent.Data;
1116
1231
  }
1117
1232
 
1118
1233
  export namespace Agent {
1119
- /**
1120
- * Related resource identifier
1121
- */
1122
1234
  export interface Data {
1123
- id: string;
1124
-
1125
1235
  /**
1126
- * Resource type
1236
+ * Agent ID (agt\_\*)
1127
1237
  */
1128
- type: string;
1129
- }
1130
- }
1131
-
1132
- /**
1133
- * Resulting agent delegation once accepted; currently null on public create/list
1134
- * responses
1135
- */
1136
- export interface AgentDelegation {
1137
- /**
1138
- * Related resource identifier
1139
- */
1140
- data: AgentDelegation.Data | null;
1141
- }
1142
-
1143
- export namespace AgentDelegation {
1144
- /**
1145
- * Related resource identifier
1146
- */
1147
- export interface Data {
1148
1238
  id: string;
1149
1239
 
1150
1240
  /**
1151
- * Resource type
1241
+ * Agent attributes
1152
1242
  */
1153
- type: string;
1154
- }
1155
- }
1156
-
1157
- /**
1158
- * Customer party the invitation was accepted on (null until accept)
1159
- */
1160
- export interface CustomerParty {
1161
- /**
1162
- * Related resource identifier
1163
- */
1164
- data: CustomerParty.Data | null;
1165
- }
1166
-
1167
- export namespace CustomerParty {
1168
- /**
1169
- * Related resource identifier
1170
- */
1171
- export interface Data {
1172
- id: string;
1243
+ attributes: Data.Attributes;
1173
1244
 
1174
1245
  /**
1175
1246
  * Resource type
1176
1247
  */
1177
1248
  type: string;
1178
1249
  }
1179
- }
1180
-
1181
- /**
1182
- * Developer party that issued the invitation
1183
- */
1184
- export interface DeveloperParty {
1185
- /**
1186
- * Related resource identifier
1187
- */
1188
- data: DeveloperParty.Data;
1189
- }
1190
-
1191
- export namespace DeveloperParty {
1192
- /**
1193
- * Related resource identifier
1194
- */
1195
- export interface Data {
1196
- id: string;
1197
1250
 
1251
+ export namespace Data {
1198
1252
  /**
1199
- * Resource type
1253
+ * Agent attributes
1200
1254
  */
1201
- type: string;
1255
+ export interface Attributes {
1256
+ /**
1257
+ * Agent display name
1258
+ */
1259
+ name: string | null;
1260
+ }
1202
1261
  }
1203
1262
  }
1204
1263
  }
@@ -1341,6 +1400,147 @@ export namespace AgentRemoveResponse {
1341
1400
  }
1342
1401
  }
1343
1402
 
1403
+ export interface AgentRemoveCustomerResponse {
1404
+ data: AgentRemoveCustomerResponse.Data;
1405
+
1406
+ meta: AgentRemoveCustomerResponse.Meta;
1407
+ }
1408
+
1409
+ export namespace AgentRemoveCustomerResponse {
1410
+ export interface Data {
1411
+ /**
1412
+ * Customer party ID when known; otherwise the lowercased customer email
1413
+ */
1414
+ id: string;
1415
+
1416
+ /**
1417
+ * Customer party and invitation attributes
1418
+ */
1419
+ attributes: Data.Attributes;
1420
+
1421
+ /**
1422
+ * Related agent details
1423
+ */
1424
+ relationships: Data.Relationships;
1425
+
1426
+ /**
1427
+ * Resource type
1428
+ */
1429
+ type: string;
1430
+ }
1431
+
1432
+ export namespace Data {
1433
+ /**
1434
+ * Customer party and invitation attributes
1435
+ */
1436
+ export interface Attributes {
1437
+ /**
1438
+ * When this agent-customer relationship was created
1439
+ */
1440
+ createdAt: string;
1441
+
1442
+ /**
1443
+ * Customer email, when known
1444
+ */
1445
+ email: string | null;
1446
+
1447
+ /**
1448
+ * Per-agent customer transaction limits
1449
+ */
1450
+ limits: Attributes.Limits | null;
1451
+
1452
+ /**
1453
+ * Customer party display name, when known
1454
+ */
1455
+ name: string | null;
1456
+
1457
+ /**
1458
+ * Permissions granted or requested for this agent
1459
+ */
1460
+ permissions: Array<string>;
1461
+
1462
+ /**
1463
+ * Current agent-customer relationship status
1464
+ */
1465
+ status: 'ACTIVE' | 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED' | 'REVOKED';
1466
+
1467
+ /**
1468
+ * When this agent-customer relationship was last updated
1469
+ */
1470
+ updatedAt: string | null;
1471
+ }
1472
+
1473
+ export namespace Attributes {
1474
+ /**
1475
+ * Per-agent customer transaction limits
1476
+ */
1477
+ export interface Limits {
1478
+ /**
1479
+ * Per-transaction cap, integer cents (USD).
1480
+ */
1481
+ perTransaction?: number | null;
1482
+ }
1483
+ }
1484
+
1485
+ /**
1486
+ * Related agent details
1487
+ */
1488
+ export interface Relationships {
1489
+ /**
1490
+ * Agent attached to this customer
1491
+ */
1492
+ agent: Relationships.Agent;
1493
+ }
1494
+
1495
+ export namespace Relationships {
1496
+ /**
1497
+ * Agent attached to this customer
1498
+ */
1499
+ export interface Agent {
1500
+ data: Agent.Data;
1501
+ }
1502
+
1503
+ export namespace Agent {
1504
+ export interface Data {
1505
+ /**
1506
+ * Agent ID (agt\_\*)
1507
+ */
1508
+ id: string;
1509
+
1510
+ /**
1511
+ * Agent attributes
1512
+ */
1513
+ attributes: Data.Attributes;
1514
+
1515
+ /**
1516
+ * Resource type
1517
+ */
1518
+ type: string;
1519
+ }
1520
+
1521
+ export namespace Data {
1522
+ /**
1523
+ * Agent attributes
1524
+ */
1525
+ export interface Attributes {
1526
+ /**
1527
+ * Agent display name
1528
+ */
1529
+ name: string | null;
1530
+ }
1531
+ }
1532
+ }
1533
+ }
1534
+ }
1535
+
1536
+ export interface Meta {
1537
+ /**
1538
+ * Indicates the resource was deleted
1539
+ */
1540
+ deleted: true;
1541
+ }
1542
+ }
1543
+
1344
1544
  export interface AgentCreateParams {
1345
1545
  /**
1346
1546
  * Body param: Agent display name
@@ -1462,16 +1662,16 @@ export interface AgentListParams {
1462
1662
  'X-Instance-ID'?: string;
1463
1663
  }
1464
1664
 
1465
- export interface AgentCreateInvitationsParams {
1665
+ export interface AgentCreateCustomerParams {
1466
1666
  /**
1467
- * Body param: Per-agent delegation requests (1-50)
1667
+ * Body param: Permissions to request
1468
1668
  */
1469
- agents: Array<AgentCreateInvitationsParams.Agent>;
1669
+ permissions: Array<string>;
1470
1670
 
1471
1671
  /**
1472
- * Body param: Email address of the customer to invite
1672
+ * Body param: Customer recipients to invite (1-50)
1473
1673
  */
1474
- customerEmail: string;
1674
+ recipients: Array<AgentCreateCustomerParams.UnionMember0 | AgentCreateCustomerParams.UnionMember1>;
1475
1675
 
1476
1676
  /**
1477
1677
  * Header param: Unique key for idempotent request handling. If a request with the
@@ -1484,6 +1684,11 @@ export interface AgentCreateInvitationsParams {
1484
1684
  */
1485
1685
  expiresAt?: string;
1486
1686
 
1687
+ /**
1688
+ * Body param: Optional per-transaction limit
1689
+ */
1690
+ limits?: AgentCreateCustomerParams.Limits;
1691
+
1487
1692
  /**
1488
1693
  * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1489
1694
  */
@@ -1496,22 +1701,33 @@ export interface AgentCreateInvitationsParams {
1496
1701
  'X-Instance-ID'?: string;
1497
1702
  }
1498
1703
 
1499
- export namespace AgentCreateInvitationsParams {
1500
- export interface Agent {
1501
- agentId: string;
1704
+ export namespace AgentCreateCustomerParams {
1705
+ export interface UnionMember0 {
1706
+ type: string;
1502
1707
 
1503
- permissions: Array<string>;
1708
+ /**
1709
+ * Email address
1710
+ */
1711
+ value: string;
1712
+ }
1504
1713
 
1505
- limits?: Agent.Limits;
1714
+ export interface UnionMember1 {
1715
+ type: string;
1716
+
1717
+ /**
1718
+ * Phone number in E.164 format
1719
+ */
1720
+ value: string;
1506
1721
  }
1507
1722
 
1508
- export namespace Agent {
1509
- export interface Limits {
1510
- /**
1511
- * Per-transaction cap, integer cents (USD).
1512
- */
1513
- perTransaction?: number | null;
1514
- }
1723
+ /**
1724
+ * Optional per-transaction limit
1725
+ */
1726
+ export interface Limits {
1727
+ /**
1728
+ * Per-transaction cap, integer cents (USD).
1729
+ */
1730
+ perTransaction?: number | null;
1515
1731
  }
1516
1732
  }
1517
1733
 
@@ -1528,31 +1744,34 @@ export interface AgentGetParams {
1528
1744
  'X-Instance-ID'?: string;
1529
1745
  }
1530
1746
 
1531
- export interface AgentListInvitationsForDeveloperParams {
1747
+ export interface AgentGetCustomerParams {
1532
1748
  /**
1533
- * Query param
1749
+ * Path param: Agent ID
1534
1750
  */
1535
- agentId?: string;
1751
+ agentId: string;
1536
1752
 
1537
1753
  /**
1538
- * Query param
1754
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1539
1755
  */
1540
- cursor?: string;
1756
+ 'X-Agent-ID'?: string;
1541
1757
 
1542
1758
  /**
1543
- * Query param
1759
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1760
+ * for agent observability.
1544
1761
  */
1545
- customerEmail?: string;
1762
+ 'X-Instance-ID'?: string;
1763
+ }
1546
1764
 
1765
+ export interface AgentListCustomersParams {
1547
1766
  /**
1548
1767
  * Query param
1549
1768
  */
1550
- limit?: number;
1769
+ cursor?: string;
1551
1770
 
1552
1771
  /**
1553
1772
  * Query param
1554
1773
  */
1555
- status?: Array<'PENDING' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELLED'>;
1774
+ limit?: number;
1556
1775
 
1557
1776
  /**
1558
1777
  * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
@@ -1585,21 +1804,49 @@ export interface AgentRemoveParams {
1585
1804
  'X-Instance-ID'?: string;
1586
1805
  }
1587
1806
 
1807
+ export interface AgentRemoveCustomerParams {
1808
+ /**
1809
+ * Path param: Agent ID
1810
+ */
1811
+ agentId: string;
1812
+
1813
+ /**
1814
+ * Header param: Unique key for idempotent request handling. If a request with the
1815
+ * same key was already processed, the original response is returned.
1816
+ */
1817
+ 'Idempotency-Key': string;
1818
+
1819
+ /**
1820
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1821
+ */
1822
+ 'X-Agent-ID'?: string;
1823
+
1824
+ /**
1825
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1826
+ * for agent observability.
1827
+ */
1828
+ 'X-Instance-ID'?: string;
1829
+ }
1830
+
1588
1831
  export declare namespace Agents {
1589
1832
  export {
1590
1833
  type AgentCreateResponse as AgentCreateResponse,
1591
1834
  type AgentUpdateResponse as AgentUpdateResponse,
1592
1835
  type AgentListResponse as AgentListResponse,
1593
- type AgentCreateInvitationsResponse as AgentCreateInvitationsResponse,
1836
+ type AgentCreateCustomerResponse as AgentCreateCustomerResponse,
1594
1837
  type AgentGetResponse as AgentGetResponse,
1595
- type AgentListInvitationsForDeveloperResponse as AgentListInvitationsForDeveloperResponse,
1838
+ type AgentGetCustomerResponse as AgentGetCustomerResponse,
1839
+ type AgentListCustomersResponse as AgentListCustomersResponse,
1596
1840
  type AgentRemoveResponse as AgentRemoveResponse,
1841
+ type AgentRemoveCustomerResponse as AgentRemoveCustomerResponse,
1597
1842
  type AgentCreateParams as AgentCreateParams,
1598
1843
  type AgentUpdateParams as AgentUpdateParams,
1599
1844
  type AgentListParams as AgentListParams,
1600
- type AgentCreateInvitationsParams as AgentCreateInvitationsParams,
1845
+ type AgentCreateCustomerParams as AgentCreateCustomerParams,
1601
1846
  type AgentGetParams as AgentGetParams,
1602
- type AgentListInvitationsForDeveloperParams as AgentListInvitationsForDeveloperParams,
1847
+ type AgentGetCustomerParams as AgentGetCustomerParams,
1848
+ type AgentListCustomersParams as AgentListCustomersParams,
1603
1849
  type AgentRemoveParams as AgentRemoveParams,
1850
+ type AgentRemoveCustomerParams as AgentRemoveCustomerParams,
1604
1851
  };
1605
1852
  }