@talqing/sdk 0.2.0 → 0.3.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 (44) hide show
  1. package/README.md +66 -5
  2. package/dist/cjs/browser.d.ts +5 -0
  3. package/dist/cjs/browser.d.ts.map +1 -1
  4. package/dist/cjs/browser.js +30 -28
  5. package/dist/cjs/browser.js.map +1 -1
  6. package/dist/cjs/client.d.ts +0 -2
  7. package/dist/cjs/client.d.ts.map +1 -1
  8. package/dist/cjs/client.js +0 -3
  9. package/dist/cjs/client.js.map +1 -1
  10. package/dist/cjs/gen/index.d.ts +1 -1
  11. package/dist/cjs/gen/index.d.ts.map +1 -1
  12. package/dist/cjs/gen/sdk.gen.d.ts +50 -219
  13. package/dist/cjs/gen/sdk.gen.d.ts.map +1 -1
  14. package/dist/cjs/gen/sdk.gen.js +78 -418
  15. package/dist/cjs/gen/sdk.gen.js.map +1 -1
  16. package/dist/cjs/gen/types.gen.d.ts +293 -1013
  17. package/dist/cjs/gen/types.gen.d.ts.map +1 -1
  18. package/dist/cjs/vocabulary.d.ts +1 -4
  19. package/dist/cjs/vocabulary.d.ts.map +1 -1
  20. package/dist/esm/browser.d.ts +5 -0
  21. package/dist/esm/browser.d.ts.map +1 -1
  22. package/dist/esm/browser.js +30 -28
  23. package/dist/esm/browser.js.map +1 -1
  24. package/dist/esm/client.d.ts +0 -2
  25. package/dist/esm/client.d.ts.map +1 -1
  26. package/dist/esm/client.js +0 -3
  27. package/dist/esm/client.js.map +1 -1
  28. package/dist/esm/gen/index.d.ts +1 -1
  29. package/dist/esm/gen/index.d.ts.map +1 -1
  30. package/dist/esm/gen/sdk.gen.d.ts +50 -219
  31. package/dist/esm/gen/sdk.gen.d.ts.map +1 -1
  32. package/dist/esm/gen/sdk.gen.js +75 -412
  33. package/dist/esm/gen/sdk.gen.js.map +1 -1
  34. package/dist/esm/gen/types.gen.d.ts +293 -1013
  35. package/dist/esm/gen/types.gen.d.ts.map +1 -1
  36. package/dist/esm/vocabulary.d.ts +1 -4
  37. package/dist/esm/vocabulary.d.ts.map +1 -1
  38. package/package.json +5 -5
  39. package/src/browser.tsx +31 -28
  40. package/src/client.ts +0 -6
  41. package/src/gen/index.ts +1 -1
  42. package/src/gen/sdk.gen.ts +88 -469
  43. package/src/gen/types.gen.ts +317 -1119
  44. package/src/vocabulary.ts +0 -5
@@ -251,28 +251,78 @@ export class Agents extends HeyApiClient {
251
251
  return this._versions ?? (this._versions = new Versions({ client: this.client }));
252
252
  }
253
253
  }
254
- export class Auth extends HeyApiClient {
254
+ export class Credits extends HeyApiClient {
255
255
  /**
256
- * Logout
256
+ * Get Credits
257
+ *
258
+ * This workspace's credit balance in this region, what it buys, and what a
259
+ * top-up costs.
260
+ *
261
+ * Readable by every role: a VIEWER can start a web call, so a VIEWER must be
262
+ * able to see why one was refused.
263
+ *
264
+ * This is also where credit the control plane could not deliver lands. Anything
265
+ * it has issued for this workspace here — a purchase, a signup grant, a
266
+ * reversal — that this region has not written yet is applied before the balance
267
+ * is read. That is the backstop for a failed push, and it is a reconcile on
268
+ * demand rather than a timer: the moment someone cares is the moment this page
269
+ * loads, whether they arrived from the payment processor or from the "out of
270
+ * credits" banner. It costs nothing when there is nothing to apply, which is
271
+ * almost always.
257
272
  */
258
- logout(options) {
259
- return (options?.client ?? this.client).post({
273
+ get(parameters, options) {
274
+ const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'topup' }] }]);
275
+ return (options?.client ?? this.client).get({
260
276
  responseStyle: 'data',
261
- url: '/v1/auth/logout',
262
- ...options
277
+ security: [{ scheme: 'bearer', type: 'http' }, {
278
+ in: 'cookie',
279
+ name: 'talqing_session',
280
+ type: 'apiKey'
281
+ }],
282
+ url: '/v1/billing/credits',
283
+ ...options,
284
+ ...params
263
285
  });
264
286
  }
265
287
  /**
266
- * Me
288
+ * Create Credit Checkout
289
+ *
290
+ * Start a credit purchase and return the hosted checkout URL to open.
267
291
  *
268
- * Who this credential is: the signed-in user, their role, and the organization.
292
+ * Organization admins only spending the workspace's money is an admin act,
293
+ * the same as storing a secret or a provider key.
269
294
  *
270
- * Everything else you can reach is scoped to that organization, and `role`
271
- * (`ADMIN`, `EDITOR` or `VIEWER`) decides whether writes will be accepted. A
272
- * user may belong to several organizations with a different role in each; this
273
- * reports the one this credential is for.
295
+ * The credit lands in THIS region, and that is decided by which region's API
296
+ * you called rather than by anything in the request. A slug in a body could be
297
+ * pointed at the other region, where the money would then be stuck: balances
298
+ * are per region and there is no transfer between them.
274
299
  */
275
- me(options) {
300
+ checkout(parameters, options) {
301
+ const params = buildClientParams([parameters], [{ args: [{ key: 'creditCheckoutRequest', map: 'body' }] }]);
302
+ return (options?.client ?? this.client).post({
303
+ responseStyle: 'data',
304
+ security: [{ scheme: 'bearer', type: 'http' }, {
305
+ in: 'cookie',
306
+ name: 'talqing_session',
307
+ type: 'apiKey'
308
+ }],
309
+ url: '/v1/billing/credits/checkout',
310
+ ...options,
311
+ ...params,
312
+ headers: {
313
+ 'Content-Type': 'application/json',
314
+ ...options?.headers,
315
+ ...params.headers
316
+ }
317
+ });
318
+ }
319
+ /**
320
+ * List Credit Ledger
321
+ *
322
+ * Every movement of this region's balance, newest first, with what caused each.
323
+ */
324
+ ledger(parameters, options) {
325
+ const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
276
326
  return (options?.client ?? this.client).get({
277
327
  responseStyle: 'data',
278
328
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -280,11 +330,17 @@ export class Auth extends HeyApiClient {
280
330
  name: 'talqing_session',
281
331
  type: 'apiKey'
282
332
  }],
283
- url: '/v1/auth/me',
284
- ...options
333
+ url: '/v1/billing/credits/ledger',
334
+ ...options,
335
+ ...params
285
336
  });
286
337
  }
287
338
  }
339
+ export class Billing extends HeyApiClient {
340
+ get credits() {
341
+ return this._credits ?? (this._credits = new Credits({ client: this.client }));
342
+ }
343
+ }
288
344
  export class ProviderKeys extends HeyApiClient {
289
345
  /**
290
346
  * List Provider Keys
@@ -2654,113 +2710,6 @@ export class Knowledge2 extends HeyApiClient {
2654
2710
  return this._pages ?? (this._pages = new Pages({ client: this.client }));
2655
2711
  }
2656
2712
  }
2657
- export class Tokens extends HeyApiClient {
2658
- /**
2659
- * Mcp Token
2660
- *
2661
- * This user's MCP token, in plaintext, with the API URL to pair it with.
2662
- *
2663
- * Unlike a token created by hand, this one can be read whenever it is needed:
2664
- * the dashboard renders it into ready-to-paste MCP configuration for Claude
2665
- * Code, Codex and Grok. The value is re-derived from the token's row, not
2666
- * stored, and is the same string every time — so a configuration a user
2667
- * already saved keeps working.
2668
- *
2669
- * It is always the caller's own token, never anyone else's, and is created on
2670
- * the spot for a user who somehow has none. Delete it from the tokens list to
2671
- * revoke it; the next call issues a new one, which rotates the credential.
2672
- */
2673
- mcp(options) {
2674
- return (options?.client ?? this.client).get({
2675
- responseStyle: 'data',
2676
- security: [{ scheme: 'bearer', type: 'http' }, {
2677
- in: 'cookie',
2678
- name: 'talqing_session',
2679
- type: 'apiKey'
2680
- }],
2681
- url: '/v1/mcp-token',
2682
- ...options
2683
- });
2684
- }
2685
- /**
2686
- * List Tokens
2687
- *
2688
- * List personal access tokens: your own, or every one in the organization
2689
- * if you are an admin.
2690
- *
2691
- * Who holds which credential is organization-admin information, so an EDITOR
2692
- * or VIEWER sees only what they created. Plaintext token values are never
2693
- * returned. A token with `kind: mcp` was issued automatically for the
2694
- * dashboard's MCP setup; the rest were created by hand.
2695
- */
2696
- list(parameters, options) {
2697
- const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
2698
- return (options?.client ?? this.client).get({
2699
- responseStyle: 'data',
2700
- security: [{ scheme: 'bearer', type: 'http' }, {
2701
- in: 'cookie',
2702
- name: 'talqing_session',
2703
- type: 'apiKey'
2704
- }],
2705
- url: '/v1/tokens',
2706
- ...options,
2707
- ...params
2708
- });
2709
- }
2710
- /**
2711
- * Create Token
2712
- *
2713
- * Create a personal access token for driving this API without the dashboard.
2714
- *
2715
- * The token authenticates as its creator and acts with that user's live role,
2716
- * so it can never do more than they can. It does not expire; deleting it is
2717
- * the revocation. The plaintext value is returned once here and never again —
2718
- * treat it like a password and do not echo it back into a conversation.
2719
- */
2720
- create(parameters, options) {
2721
- const params = buildClientParams([parameters], [{ args: [{ key: 'createTokenRequest', map: 'body' }] }]);
2722
- return (options?.client ?? this.client).post({
2723
- responseStyle: 'data',
2724
- security: [{ scheme: 'bearer', type: 'http' }, {
2725
- in: 'cookie',
2726
- name: 'talqing_session',
2727
- type: 'apiKey'
2728
- }],
2729
- url: '/v1/tokens',
2730
- ...options,
2731
- ...params,
2732
- headers: {
2733
- 'Content-Type': 'application/json',
2734
- ...options?.headers,
2735
- ...params.headers
2736
- }
2737
- });
2738
- }
2739
- /**
2740
- * Delete Token
2741
- *
2742
- * Revoke a token immediately and permanently.
2743
- *
2744
- * Owners can delete their own; organization admins can delete any in the
2745
- * organization. Deleting an `mcp` token rotates it: the owner's next dashboard
2746
- * visit issues a replacement, and anything still configured with the old one
2747
- * stops working.
2748
- */
2749
- delete(parameters, options) {
2750
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'token_id' }] }]);
2751
- return (options?.client ?? this.client).delete({
2752
- responseStyle: 'data',
2753
- security: [{ scheme: 'bearer', type: 'http' }, {
2754
- in: 'cookie',
2755
- name: 'talqing_session',
2756
- type: 'apiKey'
2757
- }],
2758
- url: '/v1/tokens/{token_id}',
2759
- ...options,
2760
- ...params
2761
- });
2762
- }
2763
- }
2764
2713
  export class Observability extends HeyApiClient {
2765
2714
  /**
2766
2715
  * Get Observability
@@ -2802,286 +2751,6 @@ export class Observability extends HeyApiClient {
2802
2751
  });
2803
2752
  }
2804
2753
  }
2805
- export class Invites extends HeyApiClient {
2806
- /**
2807
- * List Invites
2808
- *
2809
- * Invites waiting on a first login. Accepted and revoked ones drop off the
2810
- * list — an accepted invite is a member, and belongs on the roster instead.
2811
- */
2812
- list(parameters, options) {
2813
- const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
2814
- return (options?.client ?? this.client).get({
2815
- responseStyle: 'data',
2816
- security: [{ scheme: 'bearer', type: 'http' }, {
2817
- in: 'cookie',
2818
- name: 'talqing_session',
2819
- type: 'apiKey'
2820
- }],
2821
- url: '/v1/org/invites',
2822
- ...options,
2823
- ...params
2824
- });
2825
- }
2826
- /**
2827
- * Create Invite
2828
- *
2829
- * Invite an email address into this organization with a role.
2830
- *
2831
- * There is no invite link and no accept step: the invite is keyed to a Google
2832
- * identity, so signing in with that address *is* the check. Someone who
2833
- * already has an account joins immediately; anyone else joins the first time
2834
- * they sign in.
2835
- *
2836
- * No email is sent at MVP, so an existing user finds out by seeing the
2837
- * organization appear in their switcher — tell them yourself.
2838
- */
2839
- create(parameters, options) {
2840
- const params = buildClientParams([parameters], [{ args: [{ key: 'inviteRequest', map: 'body' }] }]);
2841
- return (options?.client ?? this.client).post({
2842
- responseStyle: 'data',
2843
- security: [{ scheme: 'bearer', type: 'http' }, {
2844
- in: 'cookie',
2845
- name: 'talqing_session',
2846
- type: 'apiKey'
2847
- }],
2848
- url: '/v1/org/invites',
2849
- ...options,
2850
- ...params,
2851
- headers: {
2852
- 'Content-Type': 'application/json',
2853
- ...options?.headers,
2854
- ...params.headers
2855
- }
2856
- });
2857
- }
2858
- /**
2859
- * Revoke Invite
2860
- *
2861
- * Withdraw a pending invite, so signing in with that address no longer
2862
- * joins this organization.
2863
- */
2864
- revoke(parameters, options) {
2865
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'invite_id' }] }]);
2866
- return (options?.client ?? this.client).delete({
2867
- responseStyle: 'data',
2868
- security: [{ scheme: 'bearer', type: 'http' }, {
2869
- in: 'cookie',
2870
- name: 'talqing_session',
2871
- type: 'apiKey'
2872
- }],
2873
- url: '/v1/org/invites/{invite_id}',
2874
- ...options,
2875
- ...params
2876
- });
2877
- }
2878
- }
2879
- export class Members extends HeyApiClient {
2880
- /**
2881
- * List Members
2882
- *
2883
- * Every member sees the roster; only an ADMIN can change it.
2884
- */
2885
- list(parameters, options) {
2886
- const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
2887
- return (options?.client ?? this.client).get({
2888
- responseStyle: 'data',
2889
- security: [{ scheme: 'bearer', type: 'http' }, {
2890
- in: 'cookie',
2891
- name: 'talqing_session',
2892
- type: 'apiKey'
2893
- }],
2894
- url: '/v1/org/members',
2895
- ...options,
2896
- ...params
2897
- });
2898
- }
2899
- /**
2900
- * Remove Member
2901
- *
2902
- * Remove someone from this organization.
2903
- *
2904
- * They lose access on their next request, and their access tokens for this
2905
- * organization stop working with them. Nothing they created is deleted.
2906
- *
2907
- * Allowed even when this is the only organization they belong to — whether
2908
- * they have somewhere else to go is not this organization's problem, and their
2909
- * next sign-in gives them one of their own.
2910
- */
2911
- remove(parameters, options) {
2912
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'user_id' }] }]);
2913
- return (options?.client ?? this.client).delete({
2914
- responseStyle: 'data',
2915
- security: [{ scheme: 'bearer', type: 'http' }, {
2916
- in: 'cookie',
2917
- name: 'talqing_session',
2918
- type: 'apiKey'
2919
- }],
2920
- url: '/v1/org/members/{user_id}',
2921
- ...options,
2922
- ...params
2923
- });
2924
- }
2925
- /**
2926
- * Set Member Role
2927
- *
2928
- * Change a member's role. Takes effect on their very next request.
2929
- */
2930
- setRole(parameters, options) {
2931
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'user_id' }, { key: 'roleRequest', map: 'body' }] }]);
2932
- return (options?.client ?? this.client).patch({
2933
- responseStyle: 'data',
2934
- security: [{ scheme: 'bearer', type: 'http' }, {
2935
- in: 'cookie',
2936
- name: 'talqing_session',
2937
- type: 'apiKey'
2938
- }],
2939
- url: '/v1/org/members/{user_id}',
2940
- ...options,
2941
- ...params,
2942
- headers: {
2943
- 'Content-Type': 'application/json',
2944
- ...options?.headers,
2945
- ...params.headers
2946
- }
2947
- });
2948
- }
2949
- }
2950
- export class Orgs extends HeyApiClient {
2951
- /**
2952
- * Patch Org
2953
- *
2954
- * Change this organization's name or its data retention policy.
2955
- *
2956
- * The name is display only — nothing keys on it.
2957
- *
2958
- * `retention_days` is how long call and conversation *content* is kept:
2959
- * recordings, transcripts, summaries, extracted fields and the phone numbers
2960
- * on a call. When it passes, all of that is deleted and the call itself
2961
- * remains, with its duration, outcome and cost, so past invoices still
2962
- * resolve. `null` keeps everything forever, which is the default.
2963
- *
2964
- * It applies to calls from now on: a call already in the system keeps the
2965
- * deadline it was given when it ended, so shortening the policy never
2966
- * retroactively destroys anything. Erasing a contact's last call also resets
2967
- * what your agents remember about that person.
2968
- */
2969
- update(parameters, options) {
2970
- const params = buildClientParams([parameters], [{ args: [{ key: 'patchOrgRequest', map: 'body' }] }]);
2971
- return (options?.client ?? this.client).patch({
2972
- responseStyle: 'data',
2973
- security: [{ scheme: 'bearer', type: 'http' }, {
2974
- in: 'cookie',
2975
- name: 'talqing_session',
2976
- type: 'apiKey'
2977
- }],
2978
- url: '/v1/org',
2979
- ...options,
2980
- ...params,
2981
- headers: {
2982
- 'Content-Type': 'application/json',
2983
- ...options?.headers,
2984
- ...params.headers
2985
- }
2986
- });
2987
- }
2988
- /**
2989
- * Leave Org
2990
- *
2991
- * Leave this organization. Any member may, including an admin who has
2992
- * promoted a successor. Nothing they created is deleted.
2993
- */
2994
- leave(options) {
2995
- return (options?.client ?? this.client).post({
2996
- responseStyle: 'data',
2997
- security: [{ scheme: 'bearer', type: 'http' }, {
2998
- in: 'cookie',
2999
- name: 'talqing_session',
3000
- type: 'apiKey'
3001
- }],
3002
- url: '/v1/org/leave',
3003
- ...options
3004
- });
3005
- }
3006
- /**
3007
- * List Orgs
3008
- *
3009
- * Every organization the signed-in user belongs to, with their role in each.
3010
- *
3011
- * Newest membership first, deliberately: an admin can add you to their
3012
- * organization without you being asked or emailed, so the one you did not know
3013
- * about is the one that needs to be visible.
3014
- */
3015
- list(parameters, options) {
3016
- const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
3017
- return (options?.client ?? this.client).get({
3018
- responseStyle: 'data',
3019
- security: [{ scheme: 'bearer', type: 'http' }, {
3020
- in: 'cookie',
3021
- name: 'talqing_session',
3022
- type: 'apiKey'
3023
- }],
3024
- url: '/v1/orgs',
3025
- ...options,
3026
- ...params
3027
- });
3028
- }
3029
- /**
3030
- * Create Org
3031
- *
3032
- * Create a new, empty organization with the caller as its ADMIN.
3033
- *
3034
- * Any member can do this — it grants nothing in the organization they are
3035
- * currently in. Switch into it to start working there.
3036
- */
3037
- create(parameters, options) {
3038
- const params = buildClientParams([parameters], [{ args: [{ key: 'orgNameRequest', map: 'body' }] }]);
3039
- return (options?.client ?? this.client).post({
3040
- responseStyle: 'data',
3041
- security: [{ scheme: 'bearer', type: 'http' }, {
3042
- in: 'cookie',
3043
- name: 'talqing_session',
3044
- type: 'apiKey'
3045
- }],
3046
- url: '/v1/orgs',
3047
- ...options,
3048
- ...params,
3049
- headers: {
3050
- 'Content-Type': 'application/json',
3051
- ...options?.headers,
3052
- ...params.headers
3053
- }
3054
- });
3055
- }
3056
- /**
3057
- * Switch Org
3058
- *
3059
- * Point the dashboard session at another of the caller's organizations.
3060
- *
3061
- * The session cookie carries the organization, so switching re-issues it — the
3062
- * caller's role, resources and billing all move with it. Reload after this.
3063
- */
3064
- switch(parameters, options) {
3065
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'org_id' }] }]);
3066
- return (options?.client ?? this.client).post({
3067
- responseStyle: 'data',
3068
- security: [{ scheme: 'bearer', type: 'http' }, {
3069
- in: 'cookie',
3070
- name: 'talqing_session',
3071
- type: 'apiKey'
3072
- }],
3073
- url: '/v1/orgs/{org_id}/switch',
3074
- ...options,
3075
- ...params
3076
- });
3077
- }
3078
- get invites() {
3079
- return this._invites ?? (this._invites = new Invites({ client: this.client }));
3080
- }
3081
- get members() {
3082
- return this._members ?? (this._members = new Members({ client: this.client }));
3083
- }
3084
- }
3085
2754
  export class Schemas extends HeyApiClient {
3086
2755
  /**
3087
2756
  * Describe Schema
@@ -4248,8 +3917,8 @@ export class TalqingApi extends HeyApiClient {
4248
3917
  *
4249
3918
  * Liveness probe: `200` once this process is serving. Unauthenticated.
4250
3919
  *
4251
- * It answers for the API process, not its dependencies — a `200` here does not
4252
- * promise Postgres, Redis or LiveKit are reachable.
3920
+ * It answers for the API process, not its dependencies — a `200` here does
3921
+ * not promise Postgres, Redis or LiveKit are reachable.
4253
3922
  */
4254
3923
  health(options) {
4255
3924
  return (options?.client ?? this.client).get({
@@ -4261,8 +3930,8 @@ export class TalqingApi extends HeyApiClient {
4261
3930
  get agents() {
4262
3931
  return this._agents ?? (this._agents = new Agents({ client: this.client }));
4263
3932
  }
4264
- get auth() {
4265
- return this._auth ?? (this._auth = new Auth({ client: this.client }));
3933
+ get billing() {
3934
+ return this._billing ?? (this._billing = new Billing({ client: this.client }));
4266
3935
  }
4267
3936
  get providerKeys() {
4268
3937
  return this._providerKeys ?? (this._providerKeys = new ProviderKeys({ client: this.client }));
@@ -4288,15 +3957,9 @@ export class TalqingApi extends HeyApiClient {
4288
3957
  get knowledge() {
4289
3958
  return this._knowledge ?? (this._knowledge = new Knowledge2({ client: this.client }));
4290
3959
  }
4291
- get tokens() {
4292
- return this._tokens ?? (this._tokens = new Tokens({ client: this.client }));
4293
- }
4294
3960
  get observability() {
4295
3961
  return this._observability ?? (this._observability = new Observability({ client: this.client }));
4296
3962
  }
4297
- get orgs() {
4298
- return this._orgs ?? (this._orgs = new Orgs({ client: this.client }));
4299
- }
4300
3963
  get schemas() {
4301
3964
  return this._schemas ?? (this._schemas = new Schemas({ client: this.client }));
4302
3965
  }