weft-sdk 0.7.0 → 0.9.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 (170) hide show
  1. checksums.yaml +4 -4
  2. data/docs/APIKeysApi.md +1 -2
  3. data/docs/AccountApi.md +6 -5
  4. data/docs/AccountDetails.md +2 -1
  5. data/docs/ApiKey.md +0 -1
  6. data/docs/ApiKeyCreated.md +0 -1
  7. data/docs/ApiKeyCreatedResponse.md +0 -1
  8. data/docs/ApiKeyListResponse.md +0 -1
  9. data/docs/AuthApi.md +6 -7
  10. data/docs/AuthResponse.md +0 -1
  11. data/docs/AuthResponseData.md +0 -1
  12. data/docs/BalanceApi.md +1 -2
  13. data/docs/BalanceResponse.md +3 -4
  14. data/docs/ConfirmRequest.md +0 -1
  15. data/docs/CreateApiKeyRequest.md +0 -1
  16. data/docs/DefaultApi.md +0 -1
  17. data/docs/EnrolledResource.md +0 -1
  18. data/docs/Error.md +0 -1
  19. data/docs/ErrorResponse.md +0 -1
  20. data/docs/Fetch403Response.md +0 -1
  21. data/docs/FetchApi.md +10 -7
  22. data/docs/FetchBalanceSnapshot.md +2 -3
  23. data/docs/FetchErrorResponse.md +0 -1
  24. data/docs/FetchRequest.md +0 -1
  25. data/docs/FetchRequestBody.md +0 -1
  26. data/docs/FetchResponse.md +5 -2
  27. data/docs/InsufficientScopeResponse.md +0 -1
  28. data/docs/MeApiKey.md +0 -1
  29. data/docs/MeApiKeyCreator.md +0 -1
  30. data/docs/MeResponse.md +1 -2
  31. data/docs/MeResponseData.md +78 -0
  32. data/docs/Merchant.md +0 -1
  33. data/docs/MessageResponse.md +0 -1
  34. data/docs/MessageResponseData.md +0 -1
  35. data/docs/Pagination.md +0 -1
  36. data/docs/PasswordResetRequest.md +0 -1
  37. data/docs/PasswordUpdateRequest.md +0 -1
  38. data/docs/Payment.md +0 -3
  39. data/docs/PaymentListResponse.md +0 -1
  40. data/docs/PaymentResponse.md +0 -1
  41. data/docs/PaymentsApi.md +0 -1
  42. data/docs/PrincipalWallet.md +19 -0
  43. data/docs/PromoBalance.md +0 -1
  44. data/docs/Purchase.md +43 -0
  45. data/docs/PurchaseArtifact.md +23 -0
  46. data/docs/PurchaseListResponse.md +19 -0
  47. data/docs/PurchaseResponse.md +17 -0
  48. data/docs/PurchasesApi.md +148 -0
  49. data/docs/ResendConfirmationRequest.md +0 -1
  50. data/docs/ResourceEnrollmentRequest.md +0 -1
  51. data/docs/ResourceEnrollmentResponse.md +0 -1
  52. data/docs/ResourceStats.md +0 -1
  53. data/docs/ResourcesApi.md +2 -3
  54. data/docs/SearchApi.md +2 -3
  55. data/docs/SearchCapabilityRef.md +19 -0
  56. data/docs/SearchEndpointCall.md +23 -0
  57. data/docs/SearchEndpointHit.md +41 -0
  58. data/docs/SearchEndpointPrice.md +25 -0
  59. data/docs/SearchErrorResponse.md +0 -1
  60. data/docs/SearchFilterSpec.md +23 -0
  61. data/docs/SearchPaymentOffer.md +31 -0
  62. data/docs/SearchPriceAtomicFilter.md +25 -0
  63. data/docs/SearchPriceUsdFilter.md +25 -0
  64. data/docs/SearchProtocolFilter.md +19 -0
  65. data/docs/SearchProviderRef.md +21 -0
  66. data/docs/SearchRequest.md +3 -4
  67. data/docs/SearchResourceTypeFilter.md +19 -0
  68. data/docs/SearchResponse.md +35 -8
  69. data/docs/SearchResponseWarningsInner.md +23 -0
  70. data/docs/SearchResult.md +8 -21
  71. data/docs/SignInRequest.md +0 -1
  72. data/docs/SignUpRequest.md +0 -1
  73. data/docs/SpendingPolicy.md +0 -1
  74. data/docs/User.md +0 -1
  75. data/docs/UserPrincipal.md +33 -0
  76. data/docs/Wallet.md +3 -4
  77. data/lib/weft/generated/api/account_api.rb +6 -4
  78. data/lib/weft/generated/api/api_keys_api.rb +4 -4
  79. data/lib/weft/generated/api/auth_api.rb +14 -14
  80. data/lib/weft/generated/api/balance_api.rb +4 -4
  81. data/lib/weft/generated/api/default_api.rb +2 -2
  82. data/lib/weft/generated/api/fetch_api.rb +22 -6
  83. data/lib/weft/generated/api/payments_api.rb +2 -2
  84. data/lib/weft/generated/api/purchases_api.rb +150 -0
  85. data/lib/weft/generated/api/resources_api.rb +6 -6
  86. data/lib/weft/generated/api/search_api.rb +6 -6
  87. data/lib/weft/generated/api_client.rb +2 -2
  88. data/lib/weft/generated/api_error.rb +2 -2
  89. data/lib/weft/generated/api_model_base.rb +2 -2
  90. data/lib/weft/generated/configuration.rb +2 -2
  91. data/lib/weft/generated/models/account_details.rb +54 -4
  92. data/lib/weft/generated/models/api_key.rb +2 -2
  93. data/lib/weft/generated/models/api_key_created.rb +2 -2
  94. data/lib/weft/generated/models/api_key_created_response.rb +2 -2
  95. data/lib/weft/generated/models/api_key_list_response.rb +2 -2
  96. data/lib/weft/generated/models/auth_response.rb +2 -2
  97. data/lib/weft/generated/models/auth_response_data.rb +2 -2
  98. data/lib/weft/generated/models/balance_response.rb +5 -5
  99. data/lib/weft/generated/models/confirm_request.rb +2 -2
  100. data/lib/weft/generated/models/create_api_key_request.rb +2 -2
  101. data/lib/weft/generated/models/enrolled_resource.rb +4 -4
  102. data/lib/weft/generated/models/error.rb +3 -3
  103. data/lib/weft/generated/models/error_response.rb +3 -3
  104. data/lib/weft/generated/models/fetch403_response.rb +2 -2
  105. data/lib/weft/generated/models/fetch_balance_snapshot.rb +5 -5
  106. data/lib/weft/generated/models/fetch_error_response.rb +5 -5
  107. data/lib/weft/generated/models/fetch_request.rb +5 -5
  108. data/lib/weft/generated/models/fetch_request_body.rb +2 -2
  109. data/lib/weft/generated/models/fetch_response.rb +83 -5
  110. data/lib/weft/generated/models/insufficient_scope_response.rb +3 -3
  111. data/lib/weft/generated/models/me_api_key.rb +2 -2
  112. data/lib/weft/generated/models/me_api_key_creator.rb +3 -3
  113. data/lib/weft/generated/models/me_response.rb +3 -3
  114. data/lib/weft/generated/models/me_response_data.rb +55 -0
  115. data/lib/weft/generated/models/merchant.rb +2 -2
  116. data/lib/weft/generated/models/message_response.rb +2 -2
  117. data/lib/weft/generated/models/message_response_data.rb +2 -2
  118. data/lib/weft/generated/models/pagination.rb +2 -2
  119. data/lib/weft/generated/models/password_reset_request.rb +2 -2
  120. data/lib/weft/generated/models/password_update_request.rb +2 -2
  121. data/lib/weft/generated/models/payment.rb +3 -12
  122. data/lib/weft/generated/models/payment_list_response.rb +2 -2
  123. data/lib/weft/generated/models/payment_response.rb +2 -2
  124. data/lib/weft/generated/models/principal_wallet.rb +190 -0
  125. data/lib/weft/generated/models/promo_balance.rb +3 -3
  126. data/lib/weft/generated/models/purchase.rb +427 -0
  127. data/lib/weft/generated/models/{search_agent_card.rb → purchase_artifact.rb} +91 -82
  128. data/lib/weft/generated/models/purchase_list_response.rb +192 -0
  129. data/lib/weft/generated/models/purchase_response.rb +164 -0
  130. data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
  131. data/lib/weft/generated/models/resource_enrollment_request.rb +5 -5
  132. data/lib/weft/generated/models/resource_enrollment_response.rb +2 -2
  133. data/lib/weft/generated/models/resource_stats.rb +2 -2
  134. data/lib/weft/generated/models/{search_skill_endpoint.rb → search_capability_ref.rb} +18 -19
  135. data/lib/weft/generated/models/search_endpoint_call.rb +179 -0
  136. data/lib/weft/generated/models/search_endpoint_hit.rb +296 -0
  137. data/lib/weft/generated/models/{search_skill.rb → search_endpoint_price.rb} +76 -112
  138. data/lib/weft/generated/models/search_error_response.rb +5 -5
  139. data/lib/weft/generated/models/search_filter_spec.rb +175 -0
  140. data/lib/weft/generated/models/{search_pricing.rb → search_payment_offer.rb} +64 -67
  141. data/lib/weft/generated/models/search_price_atomic_filter.rb +284 -0
  142. data/lib/weft/generated/models/search_price_usd_filter.rb +294 -0
  143. data/lib/weft/generated/models/search_protocol_filter.rb +200 -0
  144. data/lib/weft/generated/models/{search_endpoints.rb → search_provider_ref.rb} +26 -36
  145. data/lib/weft/generated/models/search_request.rb +36 -27
  146. data/lib/weft/generated/models/search_resource_type_filter.rb +200 -0
  147. data/lib/weft/generated/models/search_response.rb +367 -31
  148. data/lib/weft/generated/models/search_response_warnings_inner.rb +210 -0
  149. data/lib/weft/generated/models/search_result.rb +68 -220
  150. data/lib/weft/generated/models/sign_in_request.rb +2 -2
  151. data/lib/weft/generated/models/sign_up_request.rb +2 -2
  152. data/lib/weft/generated/models/spending_policy.rb +2 -2
  153. data/lib/weft/generated/models/user.rb +2 -2
  154. data/lib/weft/generated/models/user_principal.rb +370 -0
  155. data/lib/weft/generated/models/wallet.rb +5 -5
  156. data/lib/weft/generated/version.rb +3 -3
  157. data/lib/weft/generated.rb +10 -4
  158. data/lib/weft/sdk.rb +1 -1
  159. metadata +57 -19
  160. data/docs/SearchAgentCard.md +0 -34
  161. data/docs/SearchEndpoints.md +0 -24
  162. data/docs/SearchFilters.md +0 -26
  163. data/docs/SearchPricing.md +0 -24
  164. data/docs/SearchRanking.md +0 -26
  165. data/docs/SearchResponseResultsInner.md +0 -36
  166. data/docs/SearchSkill.md +0 -36
  167. data/docs/SearchSkillEndpoint.md +0 -20
  168. data/lib/weft/generated/models/search_filters.rb +0 -277
  169. data/lib/weft/generated/models/search_ranking.rb +0 -277
  170. data/lib/weft/generated/models/search_response_results_inner.rb +0 -103
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0aaf25197f0063b4c1395a610ae562335a24303eb17691103bc523be80a6097a
4
- data.tar.gz: 12efca83b6af39dcddc777c9c5df46adeaec781e6edb79f678d879f9afb31787
3
+ metadata.gz: bed3008bc143e5170f329a07eab4e6e5137e73f5ea365265ddde9030edd94403
4
+ data.tar.gz: e9a247db0790f417e0368b956dee3658fc691a4ef4afbc4e865b127704b08d38
5
5
  SHA512:
6
- metadata.gz: 8e600a6083dc32201aace8809c420da51447be550da953709ade7036158bd3eab8a653ecead0ea34aa91b4b45c3d5255e5f1c248e460069f29c754c1ef422cd7
7
- data.tar.gz: e0b6ef4b0667c7177fba16ed6b87536f97dcbbce14a6be3300dd2130e771608048e690a890774d279e633f2e56b1d5db7c6b415d87e44a528fac40404ba37001
6
+ metadata.gz: 9e732e0ba6c605b2f0bb00a39badfee76bffaa52e5dcaf083d0a84b7d79bcca8f9a71cb80e576bf0147b5f7edb1fbca20443bc1580bff9721c45f009c8908040
7
+ data.tar.gz: e9aec2ac82424e9274f144c20dadf6cf297254900012b732b45b332a56e319060af11cb1bcb7af653c8675a30240809d96db91673578223c5e0d630ae64b2e19
data/docs/APIKeysApi.md CHANGED
@@ -27,7 +27,7 @@ Weft.configure do |config|
27
27
  end
28
28
 
29
29
  api_instance = Weft::APIKeysApi.new
30
- create_api_key_request = Weft::CreateApiKeyRequest.new # CreateApiKeyRequest |
30
+ create_api_key_request = Weft::CreateApiKeyRequest.new # CreateApiKeyRequest |
31
31
 
32
32
  begin
33
33
  # Create an API key
@@ -205,4 +205,3 @@ end
205
205
 
206
206
  - **Content-Type**: Not defined
207
207
  - **Accept**: application/json
208
-
data/docs/AccountApi.md CHANGED
@@ -4,14 +4,16 @@ All URIs are relative to *https://weft.network*
4
4
 
5
5
  | Method | HTTP request | Description |
6
6
  | ------ | ------------ | ----------- |
7
- | [**get_me**](AccountApi.md#get_me) | **GET** /api/v1/me | Get current account |
7
+ | [**get_me**](AccountApi.md#get_me) | **GET** /api/v1/me | Get the current credential principal |
8
8
 
9
9
 
10
10
  ## get_me
11
11
 
12
12
  > <MeResponse> get_me
13
13
 
14
- Get current account
14
+ Get the current credential principal
15
+
16
+ Returns the Organization represented by a resource API key, or the User represented by an account API key or OAuth access token. Branch on `data.principal_type`; existing Organization fields remain unchanged.
15
17
 
16
18
  ### Examples
17
19
 
@@ -27,7 +29,7 @@ end
27
29
  api_instance = Weft::AccountApi.new
28
30
 
29
31
  begin
30
- # Get current account
32
+ # Get the current credential principal
31
33
  result = api_instance.get_me
32
34
  p result
33
35
  rescue Weft::ApiError => e
@@ -43,7 +45,7 @@ This returns an Array which contains the response data, status code and headers.
43
45
 
44
46
  ```ruby
45
47
  begin
46
- # Get current account
48
+ # Get the current credential principal
47
49
  data, status_code, headers = api_instance.get_me_with_http_info
48
50
  p status_code # => 2xx
49
51
  p headers # => { ... }
@@ -69,4 +71,3 @@ This endpoint does not need any parameter.
69
71
 
70
72
  - **Content-Type**: Not defined
71
73
  - **Accept**: application/json
72
-
@@ -4,6 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
+ | **principal_type** | **String** | | |
7
8
  | **id** | **Integer** | | |
8
9
  | **name** | **String** | | |
9
10
  | **slug** | **String** | | |
@@ -16,6 +17,7 @@
16
17
  require 'weft-sdk'
17
18
 
18
19
  instance = Weft::AccountDetails.new(
20
+ principal_type: null,
19
21
  id: null,
20
22
  name: null,
21
23
  slug: null,
@@ -23,4 +25,3 @@ instance = Weft::AccountDetails.new(
23
25
  api_key: null
24
26
  )
25
27
  ```
26
-
data/docs/ApiKey.md CHANGED
@@ -25,4 +25,3 @@ instance = Weft::ApiKey.new(
25
25
  created_at: null
26
26
  )
27
27
  ```
28
-
@@ -23,4 +23,3 @@ instance = Weft::ApiKeyCreated.new(
23
23
  created_at: null
24
24
  )
25
25
  ```
26
-
@@ -15,4 +15,3 @@ instance = Weft::ApiKeyCreatedResponse.new(
15
15
  data: null
16
16
  )
17
17
  ```
18
-
@@ -17,4 +17,3 @@ instance = Weft::ApiKeyListResponse.new(
17
17
  pagination: null
18
18
  )
19
19
  ```
20
-
data/docs/AuthApi.md CHANGED
@@ -25,7 +25,7 @@ require 'time'
25
25
  require 'weft-sdk'
26
26
 
27
27
  api_instance = Weft::AuthApi.new
28
- confirm_request = Weft::ConfirmRequest.new({confirmation_token: 'confirmation_token_example'}) # ConfirmRequest |
28
+ confirm_request = Weft::ConfirmRequest.new({confirmation_token: 'confirmation_token_example'}) # ConfirmRequest |
29
29
 
30
30
  begin
31
31
  # Confirm an account
@@ -87,7 +87,7 @@ require 'time'
87
87
  require 'weft-sdk'
88
88
 
89
89
  api_instance = Weft::AuthApi.new
90
- password_reset_request = Weft::PasswordResetRequest.new({email: 'email_example'}) # PasswordResetRequest |
90
+ password_reset_request = Weft::PasswordResetRequest.new({email: 'email_example'}) # PasswordResetRequest |
91
91
 
92
92
  begin
93
93
  # Request password reset
@@ -149,7 +149,7 @@ require 'time'
149
149
  require 'weft-sdk'
150
150
 
151
151
  api_instance = Weft::AuthApi.new
152
- resend_confirmation_request = Weft::ResendConfirmationRequest.new({email: 'email_example'}) # ResendConfirmationRequest |
152
+ resend_confirmation_request = Weft::ResendConfirmationRequest.new({email: 'email_example'}) # ResendConfirmationRequest |
153
153
 
154
154
  begin
155
155
  # Resend confirmation email
@@ -211,7 +211,7 @@ require 'time'
211
211
  require 'weft-sdk'
212
212
 
213
213
  api_instance = Weft::AuthApi.new
214
- sign_in_request = Weft::SignInRequest.new({email: 'email_example', password: 'password_example'}) # SignInRequest |
214
+ sign_in_request = Weft::SignInRequest.new({email: 'email_example', password: 'password_example'}) # SignInRequest |
215
215
 
216
216
  begin
217
217
  # Sign in with email and password
@@ -273,7 +273,7 @@ require 'time'
273
273
  require 'weft-sdk'
274
274
 
275
275
  api_instance = Weft::AuthApi.new
276
- sign_up_request = Weft::SignUpRequest.new({email: 'email_example', password: 'password_example', password_confirmation: 'password_confirmation_example'}) # SignUpRequest |
276
+ sign_up_request = Weft::SignUpRequest.new({email: 'email_example', password: 'password_example', password_confirmation: 'password_confirmation_example'}) # SignUpRequest |
277
277
 
278
278
  begin
279
279
  # Create an account
@@ -335,7 +335,7 @@ require 'time'
335
335
  require 'weft-sdk'
336
336
 
337
337
  api_instance = Weft::AuthApi.new
338
- password_update_request = Weft::PasswordUpdateRequest.new({reset_password_token: 'reset_password_token_example', password: 'password_example', password_confirmation: 'password_confirmation_example'}) # PasswordUpdateRequest |
338
+ password_update_request = Weft::PasswordUpdateRequest.new({reset_password_token: 'reset_password_token_example', password: 'password_example', password_confirmation: 'password_confirmation_example'}) # PasswordUpdateRequest |
339
339
 
340
340
  begin
341
341
  # Update password with reset token
@@ -382,4 +382,3 @@ No authorization required
382
382
 
383
383
  - **Content-Type**: application/json
384
384
  - **Accept**: application/json
385
-
data/docs/AuthResponse.md CHANGED
@@ -15,4 +15,3 @@ instance = Weft::AuthResponse.new(
15
15
  data: null
16
16
  )
17
17
  ```
18
-
@@ -19,4 +19,3 @@ instance = Weft::AuthResponseData.new(
19
19
  confirmation_required: null
20
20
  )
21
21
  ```
22
-
data/docs/BalanceApi.md CHANGED
@@ -13,7 +13,7 @@ All URIs are relative to *https://weft.network*
13
13
 
14
14
  Get wallet, spending policy, and current-window spend
15
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.
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
17
 
18
18
  ### Examples
19
19
 
@@ -71,4 +71,3 @@ This endpoint does not need any parameter.
71
71
 
72
72
  - **Content-Type**: Not defined
73
73
  - **Accept**: application/json
74
-
@@ -6,8 +6,8 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **promo** | [**PromoBalance**](PromoBalance.md) | | |
8
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. | |
9
+ | **spent_today_usd** | **String** | USD spent in the current calendar day (UTC). Exact to the micro-dollar so sub-cent micro-payments survive (\&quot;0.0005\&quot;, \&quot;0.42\&quot;), never narrower than two decimals; a zero total renders as \&quot;0.00\&quot;. | |
10
+ | **spent_week_usd** | **String** | USD spent in the current calendar week (UTC, Monday start). Exact to the micro-dollar (\&quot;0.0005\&quot;, \&quot;3.10\&quot;), never narrower than two decimals; a zero total renders as \&quot;0.00\&quot;. | |
11
11
  | **policy** | [**SpendingPolicy**](SpendingPolicy.md) | | |
12
12
 
13
13
  ## Example
@@ -18,9 +18,8 @@ require 'weft-sdk'
18
18
  instance = Weft::BalanceResponse.new(
19
19
  promo: null,
20
20
  wallet: null,
21
- spent_today_usd: 0.42,
21
+ spent_today_usd: 0.0005,
22
22
  spent_week_usd: 3.10,
23
23
  policy: null
24
24
  )
25
25
  ```
26
-
@@ -15,4 +15,3 @@ instance = Weft::ConfirmRequest.new(
15
15
  confirmation_token: null
16
16
  )
17
17
  ```
18
-
@@ -15,4 +15,3 @@ instance = Weft::CreateApiKeyRequest.new(
15
15
  name: null
16
16
  )
17
17
  ```
18
-
data/docs/DefaultApi.md CHANGED
@@ -64,4 +64,3 @@ No authorization required
64
64
 
65
65
  - **Content-Type**: Not defined
66
66
  - **Accept**: application/yaml
67
-
@@ -41,4 +41,3 @@ instance = Weft::EnrolledResource.new(
41
41
  claim_url: null
42
42
  )
43
43
  ```
44
-
data/docs/Error.md CHANGED
@@ -21,4 +21,3 @@ instance = Weft::Error.new(
21
21
  request_id: req_01HX9F3K7B2N4P8Q1R6T8Y2Z5
22
22
  )
23
23
  ```
24
-
@@ -15,4 +15,3 @@ instance = Weft::ErrorResponse.new(
15
15
  error: null
16
16
  )
17
17
  ```
18
-
@@ -46,4 +46,3 @@ Weft::Fetch403Response.build(data_that_doesnt_match)
46
46
  - `FetchErrorResponse`
47
47
  - `InsufficientScopeResponse`
48
48
  - `nil` (if no type matches)
49
-
data/docs/FetchApi.md CHANGED
@@ -9,11 +9,11 @@ All URIs are relative to *https://weft.network*
9
9
 
10
10
  ## fetch
11
11
 
12
- > <FetchResponse> fetch(fetch_request)
12
+ > <FetchResponse> fetch(fetch_request, opts)
13
13
 
14
14
  Pay-and-fetch any URL (x402 proxy)
15
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.
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`, `held_usd`, `payment_status`, `tx_hash`, and the merchant's reputation snapshot. `paid_usd` is \"0.00\" until the charge is CONFIRMED settled — a signed-but- unsettled hold (the common case for x402, which settles asynchronously) reports its amount in `held_usd` instead, never in `paid_usd`. 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
17
 
18
18
  ### Examples
19
19
 
@@ -27,11 +27,14 @@ Weft.configure do |config|
27
27
  end
28
28
 
29
29
  api_instance = Weft::FetchApi.new
30
- fetch_request = Weft::FetchRequest.new({url: 'https://x402.api.agentmail.to/v0/inboxes'}) # FetchRequest |
30
+ fetch_request = Weft::FetchRequest.new({url: 'https://x402.api.agentmail.to/v0/inboxes'}) # FetchRequest |
31
+ opts = {
32
+ idempotency_key: 'idempotency_key_example' # String | Opaque caller-generated retry key. Reusing the same key for the same buyer converges on one paid fetch; keys are hashed and namespaced by buyer before storage. Send this header for every unattended or retryable paid request.
33
+ }
31
34
 
32
35
  begin
33
36
  # Pay-and-fetch any URL (x402 proxy)
34
- result = api_instance.fetch(fetch_request)
37
+ result = api_instance.fetch(fetch_request, opts)
35
38
  p result
36
39
  rescue Weft::ApiError => e
37
40
  puts "Error when calling FetchApi->fetch: #{e}"
@@ -42,12 +45,12 @@ end
42
45
 
43
46
  This returns an Array which contains the response data, status code and headers.
44
47
 
45
- > <Array(<FetchResponse>, Integer, Hash)> fetch_with_http_info(fetch_request)
48
+ > <Array(<FetchResponse>, Integer, Hash)> fetch_with_http_info(fetch_request, opts)
46
49
 
47
50
  ```ruby
48
51
  begin
49
52
  # Pay-and-fetch any URL (x402 proxy)
50
- data, status_code, headers = api_instance.fetch_with_http_info(fetch_request)
53
+ data, status_code, headers = api_instance.fetch_with_http_info(fetch_request, opts)
51
54
  p status_code # => 2xx
52
55
  p headers # => { ... }
53
56
  p data # => <FetchResponse>
@@ -61,6 +64,7 @@ end
61
64
  | Name | Type | Description | Notes |
62
65
  | ---- | ---- | ----------- | ----- |
63
66
  | **fetch_request** | [**FetchRequest**](FetchRequest.md) | | |
67
+ | **idempotency_key** | **String** | Opaque caller-generated retry key. Reusing the same key for the same buyer converges on one paid fetch; keys are hashed and namespaced by buyer before storage. Send this header for every unattended or retryable paid request. | [optional] |
64
68
 
65
69
  ### Return type
66
70
 
@@ -74,4 +78,3 @@ end
74
78
 
75
79
  - **Content-Type**: application/json
76
80
  - **Accept**: application/json
77
-
@@ -6,8 +6,8 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **promo_usd** | **String** | | |
8
8
  | **wallet_usdc** | **String** | Live Base USDC balance. | |
9
- | **tempo_usd** | **String** | Aggregated USD of allowlisted Tempo dollar tokens, 2dp. &#x60;null&#x60; when UNKNOWN (RPC read failed or no token allowlisted for the paired chain) — never \&quot;0.00\&quot; for an unread component. | |
10
- | **total_usd** | **String** | Aggregated USD balance &#x3D; Base USDC + Tempo dollar tokens, 2dp. Equals &#x60;wallet_usdc&#x60; alone when &#x60;tempo_usd&#x60; is null. Null when the Base USDC provider is unreachable. | |
9
+ | **tempo_usd** | **String** | Aggregated USD of allowlisted Tempo dollar tokens, exact to the micro-dollar. &#x60;null&#x60; when UNKNOWN (RPC read failed or no token allowlisted for the paired chain) — never \&quot;0.00\&quot; for an unread component. | |
10
+ | **total_usd** | **String** | Aggregated USD balance &#x3D; Base USDC + Tempo dollar tokens, exact to the micro-dollar. Equals &#x60;wallet_usdc&#x60; alone when &#x60;tempo_usd&#x60; is null. Null when the Base USDC provider is unreachable. | |
11
11
  | **spent_today_usd** | **String** | | |
12
12
 
13
13
  ## Example
@@ -23,4 +23,3 @@ instance = Weft::FetchBalanceSnapshot.new(
23
23
  spent_today_usd: 0.42
24
24
  )
25
25
  ```
26
-
@@ -23,4 +23,3 @@ instance = Weft::FetchErrorResponse.new(
23
23
  dashboard_url: null
24
24
  )
25
25
  ```
26
-
data/docs/FetchRequest.md CHANGED
@@ -23,4 +23,3 @@ instance = Weft::FetchRequest.new(
23
23
  headers: {Accept&#x3D;application/json, User-Agent&#x3D;my-agent/1.0}
24
24
  )
25
25
  ```
26
-
@@ -46,4 +46,3 @@ Weft::FetchRequestBody.build(data_that_doesnt_match)
46
46
  - `Object`
47
47
  - `String`
48
48
  - `nil` (if no type matches)
49
-
@@ -7,7 +7,9 @@
7
7
  | **status** | **Integer** | HTTP status returned by the upstream after the paid replay. | |
8
8
  | **headers** | **Hash&lt;String, String&gt;** | Response headers from the upstream. | |
9
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. | |
10
+ | **paid_usd** | **String** | USD amount actually settled on-chain. \&quot;0.00\&quot; for free upstreams AND for any charge that hasn&#39;t (yet, or ever) settled — a signed hold is not yet spend. See &#x60;held_usd&#x60; for the nominal amount in that case. Exact to the micro-dollar, minimum two decimals; parse as a decimal rather than string-comparing against a bare zero literal. | |
11
+ | **held_usd** | **String** | The nominal charge amount when &#x60;paid_usd&#x60; is \&quot;0.00\&quot; — a hold awaiting settlement, or a charge that failed/expired without ever settling. &#x60;null&#x60; once &#x60;paid_usd&#x60; reflects the real settlement (or for a free upstream, where nothing was ever charged). Same format as &#x60;paid_usd&#x60;: exact to the micro-dollar, minimum two decimals. | |
12
+ | **payment_status** | **String** | Agent-facing settlement status. &#x60;pending&#x60; &#x3D; signed, no refusal signal yet (settlement may still land, e.g. x402&#39;s async facilitator webhook). &#x60;declined-pending&#x60; &#x3D; the merchant refused but the authorization isn&#39;t provably dead yet. &#x60;declined&#x60; / &#x60;expired&#x60; / &#x60;reverted&#x60; are terminal — the money never moved (or, for &#x60;reverted&#x60;, moved and then reversed on-chain) and never will for this charge. | |
11
13
  | **tx_hash** | **String** | Settlement transaction hash. Null for free upstreams. | |
12
14
  | **artifact_id** | **Integer** | Internal artifact identifier if the response was persisted; &#x60;null&#x60; otherwise. | |
13
15
  | **merchant** | [**Merchant**](Merchant.md) | Merchant reputation snapshot. Null for free upstreams. | |
@@ -22,9 +24,10 @@ instance = Weft::FetchResponse.new(
22
24
  headers: null,
23
25
  body_base64: null,
24
26
  paid_usd: 0.002,
27
+ held_usd: 0.002,
28
+ payment_status: pending,
25
29
  tx_hash: null,
26
30
  artifact_id: null,
27
31
  merchant: null
28
32
  )
29
33
  ```
30
-
@@ -19,4 +19,3 @@ instance = Weft::InsufficientScopeResponse.new(
19
19
  scope: balance
20
20
  )
21
21
  ```
22
-
data/docs/MeApiKey.md CHANGED
@@ -23,4 +23,3 @@ instance = Weft::MeApiKey.new(
23
23
  created_by: null
24
24
  )
25
25
  ```
26
-
@@ -19,4 +19,3 @@ instance = Weft::MeApiKeyCreator.new(
19
19
  display_name: null
20
20
  )
21
21
  ```
22
-
data/docs/MeResponse.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **data** | [**AccountDetails**](AccountDetails.md) | | |
7
+ | **data** | [**MeResponseData**](MeResponseData.md) | | |
8
8
 
9
9
  ## Example
10
10
 
@@ -15,4 +15,3 @@ instance = Weft::MeResponse.new(
15
15
  data: null
16
16
  )
17
17
  ```
18
-
@@ -0,0 +1,78 @@
1
+ # Weft::MeResponseData
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::MeResponseData.openapi_one_of
15
+ # =>
16
+ # [
17
+ # :'AccountDetails',
18
+ # :'UserPrincipal'
19
+ # ]
20
+ ```
21
+
22
+ ### `openapi_discriminator_name`
23
+
24
+ Returns the discriminator's property name.
25
+
26
+ #### Example
27
+
28
+ ```ruby
29
+ require 'weft-sdk'
30
+
31
+ Weft::MeResponseData.openapi_discriminator_name
32
+ # => :'principal_type'
33
+ ```
34
+
35
+ ### `openapi_discriminator_name`
36
+
37
+ Returns the discriminator's mapping.
38
+
39
+ #### Example
40
+
41
+ ```ruby
42
+ require 'weft-sdk'
43
+
44
+ Weft::MeResponseData.openapi_discriminator_mapping
45
+ # =>
46
+ # {
47
+ # :'organization' => :'AccountDetails',
48
+ # :'user' => :'UserPrincipal'
49
+ # }
50
+ ```
51
+
52
+ ### build
53
+
54
+ Find the appropriate object from the `openapi_one_of` list and casts the data into it.
55
+
56
+ #### Example
57
+
58
+ ```ruby
59
+ require 'weft-sdk'
60
+
61
+ Weft::MeResponseData.build(data)
62
+ # => #<AccountDetails:0x00007fdd4aab02a0>
63
+
64
+ Weft::MeResponseData.build(data_that_doesnt_match)
65
+ # => nil
66
+ ```
67
+
68
+ #### Parameters
69
+
70
+ | Name | Type | Description |
71
+ | ---- | ---- | ----------- |
72
+ | **data** | **Mixed** | data to be matched against the list of oneOf items |
73
+
74
+ #### Return type
75
+
76
+ - `AccountDetails`
77
+ - `UserPrincipal`
78
+ - `nil` (if no type matches)
data/docs/Merchant.md CHANGED
@@ -21,4 +21,3 @@ instance = Weft::Merchant.new(
21
21
  dispute_count: null
22
22
  )
23
23
  ```
24
-
@@ -15,4 +15,3 @@ instance = Weft::MessageResponse.new(
15
15
  data: null
16
16
  )
17
17
  ```
18
-
@@ -15,4 +15,3 @@ instance = Weft::MessageResponseData.new(
15
15
  message: null
16
16
  )
17
17
  ```
18
-
data/docs/Pagination.md CHANGED
@@ -21,4 +21,3 @@ instance = Weft::Pagination.new(
21
21
  total_pages: null
22
22
  )
23
23
  ```
24
-
@@ -15,4 +15,3 @@ instance = Weft::PasswordResetRequest.new(
15
15
  email: null
16
16
  )
17
17
  ```
18
-
@@ -19,4 +19,3 @@ instance = Weft::PasswordUpdateRequest.new(
19
19
  password_confirmation: null
20
20
  )
21
21
  ```
22
-
data/docs/Payment.md CHANGED
@@ -14,7 +14,6 @@
14
14
  | **network** | **String** | CAIP-2 chain identifier | |
15
15
  | **resource_url** | **String** | | [optional] |
16
16
  | **resource_host** | **String** | | [optional] |
17
- | **fee_amount** | **Integer** | | [optional] |
18
17
  | **settlement_latency_ms** | **Integer** | | [optional] |
19
18
  | **settled_at** | **Time** | | |
20
19
  | **api_key_name** | **String** | | |
@@ -35,10 +34,8 @@ instance = Weft::Payment.new(
35
34
  network: null,
36
35
  resource_url: null,
37
36
  resource_host: null,
38
- fee_amount: null,
39
37
  settlement_latency_ms: null,
40
38
  settled_at: null,
41
39
  api_key_name: null
42
40
  )
43
41
  ```
44
-
@@ -17,4 +17,3 @@ instance = Weft::PaymentListResponse.new(
17
17
  pagination: null
18
18
  )
19
19
  ```
20
-
@@ -15,4 +15,3 @@ instance = Weft::PaymentResponse.new(
15
15
  data: null
16
16
  )
17
17
  ```
18
-
data/docs/PaymentsApi.md CHANGED
@@ -144,4 +144,3 @@ end
144
144
 
145
145
  - **Content-Type**: Not defined
146
146
  - **Accept**: application/json
147
-
@@ -0,0 +1,19 @@
1
+ # Weft::PrincipalWallet
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **address** | **String** | | |
8
+ | **network** | **String** | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'weft-sdk'
14
+
15
+ instance = Weft::PrincipalWallet.new(
16
+ address: null,
17
+ network: null
18
+ )
19
+ ```
data/docs/PromoBalance.md CHANGED
@@ -19,4 +19,3 @@ instance = Weft::PromoBalance.new(
19
19
  expires_at: null
20
20
  )
21
21
  ```
22
-
data/docs/Purchase.md ADDED
@@ -0,0 +1,43 @@
1
+ # Weft::Purchase
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **Integer** | | |
8
+ | **status** | **String** | | |
9
+ | **amount_usd** | **String** | Exact decimal USD amount with up to six fractional digits. | |
10
+ | **recipient_address** | **String** | | |
11
+ | **network** | **String** | | |
12
+ | **protocol** | **String** | | |
13
+ | **context** | **String** | | |
14
+ | **tx_hash** | **String** | | |
15
+ | **reject_reason** | **String** | | |
16
+ | **failure_reason** | **String** | | |
17
+ | **idempotency_key** | **String** | | |
18
+ | **signed_at** | **Time** | | |
19
+ | **settled_at** | **Time** | | |
20
+ | **artifact** | [**PurchaseArtifact**](PurchaseArtifact.md) | | |
21
+
22
+ ## Example
23
+
24
+ ```ruby
25
+ require 'weft-sdk'
26
+
27
+ instance = Weft::Purchase.new(
28
+ id: null,
29
+ status: null,
30
+ amount_usd: null,
31
+ recipient_address: null,
32
+ network: null,
33
+ protocol: null,
34
+ context: null,
35
+ tx_hash: null,
36
+ reject_reason: null,
37
+ failure_reason: null,
38
+ idempotency_key: null,
39
+ signed_at: null,
40
+ settled_at: null,
41
+ artifact: null
42
+ )
43
+ ```