@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.
- package/README.md +499 -0
- package/dist/client-C9_zh3Qg.d.mts +11 -0
- package/dist/client-C9_zh3Qg.d.ts +11 -0
- package/dist/facilitator/index.d.mts +18 -0
- package/dist/facilitator/index.d.ts +18 -0
- package/dist/facilitator/index.js +180 -0
- package/dist/facilitator/index.js.map +1 -0
- package/dist/facilitator/index.mjs +149 -0
- package/dist/facilitator/index.mjs.map +1 -0
- package/dist/facilitator/middleware/index.d.mts +539 -0
- package/dist/facilitator/middleware/index.d.ts +539 -0
- package/dist/facilitator/middleware/index.js +1522 -0
- package/dist/facilitator/middleware/index.js.map +1 -0
- package/dist/facilitator/middleware/index.mjs +1493 -0
- package/dist/facilitator/middleware/index.mjs.map +1 -0
- package/dist/index.d.mts +5667 -0
- package/dist/index.d.ts +5667 -0
- package/dist/index.js +5555 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5553 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +8 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +1587 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +1574 -0
- package/dist/server.mjs.map +1 -0
- package/docs/APIKeysApi.md +219 -0
- package/docs/AccountApi.md +72 -0
- package/docs/AccountBootstrapApproval.md +36 -0
- package/docs/AccountBootstrapCreated.md +44 -0
- package/docs/AccountBootstrapCreatedApproval.md +38 -0
- package/docs/AccountBootstrapCreatedResponse.md +32 -0
- package/docs/AccountBootstrapRequest.md +42 -0
- package/docs/AccountBootstrapStatus.md +40 -0
- package/docs/AccountBootstrapStatusResponse.md +32 -0
- package/docs/AccountDetails.md +43 -0
- package/docs/AgentBootstrapApi.md +223 -0
- package/docs/ApiKey.md +42 -0
- package/docs/ApiKeyCreated.md +40 -0
- package/docs/ApiKeyCreatedResponse.md +32 -0
- package/docs/ApiKeyListResponse.md +34 -0
- package/docs/AuthApi.md +408 -0
- package/docs/AuthResponse.md +32 -0
- package/docs/AuthResponseData.md +36 -0
- package/docs/BalanceApi.md +73 -0
- package/docs/BalanceResponse.md +45 -0
- package/docs/ConfirmRequest.md +32 -0
- package/docs/CreateApiKeyRequest.md +32 -0
- package/docs/DocumentationApi.md +65 -0
- package/docs/EnrolledResource.md +59 -0
- package/docs/ErrorResponse.md +33 -0
- package/docs/Fetch403Response.md +44 -0
- package/docs/FetchApi.md +91 -0
- package/docs/FetchBalanceSnapshot.md +41 -0
- package/docs/FetchErrorResponse.md +41 -0
- package/docs/FetchRequest.md +46 -0
- package/docs/FetchRequestBody.md +31 -0
- package/docs/FetchResponse.md +49 -0
- package/docs/InsufficientScopeResponse.md +37 -0
- package/docs/MeApiKey.md +40 -0
- package/docs/MeApiKeyCreator.md +37 -0
- package/docs/MeResponse.md +32 -0
- package/docs/MeResponseData.md +56 -0
- package/docs/MessageResponse.md +32 -0
- package/docs/MessageResponseData.md +32 -0
- package/docs/ModelError.md +39 -0
- package/docs/Pagination.md +38 -0
- package/docs/PasswordResetRequest.md +32 -0
- package/docs/PasswordUpdateRequest.md +36 -0
- package/docs/Payment.md +56 -0
- package/docs/PaymentListResponse.md +34 -0
- package/docs/PaymentResponse.md +32 -0
- package/docs/PaymentsApi.md +154 -0
- package/docs/PrincipalWallet.md +34 -0
- package/docs/PromoBalance.md +37 -0
- package/docs/Purchase.md +58 -0
- package/docs/PurchaseArtifact.md +38 -0
- package/docs/PurchaseListResponse.md +34 -0
- package/docs/PurchaseResponse.md +32 -0
- package/docs/PurchasesApi.md +157 -0
- package/docs/RateLimitResponse.md +34 -0
- package/docs/ResendConfirmationRequest.md +32 -0
- package/docs/ResourceEnrollmentRequest.md +39 -0
- package/docs/ResourceEnrollmentResponse.md +32 -0
- package/docs/ResourceStats.md +45 -0
- package/docs/ResourcesApi.md +77 -0
- package/docs/SearchAccessMethod.md +52 -0
- package/docs/SearchApi.md +86 -0
- package/docs/SearchCapabilityRef.md +34 -0
- package/docs/SearchCuratedCallability.md +34 -0
- package/docs/SearchCuratedExecution.md +32 -0
- package/docs/SearchCuratedOperation.md +36 -0
- package/docs/SearchCuratedService.md +34 -0
- package/docs/SearchCuratedSource.md +36 -0
- package/docs/SearchEndpointCall.md +39 -0
- package/docs/SearchEndpointHit.md +74 -0
- package/docs/SearchEndpointPrice.md +41 -0
- package/docs/SearchErrorResponse.md +35 -0
- package/docs/SearchExecutionModeFilter.md +34 -0
- package/docs/SearchFilterSpec.md +49 -0
- package/docs/SearchMethodFilter.md +34 -0
- package/docs/SearchPaymentOffer.md +47 -0
- package/docs/SearchPriceAtomicFilter.md +41 -0
- package/docs/SearchPriceUsdFilter.md +41 -0
- package/docs/SearchProtocolFilter.md +35 -0
- package/docs/SearchProviderRef.md +36 -0
- package/docs/SearchRequest.md +36 -0
- package/docs/SearchResourceTypeFilter.md +35 -0
- package/docs/SearchResponse.md +67 -0
- package/docs/SearchResponseWarningsInner.md +38 -0
- package/docs/SearchResult.md +38 -0
- package/docs/SearchStringSetFilter.md +34 -0
- package/docs/SearchWeftFetchCompatibility.md +36 -0
- package/docs/SignInRequest.md +34 -0
- package/docs/SignUpRequest.md +36 -0
- package/docs/SpendingPolicy.md +36 -0
- package/docs/User.md +36 -0
- package/docs/UserPrincipal.md +49 -0
- package/docs/Wallet.md +42 -0
- package/examples/charge-api-hono.mjs +40 -0
- package/examples/charge-api.mjs +43 -0
- package/examples/quickstart.mjs +16 -0
- package/package.json +105 -0
package/docs/Purchase.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
# Purchase
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`id` | number
|
|
10
|
+
`status` | string
|
|
11
|
+
`amountUsd` | string
|
|
12
|
+
`recipientAddress` | string
|
|
13
|
+
`network` | string
|
|
14
|
+
`protocol` | string
|
|
15
|
+
`context` | string
|
|
16
|
+
`txHash` | string
|
|
17
|
+
`rejectReason` | string
|
|
18
|
+
`failureReason` | string
|
|
19
|
+
`idempotencyKey` | string
|
|
20
|
+
`signedAt` | Date
|
|
21
|
+
`settledAt` | Date
|
|
22
|
+
`artifact` | [PurchaseArtifact](PurchaseArtifact.md)
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import type { Purchase } from '@weftlabs/sdk'
|
|
28
|
+
|
|
29
|
+
// TODO: Update the object below with actual values
|
|
30
|
+
const example = {
|
|
31
|
+
"id": null,
|
|
32
|
+
"status": null,
|
|
33
|
+
"amountUsd": null,
|
|
34
|
+
"recipientAddress": null,
|
|
35
|
+
"network": null,
|
|
36
|
+
"protocol": null,
|
|
37
|
+
"context": null,
|
|
38
|
+
"txHash": null,
|
|
39
|
+
"rejectReason": null,
|
|
40
|
+
"failureReason": null,
|
|
41
|
+
"idempotencyKey": null,
|
|
42
|
+
"signedAt": null,
|
|
43
|
+
"settledAt": null,
|
|
44
|
+
"artifact": null,
|
|
45
|
+
} satisfies Purchase
|
|
46
|
+
|
|
47
|
+
console.log(example)
|
|
48
|
+
|
|
49
|
+
// Convert the instance to a JSON string
|
|
50
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
51
|
+
console.log(exampleJSON)
|
|
52
|
+
|
|
53
|
+
// Parse the JSON string back to an object
|
|
54
|
+
const exampleParsed = JSON.parse(exampleJSON) as Purchase
|
|
55
|
+
console.log(exampleParsed)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
[[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,38 @@
|
|
|
1
|
+
|
|
2
|
+
# PurchaseArtifact
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`id` | number
|
|
10
|
+
`merchantUrl` | string
|
|
11
|
+
`bytes` | number
|
|
12
|
+
`mime` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { PurchaseArtifact } from '@weftlabs/sdk'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"id": null,
|
|
22
|
+
"merchantUrl": null,
|
|
23
|
+
"bytes": null,
|
|
24
|
+
"mime": null,
|
|
25
|
+
} satisfies PurchaseArtifact
|
|
26
|
+
|
|
27
|
+
console.log(example)
|
|
28
|
+
|
|
29
|
+
// Convert the instance to a JSON string
|
|
30
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
31
|
+
console.log(exampleJSON)
|
|
32
|
+
|
|
33
|
+
// Parse the JSON string back to an object
|
|
34
|
+
const exampleParsed = JSON.parse(exampleJSON) as PurchaseArtifact
|
|
35
|
+
console.log(exampleParsed)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[[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
|
+
# PurchaseListResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`data` | [Array<Purchase>](Purchase.md)
|
|
10
|
+
`pagination` | [Pagination](Pagination.md)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { PurchaseListResponse } from '@weftlabs/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"data": null,
|
|
20
|
+
"pagination": null,
|
|
21
|
+
} satisfies PurchaseListResponse
|
|
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 PurchaseListResponse
|
|
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,32 @@
|
|
|
1
|
+
|
|
2
|
+
# PurchaseResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`data` | [Purchase](Purchase.md)
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { PurchaseResponse } from '@weftlabs/sdk'
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"data": null,
|
|
19
|
+
} satisfies PurchaseResponse
|
|
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 PurchaseResponse
|
|
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,157 @@
|
|
|
1
|
+
# PurchasesApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://weft.network*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**getPurchase**](PurchasesApi.md#getpurchase) | **GET** /api/v1/purchases/{id} | Get a buyer purchase |
|
|
8
|
+
| [**listPurchases**](PurchasesApi.md#listpurchases) | **GET** /api/v1/purchases | List buyer purchases |
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## getPurchase
|
|
13
|
+
|
|
14
|
+
> PurchaseResponse getPurchase(id)
|
|
15
|
+
|
|
16
|
+
Get a buyer purchase
|
|
17
|
+
|
|
18
|
+
### Example
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import {
|
|
22
|
+
Configuration,
|
|
23
|
+
PurchasesApi,
|
|
24
|
+
} from '@weftlabs/sdk';
|
|
25
|
+
import type { GetPurchaseRequest } from '@weftlabs/sdk';
|
|
26
|
+
|
|
27
|
+
async function example() {
|
|
28
|
+
console.log("🚀 Testing @weftlabs/sdk SDK...");
|
|
29
|
+
const config = new Configuration({
|
|
30
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
31
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
32
|
+
});
|
|
33
|
+
const api = new PurchasesApi(config);
|
|
34
|
+
|
|
35
|
+
const body = {
|
|
36
|
+
// number | Purchase ID
|
|
37
|
+
id: 56,
|
|
38
|
+
} satisfies GetPurchaseRequest;
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
const data = await api.getPurchase(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
|
+
| **id** | `number` | Purchase ID | [Defaults to `undefined`] |
|
|
58
|
+
|
|
59
|
+
### Return type
|
|
60
|
+
|
|
61
|
+
[**PurchaseResponse**](PurchaseResponse.md)
|
|
62
|
+
|
|
63
|
+
### Authorization
|
|
64
|
+
|
|
65
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
66
|
+
|
|
67
|
+
### HTTP request headers
|
|
68
|
+
|
|
69
|
+
- **Content-Type**: Not defined
|
|
70
|
+
- **Accept**: `application/json`
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### HTTP response details
|
|
74
|
+
| Status code | Description | Response headers |
|
|
75
|
+
|-------------|-------------|------------------|
|
|
76
|
+
| **200** | Buyer purchase details | - |
|
|
77
|
+
| **401** | Unauthorized — missing or non-buyer-scoped credential | - |
|
|
78
|
+
| **403** | OAuth token lacks the `balance` scope. | - |
|
|
79
|
+
| **404** | Purchase not found or owned by another buyer | - |
|
|
80
|
+
|
|
81
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## listPurchases
|
|
85
|
+
|
|
86
|
+
> PurchaseListResponse listPurchases(page, perPage)
|
|
87
|
+
|
|
88
|
+
List buyer purchases
|
|
89
|
+
|
|
90
|
+
Returns the authenticated buyer\'s signing and settlement ledger. Unlike `/api/v1/payments`, this endpoint is User-scoped and backed by `signed_events`, so rejected and pending attempts are included. Scoped to the buyer\'s own merchant spend, matching the dashboard\'s Purchases page. Internal signings are excluded: historical refill self-transfers (`rebalance`) and operator signings (`manual`) are not payments the buyer made and never appear here.
|
|
91
|
+
|
|
92
|
+
### Example
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import {
|
|
96
|
+
Configuration,
|
|
97
|
+
PurchasesApi,
|
|
98
|
+
} from '@weftlabs/sdk';
|
|
99
|
+
import type { ListPurchasesRequest } from '@weftlabs/sdk';
|
|
100
|
+
|
|
101
|
+
async function example() {
|
|
102
|
+
console.log("🚀 Testing @weftlabs/sdk SDK...");
|
|
103
|
+
const config = new Configuration({
|
|
104
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
105
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
106
|
+
});
|
|
107
|
+
const api = new PurchasesApi(config);
|
|
108
|
+
|
|
109
|
+
const body = {
|
|
110
|
+
// number | Page number (optional)
|
|
111
|
+
page: 56,
|
|
112
|
+
// number | Items per page (optional)
|
|
113
|
+
perPage: 56,
|
|
114
|
+
} satisfies ListPurchasesRequest;
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const data = await api.listPurchases(body);
|
|
118
|
+
console.log(data);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error(error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Run the test
|
|
125
|
+
example().catch(console.error);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Parameters
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
| Name | Type | Description | Notes |
|
|
132
|
+
|------------- | ------------- | ------------- | -------------|
|
|
133
|
+
| **page** | `number` | Page number | [Optional] [Defaults to `1`] |
|
|
134
|
+
| **perPage** | `number` | Items per page | [Optional] [Defaults to `25`] |
|
|
135
|
+
|
|
136
|
+
### Return type
|
|
137
|
+
|
|
138
|
+
[**PurchaseListResponse**](PurchaseListResponse.md)
|
|
139
|
+
|
|
140
|
+
### Authorization
|
|
141
|
+
|
|
142
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
143
|
+
|
|
144
|
+
### HTTP request headers
|
|
145
|
+
|
|
146
|
+
- **Content-Type**: Not defined
|
|
147
|
+
- **Accept**: `application/json`
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### HTTP response details
|
|
151
|
+
| Status code | Description | Response headers |
|
|
152
|
+
|-------------|-------------|------------------|
|
|
153
|
+
| **200** | Buyer purchase ledger | - |
|
|
154
|
+
| **401** | Unauthorized — missing or non-buyer-scoped credential | - |
|
|
155
|
+
| **403** | OAuth token lacks the `balance` scope. | - |
|
|
156
|
+
|
|
157
|
+
[[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
|
+
# RateLimitResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`error` | string
|
|
10
|
+
`errorDescription` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { RateLimitResponse } from '@weftlabs/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"error": null,
|
|
20
|
+
"errorDescription": null,
|
|
21
|
+
} satisfies RateLimitResponse
|
|
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 RateLimitResponse
|
|
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,32 @@
|
|
|
1
|
+
|
|
2
|
+
# ResendConfirmationRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`email` | string
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { ResendConfirmationRequest } from '@weftlabs/sdk'
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"email": null,
|
|
19
|
+
} satisfies ResendConfirmationRequest
|
|
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 ResendConfirmationRequest
|
|
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,39 @@
|
|
|
1
|
+
|
|
2
|
+
# ResourceEnrollmentRequest
|
|
3
|
+
|
|
4
|
+
`slug` and `category` are accepted but silently ignored — the server generates the slug from `name`, and category is a post-claim concern.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`kind` | string
|
|
11
|
+
`name` | string
|
|
12
|
+
`description` | string
|
|
13
|
+
`walletAddress` | string
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { ResourceEnrollmentRequest } from '@weftlabs/sdk'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"kind": agent,
|
|
23
|
+
"name": Self-Enrolled Bot,
|
|
24
|
+
"description": null,
|
|
25
|
+
"walletAddress": null,
|
|
26
|
+
} satisfies ResourceEnrollmentRequest
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as ResourceEnrollmentRequest
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[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
|
+
# ResourceEnrollmentResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`data` | [EnrolledResource](EnrolledResource.md)
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { ResourceEnrollmentResponse } from '@weftlabs/sdk'
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"data": null,
|
|
19
|
+
} satisfies ResourceEnrollmentResponse
|
|
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 ResourceEnrollmentResponse
|
|
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,45 @@
|
|
|
1
|
+
|
|
2
|
+
# ResourceStats
|
|
3
|
+
|
|
4
|
+
Aggregate public payment stats for the resource.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`totalPaid` | number
|
|
11
|
+
`totalReceived` | number
|
|
12
|
+
`paymentsMade` | number
|
|
13
|
+
`paymentsReceived` | number
|
|
14
|
+
`uniqueCounterparties` | number
|
|
15
|
+
`firstSeen` | Date
|
|
16
|
+
`lastActive` | Date
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import type { ResourceStats } from '@weftlabs/sdk'
|
|
22
|
+
|
|
23
|
+
// TODO: Update the object below with actual values
|
|
24
|
+
const example = {
|
|
25
|
+
"totalPaid": null,
|
|
26
|
+
"totalReceived": null,
|
|
27
|
+
"paymentsMade": null,
|
|
28
|
+
"paymentsReceived": null,
|
|
29
|
+
"uniqueCounterparties": null,
|
|
30
|
+
"firstSeen": null,
|
|
31
|
+
"lastActive": null,
|
|
32
|
+
} satisfies ResourceStats
|
|
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 ResourceStats
|
|
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,77 @@
|
|
|
1
|
+
# ResourcesApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://weft.network*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**enrollResource**](ResourcesApi.md#enrollresource) | **POST** /api/v1/resources/enroll | Self-enroll a ghost resource (public, no auth) |
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## enrollResource
|
|
12
|
+
|
|
13
|
+
> ResourceEnrollmentResponse enrollResource(resourceEnrollmentRequest)
|
|
14
|
+
|
|
15
|
+
Self-enroll a ghost resource (public, no auth)
|
|
16
|
+
|
|
17
|
+
Lets an unauthenticated agent (or its operator) self-enroll a Resource as a \"ghost\" (no owning provider). The server generates the `slug` and a single-use `claim_token`; the response also carries a `claim_url` the agent hands to its human controller to claim the resource from the dashboard. Client-supplied `slug` and `category` are silently ignored: slugs are server-generated from `name` (so callers cannot squat on reserved names), and `category` is a post-claim concern set by a real human. Rate-limited to 10 enrollments/hour/IP.
|
|
18
|
+
|
|
19
|
+
### Example
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
Configuration,
|
|
24
|
+
ResourcesApi,
|
|
25
|
+
} from '@weftlabs/sdk';
|
|
26
|
+
import type { EnrollResourceRequest } from '@weftlabs/sdk';
|
|
27
|
+
|
|
28
|
+
async function example() {
|
|
29
|
+
console.log("🚀 Testing @weftlabs/sdk SDK...");
|
|
30
|
+
const api = new ResourcesApi();
|
|
31
|
+
|
|
32
|
+
const body = {
|
|
33
|
+
// ResourceEnrollmentRequest
|
|
34
|
+
resourceEnrollmentRequest: ...,
|
|
35
|
+
} satisfies EnrollResourceRequest;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const data = await api.enrollResource(body);
|
|
39
|
+
console.log(data);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error(error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Run the test
|
|
46
|
+
example().catch(console.error);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Parameters
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
| Name | Type | Description | Notes |
|
|
53
|
+
|------------- | ------------- | ------------- | -------------|
|
|
54
|
+
| **resourceEnrollmentRequest** | [ResourceEnrollmentRequest](ResourceEnrollmentRequest.md) | | |
|
|
55
|
+
|
|
56
|
+
### Return type
|
|
57
|
+
|
|
58
|
+
[**ResourceEnrollmentResponse**](ResourceEnrollmentResponse.md)
|
|
59
|
+
|
|
60
|
+
### Authorization
|
|
61
|
+
|
|
62
|
+
No authorization required
|
|
63
|
+
|
|
64
|
+
### HTTP request headers
|
|
65
|
+
|
|
66
|
+
- **Content-Type**: `application/json`
|
|
67
|
+
- **Accept**: `application/json`
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### HTTP response details
|
|
71
|
+
| Status code | Description | Response headers |
|
|
72
|
+
|-------------|-------------|------------------|
|
|
73
|
+
| **201** | Ghost resource created | - |
|
|
74
|
+
| **422** | Validation error (missing/blank fields, or unknown `kind`) | - |
|
|
75
|
+
| **429** | Rate limit exceeded (10 enrollments/hour/IP) | - |
|
|
76
|
+
|
|
77
|
+
[[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,52 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchAccessMethod
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`accessMethodId` | string
|
|
10
|
+
`protocol` | string
|
|
11
|
+
`scheme` | string
|
|
12
|
+
`network` | string
|
|
13
|
+
`asset` | string
|
|
14
|
+
`assetDecimals` | number
|
|
15
|
+
`price` | object
|
|
16
|
+
`merchant` | object
|
|
17
|
+
`terms` | object
|
|
18
|
+
`status` | string
|
|
19
|
+
`weftFetch` | [SearchWeftFetchCompatibility](SearchWeftFetchCompatibility.md)
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import type { SearchAccessMethod } from '@weftlabs/sdk'
|
|
25
|
+
|
|
26
|
+
// TODO: Update the object below with actual values
|
|
27
|
+
const example = {
|
|
28
|
+
"accessMethodId": null,
|
|
29
|
+
"protocol": null,
|
|
30
|
+
"scheme": null,
|
|
31
|
+
"network": null,
|
|
32
|
+
"asset": null,
|
|
33
|
+
"assetDecimals": null,
|
|
34
|
+
"price": null,
|
|
35
|
+
"merchant": null,
|
|
36
|
+
"terms": null,
|
|
37
|
+
"status": null,
|
|
38
|
+
"weftFetch": null,
|
|
39
|
+
} satisfies SearchAccessMethod
|
|
40
|
+
|
|
41
|
+
console.log(example)
|
|
42
|
+
|
|
43
|
+
// Convert the instance to a JSON string
|
|
44
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
45
|
+
console.log(exampleJSON)
|
|
46
|
+
|
|
47
|
+
// Parse the JSON string back to an object
|
|
48
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchAccessMethod
|
|
49
|
+
console.log(exampleParsed)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|