weft-sdk 0.3.0 → 0.5.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.
- checksums.yaml +4 -4
- data/docs/ApiKeyListResponse.md +3 -1
- data/docs/BalanceApi.md +74 -0
- data/docs/BalanceResponse.md +26 -0
- data/docs/DefaultApi.md +12 -12
- data/docs/Error.md +7 -7
- data/docs/FetchApi.md +77 -0
- data/docs/FetchBalanceSnapshot.md +22 -0
- data/docs/FetchErrorResponse.md +26 -0
- data/docs/FetchRequest.md +26 -0
- data/docs/FetchRequestBody.md +49 -0
- data/docs/FetchResponse.md +30 -0
- data/docs/Merchant.md +24 -0
- data/docs/PromoBalance.md +22 -0
- data/docs/SearchAgentCard.md +34 -0
- data/docs/SearchApi.md +77 -0
- data/docs/SearchEndpoints.md +24 -0
- data/docs/SearchErrorResponse.md +20 -0
- data/docs/SearchFilters.md +26 -0
- data/docs/SearchPricing.md +24 -0
- data/docs/SearchRanking.md +26 -0
- data/docs/SearchRequest.md +22 -0
- data/docs/SearchResponse.md +26 -0
- data/docs/SearchResult.md +36 -0
- data/docs/SearchSkill.md +36 -0
- data/docs/SearchSkillEndpoint.md +20 -0
- data/docs/SpendingPolicy.md +22 -0
- data/docs/Wallet.md +22 -0
- data/lib/weft/generated/api/account_api.rb +2 -2
- data/lib/weft/generated/api/api_keys_api.rb +2 -2
- data/lib/weft/generated/api/auth_api.rb +2 -2
- data/lib/weft/generated/api/balance_api.rb +79 -0
- data/lib/weft/generated/api/default_api.rb +11 -11
- data/lib/weft/generated/api/fetch_api.rb +90 -0
- data/lib/weft/generated/api/payments_api.rb +2 -2
- data/lib/weft/generated/api/search_api.rb +90 -0
- data/lib/weft/generated/api_client.rb +2 -2
- data/lib/weft/generated/api_error.rb +2 -2
- data/lib/weft/generated/api_model_base.rb +2 -2
- data/lib/weft/generated/configuration.rb +2 -2
- data/lib/weft/generated/models/account_details.rb +2 -2
- data/lib/weft/generated/models/api_key.rb +2 -2
- data/lib/weft/generated/models/api_key_created.rb +2 -2
- data/lib/weft/generated/models/api_key_created_response.rb +2 -2
- data/lib/weft/generated/models/api_key_list_response.rb +32 -6
- data/lib/weft/generated/models/auth_response.rb +2 -2
- data/lib/weft/generated/models/auth_response_data.rb +2 -2
- data/lib/weft/generated/models/balance_response.rb +271 -0
- data/lib/weft/generated/models/confirm_request.rb +2 -2
- data/lib/weft/generated/models/create_api_key_request.rb +2 -2
- data/lib/weft/generated/models/error.rb +7 -2
- data/lib/weft/generated/models/error_response.rb +3 -2
- data/lib/weft/generated/models/fetch_balance_snapshot.rb +217 -0
- data/lib/weft/generated/models/fetch_error_response.rb +298 -0
- data/lib/weft/generated/models/fetch_request.rb +266 -0
- data/lib/weft/generated/models/fetch_request_body.rb +105 -0
- data/lib/weft/generated/models/fetch_response.rb +330 -0
- data/lib/weft/generated/models/me_response.rb +2 -2
- data/lib/weft/generated/models/merchant.rb +264 -0
- data/lib/weft/generated/models/message_response.rb +2 -2
- data/lib/weft/generated/models/message_response_data.rb +2 -2
- data/lib/weft/generated/models/pagination.rb +2 -2
- data/lib/weft/generated/models/password_reset_request.rb +2 -2
- data/lib/weft/generated/models/password_update_request.rb +2 -2
- data/lib/weft/generated/models/payment.rb +2 -2
- data/lib/weft/generated/models/payment_list_response.rb +2 -2
- data/lib/weft/generated/models/payment_response.rb +2 -2
- data/lib/weft/generated/models/promo_balance.rb +218 -0
- data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
- data/lib/weft/generated/models/search_agent_card.rb +228 -0
- data/lib/weft/generated/models/{agent_stats.rb → search_endpoints.rb} +33 -57
- data/lib/weft/generated/models/search_error_response.rb +202 -0
- data/lib/weft/generated/models/search_filters.rb +277 -0
- data/lib/weft/generated/models/search_pricing.rb +232 -0
- data/lib/weft/generated/models/search_ranking.rb +277 -0
- data/lib/weft/generated/models/search_request.rb +223 -0
- data/lib/weft/generated/models/{agent_response.rb → search_response.rb} +64 -21
- data/lib/weft/generated/models/search_result.rb +414 -0
- data/lib/weft/generated/models/search_skill.rb +259 -0
- data/lib/weft/generated/models/{agent_list_response.rb → search_skill_endpoint.rb} +19 -54
- data/lib/weft/generated/models/sign_in_request.rb +2 -2
- data/lib/weft/generated/models/sign_up_request.rb +2 -2
- data/lib/weft/generated/models/spending_policy.rb +219 -0
- data/lib/weft/generated/models/user.rb +2 -2
- data/lib/weft/generated/models/wallet.rb +219 -0
- data/lib/weft/generated/version.rb +3 -3
- data/lib/weft/sdk.rb +1 -1
- metadata +50 -12
- data/docs/Agent.md +0 -38
- data/docs/AgentListResponse.md +0 -20
- data/docs/AgentResponse.md +0 -18
- data/docs/AgentStats.md +0 -30
- data/docs/AgentsApi.md +0 -147
- data/lib/weft/generated/api/agents_api.rb +0 -148
- data/lib/weft/generated/models/agent.rb +0 -417
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a81e47f4a0e295afc026bdeb5ec56495d386d672b0eb9d4ce0f2a33adf117acf
|
|
4
|
+
data.tar.gz: 94a7f5b12c8214ea09b422ff559e307b529ad088030f489c4fc5f5f9606b62aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec29610f684ebd49e9b6d33a35bf554d1971f6f07268214a58caca6850090a1bcea0339fe5fbea848669ee0de069b3fe85b33b3a22c4c0963648602cdc9c5c9d
|
|
7
|
+
data.tar.gz: 255b314f10e3dfa98fa65035326ed49863d1794fc855e1bb5b22b2ceaf97f055e37c3c245a63c4b2a1a7efdf8a35a728b89475a335f697a6070f823cf98e6608
|
data/docs/ApiKeyListResponse.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **data** | [**Array<ApiKey>**](ApiKey.md) | | |
|
|
8
|
+
| **pagination** | [**Pagination**](Pagination.md) | | |
|
|
8
9
|
|
|
9
10
|
## Example
|
|
10
11
|
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
require 'weft-sdk'
|
|
13
14
|
|
|
14
15
|
instance = Weft::ApiKeyListResponse.new(
|
|
15
|
-
data: null
|
|
16
|
+
data: null,
|
|
17
|
+
pagination: null
|
|
16
18
|
)
|
|
17
19
|
```
|
|
18
20
|
|
data/docs/BalanceApi.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Weft::BalanceApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.weftlabs.com*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**get_balance**](BalanceApi.md#get_balance) | **GET** /api/v1/balance | Get wallet, spending policy, and current-window spend |
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## get_balance
|
|
11
|
+
|
|
12
|
+
> <BalanceResponse> get_balance
|
|
13
|
+
|
|
14
|
+
Get wallet, spending policy, and current-window spend
|
|
15
|
+
|
|
16
|
+
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. `wallet.balance_usdc` is fetched live from Privy; if Privy is unreachable the field returns `\"0.00\"` rather than erroring the whole call. Account-scoped: the bearer must be a buyer-scoped API key.
|
|
17
|
+
|
|
18
|
+
### Examples
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
require 'time'
|
|
22
|
+
require 'weft-sdk'
|
|
23
|
+
# setup authorization
|
|
24
|
+
Weft.configure do |config|
|
|
25
|
+
# Configure Bearer authorization (APIKey): bearerAuth
|
|
26
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
api_instance = Weft::BalanceApi.new
|
|
30
|
+
|
|
31
|
+
begin
|
|
32
|
+
# Get wallet, spending policy, and current-window spend
|
|
33
|
+
result = api_instance.get_balance
|
|
34
|
+
p result
|
|
35
|
+
rescue Weft::ApiError => e
|
|
36
|
+
puts "Error when calling BalanceApi->get_balance: #{e}"
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### Using the get_balance_with_http_info variant
|
|
41
|
+
|
|
42
|
+
This returns an Array which contains the response data, status code and headers.
|
|
43
|
+
|
|
44
|
+
> <Array(<BalanceResponse>, Integer, Hash)> get_balance_with_http_info
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
begin
|
|
48
|
+
# Get wallet, spending policy, and current-window spend
|
|
49
|
+
data, status_code, headers = api_instance.get_balance_with_http_info
|
|
50
|
+
p status_code # => 2xx
|
|
51
|
+
p headers # => { ... }
|
|
52
|
+
p data # => <BalanceResponse>
|
|
53
|
+
rescue Weft::ApiError => e
|
|
54
|
+
puts "Error when calling BalanceApi->get_balance_with_http_info: #{e}"
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Parameters
|
|
59
|
+
|
|
60
|
+
This endpoint does not need any parameter.
|
|
61
|
+
|
|
62
|
+
### Return type
|
|
63
|
+
|
|
64
|
+
[**BalanceResponse**](BalanceResponse.md)
|
|
65
|
+
|
|
66
|
+
### Authorization
|
|
67
|
+
|
|
68
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
69
|
+
|
|
70
|
+
### HTTP request headers
|
|
71
|
+
|
|
72
|
+
- **Content-Type**: Not defined
|
|
73
|
+
- **Accept**: application/json
|
|
74
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Weft::BalanceResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **promo** | [**PromoBalance**](PromoBalance.md) | | |
|
|
8
|
+
| **wallet** | [**Wallet**](Wallet.md) | | |
|
|
9
|
+
| **spent_today_usd** | **String** | USD spent in the current calendar day (UTC), 2dp. | |
|
|
10
|
+
| **spent_week_usd** | **String** | USD spent in the current calendar week (UTC, Monday start), 2dp. | |
|
|
11
|
+
| **policy** | [**SpendingPolicy**](SpendingPolicy.md) | | |
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require 'weft-sdk'
|
|
17
|
+
|
|
18
|
+
instance = Weft::BalanceResponse.new(
|
|
19
|
+
promo: null,
|
|
20
|
+
wallet: null,
|
|
21
|
+
spent_today_usd: 0.42,
|
|
22
|
+
spent_week_usd: 3.10,
|
|
23
|
+
policy: null
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
data/docs/DefaultApi.md
CHANGED
|
@@ -4,14 +4,14 @@ All URIs are relative to *https://api.weftlabs.com*
|
|
|
4
4
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
| ------ | ------------ | ----------- |
|
|
7
|
-
| [**
|
|
7
|
+
| [**get_open_api_document**](DefaultApi.md#get_open_api_document) | **GET** /docs/openapi.yaml | Fetch this OpenAPI document |
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## get_open_api_document
|
|
11
11
|
|
|
12
|
-
> String
|
|
12
|
+
> String get_open_api_document
|
|
13
13
|
|
|
14
|
-
Fetch OpenAPI
|
|
14
|
+
Fetch this OpenAPI document
|
|
15
15
|
|
|
16
16
|
### Examples
|
|
17
17
|
|
|
@@ -22,29 +22,29 @@ require 'weft-sdk'
|
|
|
22
22
|
api_instance = Weft::DefaultApi.new
|
|
23
23
|
|
|
24
24
|
begin
|
|
25
|
-
# Fetch OpenAPI
|
|
26
|
-
result = api_instance.
|
|
25
|
+
# Fetch this OpenAPI document
|
|
26
|
+
result = api_instance.get_open_api_document
|
|
27
27
|
p result
|
|
28
28
|
rescue Weft::ApiError => e
|
|
29
|
-
puts "Error when calling DefaultApi->
|
|
29
|
+
puts "Error when calling DefaultApi->get_open_api_document: #{e}"
|
|
30
30
|
end
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
#### Using the
|
|
33
|
+
#### Using the get_open_api_document_with_http_info variant
|
|
34
34
|
|
|
35
35
|
This returns an Array which contains the response data, status code and headers.
|
|
36
36
|
|
|
37
|
-
> <Array(String, Integer, Hash)>
|
|
37
|
+
> <Array(String, Integer, Hash)> get_open_api_document_with_http_info
|
|
38
38
|
|
|
39
39
|
```ruby
|
|
40
40
|
begin
|
|
41
|
-
# Fetch OpenAPI
|
|
42
|
-
data, status_code, headers = api_instance.
|
|
41
|
+
# Fetch this OpenAPI document
|
|
42
|
+
data, status_code, headers = api_instance.get_open_api_document_with_http_info
|
|
43
43
|
p status_code # => 2xx
|
|
44
44
|
p headers # => { ... }
|
|
45
45
|
p data # => String
|
|
46
46
|
rescue Weft::ApiError => e
|
|
47
|
-
puts "Error when calling DefaultApi->
|
|
47
|
+
puts "Error when calling DefaultApi->get_open_api_document_with_http_info: #{e}"
|
|
48
48
|
end
|
|
49
49
|
```
|
|
50
50
|
|
data/docs/Error.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **code** | **String** |
|
|
8
|
-
| **message** | **String** |
|
|
9
|
-
| **details** | **Object** |
|
|
10
|
-
| **request_id** | **String** |
|
|
7
|
+
| **code** | **String** | Stable machine-readable error code (snake_case). | |
|
|
8
|
+
| **message** | **String** | Human-readable error description. | |
|
|
9
|
+
| **details** | **Object** | Optional structured context about the failure. | [optional] |
|
|
10
|
+
| **request_id** | **String** | Correlates with server logs; include when reporting bugs. | [optional] |
|
|
11
11
|
|
|
12
12
|
## Example
|
|
13
13
|
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
require 'weft-sdk'
|
|
16
16
|
|
|
17
17
|
instance = Weft::Error.new(
|
|
18
|
-
code:
|
|
19
|
-
message:
|
|
18
|
+
code: validation_failed,
|
|
19
|
+
message: Email has already been taken,
|
|
20
20
|
details: null,
|
|
21
|
-
request_id:
|
|
21
|
+
request_id: req_01HX9F3K7B2N4P8Q1R6T8Y2Z5
|
|
22
22
|
)
|
|
23
23
|
```
|
|
24
24
|
|
data/docs/FetchApi.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Weft::FetchApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.weftlabs.com*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**fetch**](FetchApi.md#fetch) | **POST** /api/v1/fetch | Pay-and-fetch any URL (x402 proxy) |
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## fetch
|
|
11
|
+
|
|
12
|
+
> <FetchResponse> fetch(fetch_request)
|
|
13
|
+
|
|
14
|
+
Pay-and-fetch any URL (x402 proxy)
|
|
15
|
+
|
|
16
|
+
Universal x402 fetch proxy. The caller provides a target `url`, a hard `max_cost_usd` ceiling, and optional `method` / `body` / `headers`. Weft: 1. Issues the request. 2. On `402 Payment Required`, parses the merchant's challenge. 3. Compares the asking price to `max_cost_usd` and the buyer's policy (`max_tx_usd`, daily/weekly limits). 4. Signs an EIP-3009 transfer from the buyer's wallet. 5. Replays the request with the `X-Payment` header. 6. Streams the upstream artifact back, base64-encoded under `body_base64`, with `paid_usd`, `tx_hash`, and the merchant's reputation snapshot. Errors are structured with a stable `error` code, and each error response carries the buyer's `policy`, `balance`, and a `dashboard_url` so a CLI can render an actionable message without a second round-trip. Account-scoped: the bearer must be a buyer-scoped API key. **Forwarded headers:** the caller's `headers` are passed through to the upstream, except a denylist of hop-by-hop and Weft-internal headers (`host`, `authorization`, `cookie`, `proxy-authorization`, `x-forwarded-*`, `x-real-ip`, `x-payment`, `connection`, `upgrade`). Up to 32 headers, 4 KB of combined value bytes.
|
|
17
|
+
|
|
18
|
+
### Examples
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
require 'time'
|
|
22
|
+
require 'weft-sdk'
|
|
23
|
+
# setup authorization
|
|
24
|
+
Weft.configure do |config|
|
|
25
|
+
# Configure Bearer authorization (APIKey): bearerAuth
|
|
26
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
api_instance = Weft::FetchApi.new
|
|
30
|
+
fetch_request = Weft::FetchRequest.new({url: 'https://x402.api.agentmail.to/v0/inboxes'}) # FetchRequest |
|
|
31
|
+
|
|
32
|
+
begin
|
|
33
|
+
# Pay-and-fetch any URL (x402 proxy)
|
|
34
|
+
result = api_instance.fetch(fetch_request)
|
|
35
|
+
p result
|
|
36
|
+
rescue Weft::ApiError => e
|
|
37
|
+
puts "Error when calling FetchApi->fetch: #{e}"
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Using the fetch_with_http_info variant
|
|
42
|
+
|
|
43
|
+
This returns an Array which contains the response data, status code and headers.
|
|
44
|
+
|
|
45
|
+
> <Array(<FetchResponse>, Integer, Hash)> fetch_with_http_info(fetch_request)
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
begin
|
|
49
|
+
# Pay-and-fetch any URL (x402 proxy)
|
|
50
|
+
data, status_code, headers = api_instance.fetch_with_http_info(fetch_request)
|
|
51
|
+
p status_code # => 2xx
|
|
52
|
+
p headers # => { ... }
|
|
53
|
+
p data # => <FetchResponse>
|
|
54
|
+
rescue Weft::ApiError => e
|
|
55
|
+
puts "Error when calling FetchApi->fetch_with_http_info: #{e}"
|
|
56
|
+
end
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Parameters
|
|
60
|
+
|
|
61
|
+
| Name | Type | Description | Notes |
|
|
62
|
+
| ---- | ---- | ----------- | ----- |
|
|
63
|
+
| **fetch_request** | [**FetchRequest**](FetchRequest.md) | | |
|
|
64
|
+
|
|
65
|
+
### Return type
|
|
66
|
+
|
|
67
|
+
[**FetchResponse**](FetchResponse.md)
|
|
68
|
+
|
|
69
|
+
### Authorization
|
|
70
|
+
|
|
71
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
72
|
+
|
|
73
|
+
### HTTP request headers
|
|
74
|
+
|
|
75
|
+
- **Content-Type**: application/json
|
|
76
|
+
- **Accept**: application/json
|
|
77
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Weft::FetchBalanceSnapshot
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **promo_usd** | **String** | | |
|
|
8
|
+
| **wallet_usdc** | **String** | | |
|
|
9
|
+
| **spent_today_usd** | **String** | | |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'weft-sdk'
|
|
15
|
+
|
|
16
|
+
instance = Weft::FetchBalanceSnapshot.new(
|
|
17
|
+
promo_usd: 0.00,
|
|
18
|
+
wallet_usdc: 12.34,
|
|
19
|
+
spent_today_usd: 0.42
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Weft::FetchErrorResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **error** | **String** | Stable error code. | |
|
|
8
|
+
| **details** | **Hash<String, Object>** | Optional context. Shape varies by error code. | |
|
|
9
|
+
| **policy** | [**SpendingPolicy**](SpendingPolicy.md) | | |
|
|
10
|
+
| **balance** | [**FetchBalanceSnapshot**](FetchBalanceSnapshot.md) | | |
|
|
11
|
+
| **dashboard_url** | **String** | Deep-link to the dashboard's policy page. | |
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require 'weft-sdk'
|
|
17
|
+
|
|
18
|
+
instance = Weft::FetchErrorResponse.new(
|
|
19
|
+
error: EXCEEDED_MAX_COST,
|
|
20
|
+
details: null,
|
|
21
|
+
policy: null,
|
|
22
|
+
balance: null,
|
|
23
|
+
dashboard_url: null
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Weft::FetchRequest
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **url** | **String** | Target URL. Must pass Weft's URL safety check (no SSRF / private IP ranges). | |
|
|
8
|
+
| **max_cost_usd** | **String** | Hard ceiling on what the buyer is willing to pay. Defaults to `0.10` USD. | [optional][default to '0.10'] |
|
|
9
|
+
| **method** | **String** | HTTP method to use against the upstream. | [optional][default to 'GET'] |
|
|
10
|
+
| **body** | [**FetchRequestBody**](FetchRequestBody.md) | | [optional] |
|
|
11
|
+
| **headers** | **Hash<String, String>** | Headers forwarded to the upstream. Up to 32 headers, 4 KB total. The following are silently stripped: `host`, `authorization`, `cookie`, `proxy-authorization`, `x-forwarded-*`, `x-real-ip`, `x-payment`, `connection`, `upgrade`. | [optional] |
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require 'weft-sdk'
|
|
17
|
+
|
|
18
|
+
instance = Weft::FetchRequest.new(
|
|
19
|
+
url: https://x402.api.agentmail.to/v0/inboxes,
|
|
20
|
+
max_cost_usd: 0.05,
|
|
21
|
+
method: null,
|
|
22
|
+
body: null,
|
|
23
|
+
headers: {Accept=application/json, User-Agent=my-agent/1.0}
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Weft::FetchRequestBody
|
|
2
|
+
|
|
3
|
+
## Class instance methods
|
|
4
|
+
|
|
5
|
+
### `openapi_one_of`
|
|
6
|
+
|
|
7
|
+
Returns the list of classes defined in oneOf.
|
|
8
|
+
|
|
9
|
+
#### Example
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'weft-sdk'
|
|
13
|
+
|
|
14
|
+
Weft::FetchRequestBody.openapi_one_of
|
|
15
|
+
# =>
|
|
16
|
+
# [
|
|
17
|
+
# :'Object',
|
|
18
|
+
# :'String'
|
|
19
|
+
# ]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### build
|
|
23
|
+
|
|
24
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
|
25
|
+
|
|
26
|
+
#### Example
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require 'weft-sdk'
|
|
30
|
+
|
|
31
|
+
Weft::FetchRequestBody.build(data)
|
|
32
|
+
# => #<Object:0x00007fdd4aab02a0>
|
|
33
|
+
|
|
34
|
+
Weft::FetchRequestBody.build(data_that_doesnt_match)
|
|
35
|
+
# => nil
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Parameters
|
|
39
|
+
|
|
40
|
+
| Name | Type | Description |
|
|
41
|
+
| ---- | ---- | ----------- |
|
|
42
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
|
43
|
+
|
|
44
|
+
#### Return type
|
|
45
|
+
|
|
46
|
+
- `Object`
|
|
47
|
+
- `String`
|
|
48
|
+
- `nil` (if no type matches)
|
|
49
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Weft::FetchResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **status** | **Integer** | HTTP status returned by the upstream after the paid replay. | |
|
|
8
|
+
| **headers** | **Hash<String, String>** | Response headers from the upstream. | |
|
|
9
|
+
| **body_base64** | **String** | Base64-encoded response body. Empty string for empty bodies. | |
|
|
10
|
+
| **paid_usd** | **String** | USD amount actually settled. Null for free upstreams. | |
|
|
11
|
+
| **tx_hash** | **String** | Settlement transaction hash. Null for free upstreams. | |
|
|
12
|
+
| **artifact_id** | **String** | Internal artifact identifier if the response was persisted. | |
|
|
13
|
+
| **merchant** | [**Merchant**](Merchant.md) | Merchant reputation snapshot. Null for free upstreams. | |
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require 'weft-sdk'
|
|
19
|
+
|
|
20
|
+
instance = Weft::FetchResponse.new(
|
|
21
|
+
status: 200,
|
|
22
|
+
headers: null,
|
|
23
|
+
body_base64: null,
|
|
24
|
+
paid_usd: 0.002,
|
|
25
|
+
tx_hash: null,
|
|
26
|
+
artifact_id: null,
|
|
27
|
+
merchant: null
|
|
28
|
+
)
|
|
29
|
+
```
|
|
30
|
+
|
data/docs/Merchant.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Weft::Merchant
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **address** | **String** | EVM address that received the payment. | |
|
|
8
|
+
| **settlement_count** | **Integer** | All-time settlement count for this merchant address. | |
|
|
9
|
+
| **first_seen_at** | **Time** | First time Weft observed a payment to this address. | |
|
|
10
|
+
| **dispute_count** | **Integer** | All-time dispute count for this merchant address. | |
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'weft-sdk'
|
|
16
|
+
|
|
17
|
+
instance = Weft::Merchant.new(
|
|
18
|
+
address: null,
|
|
19
|
+
settlement_count: null,
|
|
20
|
+
first_seen_at: null,
|
|
21
|
+
dispute_count: null
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Weft::PromoBalance
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **balance_usd** | **String** | | |
|
|
8
|
+
| **scope** | **String** | Where the promo can be spent. | |
|
|
9
|
+
| **expires_at** | **Time** | | |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'weft-sdk'
|
|
15
|
+
|
|
16
|
+
instance = Weft::PromoBalance.new(
|
|
17
|
+
balance_usd: 0.00,
|
|
18
|
+
scope: weft-search,
|
|
19
|
+
expires_at: null
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Weft::SearchAgentCard
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **name** | **String** | | [optional] |
|
|
8
|
+
| **description** | **String** | | [optional] |
|
|
9
|
+
| **url** | **String** | | [optional] |
|
|
10
|
+
| **version** | **String** | | [optional] |
|
|
11
|
+
| **protocol_version** | **String** | | [optional] |
|
|
12
|
+
| **capabilities** | **Hash<String, Object>** | | [optional] |
|
|
13
|
+
| **default_input_modes** | **Array<String>** | | [optional] |
|
|
14
|
+
| **default_output_modes** | **Array<String>** | | [optional] |
|
|
15
|
+
| **skills** | [**Array<SearchSkill>**](SearchSkill.md) | | [optional] |
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
require 'weft-sdk'
|
|
21
|
+
|
|
22
|
+
instance = Weft::SearchAgentCard.new(
|
|
23
|
+
name: null,
|
|
24
|
+
description: null,
|
|
25
|
+
url: null,
|
|
26
|
+
version: null,
|
|
27
|
+
protocol_version: null,
|
|
28
|
+
capabilities: null,
|
|
29
|
+
default_input_modes: null,
|
|
30
|
+
default_output_modes: null,
|
|
31
|
+
skills: null
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
data/docs/SearchApi.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Weft::SearchApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.weftlabs.com*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**search**](SearchApi.md#search) | **POST** /api/v1/search | Search the Weft index |
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## search
|
|
11
|
+
|
|
12
|
+
> <SearchResponse> search(search_request)
|
|
13
|
+
|
|
14
|
+
Search the Weft index
|
|
15
|
+
|
|
16
|
+
Semantic search over the Weft index of paid agent resources. The request body carries a free-text `query`, an optional `limit`, and an optional `filters` object that narrows by price band, payment protocol, agent protocol, or domain tag. Filters are applied as a post-filter after the embedding score is computed. Backend selection is server-side via the `SEARCH_BACKEND` env var: `mock` (default, reads YAML fixtures and sets `_mock: true` in the response) or `platform` (proxies to the upstream search service). Both backends return the same envelope. Account-scoped: the bearer token must be a buyer-scoped API key. Free for authenticated buyers in v1; billing is planned for a later release. Response negotiation: `Accept: application/json` (default) returns the structured envelope; `Accept: text/markdown` returns a rendered Markdown digest of the same results — useful for piping into a chat UI or LLM prompt.
|
|
17
|
+
|
|
18
|
+
### Examples
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
require 'time'
|
|
22
|
+
require 'weft-sdk'
|
|
23
|
+
# setup authorization
|
|
24
|
+
Weft.configure do |config|
|
|
25
|
+
# Configure Bearer authorization (APIKey): bearerAuth
|
|
26
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
api_instance = Weft::SearchApi.new
|
|
30
|
+
search_request = Weft::SearchRequest.new({query: 'send email from an agent'}) # SearchRequest |
|
|
31
|
+
|
|
32
|
+
begin
|
|
33
|
+
# Search the Weft index
|
|
34
|
+
result = api_instance.search(search_request)
|
|
35
|
+
p result
|
|
36
|
+
rescue Weft::ApiError => e
|
|
37
|
+
puts "Error when calling SearchApi->search: #{e}"
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Using the search_with_http_info variant
|
|
42
|
+
|
|
43
|
+
This returns an Array which contains the response data, status code and headers.
|
|
44
|
+
|
|
45
|
+
> <Array(<SearchResponse>, Integer, Hash)> search_with_http_info(search_request)
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
begin
|
|
49
|
+
# Search the Weft index
|
|
50
|
+
data, status_code, headers = api_instance.search_with_http_info(search_request)
|
|
51
|
+
p status_code # => 2xx
|
|
52
|
+
p headers # => { ... }
|
|
53
|
+
p data # => <SearchResponse>
|
|
54
|
+
rescue Weft::ApiError => e
|
|
55
|
+
puts "Error when calling SearchApi->search_with_http_info: #{e}"
|
|
56
|
+
end
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Parameters
|
|
60
|
+
|
|
61
|
+
| Name | Type | Description | Notes |
|
|
62
|
+
| ---- | ---- | ----------- | ----- |
|
|
63
|
+
| **search_request** | [**SearchRequest**](SearchRequest.md) | | |
|
|
64
|
+
|
|
65
|
+
### Return type
|
|
66
|
+
|
|
67
|
+
[**SearchResponse**](SearchResponse.md)
|
|
68
|
+
|
|
69
|
+
### Authorization
|
|
70
|
+
|
|
71
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
72
|
+
|
|
73
|
+
### HTTP request headers
|
|
74
|
+
|
|
75
|
+
- **Content-Type**: application/json
|
|
76
|
+
- **Accept**: application/json, text/markdown
|
|
77
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Weft::SearchEndpoints
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **a2a** | **String** | | [optional] |
|
|
8
|
+
| **mcp** | **String** | | [optional] |
|
|
9
|
+
| **openapi** | **String** | URL to the agent's OpenAPI document. | [optional] |
|
|
10
|
+
| **weft_fetch_target** | **String** | Base URL the `weft_fetch` MCP tool should target for this agent. | [optional] |
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'weft-sdk'
|
|
16
|
+
|
|
17
|
+
instance = Weft::SearchEndpoints.new(
|
|
18
|
+
a2a: null,
|
|
19
|
+
mcp: null,
|
|
20
|
+
openapi: null,
|
|
21
|
+
weft_fetch_target: null
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Weft::SearchErrorResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **error** | **String** | Stable error code. | |
|
|
8
|
+
| **details** | **Hash<String, Object>** | Optional context. Shape varies by error code. | [optional] |
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```ruby
|
|
13
|
+
require 'weft-sdk'
|
|
14
|
+
|
|
15
|
+
instance = Weft::SearchErrorResponse.new(
|
|
16
|
+
error: null,
|
|
17
|
+
details: null
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|