weft-sdk 0.3.0 → 0.6.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,414 @@
|
|
|
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.6.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 SearchResult < ApiModelBase
|
|
18
|
+
# Stable agent identifier (e.g. `weft:agent:agentmail`).
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# Cosine similarity score, clipped to [0, 1].
|
|
22
|
+
attr_accessor :score
|
|
23
|
+
|
|
24
|
+
# Agent protocol surface.
|
|
25
|
+
attr_accessor :protocol
|
|
26
|
+
|
|
27
|
+
# Domain tags declared by the agent.
|
|
28
|
+
attr_accessor :domain
|
|
29
|
+
|
|
30
|
+
# Reseller slug if this agent is fronted by an aggregator (e.g. `locus`).
|
|
31
|
+
attr_accessor :reseller
|
|
32
|
+
|
|
33
|
+
# Upstream provider hostname when fronted by a reseller.
|
|
34
|
+
attr_accessor :upstream
|
|
35
|
+
|
|
36
|
+
attr_accessor :agent_card
|
|
37
|
+
|
|
38
|
+
attr_accessor :pricing
|
|
39
|
+
|
|
40
|
+
attr_accessor :ranking
|
|
41
|
+
|
|
42
|
+
attr_accessor :endpoints
|
|
43
|
+
|
|
44
|
+
class EnumAttributeValidator
|
|
45
|
+
attr_reader :datatype
|
|
46
|
+
attr_reader :allowable_values
|
|
47
|
+
|
|
48
|
+
def initialize(datatype, allowable_values)
|
|
49
|
+
@allowable_values = allowable_values.map do |value|
|
|
50
|
+
case datatype.to_s
|
|
51
|
+
when /Integer/i
|
|
52
|
+
value.to_i
|
|
53
|
+
when /Float/i
|
|
54
|
+
value.to_f
|
|
55
|
+
else
|
|
56
|
+
value
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def valid?(value)
|
|
62
|
+
!value || allowable_values.include?(value)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
67
|
+
def self.attribute_map
|
|
68
|
+
{
|
|
69
|
+
:'id' => :'id',
|
|
70
|
+
:'score' => :'score',
|
|
71
|
+
:'protocol' => :'protocol',
|
|
72
|
+
:'domain' => :'domain',
|
|
73
|
+
:'reseller' => :'reseller',
|
|
74
|
+
:'upstream' => :'upstream',
|
|
75
|
+
:'agent_card' => :'agent_card',
|
|
76
|
+
:'pricing' => :'pricing',
|
|
77
|
+
:'ranking' => :'ranking',
|
|
78
|
+
:'endpoints' => :'endpoints'
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Returns attribute mapping this model knows about
|
|
83
|
+
def self.acceptable_attribute_map
|
|
84
|
+
attribute_map
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Returns all the JSON keys this model knows about
|
|
88
|
+
def self.acceptable_attributes
|
|
89
|
+
acceptable_attribute_map.values
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Attribute type mapping.
|
|
93
|
+
def self.openapi_types
|
|
94
|
+
{
|
|
95
|
+
:'id' => :'String',
|
|
96
|
+
:'score' => :'Float',
|
|
97
|
+
:'protocol' => :'String',
|
|
98
|
+
:'domain' => :'Array<String>',
|
|
99
|
+
:'reseller' => :'String',
|
|
100
|
+
:'upstream' => :'String',
|
|
101
|
+
:'agent_card' => :'SearchAgentCard',
|
|
102
|
+
:'pricing' => :'SearchPricing',
|
|
103
|
+
:'ranking' => :'SearchRanking',
|
|
104
|
+
:'endpoints' => :'SearchEndpoints'
|
|
105
|
+
}
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# List of attributes with nullable: true
|
|
109
|
+
def self.openapi_nullable
|
|
110
|
+
Set.new([
|
|
111
|
+
])
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Initializes the object
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
def initialize(attributes = {})
|
|
117
|
+
if (!attributes.is_a?(Hash))
|
|
118
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchResult` initialize method"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
122
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
123
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
124
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
125
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
126
|
+
end
|
|
127
|
+
h[k.to_sym] = v
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'id')
|
|
131
|
+
self.id = attributes[:'id']
|
|
132
|
+
else
|
|
133
|
+
self.id = nil
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'score')
|
|
137
|
+
self.score = attributes[:'score']
|
|
138
|
+
else
|
|
139
|
+
self.score = nil
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'protocol')
|
|
143
|
+
self.protocol = attributes[:'protocol']
|
|
144
|
+
else
|
|
145
|
+
self.protocol = nil
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'domain')
|
|
149
|
+
if (value = attributes[:'domain']).is_a?(Array)
|
|
150
|
+
self.domain = value
|
|
151
|
+
end
|
|
152
|
+
else
|
|
153
|
+
self.domain = nil
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if attributes.key?(:'reseller')
|
|
157
|
+
self.reseller = attributes[:'reseller']
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if attributes.key?(:'upstream')
|
|
161
|
+
self.upstream = attributes[:'upstream']
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if attributes.key?(:'agent_card')
|
|
165
|
+
self.agent_card = attributes[:'agent_card']
|
|
166
|
+
else
|
|
167
|
+
self.agent_card = nil
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if attributes.key?(:'pricing')
|
|
171
|
+
self.pricing = attributes[:'pricing']
|
|
172
|
+
else
|
|
173
|
+
self.pricing = nil
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if attributes.key?(:'ranking')
|
|
177
|
+
self.ranking = attributes[:'ranking']
|
|
178
|
+
else
|
|
179
|
+
self.ranking = nil
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if attributes.key?(:'endpoints')
|
|
183
|
+
self.endpoints = attributes[:'endpoints']
|
|
184
|
+
else
|
|
185
|
+
self.endpoints = nil
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
190
|
+
# @return Array for valid properties with the reasons
|
|
191
|
+
def list_invalid_properties
|
|
192
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
193
|
+
invalid_properties = Array.new
|
|
194
|
+
if @id.nil?
|
|
195
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if @score.nil?
|
|
199
|
+
invalid_properties.push('invalid value for "score", score cannot be nil.')
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if @score > 1
|
|
203
|
+
invalid_properties.push('invalid value for "score", must be smaller than or equal to 1.')
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if @score < 0
|
|
207
|
+
invalid_properties.push('invalid value for "score", must be greater than or equal to 0.')
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
if @protocol.nil?
|
|
211
|
+
invalid_properties.push('invalid value for "protocol", protocol cannot be nil.')
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
if @domain.nil?
|
|
215
|
+
invalid_properties.push('invalid value for "domain", domain cannot be nil.')
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
if @agent_card.nil?
|
|
219
|
+
invalid_properties.push('invalid value for "agent_card", agent_card cannot be nil.')
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
if @pricing.nil?
|
|
223
|
+
invalid_properties.push('invalid value for "pricing", pricing cannot be nil.')
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
if @ranking.nil?
|
|
227
|
+
invalid_properties.push('invalid value for "ranking", ranking cannot be nil.')
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
if @endpoints.nil?
|
|
231
|
+
invalid_properties.push('invalid value for "endpoints", endpoints cannot be nil.')
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
invalid_properties
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Check to see if the all the properties in the model are valid
|
|
238
|
+
# @return true if the model is valid
|
|
239
|
+
def valid?
|
|
240
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
241
|
+
return false if @id.nil?
|
|
242
|
+
return false if @score.nil?
|
|
243
|
+
return false if @score > 1
|
|
244
|
+
return false if @score < 0
|
|
245
|
+
return false if @protocol.nil?
|
|
246
|
+
protocol_validator = EnumAttributeValidator.new('String', ["a2a", "mcp", "openapi"])
|
|
247
|
+
return false unless protocol_validator.valid?(@protocol)
|
|
248
|
+
return false if @domain.nil?
|
|
249
|
+
return false if @agent_card.nil?
|
|
250
|
+
return false if @pricing.nil?
|
|
251
|
+
return false if @ranking.nil?
|
|
252
|
+
return false if @endpoints.nil?
|
|
253
|
+
true
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Custom attribute writer method with validation
|
|
257
|
+
# @param [Object] id Value to be assigned
|
|
258
|
+
def id=(id)
|
|
259
|
+
if id.nil?
|
|
260
|
+
fail ArgumentError, 'id cannot be nil'
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
@id = id
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Custom attribute writer method with validation
|
|
267
|
+
# @param [Object] score Value to be assigned
|
|
268
|
+
def score=(score)
|
|
269
|
+
if score.nil?
|
|
270
|
+
fail ArgumentError, 'score cannot be nil'
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if score > 1
|
|
274
|
+
fail ArgumentError, 'invalid value for "score", must be smaller than or equal to 1.'
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
if score < 0
|
|
278
|
+
fail ArgumentError, 'invalid value for "score", must be greater than or equal to 0.'
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
@score = score
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
285
|
+
# @param [Object] protocol Object to be assigned
|
|
286
|
+
def protocol=(protocol)
|
|
287
|
+
validator = EnumAttributeValidator.new('String', ["a2a", "mcp", "openapi"])
|
|
288
|
+
unless validator.valid?(protocol)
|
|
289
|
+
fail ArgumentError, "invalid value for \"protocol\", must be one of #{validator.allowable_values}."
|
|
290
|
+
end
|
|
291
|
+
@protocol = protocol
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Custom attribute writer method with validation
|
|
295
|
+
# @param [Object] domain Value to be assigned
|
|
296
|
+
def domain=(domain)
|
|
297
|
+
if domain.nil?
|
|
298
|
+
fail ArgumentError, 'domain cannot be nil'
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
@domain = domain
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Custom attribute writer method with validation
|
|
305
|
+
# @param [Object] agent_card Value to be assigned
|
|
306
|
+
def agent_card=(agent_card)
|
|
307
|
+
if agent_card.nil?
|
|
308
|
+
fail ArgumentError, 'agent_card cannot be nil'
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
@agent_card = agent_card
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Custom attribute writer method with validation
|
|
315
|
+
# @param [Object] pricing Value to be assigned
|
|
316
|
+
def pricing=(pricing)
|
|
317
|
+
if pricing.nil?
|
|
318
|
+
fail ArgumentError, 'pricing cannot be nil'
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
@pricing = pricing
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Custom attribute writer method with validation
|
|
325
|
+
# @param [Object] ranking Value to be assigned
|
|
326
|
+
def ranking=(ranking)
|
|
327
|
+
if ranking.nil?
|
|
328
|
+
fail ArgumentError, 'ranking cannot be nil'
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
@ranking = ranking
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Custom attribute writer method with validation
|
|
335
|
+
# @param [Object] endpoints Value to be assigned
|
|
336
|
+
def endpoints=(endpoints)
|
|
337
|
+
if endpoints.nil?
|
|
338
|
+
fail ArgumentError, 'endpoints cannot be nil'
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
@endpoints = endpoints
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
# Checks equality by comparing each attribute.
|
|
345
|
+
# @param [Object] Object to be compared
|
|
346
|
+
def ==(o)
|
|
347
|
+
return true if self.equal?(o)
|
|
348
|
+
self.class == o.class &&
|
|
349
|
+
id == o.id &&
|
|
350
|
+
score == o.score &&
|
|
351
|
+
protocol == o.protocol &&
|
|
352
|
+
domain == o.domain &&
|
|
353
|
+
reseller == o.reseller &&
|
|
354
|
+
upstream == o.upstream &&
|
|
355
|
+
agent_card == o.agent_card &&
|
|
356
|
+
pricing == o.pricing &&
|
|
357
|
+
ranking == o.ranking &&
|
|
358
|
+
endpoints == o.endpoints
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# @see the `==` method
|
|
362
|
+
# @param [Object] Object to be compared
|
|
363
|
+
def eql?(o)
|
|
364
|
+
self == o
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
# Calculates hash code according to all attributes.
|
|
368
|
+
# @return [Integer] Hash code
|
|
369
|
+
def hash
|
|
370
|
+
[id, score, protocol, domain, reseller, upstream, agent_card, pricing, ranking, endpoints].hash
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Builds the object from hash
|
|
374
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
375
|
+
# @return [Object] Returns the model itself
|
|
376
|
+
def self.build_from_hash(attributes)
|
|
377
|
+
return nil unless attributes.is_a?(Hash)
|
|
378
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
379
|
+
transformed_hash = {}
|
|
380
|
+
openapi_types.each_pair do |key, type|
|
|
381
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
382
|
+
transformed_hash["#{key}"] = nil
|
|
383
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
384
|
+
# check to ensure the input is an array given that the attribute
|
|
385
|
+
# is documented as an array but the input is not
|
|
386
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
387
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
388
|
+
end
|
|
389
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
390
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
new(transformed_hash)
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
# Returns the object in the form of hash
|
|
397
|
+
# @return [Hash] Returns the object in the form of hash
|
|
398
|
+
def to_hash
|
|
399
|
+
hash = {}
|
|
400
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
401
|
+
value = self.send(attr)
|
|
402
|
+
if value.nil?
|
|
403
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
404
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
hash[param] = _to_hash(value)
|
|
408
|
+
end
|
|
409
|
+
hash
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
end
|
|
@@ -0,0 +1,259 @@
|
|
|
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.6.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 SearchSkill < ApiModelBase
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
attr_accessor :description
|
|
23
|
+
|
|
24
|
+
attr_accessor :tags
|
|
25
|
+
|
|
26
|
+
attr_accessor :examples
|
|
27
|
+
|
|
28
|
+
attr_accessor :input_modes
|
|
29
|
+
|
|
30
|
+
attr_accessor :output_modes
|
|
31
|
+
|
|
32
|
+
# True for skills that require streaming transport (e.g. websockets). Streaming skills are filtered out of results by default so non-streaming clients only see callable skills.
|
|
33
|
+
attr_accessor :streaming
|
|
34
|
+
|
|
35
|
+
attr_accessor :endpoint
|
|
36
|
+
|
|
37
|
+
# Per-call price in USD for this individual skill.
|
|
38
|
+
attr_accessor :price_usd
|
|
39
|
+
|
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
|
+
def self.attribute_map
|
|
42
|
+
{
|
|
43
|
+
:'id' => :'id',
|
|
44
|
+
:'name' => :'name',
|
|
45
|
+
:'description' => :'description',
|
|
46
|
+
:'tags' => :'tags',
|
|
47
|
+
:'examples' => :'examples',
|
|
48
|
+
:'input_modes' => :'inputModes',
|
|
49
|
+
:'output_modes' => :'outputModes',
|
|
50
|
+
:'streaming' => :'streaming',
|
|
51
|
+
:'endpoint' => :'endpoint',
|
|
52
|
+
:'price_usd' => :'price_usd'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Returns attribute mapping this model knows about
|
|
57
|
+
def self.acceptable_attribute_map
|
|
58
|
+
attribute_map
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Returns all the JSON keys this model knows about
|
|
62
|
+
def self.acceptable_attributes
|
|
63
|
+
acceptable_attribute_map.values
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Attribute type mapping.
|
|
67
|
+
def self.openapi_types
|
|
68
|
+
{
|
|
69
|
+
:'id' => :'String',
|
|
70
|
+
:'name' => :'String',
|
|
71
|
+
:'description' => :'String',
|
|
72
|
+
:'tags' => :'Array<String>',
|
|
73
|
+
:'examples' => :'Array<String>',
|
|
74
|
+
:'input_modes' => :'Array<String>',
|
|
75
|
+
:'output_modes' => :'Array<String>',
|
|
76
|
+
:'streaming' => :'Boolean',
|
|
77
|
+
:'endpoint' => :'SearchSkillEndpoint',
|
|
78
|
+
:'price_usd' => :'String'
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# List of attributes with nullable: true
|
|
83
|
+
def self.openapi_nullable
|
|
84
|
+
Set.new([
|
|
85
|
+
])
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Initializes the object
|
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
90
|
+
def initialize(attributes = {})
|
|
91
|
+
if (!attributes.is_a?(Hash))
|
|
92
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchSkill` initialize method"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
96
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
98
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchSkill`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
100
|
+
end
|
|
101
|
+
h[k.to_sym] = v
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'id')
|
|
105
|
+
self.id = attributes[:'id']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'name')
|
|
109
|
+
self.name = attributes[:'name']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'description')
|
|
113
|
+
self.description = attributes[:'description']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'tags')
|
|
117
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
118
|
+
self.tags = value
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'examples')
|
|
123
|
+
if (value = attributes[:'examples']).is_a?(Array)
|
|
124
|
+
self.examples = value
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'input_modes')
|
|
129
|
+
if (value = attributes[:'input_modes']).is_a?(Array)
|
|
130
|
+
self.input_modes = value
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'output_modes')
|
|
135
|
+
if (value = attributes[:'output_modes']).is_a?(Array)
|
|
136
|
+
self.output_modes = value
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'streaming')
|
|
141
|
+
self.streaming = attributes[:'streaming']
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'endpoint')
|
|
145
|
+
self.endpoint = attributes[:'endpoint']
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'price_usd')
|
|
149
|
+
self.price_usd = attributes[:'price_usd']
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
154
|
+
# @return Array for valid properties with the reasons
|
|
155
|
+
def list_invalid_properties
|
|
156
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
157
|
+
invalid_properties = Array.new
|
|
158
|
+
pattern = Regexp.new(/^\d+(\.\d{1,6})?$/)
|
|
159
|
+
if !@price_usd.nil? && @price_usd !~ pattern
|
|
160
|
+
invalid_properties.push("invalid value for \"price_usd\", must conform to the pattern #{pattern}.")
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
invalid_properties
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Check to see if the all the properties in the model are valid
|
|
167
|
+
# @return true if the model is valid
|
|
168
|
+
def valid?
|
|
169
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
170
|
+
return false if !@price_usd.nil? && @price_usd !~ Regexp.new(/^\d+(\.\d{1,6})?$/)
|
|
171
|
+
true
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom attribute writer method with validation
|
|
175
|
+
# @param [Object] price_usd Value to be assigned
|
|
176
|
+
def price_usd=(price_usd)
|
|
177
|
+
if price_usd.nil?
|
|
178
|
+
fail ArgumentError, 'price_usd cannot be nil'
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
pattern = Regexp.new(/^\d+(\.\d{1,6})?$/)
|
|
182
|
+
if price_usd !~ pattern
|
|
183
|
+
fail ArgumentError, "invalid value for \"price_usd\", must conform to the pattern #{pattern}."
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
@price_usd = price_usd
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Checks equality by comparing each attribute.
|
|
190
|
+
# @param [Object] Object to be compared
|
|
191
|
+
def ==(o)
|
|
192
|
+
return true if self.equal?(o)
|
|
193
|
+
self.class == o.class &&
|
|
194
|
+
id == o.id &&
|
|
195
|
+
name == o.name &&
|
|
196
|
+
description == o.description &&
|
|
197
|
+
tags == o.tags &&
|
|
198
|
+
examples == o.examples &&
|
|
199
|
+
input_modes == o.input_modes &&
|
|
200
|
+
output_modes == o.output_modes &&
|
|
201
|
+
streaming == o.streaming &&
|
|
202
|
+
endpoint == o.endpoint &&
|
|
203
|
+
price_usd == o.price_usd
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# @see the `==` method
|
|
207
|
+
# @param [Object] Object to be compared
|
|
208
|
+
def eql?(o)
|
|
209
|
+
self == o
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Calculates hash code according to all attributes.
|
|
213
|
+
# @return [Integer] Hash code
|
|
214
|
+
def hash
|
|
215
|
+
[id, name, description, tags, examples, input_modes, output_modes, streaming, endpoint, price_usd].hash
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Builds the object from hash
|
|
219
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
220
|
+
# @return [Object] Returns the model itself
|
|
221
|
+
def self.build_from_hash(attributes)
|
|
222
|
+
return nil unless attributes.is_a?(Hash)
|
|
223
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
224
|
+
transformed_hash = {}
|
|
225
|
+
openapi_types.each_pair do |key, type|
|
|
226
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
227
|
+
transformed_hash["#{key}"] = nil
|
|
228
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
229
|
+
# check to ensure the input is an array given that the attribute
|
|
230
|
+
# is documented as an array but the input is not
|
|
231
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
232
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
233
|
+
end
|
|
234
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
235
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
new(transformed_hash)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Returns the object in the form of hash
|
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
|
243
|
+
def to_hash
|
|
244
|
+
hash = {}
|
|
245
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
246
|
+
value = self.send(attr)
|
|
247
|
+
if value.nil?
|
|
248
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
249
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
hash[param] = _to_hash(value)
|
|
253
|
+
end
|
|
254
|
+
hash
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
end
|