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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/docs/ApiKeyListResponse.md +3 -1
  3. data/docs/BalanceApi.md +74 -0
  4. data/docs/BalanceResponse.md +26 -0
  5. data/docs/DefaultApi.md +12 -12
  6. data/docs/Error.md +7 -7
  7. data/docs/FetchApi.md +77 -0
  8. data/docs/FetchBalanceSnapshot.md +22 -0
  9. data/docs/FetchErrorResponse.md +26 -0
  10. data/docs/FetchRequest.md +26 -0
  11. data/docs/FetchRequestBody.md +49 -0
  12. data/docs/FetchResponse.md +30 -0
  13. data/docs/Merchant.md +24 -0
  14. data/docs/PromoBalance.md +22 -0
  15. data/docs/SearchAgentCard.md +34 -0
  16. data/docs/SearchApi.md +77 -0
  17. data/docs/SearchEndpoints.md +24 -0
  18. data/docs/SearchErrorResponse.md +20 -0
  19. data/docs/SearchFilters.md +26 -0
  20. data/docs/SearchPricing.md +24 -0
  21. data/docs/SearchRanking.md +26 -0
  22. data/docs/SearchRequest.md +22 -0
  23. data/docs/SearchResponse.md +26 -0
  24. data/docs/SearchResult.md +36 -0
  25. data/docs/SearchSkill.md +36 -0
  26. data/docs/SearchSkillEndpoint.md +20 -0
  27. data/docs/SpendingPolicy.md +22 -0
  28. data/docs/Wallet.md +22 -0
  29. data/lib/weft/generated/api/account_api.rb +2 -2
  30. data/lib/weft/generated/api/api_keys_api.rb +2 -2
  31. data/lib/weft/generated/api/auth_api.rb +2 -2
  32. data/lib/weft/generated/api/balance_api.rb +79 -0
  33. data/lib/weft/generated/api/default_api.rb +11 -11
  34. data/lib/weft/generated/api/fetch_api.rb +90 -0
  35. data/lib/weft/generated/api/payments_api.rb +2 -2
  36. data/lib/weft/generated/api/search_api.rb +90 -0
  37. data/lib/weft/generated/api_client.rb +2 -2
  38. data/lib/weft/generated/api_error.rb +2 -2
  39. data/lib/weft/generated/api_model_base.rb +2 -2
  40. data/lib/weft/generated/configuration.rb +2 -2
  41. data/lib/weft/generated/models/account_details.rb +2 -2
  42. data/lib/weft/generated/models/api_key.rb +2 -2
  43. data/lib/weft/generated/models/api_key_created.rb +2 -2
  44. data/lib/weft/generated/models/api_key_created_response.rb +2 -2
  45. data/lib/weft/generated/models/api_key_list_response.rb +32 -6
  46. data/lib/weft/generated/models/auth_response.rb +2 -2
  47. data/lib/weft/generated/models/auth_response_data.rb +2 -2
  48. data/lib/weft/generated/models/balance_response.rb +271 -0
  49. data/lib/weft/generated/models/confirm_request.rb +2 -2
  50. data/lib/weft/generated/models/create_api_key_request.rb +2 -2
  51. data/lib/weft/generated/models/error.rb +7 -2
  52. data/lib/weft/generated/models/error_response.rb +3 -2
  53. data/lib/weft/generated/models/fetch_balance_snapshot.rb +217 -0
  54. data/lib/weft/generated/models/fetch_error_response.rb +298 -0
  55. data/lib/weft/generated/models/fetch_request.rb +266 -0
  56. data/lib/weft/generated/models/fetch_request_body.rb +105 -0
  57. data/lib/weft/generated/models/fetch_response.rb +330 -0
  58. data/lib/weft/generated/models/me_response.rb +2 -2
  59. data/lib/weft/generated/models/merchant.rb +264 -0
  60. data/lib/weft/generated/models/message_response.rb +2 -2
  61. data/lib/weft/generated/models/message_response_data.rb +2 -2
  62. data/lib/weft/generated/models/pagination.rb +2 -2
  63. data/lib/weft/generated/models/password_reset_request.rb +2 -2
  64. data/lib/weft/generated/models/password_update_request.rb +2 -2
  65. data/lib/weft/generated/models/payment.rb +2 -2
  66. data/lib/weft/generated/models/payment_list_response.rb +2 -2
  67. data/lib/weft/generated/models/payment_response.rb +2 -2
  68. data/lib/weft/generated/models/promo_balance.rb +218 -0
  69. data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
  70. data/lib/weft/generated/models/search_agent_card.rb +228 -0
  71. data/lib/weft/generated/models/{agent_stats.rb → search_endpoints.rb} +33 -57
  72. data/lib/weft/generated/models/search_error_response.rb +202 -0
  73. data/lib/weft/generated/models/search_filters.rb +277 -0
  74. data/lib/weft/generated/models/search_pricing.rb +232 -0
  75. data/lib/weft/generated/models/search_ranking.rb +277 -0
  76. data/lib/weft/generated/models/search_request.rb +223 -0
  77. data/lib/weft/generated/models/{agent_response.rb → search_response.rb} +64 -21
  78. data/lib/weft/generated/models/search_result.rb +414 -0
  79. data/lib/weft/generated/models/search_skill.rb +259 -0
  80. data/lib/weft/generated/models/{agent_list_response.rb → search_skill_endpoint.rb} +19 -54
  81. data/lib/weft/generated/models/sign_in_request.rb +2 -2
  82. data/lib/weft/generated/models/sign_up_request.rb +2 -2
  83. data/lib/weft/generated/models/spending_policy.rb +219 -0
  84. data/lib/weft/generated/models/user.rb +2 -2
  85. data/lib/weft/generated/models/wallet.rb +219 -0
  86. data/lib/weft/generated/version.rb +3 -3
  87. data/lib/weft/sdk.rb +1 -1
  88. metadata +50 -12
  89. data/docs/Agent.md +0 -38
  90. data/docs/AgentListResponse.md +0 -20
  91. data/docs/AgentResponse.md +0 -18
  92. data/docs/AgentStats.md +0 -30
  93. data/docs/AgentsApi.md +0 -147
  94. data/lib/weft/generated/api/agents_api.rb +0 -148
  95. data/lib/weft/generated/models/agent.rb +0 -417
@@ -0,0 +1,26 @@
1
+ # Weft::SearchFilters
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **min_price_usd** | **String** | Decimal USD floor; agent must have at least one skill priced at or above this. | [optional] |
8
+ | **max_price_usd** | **String** | Decimal USD ceiling; agent must have at least one skill priced at or below this. | [optional] |
9
+ | **payment_protocol** | **String** | Payment protocol the agent settles on. | [optional] |
10
+ | **agent_protocol** | **String** | Agent protocol surface (Agent-to-Agent, MCP, or raw OpenAPI). | [optional] |
11
+ | **domain** | **String** | Substring match against any of the agent's declared domain tags (e.g. `email`, `sales`, `enrichment`). | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'weft-sdk'
17
+
18
+ instance = Weft::SearchFilters.new(
19
+ min_price_usd: 0.01,
20
+ max_price_usd: 0.10,
21
+ payment_protocol: null,
22
+ agent_protocol: null,
23
+ domain: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,24 @@
1
+ # Weft::SearchPricing
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **protocol** | **String** | | [optional] |
8
+ | **scheme** | **String** | | [optional] |
9
+ | **amount_usd** | **String** | Default per-call amount; individual skills may override via `price_usd`. | [optional] |
10
+ | **network** | **String** | Settlement network (e.g. `base-sepolia`). | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'weft-sdk'
16
+
17
+ instance = Weft::SearchPricing.new(
18
+ protocol: null,
19
+ scheme: per_call,
20
+ amount_usd: null,
21
+ network: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,26 @@
1
+ # Weft::SearchRanking
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **popularity_score** | **Float** | | [optional] |
8
+ | **settlement_count_30d** | **Integer** | | [optional] |
9
+ | **success_rate_30d** | **Float** | | [optional] |
10
+ | **p50_latency_ms** | **Integer** | | [optional] |
11
+ | **first_seen_at** | **Time** | | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'weft-sdk'
17
+
18
+ instance = Weft::SearchRanking.new(
19
+ popularity_score: null,
20
+ settlement_count_30d: null,
21
+ success_rate_30d: null,
22
+ p50_latency_ms: null,
23
+ first_seen_at: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,22 @@
1
+ # Weft::SearchRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **query** | **String** | Free-text query. Required and non-empty. | |
8
+ | **limit** | **Integer** | Max number of hits to return. Clamped to [1, 50]. | [optional][default to 10] |
9
+ | **filters** | [**SearchFilters**](SearchFilters.md) | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'weft-sdk'
15
+
16
+ instance = Weft::SearchRequest.new(
17
+ query: send email from an agent,
18
+ limit: null,
19
+ filters: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,26 @@
1
+ # Weft::SearchResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **results** | [**Array<SearchResult>**](SearchResult.md) | | |
8
+ | **paid_usd** | **String** | Always `null` in v1. | [optional] |
9
+ | **tx_hash** | **String** | Always `null` in v1. | [optional] |
10
+ | **artifact_id** | **String** | Always `null` in v1. | [optional] |
11
+ | **_mock** | **Boolean** | Present and `true` only when served by the mock backend. | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'weft-sdk'
17
+
18
+ instance = Weft::SearchResponse.new(
19
+ results: null,
20
+ paid_usd: null,
21
+ tx_hash: null,
22
+ artifact_id: null,
23
+ _mock: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,36 @@
1
+ # Weft::SearchResult
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | Stable agent identifier (e.g. `weft:agent:agentmail`). | |
8
+ | **score** | **Float** | Cosine similarity score, clipped to [0, 1]. | |
9
+ | **protocol** | **String** | Agent protocol surface. | |
10
+ | **domain** | **Array<String>** | Domain tags declared by the agent. | |
11
+ | **reseller** | **String** | Reseller slug if this agent is fronted by an aggregator (e.g. `locus`). | [optional] |
12
+ | **upstream** | **String** | Upstream provider hostname when fronted by a reseller. | [optional] |
13
+ | **agent_card** | [**SearchAgentCard**](SearchAgentCard.md) | | |
14
+ | **pricing** | [**SearchPricing**](SearchPricing.md) | | |
15
+ | **ranking** | [**SearchRanking**](SearchRanking.md) | | |
16
+ | **endpoints** | [**SearchEndpoints**](SearchEndpoints.md) | | |
17
+
18
+ ## Example
19
+
20
+ ```ruby
21
+ require 'weft-sdk'
22
+
23
+ instance = Weft::SearchResult.new(
24
+ id: null,
25
+ score: null,
26
+ protocol: null,
27
+ domain: null,
28
+ reseller: null,
29
+ upstream: null,
30
+ agent_card: null,
31
+ pricing: null,
32
+ ranking: null,
33
+ endpoints: null
34
+ )
35
+ ```
36
+
@@ -0,0 +1,36 @@
1
+ # Weft::SearchSkill
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | [optional] |
8
+ | **name** | **String** | | [optional] |
9
+ | **description** | **String** | | [optional] |
10
+ | **tags** | **Array<String>** | | [optional] |
11
+ | **examples** | **Array<String>** | | [optional] |
12
+ | **input_modes** | **Array<String>** | | [optional] |
13
+ | **output_modes** | **Array<String>** | | [optional] |
14
+ | **streaming** | **Boolean** | True for skills that require streaming transport (e.g. websockets). Streaming skills are filtered out of results by default so non-streaming clients only see callable skills. | [optional] |
15
+ | **endpoint** | [**SearchSkillEndpoint**](SearchSkillEndpoint.md) | | [optional] |
16
+ | **price_usd** | **String** | Per-call price in USD for this individual skill. | [optional] |
17
+
18
+ ## Example
19
+
20
+ ```ruby
21
+ require 'weft-sdk'
22
+
23
+ instance = Weft::SearchSkill.new(
24
+ id: null,
25
+ name: null,
26
+ description: null,
27
+ tags: null,
28
+ examples: null,
29
+ input_modes: null,
30
+ output_modes: null,
31
+ streaming: null,
32
+ endpoint: null,
33
+ price_usd: null
34
+ )
35
+ ```
36
+
@@ -0,0 +1,20 @@
1
+ # Weft::SearchSkillEndpoint
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **method** | **String** | HTTP method or `WEBSOCKET` for streaming skills. | [optional] |
8
+ | **path** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'weft-sdk'
14
+
15
+ instance = Weft::SearchSkillEndpoint.new(
16
+ method: null,
17
+ path: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,22 @@
1
+ # Weft::SpendingPolicy
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **max_tx_usd** | **String** | Maximum USD per single transaction. | |
8
+ | **daily_limit_usd** | **String** | Maximum USD spent in a 24-hour window. | |
9
+ | **weekly_limit_usd** | **String** | Maximum USD spent in a 7-day window. | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'weft-sdk'
15
+
16
+ instance = Weft::SpendingPolicy.new(
17
+ max_tx_usd: 1.00,
18
+ daily_limit_usd: 10.00,
19
+ weekly_limit_usd: 50.00
20
+ )
21
+ ```
22
+
data/docs/Wallet.md ADDED
@@ -0,0 +1,22 @@
1
+ # Weft::Wallet
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **address** | **String** | EVM address of the buyer's Privy-managed wallet. Null if no wallet provisioned. | |
8
+ | **balance_usdc** | **String** | Live USDC balance, 2dp. Returns \"0.00\" if the upstream wallet provider is unreachable. | |
9
+ | **network** | **String** | Wallet network (e.g. `base-sepolia`). | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'weft-sdk'
15
+
16
+ instance = Weft::Wallet.new(
17
+ address: null,
18
+ balance_usdc: 12.34,
19
+ network: null
20
+ )
21
+ ```
22
+
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Weft API
3
3
 
4
- #API for agent-first payments and discovery.
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
5
 
6
- The version of the OpenAPI document: 0.3.0
6
+ The version of the OpenAPI document: 0.5.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Weft API
3
3
 
4
- #API for agent-first payments and discovery.
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
5
 
6
- The version of the OpenAPI document: 0.3.0
6
+ The version of the OpenAPI document: 0.5.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Weft API
3
3
 
4
- #API for agent-first payments and discovery.
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
5
 
6
- The version of the OpenAPI document: 0.3.0
6
+ The version of the OpenAPI document: 0.5.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -0,0 +1,79 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Weft
16
+ class BalanceApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get wallet, spending policy, and current-window spend
23
+ # 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.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [BalanceResponse]
26
+ def get_balance(opts = {})
27
+ data, _status_code, _headers = get_balance_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Get wallet, spending policy, and current-window spend
32
+ # 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.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(BalanceResponse, Integer, Hash)>] BalanceResponse data, response status code and response headers
35
+ def get_balance_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: BalanceApi.get_balance ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/api/v1/balance'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'BalanceResponse'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"BalanceApi.get_balance",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: BalanceApi#get_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Weft API
3
3
 
4
- #API for agent-first payments and discovery.
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
5
 
6
- The version of the OpenAPI document: 0.3.0
6
+ The version of the OpenAPI document: 0.5.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -19,23 +19,23 @@ module Weft
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Fetch OpenAPI spec
22
+ # Fetch this OpenAPI document
23
23
  # @param [Hash] opts the optional parameters
24
24
  # @return [String]
25
- def get_api_docs(opts = {})
26
- data, _status_code, _headers = get_api_docs_with_http_info(opts)
25
+ def get_open_api_document(opts = {})
26
+ data, _status_code, _headers = get_open_api_document_with_http_info(opts)
27
27
  data
28
28
  end
29
29
 
30
- # Fetch OpenAPI spec
30
+ # Fetch this OpenAPI document
31
31
  # @param [Hash] opts the optional parameters
32
32
  # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
33
- def get_api_docs_with_http_info(opts = {})
33
+ def get_open_api_document_with_http_info(opts = {})
34
34
  if @api_client.config.debugging
35
- @api_client.config.logger.debug 'Calling API: DefaultApi.get_api_docs ...'
35
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_open_api_document ...'
36
36
  end
37
37
  # resource path
38
- local_var_path = '/api/v1/docs'
38
+ local_var_path = '/docs/openapi.yaml'
39
39
 
40
40
  # query parameters
41
41
  query_params = opts[:query_params] || {}
@@ -58,7 +58,7 @@ module Weft
58
58
  auth_names = opts[:debug_auth_names] || []
59
59
 
60
60
  new_options = opts.merge(
61
- :operation => :"DefaultApi.get_api_docs",
61
+ :operation => :"DefaultApi.get_open_api_document",
62
62
  :header_params => header_params,
63
63
  :query_params => query_params,
64
64
  :form_params => form_params,
@@ -69,7 +69,7 @@ module Weft
69
69
 
70
70
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
71
71
  if @api_client.config.debugging
72
- @api_client.config.logger.debug "API called: DefaultApi#get_api_docs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
72
+ @api_client.config.logger.debug "API called: DefaultApi#get_open_api_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
73
73
  end
74
74
  return data, status_code, headers
75
75
  end
@@ -0,0 +1,90 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Weft
16
+ class FetchApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Pay-and-fetch any URL (x402 proxy)
23
+ # 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.
24
+ # @param fetch_request [FetchRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [FetchResponse]
27
+ def fetch(fetch_request, opts = {})
28
+ data, _status_code, _headers = fetch_with_http_info(fetch_request, opts)
29
+ data
30
+ end
31
+
32
+ # Pay-and-fetch any URL (x402 proxy)
33
+ # Universal x402 fetch proxy. The caller provides a target &#x60;url&#x60;, a hard &#x60;max_cost_usd&#x60; ceiling, and optional &#x60;method&#x60; / &#x60;body&#x60; / &#x60;headers&#x60;. Weft: 1. Issues the request. 2. On &#x60;402 Payment Required&#x60;, parses the merchant&#39;s challenge. 3. Compares the asking price to &#x60;max_cost_usd&#x60; and the buyer&#39;s policy (&#x60;max_tx_usd&#x60;, daily/weekly limits). 4. Signs an EIP-3009 transfer from the buyer&#39;s wallet. 5. Replays the request with the &#x60;X-Payment&#x60; header. 6. Streams the upstream artifact back, base64-encoded under &#x60;body_base64&#x60;, with &#x60;paid_usd&#x60;, &#x60;tx_hash&#x60;, and the merchant&#39;s reputation snapshot. Errors are structured with a stable &#x60;error&#x60; code, and each error response carries the buyer&#39;s &#x60;policy&#x60;, &#x60;balance&#x60;, and a &#x60;dashboard_url&#x60; 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&#39;s &#x60;headers&#x60; are passed through to the upstream, except a denylist of hop-by-hop and Weft-internal headers (&#x60;host&#x60;, &#x60;authorization&#x60;, &#x60;cookie&#x60;, &#x60;proxy-authorization&#x60;, &#x60;x-forwarded-*&#x60;, &#x60;x-real-ip&#x60;, &#x60;x-payment&#x60;, &#x60;connection&#x60;, &#x60;upgrade&#x60;). Up to 32 headers, 4 KB of combined value bytes.
34
+ # @param fetch_request [FetchRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(FetchResponse, Integer, Hash)>] FetchResponse data, response status code and response headers
37
+ def fetch_with_http_info(fetch_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: FetchApi.fetch ...'
40
+ end
41
+ # verify the required parameter 'fetch_request' is set
42
+ if @api_client.config.client_side_validation && fetch_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'fetch_request' when calling FetchApi.fetch"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/v1/fetch'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(fetch_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'FetchResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"FetchApi.fetch",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: FetchApi#fetch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+ end
90
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Weft API
3
3
 
4
- #API for agent-first payments and discovery.
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
5
 
6
- The version of the OpenAPI document: 0.3.0
6
+ The version of the OpenAPI document: 0.5.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -0,0 +1,90 @@
1
+ =begin
2
+ #Weft API
3
+
4
+ #The Weft API is the buyer-runtime surface that powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and any third-party agent that wants to discover and pay for paid resources on Weft. v1 covers five buyer concerns: 1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`) 2. CLI authentication (`/api/v1/api_keys`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/payments`) Seller-side concerns (agent management, payout analytics, webhook delivery, the public storefront for `data_api` resources) live in the dashboard and are intentionally not documented here. They will be split out into a separate, dashboard-scoped spec when they need to be SDK-consumable. All errors share the envelope defined by `ErrorResponse`, except the buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke envelopes carrying additional context — see `SearchErrorResponse` and `FetchErrorResponse`.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Weft
16
+ class SearchApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Search the Weft index
23
+ # 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.
24
+ # @param search_request [SearchRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [SearchResponse]
27
+ def search(search_request, opts = {})
28
+ data, _status_code, _headers = search_with_http_info(search_request, opts)
29
+ data
30
+ end
31
+
32
+ # Search the Weft index
33
+ # Semantic search over the Weft index of paid agent resources. The request body carries a free-text &#x60;query&#x60;, an optional &#x60;limit&#x60;, and an optional &#x60;filters&#x60; 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 &#x60;SEARCH_BACKEND&#x60; env var: &#x60;mock&#x60; (default, reads YAML fixtures and sets &#x60;_mock: true&#x60; in the response) or &#x60;platform&#x60; (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: &#x60;Accept: application/json&#x60; (default) returns the structured envelope; &#x60;Accept: text/markdown&#x60; returns a rendered Markdown digest of the same results — useful for piping into a chat UI or LLM prompt.
34
+ # @param search_request [SearchRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(SearchResponse, Integer, Hash)>] SearchResponse data, response status code and response headers
37
+ def search_with_http_info(search_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: SearchApi.search ...'
40
+ end
41
+ # verify the required parameter 'search_request' is set
42
+ if @api_client.config.client_side_validation && search_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'search_request' when calling SearchApi.search"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/v1/search'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/markdown']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(search_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'SearchResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"SearchApi.search",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: SearchApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+ end
90
+ end