weft-sdk 0.6.2 → 0.7.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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AccountDetails.md +8 -12
  3. data/docs/EnrolledResource.md +44 -0
  4. data/docs/Fetch403Response.md +49 -0
  5. data/docs/FetchBalanceSnapshot.md +5 -1
  6. data/docs/FetchResponse.md +1 -1
  7. data/docs/InsufficientScopeResponse.md +22 -0
  8. data/docs/MeApiKey.md +26 -0
  9. data/docs/MeApiKeyCreator.md +22 -0
  10. data/docs/ResourceEnrollmentRequest.md +24 -0
  11. data/docs/ResourceEnrollmentResponse.md +18 -0
  12. data/docs/ResourceStats.md +30 -0
  13. data/docs/ResourcesApi.md +72 -0
  14. data/docs/SearchFilters.md +1 -1
  15. data/docs/SearchResponse.md +1 -1
  16. data/docs/SearchResponseResultsInner.md +36 -0
  17. data/docs/Wallet.md +5 -1
  18. data/lib/weft/generated/api/account_api.rb +1 -1
  19. data/lib/weft/generated/api/api_keys_api.rb +1 -1
  20. data/lib/weft/generated/api/auth_api.rb +1 -1
  21. data/lib/weft/generated/api/balance_api.rb +1 -1
  22. data/lib/weft/generated/api/default_api.rb +1 -1
  23. data/lib/weft/generated/api/fetch_api.rb +1 -1
  24. data/lib/weft/generated/api/payments_api.rb +1 -1
  25. data/lib/weft/generated/api/resources_api.rb +90 -0
  26. data/lib/weft/generated/api/search_api.rb +1 -1
  27. data/lib/weft/generated/api_client.rb +1 -1
  28. data/lib/weft/generated/api_error.rb +1 -1
  29. data/lib/weft/generated/api_model_base.rb +1 -1
  30. data/lib/weft/generated/configuration.rb +1 -1
  31. data/lib/weft/generated/models/account_details.rb +65 -106
  32. data/lib/weft/generated/models/api_key.rb +1 -1
  33. data/lib/weft/generated/models/api_key_created.rb +1 -1
  34. data/lib/weft/generated/models/api_key_created_response.rb +1 -1
  35. data/lib/weft/generated/models/api_key_list_response.rb +1 -1
  36. data/lib/weft/generated/models/auth_response.rb +1 -1
  37. data/lib/weft/generated/models/auth_response_data.rb +1 -1
  38. data/lib/weft/generated/models/balance_response.rb +1 -1
  39. data/lib/weft/generated/models/confirm_request.rb +1 -1
  40. data/lib/weft/generated/models/create_api_key_request.rb +1 -1
  41. data/lib/weft/generated/models/enrolled_resource.rb +474 -0
  42. data/lib/weft/generated/models/error.rb +1 -1
  43. data/lib/weft/generated/models/error_response.rb +1 -1
  44. data/lib/weft/generated/models/fetch403_response.rb +104 -0
  45. data/lib/weft/generated/models/fetch_balance_snapshot.rb +58 -3
  46. data/lib/weft/generated/models/fetch_error_response.rb +4 -4
  47. data/lib/weft/generated/models/fetch_request.rb +1 -1
  48. data/lib/weft/generated/models/fetch_request_body.rb +1 -1
  49. data/lib/weft/generated/models/fetch_response.rb +3 -3
  50. data/lib/weft/generated/models/insufficient_scope_response.rb +242 -0
  51. data/lib/weft/generated/models/me_api_key.rb +217 -0
  52. data/lib/weft/generated/models/me_api_key_creator.rb +200 -0
  53. data/lib/weft/generated/models/me_response.rb +1 -1
  54. data/lib/weft/generated/models/merchant.rb +1 -1
  55. data/lib/weft/generated/models/message_response.rb +1 -1
  56. data/lib/weft/generated/models/message_response_data.rb +1 -1
  57. data/lib/weft/generated/models/pagination.rb +1 -1
  58. data/lib/weft/generated/models/password_reset_request.rb +1 -1
  59. data/lib/weft/generated/models/password_update_request.rb +1 -1
  60. data/lib/weft/generated/models/payment.rb +1 -1
  61. data/lib/weft/generated/models/payment_list_response.rb +1 -1
  62. data/lib/weft/generated/models/payment_response.rb +1 -1
  63. data/lib/weft/generated/models/promo_balance.rb +1 -1
  64. data/lib/weft/generated/models/resend_confirmation_request.rb +1 -1
  65. data/lib/weft/generated/models/resource_enrollment_request.rb +212 -0
  66. data/lib/weft/generated/models/resource_enrollment_response.rb +164 -0
  67. data/lib/weft/generated/models/resource_stats.rb +323 -0
  68. data/lib/weft/generated/models/search_agent_card.rb +1 -1
  69. data/lib/weft/generated/models/search_endpoints.rb +1 -1
  70. data/lib/weft/generated/models/search_error_response.rb +1 -1
  71. data/lib/weft/generated/models/search_filters.rb +4 -4
  72. data/lib/weft/generated/models/search_pricing.rb +1 -1
  73. data/lib/weft/generated/models/search_ranking.rb +1 -1
  74. data/lib/weft/generated/models/search_request.rb +1 -1
  75. data/lib/weft/generated/models/search_response.rb +3 -3
  76. data/lib/weft/generated/models/search_response_results_inner.rb +103 -0
  77. data/lib/weft/generated/models/search_result.rb +3 -3
  78. data/lib/weft/generated/models/search_skill.rb +1 -1
  79. data/lib/weft/generated/models/search_skill_endpoint.rb +1 -1
  80. data/lib/weft/generated/models/sign_in_request.rb +1 -1
  81. data/lib/weft/generated/models/sign_up_request.rb +1 -1
  82. data/lib/weft/generated/models/spending_policy.rb +1 -1
  83. data/lib/weft/generated/models/user.rb +1 -1
  84. data/lib/weft/generated/models/wallet.rb +57 -3
  85. data/lib/weft/generated/version.rb +2 -2
  86. data/lib/weft/sdk.rb +1 -1
  87. metadata +22 -2
@@ -3,7 +3,7 @@
3
3
 
4
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.6.2
6
+ The version of the OpenAPI document: 0.7.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -14,12 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Weft
17
- # Compact balance snapshot returned inside `FetchErrorResponse`. Less rich than `BalanceResponse` — just the three fields a CLI needs to explain why a fetch failed.
17
+ # Compact balance snapshot returned inside `FetchErrorResponse`. Less rich than `BalanceResponse` — just the fields a CLI needs to explain why a fetch failed.
18
18
  class FetchBalanceSnapshot < ApiModelBase
19
19
  attr_accessor :promo_usd
20
20
 
21
+ # Live Base USDC balance.
21
22
  attr_accessor :wallet_usdc
22
23
 
24
+ # Aggregated USD of allowlisted Tempo dollar tokens, 2dp. `null` when UNKNOWN (RPC read failed or no token allowlisted for the paired chain) — never \"0.00\" for an unread component.
25
+ attr_accessor :tempo_usd
26
+
27
+ # Aggregated USD balance = Base USDC + Tempo dollar tokens, 2dp. Equals `wallet_usdc` alone when `tempo_usd` is null. Null when the Base USDC provider is unreachable.
28
+ attr_accessor :total_usd
29
+
23
30
  attr_accessor :spent_today_usd
24
31
 
25
32
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -27,6 +34,8 @@ module Weft
27
34
  {
28
35
  :'promo_usd' => :'promo_usd',
29
36
  :'wallet_usdc' => :'wallet_usdc',
37
+ :'tempo_usd' => :'tempo_usd',
38
+ :'total_usd' => :'total_usd',
30
39
  :'spent_today_usd' => :'spent_today_usd'
31
40
  }
32
41
  end
@@ -46,6 +55,8 @@ module Weft
46
55
  {
47
56
  :'promo_usd' => :'String',
48
57
  :'wallet_usdc' => :'String',
58
+ :'tempo_usd' => :'String',
59
+ :'total_usd' => :'String',
49
60
  :'spent_today_usd' => :'String'
50
61
  }
51
62
  end
@@ -84,6 +95,18 @@ module Weft
84
95
  self.wallet_usdc = nil
85
96
  end
86
97
 
98
+ if attributes.key?(:'tempo_usd')
99
+ self.tempo_usd = attributes[:'tempo_usd']
100
+ else
101
+ self.tempo_usd = nil
102
+ end
103
+
104
+ if attributes.key?(:'total_usd')
105
+ self.total_usd = attributes[:'total_usd']
106
+ else
107
+ self.total_usd = nil
108
+ end
109
+
87
110
  if attributes.key?(:'spent_today_usd')
88
111
  self.spent_today_usd = attributes[:'spent_today_usd']
89
112
  else
@@ -104,6 +127,14 @@ module Weft
104
127
  invalid_properties.push('invalid value for "wallet_usdc", wallet_usdc cannot be nil.')
105
128
  end
106
129
 
130
+ if @tempo_usd.nil?
131
+ invalid_properties.push('invalid value for "tempo_usd", tempo_usd cannot be nil.')
132
+ end
133
+
134
+ if @total_usd.nil?
135
+ invalid_properties.push('invalid value for "total_usd", total_usd cannot be nil.')
136
+ end
137
+
107
138
  if @spent_today_usd.nil?
108
139
  invalid_properties.push('invalid value for "spent_today_usd", spent_today_usd cannot be nil.')
109
140
  end
@@ -117,6 +148,8 @@ module Weft
117
148
  warn '[DEPRECATED] the `valid?` method is obsolete'
118
149
  return false if @promo_usd.nil?
119
150
  return false if @wallet_usdc.nil?
151
+ return false if @tempo_usd.nil?
152
+ return false if @total_usd.nil?
120
153
  return false if @spent_today_usd.nil?
121
154
  true
122
155
  end
@@ -141,6 +174,26 @@ module Weft
141
174
  @wallet_usdc = wallet_usdc
142
175
  end
143
176
 
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] tempo_usd Value to be assigned
179
+ def tempo_usd=(tempo_usd)
180
+ if tempo_usd.nil?
181
+ fail ArgumentError, 'tempo_usd cannot be nil'
182
+ end
183
+
184
+ @tempo_usd = tempo_usd
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] total_usd Value to be assigned
189
+ def total_usd=(total_usd)
190
+ if total_usd.nil?
191
+ fail ArgumentError, 'total_usd cannot be nil'
192
+ end
193
+
194
+ @total_usd = total_usd
195
+ end
196
+
144
197
  # Custom attribute writer method with validation
145
198
  # @param [Object] spent_today_usd Value to be assigned
146
199
  def spent_today_usd=(spent_today_usd)
@@ -158,6 +211,8 @@ module Weft
158
211
  self.class == o.class &&
159
212
  promo_usd == o.promo_usd &&
160
213
  wallet_usdc == o.wallet_usdc &&
214
+ tempo_usd == o.tempo_usd &&
215
+ total_usd == o.total_usd &&
161
216
  spent_today_usd == o.spent_today_usd
162
217
  end
163
218
 
@@ -170,7 +225,7 @@ module Weft
170
225
  # Calculates hash code according to all attributes.
171
226
  # @return [Integer] Hash code
172
227
  def hash
173
- [promo_usd, wallet_usdc, spent_today_usd].hash
228
+ [promo_usd, wallet_usdc, tempo_usd, total_usd, spent_today_usd].hash
174
229
  end
175
230
 
176
231
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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.6.2
6
+ The version of the OpenAPI document: 0.7.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Weft
17
- # Bespoke error envelope for `/api/v1/fetch`. Every error carries the buyer's current `policy`, `balance`, and a `dashboard_url` so a CLI can render an actionable message without a second round-trip. `error` values include the fixed codes listed below plus the family `POLICY_VIOLATION_<REASON>` (e.g. `POLICY_VIOLATION_DAILY_LIMIT`) where `<REASON>` matches the violated policy field.
17
+ # Bespoke error envelope for `/api/v1/fetch`. Every error carries the buyer's current `policy`, `balance`, and a `dashboard_url` so a CLI can render an actionable message without a second round-trip. `error` values include the fixed codes listed below plus the `POLICY_VIOLATION_<REASON>` family, where `<REASON>` is the violated policy field (`MAX_TX`, `DAILY`, or `WEEKLY` — see `PolicyViolation::REASONS`).
18
18
  class FetchErrorResponse < ApiModelBase
19
19
  # Stable error code.
20
20
  attr_accessor :error
@@ -171,7 +171,7 @@ module Weft
171
171
  def valid?
172
172
  warn '[DEPRECATED] the `valid?` method is obsolete'
173
173
  return false if @error.nil?
174
- error_validator = EnumAttributeValidator.new('String', ["INVALID_URL", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "SETTLEMENT_FAILED", "POLICY_VIOLATION"])
174
+ error_validator = EnumAttributeValidator.new('String', ["INVALID_URL", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "CONVERSION_UNAVAILABLE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "WALLET_ENVIRONMENT_MISMATCH", "SETTLEMENT_FAILED", "UNSUPPORTED_PAYMENT_METHOD", "POLICY_VIOLATION_MAX_TX", "POLICY_VIOLATION_DAILY", "POLICY_VIOLATION_WEEKLY"])
175
175
  return false unless error_validator.valid?(@error)
176
176
  return false if @details.nil?
177
177
  return false if @policy.nil?
@@ -183,7 +183,7 @@ module Weft
183
183
  # Custom attribute writer method checking allowed values (enum).
184
184
  # @param [Object] error Object to be assigned
185
185
  def error=(error)
186
- validator = EnumAttributeValidator.new('String', ["INVALID_URL", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "SETTLEMENT_FAILED", "POLICY_VIOLATION"])
186
+ validator = EnumAttributeValidator.new('String', ["INVALID_URL", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "CONVERSION_UNAVAILABLE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "WALLET_ENVIRONMENT_MISMATCH", "SETTLEMENT_FAILED", "UNSUPPORTED_PAYMENT_METHOD", "POLICY_VIOLATION_MAX_TX", "POLICY_VIOLATION_DAILY", "POLICY_VIOLATION_WEEKLY"])
187
187
  unless validator.valid?(error)
188
188
  fail ArgumentError, "invalid value for \"error\", must be one of #{validator.allowable_values}."
189
189
  end
@@ -3,7 +3,7 @@
3
3
 
4
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.6.2
6
+ The version of the OpenAPI document: 0.7.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -3,7 +3,7 @@
3
3
 
4
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.6.2
6
+ The version of the OpenAPI document: 0.7.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -3,7 +3,7 @@
3
3
 
4
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.6.2
6
+ The version of the OpenAPI document: 0.7.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.19.0
@@ -31,7 +31,7 @@ module Weft
31
31
  # Settlement transaction hash. Null for free upstreams.
32
32
  attr_accessor :tx_hash
33
33
 
34
- # Internal artifact identifier if the response was persisted.
34
+ # Internal artifact identifier if the response was persisted; `null` otherwise.
35
35
  attr_accessor :artifact_id
36
36
 
37
37
  # Merchant reputation snapshot. Null for free upstreams.
@@ -68,7 +68,7 @@ module Weft
68
68
  :'body_base64' => :'String',
69
69
  :'paid_usd' => :'String',
70
70
  :'tx_hash' => :'String',
71
- :'artifact_id' => :'String',
71
+ :'artifact_id' => :'Integer',
72
72
  :'merchant' => :'Merchant'
73
73
  }
74
74
  end
@@ -0,0 +1,242 @@
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.7.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Weft
17
+ # RFC 6750 §3.1 `insufficient_scope` error. Returned with HTTP 403 and a `WWW-Authenticate: Bearer error=\"insufficient_scope\", scope=\"...\"` header when an OAuth access token authenticates successfully but does not carry the scope the endpoint requires. Only OAuth bearer tokens are scope-gated; `wk_`-prefixed API keys are unscoped and never see this response.
18
+ class InsufficientScopeResponse < ApiModelBase
19
+ attr_accessor :error
20
+
21
+ attr_accessor :error_description
22
+
23
+ # Space-delimited list of scopes the endpoint requires.
24
+ attr_accessor :scope
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'error' => :'error',
52
+ :'error_description' => :'error_description',
53
+ :'scope' => :'scope'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'error' => :'String',
71
+ :'error_description' => :'String',
72
+ :'scope' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::InsufficientScopeResponse` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::InsufficientScopeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'error')
99
+ self.error = attributes[:'error']
100
+ else
101
+ self.error = nil
102
+ end
103
+
104
+ if attributes.key?(:'error_description')
105
+ self.error_description = attributes[:'error_description']
106
+ else
107
+ self.error_description = nil
108
+ end
109
+
110
+ if attributes.key?(:'scope')
111
+ self.scope = attributes[:'scope']
112
+ else
113
+ self.scope = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @error.nil?
123
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
124
+ end
125
+
126
+ if @error_description.nil?
127
+ invalid_properties.push('invalid value for "error_description", error_description cannot be nil.')
128
+ end
129
+
130
+ if @scope.nil?
131
+ invalid_properties.push('invalid value for "scope", scope cannot be nil.')
132
+ end
133
+
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ warn '[DEPRECATED] the `valid?` method is obsolete'
141
+ return false if @error.nil?
142
+ error_validator = EnumAttributeValidator.new('String', ["insufficient_scope"])
143
+ return false unless error_validator.valid?(@error)
144
+ return false if @error_description.nil?
145
+ return false if @scope.nil?
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method checking allowed values (enum).
150
+ # @param [Object] error Object to be assigned
151
+ def error=(error)
152
+ validator = EnumAttributeValidator.new('String', ["insufficient_scope"])
153
+ unless validator.valid?(error)
154
+ fail ArgumentError, "invalid value for \"error\", must be one of #{validator.allowable_values}."
155
+ end
156
+ @error = error
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] error_description Value to be assigned
161
+ def error_description=(error_description)
162
+ if error_description.nil?
163
+ fail ArgumentError, 'error_description cannot be nil'
164
+ end
165
+
166
+ @error_description = error_description
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] scope Value to be assigned
171
+ def scope=(scope)
172
+ if scope.nil?
173
+ fail ArgumentError, 'scope cannot be nil'
174
+ end
175
+
176
+ @scope = scope
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ error == o.error &&
185
+ error_description == o.error_description &&
186
+ scope == o.scope
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [error, error_description, scope].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ return nil unless attributes.is_a?(Hash)
206
+ attributes = attributes.transform_keys(&:to_sym)
207
+ transformed_hash = {}
208
+ openapi_types.each_pair do |key, type|
209
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
210
+ transformed_hash["#{key}"] = nil
211
+ elsif type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[attribute_map[key]].is_a?(Array)
215
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
216
+ end
217
+ elsif !attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
219
+ end
220
+ end
221
+ new(transformed_hash)
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ end
241
+
242
+ end
@@ -0,0 +1,217 @@
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.7.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Weft
17
+ class MeApiKey < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :created_at
23
+
24
+ attr_accessor :last_used_at
25
+
26
+ attr_accessor :created_by
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'name' => :'name',
33
+ :'created_at' => :'created_at',
34
+ :'last_used_at' => :'last_used_at',
35
+ :'created_by' => :'created_by'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'id' => :'Integer',
53
+ :'name' => :'String',
54
+ :'created_at' => :'Time',
55
+ :'last_used_at' => :'Time',
56
+ :'created_by' => :'MeApiKeyCreator'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::MeApiKey` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::MeApiKey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'id')
83
+ self.id = attributes[:'id']
84
+ else
85
+ self.id = nil
86
+ end
87
+
88
+ if attributes.key?(:'name')
89
+ self.name = attributes[:'name']
90
+ end
91
+
92
+ if attributes.key?(:'created_at')
93
+ self.created_at = attributes[:'created_at']
94
+ else
95
+ self.created_at = nil
96
+ end
97
+
98
+ if attributes.key?(:'last_used_at')
99
+ self.last_used_at = attributes[:'last_used_at']
100
+ end
101
+
102
+ if attributes.key?(:'created_by')
103
+ self.created_by = attributes[:'created_by']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @id.nil?
113
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
114
+ end
115
+
116
+ if @created_at.nil?
117
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @id.nil?
128
+ return false if @created_at.nil?
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] id Value to be assigned
134
+ def id=(id)
135
+ if id.nil?
136
+ fail ArgumentError, 'id cannot be nil'
137
+ end
138
+
139
+ @id = id
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] created_at Value to be assigned
144
+ def created_at=(created_at)
145
+ if created_at.nil?
146
+ fail ArgumentError, 'created_at cannot be nil'
147
+ end
148
+
149
+ @created_at = created_at
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(o)
155
+ return true if self.equal?(o)
156
+ self.class == o.class &&
157
+ id == o.id &&
158
+ name == o.name &&
159
+ created_at == o.created_at &&
160
+ last_used_at == o.last_used_at &&
161
+ created_by == o.created_by
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [id, name, created_at, last_used_at, created_by].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ transformed_hash = {}
183
+ openapi_types.each_pair do |key, type|
184
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = nil
186
+ elsif type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[attribute_map[key]].is_a?(Array)
190
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
191
+ end
192
+ elsif !attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
194
+ end
195
+ end
196
+ new(transformed_hash)
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ end
216
+
217
+ end