weft-sdk 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/ApiKeyListResponse.md +3 -1
- data/docs/BalanceApi.md +74 -0
- data/docs/BalanceResponse.md +26 -0
- data/docs/DefaultApi.md +12 -12
- data/docs/Error.md +7 -7
- data/docs/FetchApi.md +77 -0
- data/docs/FetchBalanceSnapshot.md +22 -0
- data/docs/FetchErrorResponse.md +26 -0
- data/docs/FetchRequest.md +26 -0
- data/docs/FetchRequestBody.md +49 -0
- data/docs/FetchResponse.md +30 -0
- data/docs/Merchant.md +24 -0
- data/docs/PromoBalance.md +22 -0
- data/docs/SearchAgentCard.md +34 -0
- data/docs/SearchApi.md +77 -0
- data/docs/SearchEndpoints.md +24 -0
- data/docs/SearchErrorResponse.md +20 -0
- data/docs/SearchFilters.md +26 -0
- data/docs/SearchPricing.md +24 -0
- data/docs/SearchRanking.md +26 -0
- data/docs/SearchRequest.md +22 -0
- data/docs/SearchResponse.md +26 -0
- data/docs/SearchResult.md +36 -0
- data/docs/SearchSkill.md +36 -0
- data/docs/SearchSkillEndpoint.md +20 -0
- data/docs/SpendingPolicy.md +22 -0
- data/docs/Wallet.md +22 -0
- data/lib/weft/generated/api/account_api.rb +2 -2
- data/lib/weft/generated/api/api_keys_api.rb +2 -2
- data/lib/weft/generated/api/auth_api.rb +2 -2
- data/lib/weft/generated/api/balance_api.rb +79 -0
- data/lib/weft/generated/api/default_api.rb +11 -11
- data/lib/weft/generated/api/fetch_api.rb +90 -0
- data/lib/weft/generated/api/payments_api.rb +2 -2
- data/lib/weft/generated/api/search_api.rb +90 -0
- data/lib/weft/generated/api_client.rb +2 -2
- data/lib/weft/generated/api_error.rb +2 -2
- data/lib/weft/generated/api_model_base.rb +2 -2
- data/lib/weft/generated/configuration.rb +2 -2
- data/lib/weft/generated/models/account_details.rb +2 -2
- data/lib/weft/generated/models/api_key.rb +2 -2
- data/lib/weft/generated/models/api_key_created.rb +2 -2
- data/lib/weft/generated/models/api_key_created_response.rb +2 -2
- data/lib/weft/generated/models/api_key_list_response.rb +32 -6
- data/lib/weft/generated/models/auth_response.rb +2 -2
- data/lib/weft/generated/models/auth_response_data.rb +2 -2
- data/lib/weft/generated/models/balance_response.rb +271 -0
- data/lib/weft/generated/models/confirm_request.rb +2 -2
- data/lib/weft/generated/models/create_api_key_request.rb +2 -2
- data/lib/weft/generated/models/error.rb +7 -2
- data/lib/weft/generated/models/error_response.rb +3 -2
- data/lib/weft/generated/models/fetch_balance_snapshot.rb +217 -0
- data/lib/weft/generated/models/fetch_error_response.rb +298 -0
- data/lib/weft/generated/models/fetch_request.rb +266 -0
- data/lib/weft/generated/models/fetch_request_body.rb +105 -0
- data/lib/weft/generated/models/fetch_response.rb +330 -0
- data/lib/weft/generated/models/me_response.rb +2 -2
- data/lib/weft/generated/models/merchant.rb +264 -0
- data/lib/weft/generated/models/message_response.rb +2 -2
- data/lib/weft/generated/models/message_response_data.rb +2 -2
- data/lib/weft/generated/models/pagination.rb +2 -2
- data/lib/weft/generated/models/password_reset_request.rb +2 -2
- data/lib/weft/generated/models/password_update_request.rb +2 -2
- data/lib/weft/generated/models/payment.rb +2 -2
- data/lib/weft/generated/models/payment_list_response.rb +2 -2
- data/lib/weft/generated/models/payment_response.rb +2 -2
- data/lib/weft/generated/models/promo_balance.rb +218 -0
- data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
- data/lib/weft/generated/models/search_agent_card.rb +228 -0
- data/lib/weft/generated/models/{agent_stats.rb → search_endpoints.rb} +33 -57
- data/lib/weft/generated/models/search_error_response.rb +202 -0
- data/lib/weft/generated/models/search_filters.rb +277 -0
- data/lib/weft/generated/models/search_pricing.rb +232 -0
- data/lib/weft/generated/models/search_ranking.rb +277 -0
- data/lib/weft/generated/models/search_request.rb +223 -0
- data/lib/weft/generated/models/{agent_response.rb → search_response.rb} +64 -21
- data/lib/weft/generated/models/search_result.rb +414 -0
- data/lib/weft/generated/models/search_skill.rb +259 -0
- data/lib/weft/generated/models/{agent_list_response.rb → search_skill_endpoint.rb} +19 -54
- data/lib/weft/generated/models/sign_in_request.rb +2 -2
- data/lib/weft/generated/models/sign_up_request.rb +2 -2
- data/lib/weft/generated/models/spending_policy.rb +219 -0
- data/lib/weft/generated/models/user.rb +2 -2
- data/lib/weft/generated/models/wallet.rb +219 -0
- data/lib/weft/generated/version.rb +3 -3
- data/lib/weft/sdk.rb +1 -1
- metadata +50 -12
- data/docs/Agent.md +0 -38
- data/docs/AgentListResponse.md +0 -20
- data/docs/AgentResponse.md +0 -18
- data/docs/AgentStats.md +0 -30
- data/docs/AgentsApi.md +0 -147
- data/lib/weft/generated/api/agents_api.rb +0 -148
- data/lib/weft/generated/models/agent.rb +0 -417
|
@@ -0,0 +1,277 @@
|
|
|
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 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Weft
|
|
17
|
+
class SearchRanking < ApiModelBase
|
|
18
|
+
attr_accessor :popularity_score
|
|
19
|
+
|
|
20
|
+
attr_accessor :settlement_count_30d
|
|
21
|
+
|
|
22
|
+
attr_accessor :success_rate_30d
|
|
23
|
+
|
|
24
|
+
attr_accessor :p50_latency_ms
|
|
25
|
+
|
|
26
|
+
attr_accessor :first_seen_at
|
|
27
|
+
|
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
29
|
+
def self.attribute_map
|
|
30
|
+
{
|
|
31
|
+
:'popularity_score' => :'popularity_score',
|
|
32
|
+
:'settlement_count_30d' => :'settlement_count_30d',
|
|
33
|
+
:'success_rate_30d' => :'success_rate_30d',
|
|
34
|
+
:'p50_latency_ms' => :'p50_latency_ms',
|
|
35
|
+
:'first_seen_at' => :'first_seen_at'
|
|
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
|
+
:'popularity_score' => :'Float',
|
|
53
|
+
:'settlement_count_30d' => :'Integer',
|
|
54
|
+
:'success_rate_30d' => :'Float',
|
|
55
|
+
:'p50_latency_ms' => :'Integer',
|
|
56
|
+
:'first_seen_at' => :'Time'
|
|
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::SearchRanking` 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::SearchRanking`. 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?(:'popularity_score')
|
|
83
|
+
self.popularity_score = attributes[:'popularity_score']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'settlement_count_30d')
|
|
87
|
+
self.settlement_count_30d = attributes[:'settlement_count_30d']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'success_rate_30d')
|
|
91
|
+
self.success_rate_30d = attributes[:'success_rate_30d']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'p50_latency_ms')
|
|
95
|
+
self.p50_latency_ms = attributes[:'p50_latency_ms']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'first_seen_at')
|
|
99
|
+
self.first_seen_at = attributes[:'first_seen_at']
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
104
|
+
# @return Array for valid properties with the reasons
|
|
105
|
+
def list_invalid_properties
|
|
106
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
107
|
+
invalid_properties = Array.new
|
|
108
|
+
if !@popularity_score.nil? && @popularity_score > 1
|
|
109
|
+
invalid_properties.push('invalid value for "popularity_score", must be smaller than or equal to 1.')
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if !@popularity_score.nil? && @popularity_score < 0
|
|
113
|
+
invalid_properties.push('invalid value for "popularity_score", must be greater than or equal to 0.')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if !@settlement_count_30d.nil? && @settlement_count_30d < 0
|
|
117
|
+
invalid_properties.push('invalid value for "settlement_count_30d", must be greater than or equal to 0.')
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if !@success_rate_30d.nil? && @success_rate_30d > 1
|
|
121
|
+
invalid_properties.push('invalid value for "success_rate_30d", must be smaller than or equal to 1.')
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if !@success_rate_30d.nil? && @success_rate_30d < 0
|
|
125
|
+
invalid_properties.push('invalid value for "success_rate_30d", must be greater than or equal to 0.')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if !@p50_latency_ms.nil? && @p50_latency_ms < 0
|
|
129
|
+
invalid_properties.push('invalid value for "p50_latency_ms", must be greater than or equal to 0.')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
invalid_properties
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Check to see if the all the properties in the model are valid
|
|
136
|
+
# @return true if the model is valid
|
|
137
|
+
def valid?
|
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
139
|
+
return false if !@popularity_score.nil? && @popularity_score > 1
|
|
140
|
+
return false if !@popularity_score.nil? && @popularity_score < 0
|
|
141
|
+
return false if !@settlement_count_30d.nil? && @settlement_count_30d < 0
|
|
142
|
+
return false if !@success_rate_30d.nil? && @success_rate_30d > 1
|
|
143
|
+
return false if !@success_rate_30d.nil? && @success_rate_30d < 0
|
|
144
|
+
return false if !@p50_latency_ms.nil? && @p50_latency_ms < 0
|
|
145
|
+
true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Custom attribute writer method with validation
|
|
149
|
+
# @param [Object] popularity_score Value to be assigned
|
|
150
|
+
def popularity_score=(popularity_score)
|
|
151
|
+
if popularity_score.nil?
|
|
152
|
+
fail ArgumentError, 'popularity_score cannot be nil'
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if popularity_score > 1
|
|
156
|
+
fail ArgumentError, 'invalid value for "popularity_score", must be smaller than or equal to 1.'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if popularity_score < 0
|
|
160
|
+
fail ArgumentError, 'invalid value for "popularity_score", must be greater than or equal to 0.'
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
@popularity_score = popularity_score
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Custom attribute writer method with validation
|
|
167
|
+
# @param [Object] settlement_count_30d Value to be assigned
|
|
168
|
+
def settlement_count_30d=(settlement_count_30d)
|
|
169
|
+
if settlement_count_30d.nil?
|
|
170
|
+
fail ArgumentError, 'settlement_count_30d cannot be nil'
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if settlement_count_30d < 0
|
|
174
|
+
fail ArgumentError, 'invalid value for "settlement_count_30d", must be greater than or equal to 0.'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@settlement_count_30d = settlement_count_30d
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Custom attribute writer method with validation
|
|
181
|
+
# @param [Object] success_rate_30d Value to be assigned
|
|
182
|
+
def success_rate_30d=(success_rate_30d)
|
|
183
|
+
if success_rate_30d.nil?
|
|
184
|
+
fail ArgumentError, 'success_rate_30d cannot be nil'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if success_rate_30d > 1
|
|
188
|
+
fail ArgumentError, 'invalid value for "success_rate_30d", must be smaller than or equal to 1.'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
if success_rate_30d < 0
|
|
192
|
+
fail ArgumentError, 'invalid value for "success_rate_30d", must be greater than or equal to 0.'
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
@success_rate_30d = success_rate_30d
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Custom attribute writer method with validation
|
|
199
|
+
# @param [Object] p50_latency_ms Value to be assigned
|
|
200
|
+
def p50_latency_ms=(p50_latency_ms)
|
|
201
|
+
if p50_latency_ms.nil?
|
|
202
|
+
fail ArgumentError, 'p50_latency_ms cannot be nil'
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
if p50_latency_ms < 0
|
|
206
|
+
fail ArgumentError, 'invalid value for "p50_latency_ms", must be greater than or equal to 0.'
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
@p50_latency_ms = p50_latency_ms
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Checks equality by comparing each attribute.
|
|
213
|
+
# @param [Object] Object to be compared
|
|
214
|
+
def ==(o)
|
|
215
|
+
return true if self.equal?(o)
|
|
216
|
+
self.class == o.class &&
|
|
217
|
+
popularity_score == o.popularity_score &&
|
|
218
|
+
settlement_count_30d == o.settlement_count_30d &&
|
|
219
|
+
success_rate_30d == o.success_rate_30d &&
|
|
220
|
+
p50_latency_ms == o.p50_latency_ms &&
|
|
221
|
+
first_seen_at == o.first_seen_at
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# @see the `==` method
|
|
225
|
+
# @param [Object] Object to be compared
|
|
226
|
+
def eql?(o)
|
|
227
|
+
self == o
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Calculates hash code according to all attributes.
|
|
231
|
+
# @return [Integer] Hash code
|
|
232
|
+
def hash
|
|
233
|
+
[popularity_score, settlement_count_30d, success_rate_30d, p50_latency_ms, first_seen_at].hash
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Builds the object from hash
|
|
237
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
238
|
+
# @return [Object] Returns the model itself
|
|
239
|
+
def self.build_from_hash(attributes)
|
|
240
|
+
return nil unless attributes.is_a?(Hash)
|
|
241
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
242
|
+
transformed_hash = {}
|
|
243
|
+
openapi_types.each_pair do |key, type|
|
|
244
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
245
|
+
transformed_hash["#{key}"] = nil
|
|
246
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
247
|
+
# check to ensure the input is an array given that the attribute
|
|
248
|
+
# is documented as an array but the input is not
|
|
249
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
250
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
251
|
+
end
|
|
252
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
253
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
new(transformed_hash)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Returns the object in the form of hash
|
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
|
261
|
+
def to_hash
|
|
262
|
+
hash = {}
|
|
263
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
264
|
+
value = self.send(attr)
|
|
265
|
+
if value.nil?
|
|
266
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
267
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
hash[param] = _to_hash(value)
|
|
271
|
+
end
|
|
272
|
+
hash
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
end
|
|
@@ -0,0 +1,223 @@
|
|
|
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 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Weft
|
|
17
|
+
class SearchRequest < ApiModelBase
|
|
18
|
+
# Free-text query. Required and non-empty.
|
|
19
|
+
attr_accessor :query
|
|
20
|
+
|
|
21
|
+
# Max number of hits to return. Clamped to [1, 50].
|
|
22
|
+
attr_accessor :limit
|
|
23
|
+
|
|
24
|
+
attr_accessor :filters
|
|
25
|
+
|
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
+
def self.attribute_map
|
|
28
|
+
{
|
|
29
|
+
:'query' => :'query',
|
|
30
|
+
:'limit' => :'limit',
|
|
31
|
+
:'filters' => :'filters'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns attribute mapping this model knows about
|
|
36
|
+
def self.acceptable_attribute_map
|
|
37
|
+
attribute_map
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns all the JSON keys this model knows about
|
|
41
|
+
def self.acceptable_attributes
|
|
42
|
+
acceptable_attribute_map.values
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute type mapping.
|
|
46
|
+
def self.openapi_types
|
|
47
|
+
{
|
|
48
|
+
:'query' => :'String',
|
|
49
|
+
:'limit' => :'Integer',
|
|
50
|
+
:'filters' => :'SearchFilters'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# List of attributes with nullable: true
|
|
55
|
+
def self.openapi_nullable
|
|
56
|
+
Set.new([
|
|
57
|
+
])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Initializes the object
|
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
62
|
+
def initialize(attributes = {})
|
|
63
|
+
if (!attributes.is_a?(Hash))
|
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchRequest` initialize method"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
68
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
70
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
71
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
72
|
+
end
|
|
73
|
+
h[k.to_sym] = v
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if attributes.key?(:'query')
|
|
77
|
+
self.query = attributes[:'query']
|
|
78
|
+
else
|
|
79
|
+
self.query = nil
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'limit')
|
|
83
|
+
self.limit = attributes[:'limit']
|
|
84
|
+
else
|
|
85
|
+
self.limit = 10
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'filters')
|
|
89
|
+
self.filters = attributes[:'filters']
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
94
|
+
# @return Array for valid properties with the reasons
|
|
95
|
+
def list_invalid_properties
|
|
96
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
97
|
+
invalid_properties = Array.new
|
|
98
|
+
if @query.nil?
|
|
99
|
+
invalid_properties.push('invalid value for "query", query cannot be nil.')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if @query.to_s.length < 1
|
|
103
|
+
invalid_properties.push('invalid value for "query", the character length must be greater than or equal to 1.')
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if !@limit.nil? && @limit > 50
|
|
107
|
+
invalid_properties.push('invalid value for "limit", must be smaller than or equal to 50.')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if !@limit.nil? && @limit < 1
|
|
111
|
+
invalid_properties.push('invalid value for "limit", must be greater than or equal to 1.')
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
invalid_properties
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Check to see if the all the properties in the model are valid
|
|
118
|
+
# @return true if the model is valid
|
|
119
|
+
def valid?
|
|
120
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
121
|
+
return false if @query.nil?
|
|
122
|
+
return false if @query.to_s.length < 1
|
|
123
|
+
return false if !@limit.nil? && @limit > 50
|
|
124
|
+
return false if !@limit.nil? && @limit < 1
|
|
125
|
+
true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Custom attribute writer method with validation
|
|
129
|
+
# @param [Object] query Value to be assigned
|
|
130
|
+
def query=(query)
|
|
131
|
+
if query.nil?
|
|
132
|
+
fail ArgumentError, 'query cannot be nil'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if query.to_s.length < 1
|
|
136
|
+
fail ArgumentError, 'invalid value for "query", the character length must be greater than or equal to 1.'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
@query = query
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Custom attribute writer method with validation
|
|
143
|
+
# @param [Object] limit Value to be assigned
|
|
144
|
+
def limit=(limit)
|
|
145
|
+
if limit.nil?
|
|
146
|
+
fail ArgumentError, 'limit cannot be nil'
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if limit > 50
|
|
150
|
+
fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 50.'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if limit < 1
|
|
154
|
+
fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 1.'
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
@limit = limit
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Checks equality by comparing each attribute.
|
|
161
|
+
# @param [Object] Object to be compared
|
|
162
|
+
def ==(o)
|
|
163
|
+
return true if self.equal?(o)
|
|
164
|
+
self.class == o.class &&
|
|
165
|
+
query == o.query &&
|
|
166
|
+
limit == o.limit &&
|
|
167
|
+
filters == o.filters
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# @see the `==` method
|
|
171
|
+
# @param [Object] Object to be compared
|
|
172
|
+
def eql?(o)
|
|
173
|
+
self == o
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Calculates hash code according to all attributes.
|
|
177
|
+
# @return [Integer] Hash code
|
|
178
|
+
def hash
|
|
179
|
+
[query, limit, filters].hash
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Builds the object from hash
|
|
183
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
184
|
+
# @return [Object] Returns the model itself
|
|
185
|
+
def self.build_from_hash(attributes)
|
|
186
|
+
return nil unless attributes.is_a?(Hash)
|
|
187
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
188
|
+
transformed_hash = {}
|
|
189
|
+
openapi_types.each_pair do |key, type|
|
|
190
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
191
|
+
transformed_hash["#{key}"] = nil
|
|
192
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
193
|
+
# check to ensure the input is an array given that the attribute
|
|
194
|
+
# is documented as an array but the input is not
|
|
195
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
196
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
197
|
+
end
|
|
198
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
199
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
new(transformed_hash)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Returns the object in the form of hash
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_hash
|
|
208
|
+
hash = {}
|
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
210
|
+
value = self.send(attr)
|
|
211
|
+
if value.nil?
|
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
hash[param] = _to_hash(value)
|
|
217
|
+
end
|
|
218
|
+
hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Weft API
|
|
3
3
|
|
|
4
|
-
#API for agent-
|
|
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
|
+
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
|
|
@@ -14,13 +14,30 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Weft
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
# Spec-11 search envelope. `paid_usd`, `tx_hash`, and `artifact_id` are reserved for a later release that adds per-call billing and artifact persistence; they are always `null` in v1. `_mock: true` is set only by the mock backend.
|
|
18
|
+
class SearchResponse < ApiModelBase
|
|
19
|
+
attr_accessor :results
|
|
20
|
+
|
|
21
|
+
# Always `null` in v1.
|
|
22
|
+
attr_accessor :paid_usd
|
|
23
|
+
|
|
24
|
+
# Always `null` in v1.
|
|
25
|
+
attr_accessor :tx_hash
|
|
26
|
+
|
|
27
|
+
# Always `null` in v1.
|
|
28
|
+
attr_accessor :artifact_id
|
|
29
|
+
|
|
30
|
+
# Present and `true` only when served by the mock backend.
|
|
31
|
+
attr_accessor :_mock
|
|
19
32
|
|
|
20
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
34
|
def self.attribute_map
|
|
22
35
|
{
|
|
23
|
-
:'
|
|
36
|
+
:'results' => :'results',
|
|
37
|
+
:'paid_usd' => :'paid_usd',
|
|
38
|
+
:'tx_hash' => :'tx_hash',
|
|
39
|
+
:'artifact_id' => :'artifact_id',
|
|
40
|
+
:'_mock' => :'_mock'
|
|
24
41
|
}
|
|
25
42
|
end
|
|
26
43
|
|
|
@@ -37,7 +54,11 @@ module Weft
|
|
|
37
54
|
# Attribute type mapping.
|
|
38
55
|
def self.openapi_types
|
|
39
56
|
{
|
|
40
|
-
:'
|
|
57
|
+
:'results' => :'Array<SearchResult>',
|
|
58
|
+
:'paid_usd' => :'String',
|
|
59
|
+
:'tx_hash' => :'String',
|
|
60
|
+
:'artifact_id' => :'String',
|
|
61
|
+
:'_mock' => :'Boolean'
|
|
41
62
|
}
|
|
42
63
|
end
|
|
43
64
|
|
|
@@ -51,22 +72,40 @@ module Weft
|
|
|
51
72
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
52
73
|
def initialize(attributes = {})
|
|
53
74
|
if (!attributes.is_a?(Hash))
|
|
54
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::
|
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchResponse` initialize method"
|
|
55
76
|
end
|
|
56
77
|
|
|
57
78
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
58
79
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
59
80
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
81
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
61
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::
|
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
62
83
|
end
|
|
63
84
|
h[k.to_sym] = v
|
|
64
85
|
}
|
|
65
86
|
|
|
66
|
-
if attributes.key?(:'
|
|
67
|
-
|
|
87
|
+
if attributes.key?(:'results')
|
|
88
|
+
if (value = attributes[:'results']).is_a?(Array)
|
|
89
|
+
self.results = value
|
|
90
|
+
end
|
|
68
91
|
else
|
|
69
|
-
self.
|
|
92
|
+
self.results = nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'paid_usd')
|
|
96
|
+
self.paid_usd = attributes[:'paid_usd']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'tx_hash')
|
|
100
|
+
self.tx_hash = attributes[:'tx_hash']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'artifact_id')
|
|
104
|
+
self.artifact_id = attributes[:'artifact_id']
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'_mock')
|
|
108
|
+
self._mock = attributes[:'_mock']
|
|
70
109
|
end
|
|
71
110
|
end
|
|
72
111
|
|
|
@@ -75,8 +114,8 @@ module Weft
|
|
|
75
114
|
def list_invalid_properties
|
|
76
115
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
77
116
|
invalid_properties = Array.new
|
|
78
|
-
if @
|
|
79
|
-
invalid_properties.push('invalid value for "
|
|
117
|
+
if @results.nil?
|
|
118
|
+
invalid_properties.push('invalid value for "results", results cannot be nil.')
|
|
80
119
|
end
|
|
81
120
|
|
|
82
121
|
invalid_properties
|
|
@@ -86,18 +125,18 @@ module Weft
|
|
|
86
125
|
# @return true if the model is valid
|
|
87
126
|
def valid?
|
|
88
127
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
89
|
-
return false if @
|
|
128
|
+
return false if @results.nil?
|
|
90
129
|
true
|
|
91
130
|
end
|
|
92
131
|
|
|
93
132
|
# Custom attribute writer method with validation
|
|
94
|
-
# @param [Object]
|
|
95
|
-
def
|
|
96
|
-
if
|
|
97
|
-
fail ArgumentError, '
|
|
133
|
+
# @param [Object] results Value to be assigned
|
|
134
|
+
def results=(results)
|
|
135
|
+
if results.nil?
|
|
136
|
+
fail ArgumentError, 'results cannot be nil'
|
|
98
137
|
end
|
|
99
138
|
|
|
100
|
-
@
|
|
139
|
+
@results = results
|
|
101
140
|
end
|
|
102
141
|
|
|
103
142
|
# Checks equality by comparing each attribute.
|
|
@@ -105,7 +144,11 @@ module Weft
|
|
|
105
144
|
def ==(o)
|
|
106
145
|
return true if self.equal?(o)
|
|
107
146
|
self.class == o.class &&
|
|
108
|
-
|
|
147
|
+
results == o.results &&
|
|
148
|
+
paid_usd == o.paid_usd &&
|
|
149
|
+
tx_hash == o.tx_hash &&
|
|
150
|
+
artifact_id == o.artifact_id &&
|
|
151
|
+
_mock == o._mock
|
|
109
152
|
end
|
|
110
153
|
|
|
111
154
|
# @see the `==` method
|
|
@@ -117,7 +160,7 @@ module Weft
|
|
|
117
160
|
# Calculates hash code according to all attributes.
|
|
118
161
|
# @return [Integer] Hash code
|
|
119
162
|
def hash
|
|
120
|
-
[
|
|
163
|
+
[results, paid_usd, tx_hash, artifact_id, _mock].hash
|
|
121
164
|
end
|
|
122
165
|
|
|
123
166
|
# Builds the object from hash
|