weft-sdk 0.25.0 → 0.32.5
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/FetchApi.md +3 -3
- data/docs/FetchErrorResponse.md +1 -1
- data/docs/FetchRequest.md +6 -2
- data/docs/FetchResponse.md +5 -3
- data/docs/GetPurchaseIdParameter.md +48 -0
- data/docs/PaymentsApi.md +2 -0
- data/docs/Purchase.md +6 -0
- data/docs/PurchasesApi.md +2 -2
- data/docs/SearchApi.md +1 -1
- data/docs/SearchCompactAccess.md +23 -0
- data/docs/SearchCompactAccessPrice.md +23 -0
- data/docs/SearchCompactNextCall.md +23 -0
- data/docs/SearchCompactResult.md +47 -0
- data/docs/SearchCompactResultAttribution.md +21 -0
- data/docs/SearchCompactResultBlockedScopesInner.md +19 -0
- data/docs/SearchCompactResultOperation.md +21 -0
- data/docs/SearchCompactResultProvider.md +19 -0
- data/docs/SearchEndpointCall.md +1 -1
- data/docs/SearchEndpointCallInputSchema.md +14 -0
- data/docs/SearchEndpointHit.md +5 -1
- data/docs/SearchHelperDocs.md +23 -0
- data/docs/SearchRequest.md +3 -1
- data/docs/SearchResponse.md +9 -3
- data/docs/SearchWeftFetchCompatibility.md +3 -1
- data/docs/WebhooksApi.md +414 -0
- data/lib/weft/client.rb +271 -0
- data/lib/weft/error.rb +41 -0
- data/lib/weft/facilitator/client.rb +254 -42
- data/lib/weft/facilitator/echo.rb +99 -0
- data/lib/weft/facilitator/extensions.rb +183 -0
- data/lib/weft/facilitator/fee.rb +26 -11
- data/lib/weft/facilitator/handshake.rb +92 -0
- data/lib/weft/facilitator/json_wire.rb +74 -0
- data/lib/weft/facilitator/middleware.rb +563 -137
- data/lib/weft/facilitator/path_match.rb +179 -0
- data/lib/weft/facilitator/product.rb +380 -0
- data/lib/weft/facilitator/replay.rb +46 -0
- data/lib/weft/facilitator/settlement.rb +117 -0
- data/lib/weft/facilitator/x402.rb +355 -0
- data/lib/weft/generated/api/account_api.rb +2 -2
- data/lib/weft/generated/api/agent_bootstrap_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 +2 -2
- data/lib/weft/generated/api/documentation_api.rb +2 -2
- data/lib/weft/generated/api/fetch_api.rb +6 -6
- data/lib/weft/generated/api/payments_api.rb +4 -2
- data/lib/weft/generated/api/purchases_api.rb +4 -4
- data/lib/weft/generated/api/resources_api.rb +2 -2
- data/lib/weft/generated/api/search_api.rb +4 -4
- data/lib/weft/generated/api/webhooks_api.rb +388 -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_bootstrap_approval.rb +2 -2
- data/lib/weft/generated/models/account_bootstrap_created.rb +2 -2
- data/lib/weft/generated/models/account_bootstrap_created_approval.rb +2 -2
- data/lib/weft/generated/models/account_bootstrap_created_response.rb +2 -2
- data/lib/weft/generated/models/account_bootstrap_request.rb +2 -2
- data/lib/weft/generated/models/account_bootstrap_status.rb +2 -2
- data/lib/weft/generated/models/account_bootstrap_status_response.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 +2 -2
- 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 +2 -2
- 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/enrolled_resource.rb +2 -2
- data/lib/weft/generated/models/error.rb +2 -2
- data/lib/weft/generated/models/error_response.rb +2 -2
- data/lib/weft/generated/models/fetch403_response.rb +2 -2
- data/lib/weft/generated/models/fetch_balance_snapshot.rb +2 -2
- data/lib/weft/generated/models/fetch_error_response.rb +5 -5
- data/lib/weft/generated/models/fetch_request.rb +46 -5
- data/lib/weft/generated/models/fetch_request_body.rb +2 -2
- data/lib/weft/generated/models/fetch_response.rb +36 -64
- data/lib/weft/generated/models/get_purchase_id_parameter.rb +104 -0
- data/lib/weft/generated/models/insufficient_scope_response.rb +2 -2
- data/lib/weft/generated/models/me_api_key.rb +2 -2
- data/lib/weft/generated/models/me_api_key_creator.rb +2 -2
- data/lib/weft/generated/models/me_response.rb +2 -2
- data/lib/weft/generated/models/me_response_data.rb +2 -2
- 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/principal_wallet.rb +2 -2
- data/lib/weft/generated/models/promo_balance.rb +2 -2
- data/lib/weft/generated/models/purchase.rb +75 -3
- data/lib/weft/generated/models/purchase_artifact.rb +2 -2
- data/lib/weft/generated/models/purchase_list_response.rb +2 -2
- data/lib/weft/generated/models/purchase_response.rb +2 -2
- data/lib/weft/generated/models/rate_limit_response.rb +2 -2
- data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
- data/lib/weft/generated/models/resource_enrollment_request.rb +2 -2
- data/lib/weft/generated/models/resource_enrollment_response.rb +2 -2
- data/lib/weft/generated/models/resource_stats.rb +2 -2
- data/lib/weft/generated/models/search_access_method.rb +2 -2
- data/lib/weft/generated/models/search_capability_ref.rb +2 -2
- data/lib/weft/generated/models/search_compact_access.rb +179 -0
- data/lib/weft/generated/models/search_compact_access_price.rb +176 -0
- data/lib/weft/generated/models/search_compact_next_call.rb +275 -0
- data/lib/weft/generated/models/search_compact_result.rb +389 -0
- data/lib/weft/generated/models/search_compact_result_attribution.rb +166 -0
- data/lib/weft/generated/models/search_compact_result_blocked_scopes_inner.rb +156 -0
- data/lib/weft/generated/models/search_compact_result_operation.rb +183 -0
- data/lib/weft/generated/models/search_compact_result_provider.rb +156 -0
- data/lib/weft/generated/models/search_curated_callability.rb +2 -2
- data/lib/weft/generated/models/search_curated_execution.rb +2 -2
- data/lib/weft/generated/models/search_curated_operation.rb +2 -2
- data/lib/weft/generated/models/search_curated_service.rb +2 -2
- data/lib/weft/generated/models/search_curated_source.rb +2 -2
- data/lib/weft/generated/models/search_endpoint_call.rb +4 -4
- data/lib/weft/generated/models/search_endpoint_call_input_schema.rb +103 -0
- data/lib/weft/generated/models/search_endpoint_hit.rb +25 -6
- data/lib/weft/generated/models/search_endpoint_price.rb +2 -2
- data/lib/weft/generated/models/search_error_response.rb +4 -4
- data/lib/weft/generated/models/search_execution_mode_filter.rb +2 -2
- data/lib/weft/generated/models/search_filter_spec.rb +2 -2
- data/lib/weft/generated/models/search_helper_docs.rb +175 -0
- data/lib/weft/generated/models/search_method_filter.rb +2 -2
- data/lib/weft/generated/models/search_payment_offer.rb +2 -2
- data/lib/weft/generated/models/search_price_atomic_filter.rb +2 -2
- data/lib/weft/generated/models/search_price_usd_filter.rb +2 -2
- data/lib/weft/generated/models/search_protocol_filter.rb +2 -2
- data/lib/weft/generated/models/search_provider_ref.rb +2 -2
- data/lib/weft/generated/models/search_request.rb +50 -6
- data/lib/weft/generated/models/search_resource_type_filter.rb +2 -2
- data/lib/weft/generated/models/search_response.rb +71 -8
- data/lib/weft/generated/models/search_response_warnings_inner.rb +2 -2
- data/lib/weft/generated/models/search_result.rb +2 -2
- data/lib/weft/generated/models/search_string_set_filter.rb +2 -2
- data/lib/weft/generated/models/search_weft_fetch_compatibility.rb +28 -6
- 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 +2 -2
- data/lib/weft/generated/models/user.rb +2 -2
- data/lib/weft/generated/models/user_principal.rb +2 -2
- data/lib/weft/generated/models/wallet.rb +2 -2
- data/lib/weft/generated/version.rb +3 -3
- data/lib/weft/sdk.rb +3 -1
- metadata +39 -4
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Weft API
|
|
3
|
+
|
|
4
|
+
#The Weft API powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and third-party applications that discover and pay for resources on Weft. The buyer runtime covers six concerns: 1. Account creation and recovery (`/api/v1/auth/*`) 2. Credential identity (`/api/v1/me`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/purchases`) Buyer runtime calls require a dashboard-created `wk_*` account key, an OAuth access token with the relevant scope, or a claimed `wbt_*` bearer on its fixed allowlist. The organization-scoped API key and payment operations in this document are seller administration surfaces and require an `ax_live_*` resource key. These credential types are not interchangeable. This document is a deliberate subset of the `/api/v1` surface, not an inventory of it. The seller-side management endpoints — `/api/v1/agents` and `/api/v1/analytics` — are reachable with an `ax_live_*` key but are intentionally left undocumented: they are dashboard-facing and not part of the published client contract. `/api/v1/webhook_endpoints` stays routed and returns HTTP 410 with error code `gone` for index, show, create, update, and destroy. Nothing outside this document is a supported contract, and the response-validation gate in `config/environments/test.rb` enforces only what is declared here. Before claim, a `wbt_*` bearer is temporary and permits only search plus its own status/cancel operations for 30 minutes. Human approval binds it to the User and promotes the same secret to durable identity, search, balance, fetch, purchase-history, status, and revocation capabilities. It remains valid until revoked. Seller, organization, API-key administration, dashboard-session, transfer, withdrawal, and MCP surfaces always refuse it. Bootstrap lifecycle successes follow the API-standard `{ \"data\": ... }` envelope. 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.32.5
|
|
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
|
+
# A ready paid call, present when the request is determined and the Weft fetch runtime can pay the access method. Replace each `{name}` listed in `fill` in `body` (and add `max_cost_usd` or `body` when they are listed), then send `body` as the JSON body of `POST /api/v1/fetch` with an `Idempotency-Key` header. `body` uses the wire field names (`max_cost_usd`, `search_id`); an SDK fetch call may name them differently, so map each field and keep the attribution fields.
|
|
18
|
+
class SearchCompactNextCall < ApiModelBase
|
|
19
|
+
attr_accessor :method
|
|
20
|
+
|
|
21
|
+
attr_accessor :path
|
|
22
|
+
|
|
23
|
+
# A `FetchRequest` with documented example values and `{name}` placeholders.
|
|
24
|
+
attr_accessor :body
|
|
25
|
+
|
|
26
|
+
# Names to replace before you send the request.
|
|
27
|
+
attr_accessor :fill
|
|
28
|
+
|
|
29
|
+
class EnumAttributeValidator
|
|
30
|
+
attr_reader :datatype
|
|
31
|
+
attr_reader :allowable_values
|
|
32
|
+
|
|
33
|
+
def initialize(datatype, allowable_values)
|
|
34
|
+
@allowable_values = allowable_values.map do |value|
|
|
35
|
+
case datatype.to_s
|
|
36
|
+
when /Integer/i
|
|
37
|
+
value.to_i
|
|
38
|
+
when /Float/i
|
|
39
|
+
value.to_f
|
|
40
|
+
else
|
|
41
|
+
value
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def valid?(value)
|
|
47
|
+
!value || allowable_values.include?(value)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
|
+
def self.attribute_map
|
|
53
|
+
{
|
|
54
|
+
:'method' => :'method',
|
|
55
|
+
:'path' => :'path',
|
|
56
|
+
:'body' => :'body',
|
|
57
|
+
:'fill' => :'fill'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Returns attribute mapping this model knows about
|
|
62
|
+
def self.acceptable_attribute_map
|
|
63
|
+
attribute_map
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Returns all the JSON keys this model knows about
|
|
67
|
+
def self.acceptable_attributes
|
|
68
|
+
acceptable_attribute_map.values
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Attribute type mapping.
|
|
72
|
+
def self.openapi_types
|
|
73
|
+
{
|
|
74
|
+
:'method' => :'String',
|
|
75
|
+
:'path' => :'String',
|
|
76
|
+
:'body' => :'Hash<String, Object>',
|
|
77
|
+
:'fill' => :'Array<String>'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# List of attributes with nullable: true
|
|
82
|
+
def self.openapi_nullable
|
|
83
|
+
Set.new([
|
|
84
|
+
])
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Initializes the object
|
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
|
+
def initialize(attributes = {})
|
|
90
|
+
if (!attributes.is_a?(Hash))
|
|
91
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchCompactNextCall` initialize method"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
95
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
97
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
98
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchCompactNextCall`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
99
|
+
end
|
|
100
|
+
h[k.to_sym] = v
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'method')
|
|
104
|
+
self.method = attributes[:'method']
|
|
105
|
+
else
|
|
106
|
+
self.method = nil
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'path')
|
|
110
|
+
self.path = attributes[:'path']
|
|
111
|
+
else
|
|
112
|
+
self.path = nil
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'body')
|
|
116
|
+
if (value = attributes[:'body']).is_a?(Hash)
|
|
117
|
+
self.body = value
|
|
118
|
+
end
|
|
119
|
+
else
|
|
120
|
+
self.body = nil
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'fill')
|
|
124
|
+
if (value = attributes[:'fill']).is_a?(Array)
|
|
125
|
+
self.fill = value
|
|
126
|
+
end
|
|
127
|
+
else
|
|
128
|
+
self.fill = nil
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
133
|
+
# @return Array for valid properties with the reasons
|
|
134
|
+
def list_invalid_properties
|
|
135
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
136
|
+
invalid_properties = Array.new
|
|
137
|
+
if @method.nil?
|
|
138
|
+
invalid_properties.push('invalid value for "method", method cannot be nil.')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if @path.nil?
|
|
142
|
+
invalid_properties.push('invalid value for "path", path cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if @body.nil?
|
|
146
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if @fill.nil?
|
|
150
|
+
invalid_properties.push('invalid value for "fill", fill cannot be nil.')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
invalid_properties
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Check to see if the all the properties in the model are valid
|
|
157
|
+
# @return true if the model is valid
|
|
158
|
+
def valid?
|
|
159
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
160
|
+
return false if @method.nil?
|
|
161
|
+
method_validator = EnumAttributeValidator.new('String', ["POST"])
|
|
162
|
+
return false unless method_validator.valid?(@method)
|
|
163
|
+
return false if @path.nil?
|
|
164
|
+
path_validator = EnumAttributeValidator.new('String', ["/api/v1/fetch"])
|
|
165
|
+
return false unless path_validator.valid?(@path)
|
|
166
|
+
return false if @body.nil?
|
|
167
|
+
return false if @fill.nil?
|
|
168
|
+
true
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
172
|
+
# @param [Object] method Object to be assigned
|
|
173
|
+
def method=(method)
|
|
174
|
+
validator = EnumAttributeValidator.new('String', ["POST"])
|
|
175
|
+
unless validator.valid?(method)
|
|
176
|
+
fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
|
|
177
|
+
end
|
|
178
|
+
@method = method
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
182
|
+
# @param [Object] path Object to be assigned
|
|
183
|
+
def path=(path)
|
|
184
|
+
validator = EnumAttributeValidator.new('String', ["/api/v1/fetch"])
|
|
185
|
+
unless validator.valid?(path)
|
|
186
|
+
fail ArgumentError, "invalid value for \"path\", must be one of #{validator.allowable_values}."
|
|
187
|
+
end
|
|
188
|
+
@path = path
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Custom attribute writer method with validation
|
|
192
|
+
# @param [Object] body Value to be assigned
|
|
193
|
+
def body=(body)
|
|
194
|
+
if body.nil?
|
|
195
|
+
fail ArgumentError, 'body cannot be nil'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
@body = body
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Custom attribute writer method with validation
|
|
202
|
+
# @param [Object] fill Value to be assigned
|
|
203
|
+
def fill=(fill)
|
|
204
|
+
if fill.nil?
|
|
205
|
+
fail ArgumentError, 'fill cannot be nil'
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
@fill = fill
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Checks equality by comparing each attribute.
|
|
212
|
+
# @param [Object] Object to be compared
|
|
213
|
+
def ==(o)
|
|
214
|
+
return true if self.equal?(o)
|
|
215
|
+
self.class == o.class &&
|
|
216
|
+
method == o.method &&
|
|
217
|
+
path == o.path &&
|
|
218
|
+
body == o.body &&
|
|
219
|
+
fill == o.fill
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# @see the `==` method
|
|
223
|
+
# @param [Object] Object to be compared
|
|
224
|
+
def eql?(o)
|
|
225
|
+
self == o
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Calculates hash code according to all attributes.
|
|
229
|
+
# @return [Integer] Hash code
|
|
230
|
+
def hash
|
|
231
|
+
[method, path, body, fill].hash
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Builds the object from hash
|
|
235
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
236
|
+
# @return [Object] Returns the model itself
|
|
237
|
+
def self.build_from_hash(attributes)
|
|
238
|
+
return nil unless attributes.is_a?(Hash)
|
|
239
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
240
|
+
transformed_hash = {}
|
|
241
|
+
openapi_types.each_pair do |key, type|
|
|
242
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
243
|
+
transformed_hash["#{key}"] = nil
|
|
244
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
245
|
+
# check to ensure the input is an array given that the attribute
|
|
246
|
+
# is documented as an array but the input is not
|
|
247
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
248
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
249
|
+
end
|
|
250
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
251
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
new(transformed_hash)
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Returns the object in the form of hash
|
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
|
259
|
+
def to_hash
|
|
260
|
+
hash = {}
|
|
261
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
262
|
+
value = self.send(attr)
|
|
263
|
+
if value.nil?
|
|
264
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
265
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
hash[param] = _to_hash(value)
|
|
269
|
+
end
|
|
270
|
+
hash
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
end
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Weft API
|
|
3
|
+
|
|
4
|
+
#The Weft API powers the `weft` CLI, the hosted MCP server (`weft.network/mcp`), and third-party applications that discover and pay for resources on Weft. The buyer runtime covers six concerns: 1. Account creation and recovery (`/api/v1/auth/*`) 2. Credential identity (`/api/v1/me`) 3. Wallet visibility (`/api/v1/balance`) 4. Discovery (`/api/v1/search`) 5. Paid execution (`/api/v1/fetch`) 6. Purchase history (`/api/v1/purchases`) Buyer runtime calls require a dashboard-created `wk_*` account key, an OAuth access token with the relevant scope, or a claimed `wbt_*` bearer on its fixed allowlist. The organization-scoped API key and payment operations in this document are seller administration surfaces and require an `ax_live_*` resource key. These credential types are not interchangeable. This document is a deliberate subset of the `/api/v1` surface, not an inventory of it. The seller-side management endpoints — `/api/v1/agents` and `/api/v1/analytics` — are reachable with an `ax_live_*` key but are intentionally left undocumented: they are dashboard-facing and not part of the published client contract. `/api/v1/webhook_endpoints` stays routed and returns HTTP 410 with error code `gone` for index, show, create, update, and destroy. Nothing outside this document is a supported contract, and the response-validation gate in `config/environments/test.rb` enforces only what is declared here. Before claim, a `wbt_*` bearer is temporary and permits only search plus its own status/cancel operations for 30 minutes. Human approval binds it to the User and promotes the same secret to durable identity, search, balance, fetch, purchase-history, status, and revocation capabilities. It remains valid until revoked. Seller, organization, API-key administration, dashboard-session, transfer, withdrawal, and MCP surfaces always refuse it. Bootstrap lifecycle successes follow the API-standard `{ \"data\": ... }` envelope. 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.32.5
|
|
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
|
+
# One row of the compact agent view: the minimum contract for the next paid call, below 2,000 JSON bytes. It is the hosted MCP `weft_search` projection with REST references: `contract_url` replaces the MCP `weft_contract` call, and `next_call` is a `POST /api/v1/fetch` request instead of an MCP `weft_fetch` call. To stay in the budget, the row drops optional fields in a fixed order (optional inputs, helper docs, the example, the description, then summaries) and `contract_detail` says what is left out. In the last resort the row keeps the operation id, readiness states, the `weft_fetch` state, `contract_url` and the search id, and can lose the input names, the request recipe and price. The full contract at `contract_url` is always complete. The search id is the envelope `query_trace_id`; each row also carries it in `attribution` or in `next_call.body`.
|
|
18
|
+
class SearchCompactResult < ApiModelBase
|
|
19
|
+
attr_accessor :provider
|
|
20
|
+
|
|
21
|
+
attr_accessor :operation
|
|
22
|
+
|
|
23
|
+
# Typed business inputs (a bounded JSON schema), or the names and locations of the required inputs when the full schema does not fit. Read the full contract before you send an input not listed.
|
|
24
|
+
attr_accessor :inputs
|
|
25
|
+
|
|
26
|
+
# The request recipe: `method`, canonical `url`, and, when known, the path, query, header and JSON body bindings of each input.
|
|
27
|
+
attr_accessor :request
|
|
28
|
+
|
|
29
|
+
attr_accessor :example
|
|
30
|
+
|
|
31
|
+
attr_accessor :access
|
|
32
|
+
|
|
33
|
+
attr_accessor :attribution
|
|
34
|
+
|
|
35
|
+
# Media type, execution mode, a bounded output summary and, for async work, the poll workflow.
|
|
36
|
+
attr_accessor :output
|
|
37
|
+
|
|
38
|
+
attr_accessor :docs
|
|
39
|
+
|
|
40
|
+
# Content-addressed full Weft contract. GET it with your Weft credential (a buyer account key, an OAuth token with the `search` scope, or a claimed `wbt_*` bootstrap bearer) before you build a request the summary does not fully describe. A pending bootstrap bearer gets `401` until a human approves the account.
|
|
41
|
+
attr_accessor :contract_url
|
|
42
|
+
|
|
43
|
+
# What this summary leaves out of the full contract.
|
|
44
|
+
attr_accessor :contract_detail
|
|
45
|
+
|
|
46
|
+
# Completion guidance when the completion rules did not fit inline.
|
|
47
|
+
attr_accessor :completion
|
|
48
|
+
|
|
49
|
+
attr_accessor :blocked_scopes
|
|
50
|
+
|
|
51
|
+
# Contract fields that the review did not complete.
|
|
52
|
+
attr_accessor :contract_gaps
|
|
53
|
+
|
|
54
|
+
# Independent readiness claims (`research`, `contract`, `runtime`, `paid_terminal`), each with a `state` and, when it fits, a `scope`.
|
|
55
|
+
attr_accessor :readiness
|
|
56
|
+
|
|
57
|
+
attr_accessor :next_call
|
|
58
|
+
|
|
59
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
60
|
+
def self.attribute_map
|
|
61
|
+
{
|
|
62
|
+
:'provider' => :'provider',
|
|
63
|
+
:'operation' => :'operation',
|
|
64
|
+
:'inputs' => :'inputs',
|
|
65
|
+
:'request' => :'request',
|
|
66
|
+
:'example' => :'example',
|
|
67
|
+
:'access' => :'access',
|
|
68
|
+
:'attribution' => :'attribution',
|
|
69
|
+
:'output' => :'output',
|
|
70
|
+
:'docs' => :'docs',
|
|
71
|
+
:'contract_url' => :'contract_url',
|
|
72
|
+
:'contract_detail' => :'contract_detail',
|
|
73
|
+
:'completion' => :'completion',
|
|
74
|
+
:'blocked_scopes' => :'blocked_scopes',
|
|
75
|
+
:'contract_gaps' => :'contract_gaps',
|
|
76
|
+
:'readiness' => :'readiness',
|
|
77
|
+
:'next_call' => :'next_call'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Returns attribute mapping this model knows about
|
|
82
|
+
def self.acceptable_attribute_map
|
|
83
|
+
attribute_map
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Returns all the JSON keys this model knows about
|
|
87
|
+
def self.acceptable_attributes
|
|
88
|
+
acceptable_attribute_map.values
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Attribute type mapping.
|
|
92
|
+
def self.openapi_types
|
|
93
|
+
{
|
|
94
|
+
:'provider' => :'SearchCompactResultProvider',
|
|
95
|
+
:'operation' => :'SearchCompactResultOperation',
|
|
96
|
+
:'inputs' => :'Hash<String, Object>',
|
|
97
|
+
:'request' => :'Hash<String, Object>',
|
|
98
|
+
:'example' => :'Object',
|
|
99
|
+
:'access' => :'SearchCompactAccess',
|
|
100
|
+
:'attribution' => :'SearchCompactResultAttribution',
|
|
101
|
+
:'output' => :'Hash<String, Object>',
|
|
102
|
+
:'docs' => :'SearchHelperDocs',
|
|
103
|
+
:'contract_url' => :'String',
|
|
104
|
+
:'contract_detail' => :'String',
|
|
105
|
+
:'completion' => :'String',
|
|
106
|
+
:'blocked_scopes' => :'Array<SearchCompactResultBlockedScopesInner>',
|
|
107
|
+
:'contract_gaps' => :'Array<String>',
|
|
108
|
+
:'readiness' => :'Hash<String, SearchCompactResultBlockedScopesInner>',
|
|
109
|
+
:'next_call' => :'SearchCompactNextCall'
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# List of attributes with nullable: true
|
|
114
|
+
def self.openapi_nullable
|
|
115
|
+
Set.new([
|
|
116
|
+
:'example',
|
|
117
|
+
])
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Initializes the object
|
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
122
|
+
def initialize(attributes = {})
|
|
123
|
+
if (!attributes.is_a?(Hash))
|
|
124
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchCompactResult` initialize method"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
128
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
129
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
130
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
131
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchCompactResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
132
|
+
end
|
|
133
|
+
h[k.to_sym] = v
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'provider')
|
|
137
|
+
self.provider = attributes[:'provider']
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'operation')
|
|
141
|
+
self.operation = attributes[:'operation']
|
|
142
|
+
else
|
|
143
|
+
self.operation = nil
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'inputs')
|
|
147
|
+
if (value = attributes[:'inputs']).is_a?(Hash)
|
|
148
|
+
self.inputs = value
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if attributes.key?(:'request')
|
|
153
|
+
if (value = attributes[:'request']).is_a?(Hash)
|
|
154
|
+
self.request = value
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'example')
|
|
159
|
+
self.example = attributes[:'example']
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'access')
|
|
163
|
+
self.access = attributes[:'access']
|
|
164
|
+
else
|
|
165
|
+
self.access = nil
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if attributes.key?(:'attribution')
|
|
169
|
+
self.attribution = attributes[:'attribution']
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'output')
|
|
173
|
+
if (value = attributes[:'output']).is_a?(Hash)
|
|
174
|
+
self.output = value
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
if attributes.key?(:'docs')
|
|
179
|
+
self.docs = attributes[:'docs']
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if attributes.key?(:'contract_url')
|
|
183
|
+
self.contract_url = attributes[:'contract_url']
|
|
184
|
+
else
|
|
185
|
+
self.contract_url = nil
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
if attributes.key?(:'contract_detail')
|
|
189
|
+
self.contract_detail = attributes[:'contract_detail']
|
|
190
|
+
else
|
|
191
|
+
self.contract_detail = nil
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
if attributes.key?(:'completion')
|
|
195
|
+
self.completion = attributes[:'completion']
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if attributes.key?(:'blocked_scopes')
|
|
199
|
+
if (value = attributes[:'blocked_scopes']).is_a?(Array)
|
|
200
|
+
self.blocked_scopes = value
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
if attributes.key?(:'contract_gaps')
|
|
205
|
+
if (value = attributes[:'contract_gaps']).is_a?(Array)
|
|
206
|
+
self.contract_gaps = value
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
if attributes.key?(:'readiness')
|
|
211
|
+
if (value = attributes[:'readiness']).is_a?(Hash)
|
|
212
|
+
self.readiness = value
|
|
213
|
+
end
|
|
214
|
+
else
|
|
215
|
+
self.readiness = nil
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
if attributes.key?(:'next_call')
|
|
219
|
+
self.next_call = attributes[:'next_call']
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
224
|
+
# @return Array for valid properties with the reasons
|
|
225
|
+
def list_invalid_properties
|
|
226
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
227
|
+
invalid_properties = Array.new
|
|
228
|
+
if @operation.nil?
|
|
229
|
+
invalid_properties.push('invalid value for "operation", operation cannot be nil.')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
if @access.nil?
|
|
233
|
+
invalid_properties.push('invalid value for "access", access cannot be nil.')
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
if @contract_url.nil?
|
|
237
|
+
invalid_properties.push('invalid value for "contract_url", contract_url cannot be nil.')
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
if @contract_detail.nil?
|
|
241
|
+
invalid_properties.push('invalid value for "contract_detail", contract_detail cannot be nil.')
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
if @readiness.nil?
|
|
245
|
+
invalid_properties.push('invalid value for "readiness", readiness cannot be nil.')
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
invalid_properties
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Check to see if the all the properties in the model are valid
|
|
252
|
+
# @return true if the model is valid
|
|
253
|
+
def valid?
|
|
254
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
255
|
+
return false if @operation.nil?
|
|
256
|
+
return false if @access.nil?
|
|
257
|
+
return false if @contract_url.nil?
|
|
258
|
+
return false if @contract_detail.nil?
|
|
259
|
+
return false if @readiness.nil?
|
|
260
|
+
true
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
# Custom attribute writer method with validation
|
|
264
|
+
# @param [Object] operation Value to be assigned
|
|
265
|
+
def operation=(operation)
|
|
266
|
+
if operation.nil?
|
|
267
|
+
fail ArgumentError, 'operation cannot be nil'
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
@operation = operation
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Custom attribute writer method with validation
|
|
274
|
+
# @param [Object] access Value to be assigned
|
|
275
|
+
def access=(access)
|
|
276
|
+
if access.nil?
|
|
277
|
+
fail ArgumentError, 'access cannot be nil'
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
@access = access
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# Custom attribute writer method with validation
|
|
284
|
+
# @param [Object] contract_url Value to be assigned
|
|
285
|
+
def contract_url=(contract_url)
|
|
286
|
+
if contract_url.nil?
|
|
287
|
+
fail ArgumentError, 'contract_url cannot be nil'
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
@contract_url = contract_url
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Custom attribute writer method with validation
|
|
294
|
+
# @param [Object] contract_detail Value to be assigned
|
|
295
|
+
def contract_detail=(contract_detail)
|
|
296
|
+
if contract_detail.nil?
|
|
297
|
+
fail ArgumentError, 'contract_detail cannot be nil'
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
@contract_detail = contract_detail
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Custom attribute writer method with validation
|
|
304
|
+
# @param [Object] readiness Value to be assigned
|
|
305
|
+
def readiness=(readiness)
|
|
306
|
+
if readiness.nil?
|
|
307
|
+
fail ArgumentError, 'readiness cannot be nil'
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
@readiness = readiness
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# Checks equality by comparing each attribute.
|
|
314
|
+
# @param [Object] Object to be compared
|
|
315
|
+
def ==(o)
|
|
316
|
+
return true if self.equal?(o)
|
|
317
|
+
self.class == o.class &&
|
|
318
|
+
provider == o.provider &&
|
|
319
|
+
operation == o.operation &&
|
|
320
|
+
inputs == o.inputs &&
|
|
321
|
+
request == o.request &&
|
|
322
|
+
example == o.example &&
|
|
323
|
+
access == o.access &&
|
|
324
|
+
attribution == o.attribution &&
|
|
325
|
+
output == o.output &&
|
|
326
|
+
docs == o.docs &&
|
|
327
|
+
contract_url == o.contract_url &&
|
|
328
|
+
contract_detail == o.contract_detail &&
|
|
329
|
+
completion == o.completion &&
|
|
330
|
+
blocked_scopes == o.blocked_scopes &&
|
|
331
|
+
contract_gaps == o.contract_gaps &&
|
|
332
|
+
readiness == o.readiness &&
|
|
333
|
+
next_call == o.next_call
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# @see the `==` method
|
|
337
|
+
# @param [Object] Object to be compared
|
|
338
|
+
def eql?(o)
|
|
339
|
+
self == o
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Calculates hash code according to all attributes.
|
|
343
|
+
# @return [Integer] Hash code
|
|
344
|
+
def hash
|
|
345
|
+
[provider, operation, inputs, request, example, access, attribution, output, docs, contract_url, contract_detail, completion, blocked_scopes, contract_gaps, readiness, next_call].hash
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Builds the object from hash
|
|
349
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
350
|
+
# @return [Object] Returns the model itself
|
|
351
|
+
def self.build_from_hash(attributes)
|
|
352
|
+
return nil unless attributes.is_a?(Hash)
|
|
353
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
354
|
+
transformed_hash = {}
|
|
355
|
+
openapi_types.each_pair do |key, type|
|
|
356
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
357
|
+
transformed_hash["#{key}"] = nil
|
|
358
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
359
|
+
# check to ensure the input is an array given that the attribute
|
|
360
|
+
# is documented as an array but the input is not
|
|
361
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
362
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
363
|
+
end
|
|
364
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
365
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
new(transformed_hash)
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
# Returns the object in the form of hash
|
|
372
|
+
# @return [Hash] Returns the object in the form of hash
|
|
373
|
+
def to_hash
|
|
374
|
+
hash = {}
|
|
375
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
376
|
+
value = self.send(attr)
|
|
377
|
+
if value.nil?
|
|
378
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
379
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
hash[param] = _to_hash(value)
|
|
383
|
+
end
|
|
384
|
+
hash
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
end
|