@weftlabs/sdk 0.25.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 (124) hide show
  1. package/README.md +499 -0
  2. package/dist/client-C9_zh3Qg.d.mts +11 -0
  3. package/dist/client-C9_zh3Qg.d.ts +11 -0
  4. package/dist/facilitator/index.d.mts +18 -0
  5. package/dist/facilitator/index.d.ts +18 -0
  6. package/dist/facilitator/index.js +180 -0
  7. package/dist/facilitator/index.js.map +1 -0
  8. package/dist/facilitator/index.mjs +149 -0
  9. package/dist/facilitator/index.mjs.map +1 -0
  10. package/dist/facilitator/middleware/index.d.mts +539 -0
  11. package/dist/facilitator/middleware/index.d.ts +539 -0
  12. package/dist/facilitator/middleware/index.js +1522 -0
  13. package/dist/facilitator/middleware/index.js.map +1 -0
  14. package/dist/facilitator/middleware/index.mjs +1493 -0
  15. package/dist/facilitator/middleware/index.mjs.map +1 -0
  16. package/dist/index.d.mts +5667 -0
  17. package/dist/index.d.ts +5667 -0
  18. package/dist/index.js +5555 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/index.mjs +5553 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/server.d.mts +8 -0
  23. package/dist/server.d.ts +8 -0
  24. package/dist/server.js +1587 -0
  25. package/dist/server.js.map +1 -0
  26. package/dist/server.mjs +1574 -0
  27. package/dist/server.mjs.map +1 -0
  28. package/docs/APIKeysApi.md +219 -0
  29. package/docs/AccountApi.md +72 -0
  30. package/docs/AccountBootstrapApproval.md +36 -0
  31. package/docs/AccountBootstrapCreated.md +44 -0
  32. package/docs/AccountBootstrapCreatedApproval.md +38 -0
  33. package/docs/AccountBootstrapCreatedResponse.md +32 -0
  34. package/docs/AccountBootstrapRequest.md +42 -0
  35. package/docs/AccountBootstrapStatus.md +40 -0
  36. package/docs/AccountBootstrapStatusResponse.md +32 -0
  37. package/docs/AccountDetails.md +43 -0
  38. package/docs/AgentBootstrapApi.md +223 -0
  39. package/docs/ApiKey.md +42 -0
  40. package/docs/ApiKeyCreated.md +40 -0
  41. package/docs/ApiKeyCreatedResponse.md +32 -0
  42. package/docs/ApiKeyListResponse.md +34 -0
  43. package/docs/AuthApi.md +408 -0
  44. package/docs/AuthResponse.md +32 -0
  45. package/docs/AuthResponseData.md +36 -0
  46. package/docs/BalanceApi.md +73 -0
  47. package/docs/BalanceResponse.md +45 -0
  48. package/docs/ConfirmRequest.md +32 -0
  49. package/docs/CreateApiKeyRequest.md +32 -0
  50. package/docs/DocumentationApi.md +65 -0
  51. package/docs/EnrolledResource.md +59 -0
  52. package/docs/ErrorResponse.md +33 -0
  53. package/docs/Fetch403Response.md +44 -0
  54. package/docs/FetchApi.md +91 -0
  55. package/docs/FetchBalanceSnapshot.md +41 -0
  56. package/docs/FetchErrorResponse.md +41 -0
  57. package/docs/FetchRequest.md +46 -0
  58. package/docs/FetchRequestBody.md +31 -0
  59. package/docs/FetchResponse.md +49 -0
  60. package/docs/InsufficientScopeResponse.md +37 -0
  61. package/docs/MeApiKey.md +40 -0
  62. package/docs/MeApiKeyCreator.md +37 -0
  63. package/docs/MeResponse.md +32 -0
  64. package/docs/MeResponseData.md +56 -0
  65. package/docs/MessageResponse.md +32 -0
  66. package/docs/MessageResponseData.md +32 -0
  67. package/docs/ModelError.md +39 -0
  68. package/docs/Pagination.md +38 -0
  69. package/docs/PasswordResetRequest.md +32 -0
  70. package/docs/PasswordUpdateRequest.md +36 -0
  71. package/docs/Payment.md +56 -0
  72. package/docs/PaymentListResponse.md +34 -0
  73. package/docs/PaymentResponse.md +32 -0
  74. package/docs/PaymentsApi.md +154 -0
  75. package/docs/PrincipalWallet.md +34 -0
  76. package/docs/PromoBalance.md +37 -0
  77. package/docs/Purchase.md +58 -0
  78. package/docs/PurchaseArtifact.md +38 -0
  79. package/docs/PurchaseListResponse.md +34 -0
  80. package/docs/PurchaseResponse.md +32 -0
  81. package/docs/PurchasesApi.md +157 -0
  82. package/docs/RateLimitResponse.md +34 -0
  83. package/docs/ResendConfirmationRequest.md +32 -0
  84. package/docs/ResourceEnrollmentRequest.md +39 -0
  85. package/docs/ResourceEnrollmentResponse.md +32 -0
  86. package/docs/ResourceStats.md +45 -0
  87. package/docs/ResourcesApi.md +77 -0
  88. package/docs/SearchAccessMethod.md +52 -0
  89. package/docs/SearchApi.md +86 -0
  90. package/docs/SearchCapabilityRef.md +34 -0
  91. package/docs/SearchCuratedCallability.md +34 -0
  92. package/docs/SearchCuratedExecution.md +32 -0
  93. package/docs/SearchCuratedOperation.md +36 -0
  94. package/docs/SearchCuratedService.md +34 -0
  95. package/docs/SearchCuratedSource.md +36 -0
  96. package/docs/SearchEndpointCall.md +39 -0
  97. package/docs/SearchEndpointHit.md +74 -0
  98. package/docs/SearchEndpointPrice.md +41 -0
  99. package/docs/SearchErrorResponse.md +35 -0
  100. package/docs/SearchExecutionModeFilter.md +34 -0
  101. package/docs/SearchFilterSpec.md +49 -0
  102. package/docs/SearchMethodFilter.md +34 -0
  103. package/docs/SearchPaymentOffer.md +47 -0
  104. package/docs/SearchPriceAtomicFilter.md +41 -0
  105. package/docs/SearchPriceUsdFilter.md +41 -0
  106. package/docs/SearchProtocolFilter.md +35 -0
  107. package/docs/SearchProviderRef.md +36 -0
  108. package/docs/SearchRequest.md +36 -0
  109. package/docs/SearchResourceTypeFilter.md +35 -0
  110. package/docs/SearchResponse.md +67 -0
  111. package/docs/SearchResponseWarningsInner.md +38 -0
  112. package/docs/SearchResult.md +38 -0
  113. package/docs/SearchStringSetFilter.md +34 -0
  114. package/docs/SearchWeftFetchCompatibility.md +36 -0
  115. package/docs/SignInRequest.md +34 -0
  116. package/docs/SignUpRequest.md +36 -0
  117. package/docs/SpendingPolicy.md +36 -0
  118. package/docs/User.md +36 -0
  119. package/docs/UserPrincipal.md +49 -0
  120. package/docs/Wallet.md +42 -0
  121. package/examples/charge-api-hono.mjs +40 -0
  122. package/examples/charge-api.mjs +43 -0
  123. package/examples/quickstart.mjs +16 -0
  124. package/package.json +105 -0
@@ -0,0 +1,32 @@
1
+
2
+ # ApiKeyCreatedResponse
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `data` | [ApiKeyCreated](ApiKeyCreated.md)
10
+
11
+ ## Example
12
+
13
+ ```typescript
14
+ import type { ApiKeyCreatedResponse } from '@weftlabs/sdk'
15
+
16
+ // TODO: Update the object below with actual values
17
+ const example = {
18
+ "data": null,
19
+ } satisfies ApiKeyCreatedResponse
20
+
21
+ console.log(example)
22
+
23
+ // Convert the instance to a JSON string
24
+ const exampleJSON: string = JSON.stringify(example)
25
+ console.log(exampleJSON)
26
+
27
+ // Parse the JSON string back to an object
28
+ const exampleParsed = JSON.parse(exampleJSON) as ApiKeyCreatedResponse
29
+ console.log(exampleParsed)
30
+ ```
31
+
32
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,34 @@
1
+
2
+ # ApiKeyListResponse
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `data` | [Array<ApiKey>](ApiKey.md)
10
+ `pagination` | [Pagination](Pagination.md)
11
+
12
+ ## Example
13
+
14
+ ```typescript
15
+ import type { ApiKeyListResponse } from '@weftlabs/sdk'
16
+
17
+ // TODO: Update the object below with actual values
18
+ const example = {
19
+ "data": null,
20
+ "pagination": null,
21
+ } satisfies ApiKeyListResponse
22
+
23
+ console.log(example)
24
+
25
+ // Convert the instance to a JSON string
26
+ const exampleJSON: string = JSON.stringify(example)
27
+ console.log(exampleJSON)
28
+
29
+ // Parse the JSON string back to an object
30
+ const exampleParsed = JSON.parse(exampleJSON) as ApiKeyListResponse
31
+ console.log(exampleParsed)
32
+ ```
33
+
34
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,408 @@
1
+ # AuthApi
2
+
3
+ All URIs are relative to *https://weft.network*
4
+
5
+ | Method | HTTP request | Description |
6
+ |------------- | ------------- | -------------|
7
+ | [**confirmAccount**](AuthApi.md#confirmaccount) | **POST** /api/v1/auth/confirm | Confirm an account |
8
+ | [**requestPasswordReset**](AuthApi.md#requestpasswordreset) | **POST** /api/v1/auth/password/reset | Request password reset |
9
+ | [**resendConfirmation**](AuthApi.md#resendconfirmationoperation) | **POST** /api/v1/auth/resend-confirmation | Resend confirmation email |
10
+ | [**signIn**](AuthApi.md#signinoperation) | **POST** /api/v1/auth/sign_in | Sign in with email and password |
11
+ | [**signUp**](AuthApi.md#signupoperation) | **POST** /api/v1/auth/sign_up | Create an account |
12
+ | [**updatePassword**](AuthApi.md#updatepassword) | **POST** /api/v1/auth/password/update | Update password with reset token |
13
+
14
+
15
+
16
+ ## confirmAccount
17
+
18
+ > AuthResponse confirmAccount(confirmRequest)
19
+
20
+ Confirm an account
21
+
22
+ ### Example
23
+
24
+ ```ts
25
+ import {
26
+ Configuration,
27
+ AuthApi,
28
+ } from '@weftlabs/sdk';
29
+ import type { ConfirmAccountRequest } from '@weftlabs/sdk';
30
+
31
+ async function example() {
32
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
33
+ const api = new AuthApi();
34
+
35
+ const body = {
36
+ // ConfirmRequest
37
+ confirmRequest: ...,
38
+ } satisfies ConfirmAccountRequest;
39
+
40
+ try {
41
+ const data = await api.confirmAccount(body);
42
+ console.log(data);
43
+ } catch (error) {
44
+ console.error(error);
45
+ }
46
+ }
47
+
48
+ // Run the test
49
+ example().catch(console.error);
50
+ ```
51
+
52
+ ### Parameters
53
+
54
+
55
+ | Name | Type | Description | Notes |
56
+ |------------- | ------------- | ------------- | -------------|
57
+ | **confirmRequest** | [ConfirmRequest](ConfirmRequest.md) | | |
58
+
59
+ ### Return type
60
+
61
+ [**AuthResponse**](AuthResponse.md)
62
+
63
+ ### Authorization
64
+
65
+ No authorization required
66
+
67
+ ### HTTP request headers
68
+
69
+ - **Content-Type**: `application/json`
70
+ - **Accept**: `application/json`
71
+
72
+
73
+ ### HTTP response details
74
+ | Status code | Description | Response headers |
75
+ |-------------|-------------|------------------|
76
+ | **200** | Account confirmed | - |
77
+ | **422** | Invalid token | - |
78
+
79
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
80
+
81
+
82
+ ## requestPasswordReset
83
+
84
+ > MessageResponse requestPasswordReset(passwordResetRequest)
85
+
86
+ Request password reset
87
+
88
+ ### Example
89
+
90
+ ```ts
91
+ import {
92
+ Configuration,
93
+ AuthApi,
94
+ } from '@weftlabs/sdk';
95
+ import type { RequestPasswordResetRequest } from '@weftlabs/sdk';
96
+
97
+ async function example() {
98
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
99
+ const api = new AuthApi();
100
+
101
+ const body = {
102
+ // PasswordResetRequest
103
+ passwordResetRequest: ...,
104
+ } satisfies RequestPasswordResetRequest;
105
+
106
+ try {
107
+ const data = await api.requestPasswordReset(body);
108
+ console.log(data);
109
+ } catch (error) {
110
+ console.error(error);
111
+ }
112
+ }
113
+
114
+ // Run the test
115
+ example().catch(console.error);
116
+ ```
117
+
118
+ ### Parameters
119
+
120
+
121
+ | Name | Type | Description | Notes |
122
+ |------------- | ------------- | ------------- | -------------|
123
+ | **passwordResetRequest** | [PasswordResetRequest](PasswordResetRequest.md) | | |
124
+
125
+ ### Return type
126
+
127
+ [**MessageResponse**](MessageResponse.md)
128
+
129
+ ### Authorization
130
+
131
+ No authorization required
132
+
133
+ ### HTTP request headers
134
+
135
+ - **Content-Type**: `application/json`
136
+ - **Accept**: `application/json`
137
+
138
+
139
+ ### HTTP response details
140
+ | Status code | Description | Response headers |
141
+ |-------------|-------------|------------------|
142
+ | **200** | Reset email sent | - |
143
+
144
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
145
+
146
+
147
+ ## resendConfirmation
148
+
149
+ > MessageResponse resendConfirmation(resendConfirmationRequest)
150
+
151
+ Resend confirmation email
152
+
153
+ ### Example
154
+
155
+ ```ts
156
+ import {
157
+ Configuration,
158
+ AuthApi,
159
+ } from '@weftlabs/sdk';
160
+ import type { ResendConfirmationOperationRequest } from '@weftlabs/sdk';
161
+
162
+ async function example() {
163
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
164
+ const api = new AuthApi();
165
+
166
+ const body = {
167
+ // ResendConfirmationRequest
168
+ resendConfirmationRequest: ...,
169
+ } satisfies ResendConfirmationOperationRequest;
170
+
171
+ try {
172
+ const data = await api.resendConfirmation(body);
173
+ console.log(data);
174
+ } catch (error) {
175
+ console.error(error);
176
+ }
177
+ }
178
+
179
+ // Run the test
180
+ example().catch(console.error);
181
+ ```
182
+
183
+ ### Parameters
184
+
185
+
186
+ | Name | Type | Description | Notes |
187
+ |------------- | ------------- | ------------- | -------------|
188
+ | **resendConfirmationRequest** | [ResendConfirmationRequest](ResendConfirmationRequest.md) | | |
189
+
190
+ ### Return type
191
+
192
+ [**MessageResponse**](MessageResponse.md)
193
+
194
+ ### Authorization
195
+
196
+ No authorization required
197
+
198
+ ### HTTP request headers
199
+
200
+ - **Content-Type**: `application/json`
201
+ - **Accept**: `application/json`
202
+
203
+
204
+ ### HTTP response details
205
+ | Status code | Description | Response headers |
206
+ |-------------|-------------|------------------|
207
+ | **200** | Confirmation sent | - |
208
+
209
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
210
+
211
+
212
+ ## signIn
213
+
214
+ > AuthResponse signIn(signInRequest)
215
+
216
+ Sign in with email and password
217
+
218
+ ### Example
219
+
220
+ ```ts
221
+ import {
222
+ Configuration,
223
+ AuthApi,
224
+ } from '@weftlabs/sdk';
225
+ import type { SignInOperationRequest } from '@weftlabs/sdk';
226
+
227
+ async function example() {
228
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
229
+ const api = new AuthApi();
230
+
231
+ const body = {
232
+ // SignInRequest
233
+ signInRequest: ...,
234
+ } satisfies SignInOperationRequest;
235
+
236
+ try {
237
+ const data = await api.signIn(body);
238
+ console.log(data);
239
+ } catch (error) {
240
+ console.error(error);
241
+ }
242
+ }
243
+
244
+ // Run the test
245
+ example().catch(console.error);
246
+ ```
247
+
248
+ ### Parameters
249
+
250
+
251
+ | Name | Type | Description | Notes |
252
+ |------------- | ------------- | ------------- | -------------|
253
+ | **signInRequest** | [SignInRequest](SignInRequest.md) | | |
254
+
255
+ ### Return type
256
+
257
+ [**AuthResponse**](AuthResponse.md)
258
+
259
+ ### Authorization
260
+
261
+ No authorization required
262
+
263
+ ### HTTP request headers
264
+
265
+ - **Content-Type**: `application/json`
266
+ - **Accept**: `application/json`
267
+
268
+
269
+ ### HTTP response details
270
+ | Status code | Description | Response headers |
271
+ |-------------|-------------|------------------|
272
+ | **200** | Signed in | - |
273
+ | **401** | Invalid credentials | - |
274
+
275
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
276
+
277
+
278
+ ## signUp
279
+
280
+ > AuthResponse signUp(signUpRequest)
281
+
282
+ Create an account
283
+
284
+ ### Example
285
+
286
+ ```ts
287
+ import {
288
+ Configuration,
289
+ AuthApi,
290
+ } from '@weftlabs/sdk';
291
+ import type { SignUpOperationRequest } from '@weftlabs/sdk';
292
+
293
+ async function example() {
294
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
295
+ const api = new AuthApi();
296
+
297
+ const body = {
298
+ // SignUpRequest
299
+ signUpRequest: ...,
300
+ } satisfies SignUpOperationRequest;
301
+
302
+ try {
303
+ const data = await api.signUp(body);
304
+ console.log(data);
305
+ } catch (error) {
306
+ console.error(error);
307
+ }
308
+ }
309
+
310
+ // Run the test
311
+ example().catch(console.error);
312
+ ```
313
+
314
+ ### Parameters
315
+
316
+
317
+ | Name | Type | Description | Notes |
318
+ |------------- | ------------- | ------------- | -------------|
319
+ | **signUpRequest** | [SignUpRequest](SignUpRequest.md) | | |
320
+
321
+ ### Return type
322
+
323
+ [**AuthResponse**](AuthResponse.md)
324
+
325
+ ### Authorization
326
+
327
+ No authorization required
328
+
329
+ ### HTTP request headers
330
+
331
+ - **Content-Type**: `application/json`
332
+ - **Accept**: `application/json`
333
+
334
+
335
+ ### HTTP response details
336
+ | Status code | Description | Response headers |
337
+ |-------------|-------------|------------------|
338
+ | **200** | Account created | - |
339
+ | **422** | Validation error | - |
340
+ | **429** | Rate limit exceeded (20 accounts/hour/IP) | - |
341
+
342
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
343
+
344
+
345
+ ## updatePassword
346
+
347
+ > MessageResponse updatePassword(passwordUpdateRequest)
348
+
349
+ Update password with reset token
350
+
351
+ ### Example
352
+
353
+ ```ts
354
+ import {
355
+ Configuration,
356
+ AuthApi,
357
+ } from '@weftlabs/sdk';
358
+ import type { UpdatePasswordRequest } from '@weftlabs/sdk';
359
+
360
+ async function example() {
361
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
362
+ const api = new AuthApi();
363
+
364
+ const body = {
365
+ // PasswordUpdateRequest
366
+ passwordUpdateRequest: ...,
367
+ } satisfies UpdatePasswordRequest;
368
+
369
+ try {
370
+ const data = await api.updatePassword(body);
371
+ console.log(data);
372
+ } catch (error) {
373
+ console.error(error);
374
+ }
375
+ }
376
+
377
+ // Run the test
378
+ example().catch(console.error);
379
+ ```
380
+
381
+ ### Parameters
382
+
383
+
384
+ | Name | Type | Description | Notes |
385
+ |------------- | ------------- | ------------- | -------------|
386
+ | **passwordUpdateRequest** | [PasswordUpdateRequest](PasswordUpdateRequest.md) | | |
387
+
388
+ ### Return type
389
+
390
+ [**MessageResponse**](MessageResponse.md)
391
+
392
+ ### Authorization
393
+
394
+ No authorization required
395
+
396
+ ### HTTP request headers
397
+
398
+ - **Content-Type**: `application/json`
399
+ - **Accept**: `application/json`
400
+
401
+
402
+ ### HTTP response details
403
+ | Status code | Description | Response headers |
404
+ |-------------|-------------|------------------|
405
+ | **200** | Password updated | - |
406
+ | **422** | Invalid or expired reset token | - |
407
+
408
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,32 @@
1
+
2
+ # AuthResponse
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `data` | [AuthResponseData](AuthResponseData.md)
10
+
11
+ ## Example
12
+
13
+ ```typescript
14
+ import type { AuthResponse } from '@weftlabs/sdk'
15
+
16
+ // TODO: Update the object below with actual values
17
+ const example = {
18
+ "data": null,
19
+ } satisfies AuthResponse
20
+
21
+ console.log(example)
22
+
23
+ // Convert the instance to a JSON string
24
+ const exampleJSON: string = JSON.stringify(example)
25
+ console.log(exampleJSON)
26
+
27
+ // Parse the JSON string back to an object
28
+ const exampleParsed = JSON.parse(exampleJSON) as AuthResponse
29
+ console.log(exampleParsed)
30
+ ```
31
+
32
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,36 @@
1
+
2
+ # AuthResponseData
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `user` | [User](User.md)
10
+ `token` | string
11
+ `confirmationRequired` | boolean
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { AuthResponseData } from '@weftlabs/sdk'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "user": null,
21
+ "token": null,
22
+ "confirmationRequired": null,
23
+ } satisfies AuthResponseData
24
+
25
+ console.log(example)
26
+
27
+ // Convert the instance to a JSON string
28
+ const exampleJSON: string = JSON.stringify(example)
29
+ console.log(exampleJSON)
30
+
31
+ // Parse the JSON string back to an object
32
+ const exampleParsed = JSON.parse(exampleJSON) as AuthResponseData
33
+ console.log(exampleParsed)
34
+ ```
35
+
36
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,73 @@
1
+ # BalanceApi
2
+
3
+ All URIs are relative to *https://weft.network*
4
+
5
+ | Method | HTTP request | Description |
6
+ |------------- | ------------- | -------------|
7
+ | [**getBalance**](BalanceApi.md#getbalance) | **GET** /api/v1/balance | Get wallet, spending policy, and current-window spend |
8
+
9
+
10
+
11
+ ## getBalance
12
+
13
+ > BalanceResponse getBalance()
14
+
15
+ Get wallet, spending policy, and current-window spend
16
+
17
+ Read-only snapshot for the buyer behind the bearer token. The response always includes a `promo` block — values are zero in v1 and fill in once the freemium promo ledger ships, without a shape change. The Base USDC balance is fetched server-side through Crossmint. If Crossmint is unreachable, the balance fields are `null`; consumers must not interpret that as zero. Account-scoped: the bearer must be a buyer-scoped API key, an OAuth access token carrying `balance`, or a claimed `wbt_*` bearer.
18
+
19
+ ### Example
20
+
21
+ ```ts
22
+ import {
23
+ Configuration,
24
+ BalanceApi,
25
+ } from '@weftlabs/sdk';
26
+ import type { GetBalanceRequest } from '@weftlabs/sdk';
27
+
28
+ async function example() {
29
+ console.log("🚀 Testing @weftlabs/sdk SDK...");
30
+ const config = new Configuration({
31
+ // Configure HTTP bearer authorization: bearerAuth
32
+ accessToken: "YOUR BEARER TOKEN",
33
+ });
34
+ const api = new BalanceApi(config);
35
+
36
+ try {
37
+ const data = await api.getBalance();
38
+ console.log(data);
39
+ } catch (error) {
40
+ console.error(error);
41
+ }
42
+ }
43
+
44
+ // Run the test
45
+ example().catch(console.error);
46
+ ```
47
+
48
+ ### Parameters
49
+
50
+ This endpoint does not need any parameter.
51
+
52
+ ### Return type
53
+
54
+ [**BalanceResponse**](BalanceResponse.md)
55
+
56
+ ### Authorization
57
+
58
+ [bearerAuth](../README.md#bearerAuth)
59
+
60
+ ### HTTP request headers
61
+
62
+ - **Content-Type**: Not defined
63
+ - **Accept**: `application/json`
64
+
65
+
66
+ ### HTTP response details
67
+ | Status code | Description | Response headers |
68
+ |-------------|-------------|------------------|
69
+ | **200** | Wallet + policy + spend snapshot | - |
70
+ | **401** | Unauthorized — missing or non-buyer-scoped API key | - |
71
+ | **403** | The OAuth access token authenticated but lacks the `balance` scope (RFC 6750 `insufficient_scope`). Carries a `WWW-Authenticate: Bearer error=\"insufficient_scope\", scope=\"balance\"` header. `wk_` API keys are unscoped and never see this. | - |
72
+
73
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,45 @@
1
+
2
+ # BalanceResponse
3
+
4
+ Buyer\'s wallet snapshot. Note: unlike `/me` / `/payments` / `/api_keys`, this endpoint does NOT use a `data:` envelope — the response object is the snapshot directly.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `promo` | [PromoBalance](PromoBalance.md)
11
+ `wallet` | [Wallet](Wallet.md)
12
+ `spentTodayUsd` | string
13
+ `spentWeekUsd` | string
14
+ `policyUsedTodayUsd` | string
15
+ `policyUsedWeekUsd` | string
16
+ `policy` | [SpendingPolicy](SpendingPolicy.md)
17
+
18
+ ## Example
19
+
20
+ ```typescript
21
+ import type { BalanceResponse } from '@weftlabs/sdk'
22
+
23
+ // TODO: Update the object below with actual values
24
+ const example = {
25
+ "promo": null,
26
+ "wallet": null,
27
+ "spentTodayUsd": 0.0005,
28
+ "spentWeekUsd": 3.10,
29
+ "policyUsedTodayUsd": 0.30,
30
+ "policyUsedWeekUsd": 3.30,
31
+ "policy": null,
32
+ } satisfies BalanceResponse
33
+
34
+ console.log(example)
35
+
36
+ // Convert the instance to a JSON string
37
+ const exampleJSON: string = JSON.stringify(example)
38
+ console.log(exampleJSON)
39
+
40
+ // Parse the JSON string back to an object
41
+ const exampleParsed = JSON.parse(exampleJSON) as BalanceResponse
42
+ console.log(exampleParsed)
43
+ ```
44
+
45
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
@@ -0,0 +1,32 @@
1
+
2
+ # ConfirmRequest
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `confirmationToken` | string
10
+
11
+ ## Example
12
+
13
+ ```typescript
14
+ import type { ConfirmRequest } from '@weftlabs/sdk'
15
+
16
+ // TODO: Update the object below with actual values
17
+ const example = {
18
+ "confirmationToken": null,
19
+ } satisfies ConfirmRequest
20
+
21
+ console.log(example)
22
+
23
+ // Convert the instance to a JSON string
24
+ const exampleJSON: string = JSON.stringify(example)
25
+ console.log(exampleJSON)
26
+
27
+ // Parse the JSON string back to an object
28
+ const exampleParsed = JSON.parse(exampleJSON) as ConfirmRequest
29
+ console.log(exampleParsed)
30
+ ```
31
+
32
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)