weft-sdk 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/APIKeysApi.md +1 -2
- data/docs/AccountApi.md +6 -5
- data/docs/AccountDetails.md +2 -1
- data/docs/ApiKey.md +0 -1
- data/docs/ApiKeyCreated.md +0 -1
- data/docs/ApiKeyCreatedResponse.md +0 -1
- data/docs/ApiKeyListResponse.md +0 -1
- data/docs/AuthApi.md +6 -7
- data/docs/AuthResponse.md +0 -1
- data/docs/AuthResponseData.md +0 -1
- data/docs/BalanceApi.md +1 -2
- data/docs/BalanceResponse.md +3 -4
- data/docs/ConfirmRequest.md +0 -1
- data/docs/CreateApiKeyRequest.md +0 -1
- data/docs/DefaultApi.md +0 -1
- data/docs/EnrolledResource.md +0 -1
- data/docs/Error.md +0 -1
- data/docs/ErrorResponse.md +0 -1
- data/docs/Fetch403Response.md +0 -1
- data/docs/FetchApi.md +10 -7
- data/docs/FetchBalanceSnapshot.md +2 -3
- data/docs/FetchErrorResponse.md +0 -1
- data/docs/FetchRequest.md +0 -1
- data/docs/FetchRequestBody.md +0 -1
- data/docs/FetchResponse.md +5 -2
- data/docs/InsufficientScopeResponse.md +0 -1
- data/docs/MeApiKey.md +0 -1
- data/docs/MeApiKeyCreator.md +0 -1
- data/docs/MeResponse.md +1 -2
- data/docs/MeResponseData.md +78 -0
- data/docs/Merchant.md +0 -1
- data/docs/MessageResponse.md +0 -1
- data/docs/MessageResponseData.md +0 -1
- data/docs/Pagination.md +0 -1
- data/docs/PasswordResetRequest.md +0 -1
- data/docs/PasswordUpdateRequest.md +0 -1
- data/docs/Payment.md +0 -3
- data/docs/PaymentListResponse.md +0 -1
- data/docs/PaymentResponse.md +0 -1
- data/docs/PaymentsApi.md +0 -1
- data/docs/PrincipalWallet.md +19 -0
- data/docs/PromoBalance.md +0 -1
- data/docs/Purchase.md +43 -0
- data/docs/PurchaseArtifact.md +23 -0
- data/docs/PurchaseListResponse.md +19 -0
- data/docs/PurchaseResponse.md +17 -0
- data/docs/PurchasesApi.md +148 -0
- data/docs/ResendConfirmationRequest.md +0 -1
- data/docs/ResourceEnrollmentRequest.md +0 -1
- data/docs/ResourceEnrollmentResponse.md +0 -1
- data/docs/ResourceStats.md +0 -1
- data/docs/ResourcesApi.md +2 -3
- data/docs/SearchApi.md +2 -3
- data/docs/SearchCapabilityRef.md +19 -0
- data/docs/SearchEndpointCall.md +23 -0
- data/docs/SearchEndpointHit.md +41 -0
- data/docs/SearchEndpointPrice.md +25 -0
- data/docs/SearchErrorResponse.md +0 -1
- data/docs/SearchFilterSpec.md +23 -0
- data/docs/SearchPaymentOffer.md +31 -0
- data/docs/SearchPriceAtomicFilter.md +25 -0
- data/docs/SearchPriceUsdFilter.md +25 -0
- data/docs/SearchProtocolFilter.md +19 -0
- data/docs/SearchProviderRef.md +21 -0
- data/docs/SearchRequest.md +3 -4
- data/docs/SearchResourceTypeFilter.md +19 -0
- data/docs/SearchResponse.md +35 -8
- data/docs/SearchResponseWarningsInner.md +23 -0
- data/docs/SearchResult.md +8 -21
- data/docs/SignInRequest.md +0 -1
- data/docs/SignUpRequest.md +0 -1
- data/docs/SpendingPolicy.md +0 -1
- data/docs/User.md +0 -1
- data/docs/UserPrincipal.md +33 -0
- data/docs/Wallet.md +3 -4
- data/lib/weft/generated/api/account_api.rb +6 -4
- data/lib/weft/generated/api/api_keys_api.rb +4 -4
- data/lib/weft/generated/api/auth_api.rb +14 -14
- data/lib/weft/generated/api/balance_api.rb +4 -4
- data/lib/weft/generated/api/default_api.rb +2 -2
- data/lib/weft/generated/api/fetch_api.rb +22 -6
- data/lib/weft/generated/api/payments_api.rb +2 -2
- data/lib/weft/generated/api/purchases_api.rb +150 -0
- data/lib/weft/generated/api/resources_api.rb +6 -6
- data/lib/weft/generated/api/search_api.rb +6 -6
- 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 +54 -4
- 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 +5 -5
- 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 +4 -4
- data/lib/weft/generated/models/error.rb +3 -3
- data/lib/weft/generated/models/error_response.rb +3 -3
- data/lib/weft/generated/models/fetch403_response.rb +2 -2
- data/lib/weft/generated/models/fetch_balance_snapshot.rb +5 -5
- data/lib/weft/generated/models/fetch_error_response.rb +5 -5
- data/lib/weft/generated/models/fetch_request.rb +5 -5
- data/lib/weft/generated/models/fetch_request_body.rb +2 -2
- data/lib/weft/generated/models/fetch_response.rb +83 -5
- data/lib/weft/generated/models/insufficient_scope_response.rb +3 -3
- data/lib/weft/generated/models/me_api_key.rb +2 -2
- data/lib/weft/generated/models/me_api_key_creator.rb +3 -3
- data/lib/weft/generated/models/me_response.rb +3 -3
- data/lib/weft/generated/models/me_response_data.rb +55 -0
- data/lib/weft/generated/models/merchant.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 +3 -12
- 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 +190 -0
- data/lib/weft/generated/models/promo_balance.rb +3 -3
- data/lib/weft/generated/models/purchase.rb +427 -0
- data/lib/weft/generated/models/{search_agent_card.rb → purchase_artifact.rb} +91 -82
- data/lib/weft/generated/models/purchase_list_response.rb +192 -0
- data/lib/weft/generated/models/purchase_response.rb +164 -0
- data/lib/weft/generated/models/resend_confirmation_request.rb +2 -2
- data/lib/weft/generated/models/resource_enrollment_request.rb +5 -5
- 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_skill_endpoint.rb → search_capability_ref.rb} +18 -19
- data/lib/weft/generated/models/search_endpoint_call.rb +179 -0
- data/lib/weft/generated/models/search_endpoint_hit.rb +296 -0
- data/lib/weft/generated/models/{search_skill.rb → search_endpoint_price.rb} +76 -112
- data/lib/weft/generated/models/search_error_response.rb +5 -5
- data/lib/weft/generated/models/search_filter_spec.rb +175 -0
- data/lib/weft/generated/models/{search_pricing.rb → search_payment_offer.rb} +64 -67
- data/lib/weft/generated/models/search_price_atomic_filter.rb +284 -0
- data/lib/weft/generated/models/search_price_usd_filter.rb +294 -0
- data/lib/weft/generated/models/search_protocol_filter.rb +200 -0
- data/lib/weft/generated/models/{search_endpoints.rb → search_provider_ref.rb} +26 -36
- data/lib/weft/generated/models/search_request.rb +36 -27
- data/lib/weft/generated/models/search_resource_type_filter.rb +200 -0
- data/lib/weft/generated/models/search_response.rb +367 -31
- data/lib/weft/generated/models/search_response_warnings_inner.rb +210 -0
- data/lib/weft/generated/models/search_result.rb +68 -220
- 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 +370 -0
- data/lib/weft/generated/models/wallet.rb +5 -5
- data/lib/weft/generated/version.rb +3 -3
- data/lib/weft/generated.rb +10 -4
- data/lib/weft/sdk.rb +1 -1
- metadata +57 -19
- data/docs/SearchAgentCard.md +0 -34
- data/docs/SearchEndpoints.md +0 -24
- data/docs/SearchFilters.md +0 -26
- data/docs/SearchPricing.md +0 -24
- data/docs/SearchRanking.md +0 -26
- data/docs/SearchResponseResultsInner.md +0 -36
- data/docs/SearchSkill.md +0 -36
- data/docs/SearchSkillEndpoint.md +0 -20
- data/lib/weft/generated/models/search_filters.rb +0 -277
- data/lib/weft/generated/models/search_ranking.rb +0 -277
- data/lib/weft/generated/models/search_response_results_inner.rb +0 -103
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Weft API
|
|
3
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/
|
|
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/purchases`) 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.9.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.19.0
|
|
@@ -14,42 +14,53 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Weft
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
attr_accessor :
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
attr_accessor :
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
# Price + provenance + freshness for this (endpoint × capability) pairing. Always present; an unpriced endpoint carries null amounts rather than an absent block, so a caller never has to distinguish \"free\" from \"we do not know\".
|
|
18
|
+
class SearchEndpointPrice < ApiModelBase
|
|
19
|
+
# The indexed price in USD as a decimal string (e.g. \"0.008\") — the dollar value people and agents reason in. A decimal string, never a float; trailing zeros trimmed. Null when unpriced.
|
|
20
|
+
attr_accessor :indexed_usd
|
|
21
|
+
|
|
22
|
+
# The same price in integer micro-USD — the settlement grain, exact. Null exactly when `indexed_usd` is. Use this for settlement.
|
|
23
|
+
attr_accessor :atomic
|
|
24
|
+
|
|
25
|
+
# Where the amount came from. `probe` = observed live in the endpoint's own 402 payment-required challenge — an observation, the strongest evidence we hold. `inferred` = derived from a spec (OpenAPI) or a resale edge by the extraction pipeline, so it can lag a provider's re-pricing. Null when the endpoint carries no price.
|
|
26
|
+
attr_accessor :source
|
|
27
|
+
|
|
28
|
+
# When the amount was observed. Null when unrecorded.
|
|
29
|
+
attr_accessor :last_observed_at
|
|
30
|
+
|
|
31
|
+
# Whether this amount was confirmed against a live 402 challenge for THIS response. Search does not issue a payment-required probe at query time, so this is `false` today — treat an unflagged price as indexed, not verified.
|
|
32
|
+
attr_accessor :live_verified
|
|
33
|
+
|
|
34
|
+
class EnumAttributeValidator
|
|
35
|
+
attr_reader :datatype
|
|
36
|
+
attr_reader :allowable_values
|
|
37
|
+
|
|
38
|
+
def initialize(datatype, allowable_values)
|
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
|
40
|
+
case datatype.to_s
|
|
41
|
+
when /Integer/i
|
|
42
|
+
value.to_i
|
|
43
|
+
when /Float/i
|
|
44
|
+
value.to_f
|
|
45
|
+
else
|
|
46
|
+
value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
36
50
|
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
def valid?(value)
|
|
52
|
+
!value || allowable_values.include?(value)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
39
55
|
|
|
40
56
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
57
|
def self.attribute_map
|
|
42
58
|
{
|
|
43
|
-
:'
|
|
44
|
-
:'
|
|
45
|
-
:'
|
|
46
|
-
:'
|
|
47
|
-
:'
|
|
48
|
-
:'input_modes' => :'inputModes',
|
|
49
|
-
:'output_modes' => :'outputModes',
|
|
50
|
-
:'streaming' => :'streaming',
|
|
51
|
-
:'endpoint' => :'endpoint',
|
|
52
|
-
:'price_usd' => :'price_usd'
|
|
59
|
+
:'indexed_usd' => :'indexed_usd',
|
|
60
|
+
:'atomic' => :'atomic',
|
|
61
|
+
:'source' => :'source',
|
|
62
|
+
:'last_observed_at' => :'last_observed_at',
|
|
63
|
+
:'live_verified' => :'live_verified'
|
|
53
64
|
}
|
|
54
65
|
end
|
|
55
66
|
|
|
@@ -66,16 +77,11 @@ module Weft
|
|
|
66
77
|
# Attribute type mapping.
|
|
67
78
|
def self.openapi_types
|
|
68
79
|
{
|
|
69
|
-
:'
|
|
70
|
-
:'
|
|
71
|
-
:'
|
|
72
|
-
:'
|
|
73
|
-
:'
|
|
74
|
-
:'input_modes' => :'Array<String>',
|
|
75
|
-
:'output_modes' => :'Array<String>',
|
|
76
|
-
:'streaming' => :'Boolean',
|
|
77
|
-
:'endpoint' => :'SearchSkillEndpoint',
|
|
78
|
-
:'price_usd' => :'String'
|
|
80
|
+
:'indexed_usd' => :'String',
|
|
81
|
+
:'atomic' => :'Integer',
|
|
82
|
+
:'source' => :'String',
|
|
83
|
+
:'last_observed_at' => :'Time',
|
|
84
|
+
:'live_verified' => :'Boolean'
|
|
79
85
|
}
|
|
80
86
|
end
|
|
81
87
|
|
|
@@ -89,64 +95,36 @@ module Weft
|
|
|
89
95
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
90
96
|
def initialize(attributes = {})
|
|
91
97
|
if (!attributes.is_a?(Hash))
|
|
92
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::
|
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchEndpointPrice` initialize method"
|
|
93
99
|
end
|
|
94
100
|
|
|
95
101
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
96
102
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
97
103
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
98
104
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
99
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::
|
|
105
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchEndpointPrice`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
100
106
|
end
|
|
101
107
|
h[k.to_sym] = v
|
|
102
108
|
}
|
|
103
109
|
|
|
104
|
-
if attributes.key?(:'
|
|
105
|
-
self.
|
|
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
|
|
110
|
+
if attributes.key?(:'indexed_usd')
|
|
111
|
+
self.indexed_usd = attributes[:'indexed_usd']
|
|
132
112
|
end
|
|
133
113
|
|
|
134
|
-
if attributes.key?(:'
|
|
135
|
-
|
|
136
|
-
self.output_modes = value
|
|
137
|
-
end
|
|
114
|
+
if attributes.key?(:'atomic')
|
|
115
|
+
self.atomic = attributes[:'atomic']
|
|
138
116
|
end
|
|
139
117
|
|
|
140
|
-
if attributes.key?(:'
|
|
141
|
-
self.
|
|
118
|
+
if attributes.key?(:'source')
|
|
119
|
+
self.source = attributes[:'source']
|
|
142
120
|
end
|
|
143
121
|
|
|
144
|
-
if attributes.key?(:'
|
|
145
|
-
self.
|
|
122
|
+
if attributes.key?(:'last_observed_at')
|
|
123
|
+
self.last_observed_at = attributes[:'last_observed_at']
|
|
146
124
|
end
|
|
147
125
|
|
|
148
|
-
if attributes.key?(:'
|
|
149
|
-
self.
|
|
126
|
+
if attributes.key?(:'live_verified')
|
|
127
|
+
self.live_verified = attributes[:'live_verified']
|
|
150
128
|
end
|
|
151
129
|
end
|
|
152
130
|
|
|
@@ -155,11 +133,6 @@ module Weft
|
|
|
155
133
|
def list_invalid_properties
|
|
156
134
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
157
135
|
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
136
|
invalid_properties
|
|
164
137
|
end
|
|
165
138
|
|
|
@@ -167,23 +140,19 @@ module Weft
|
|
|
167
140
|
# @return true if the model is valid
|
|
168
141
|
def valid?
|
|
169
142
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
170
|
-
|
|
143
|
+
source_validator = EnumAttributeValidator.new('String', ["probe", "inferred"])
|
|
144
|
+
return false unless source_validator.valid?(@source)
|
|
171
145
|
true
|
|
172
146
|
end
|
|
173
147
|
|
|
174
|
-
# Custom attribute writer method
|
|
175
|
-
# @param [Object]
|
|
176
|
-
def
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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}."
|
|
148
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
149
|
+
# @param [Object] source Object to be assigned
|
|
150
|
+
def source=(source)
|
|
151
|
+
validator = EnumAttributeValidator.new('String', ["probe", "inferred"])
|
|
152
|
+
unless validator.valid?(source)
|
|
153
|
+
fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}."
|
|
184
154
|
end
|
|
185
|
-
|
|
186
|
-
@price_usd = price_usd
|
|
155
|
+
@source = source
|
|
187
156
|
end
|
|
188
157
|
|
|
189
158
|
# Checks equality by comparing each attribute.
|
|
@@ -191,16 +160,11 @@ module Weft
|
|
|
191
160
|
def ==(o)
|
|
192
161
|
return true if self.equal?(o)
|
|
193
162
|
self.class == o.class &&
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
163
|
+
indexed_usd == o.indexed_usd &&
|
|
164
|
+
atomic == o.atomic &&
|
|
165
|
+
source == o.source &&
|
|
166
|
+
last_observed_at == o.last_observed_at &&
|
|
167
|
+
live_verified == o.live_verified
|
|
204
168
|
end
|
|
205
169
|
|
|
206
170
|
# @see the `==` method
|
|
@@ -212,7 +176,7 @@ module Weft
|
|
|
212
176
|
# Calculates hash code according to all attributes.
|
|
213
177
|
# @return [Integer] Hash code
|
|
214
178
|
def hash
|
|
215
|
-
[
|
|
179
|
+
[indexed_usd, atomic, source, last_observed_at, live_verified].hash
|
|
216
180
|
end
|
|
217
181
|
|
|
218
182
|
# Builds the object from hash
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Weft API
|
|
3
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/
|
|
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/purchases`) 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.9.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.19.0
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Weft
|
|
17
|
-
# Bespoke error envelope returned by `/api/v1/search` for `422`, `502`, and `500` responses. It differs from the standard `ErrorResponse` envelope (no nested `code`/`message`/`request_id`); SDK clients should handle both shapes for this endpoint until the controller is migrated to the standard envelope.
|
|
17
|
+
# Bespoke error envelope returned by `/api/v1/search` for `422`, `502`, and `500` responses. It differs from the standard `ErrorResponse` envelope (no nested `code`/`message`/`request_id`); SDK clients should handle both shapes for this endpoint until the controller is migrated to the standard envelope.
|
|
18
18
|
class SearchErrorResponse < ApiModelBase
|
|
19
19
|
# Stable error code.
|
|
20
20
|
attr_accessor :error
|
|
@@ -122,7 +122,7 @@ module Weft
|
|
|
122
122
|
def valid?
|
|
123
123
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
124
124
|
return false if @error.nil?
|
|
125
|
-
error_validator = EnumAttributeValidator.new('String', ["INVALID_QUERY", "SEARCH_UPSTREAM_ERROR", "SEARCH_BACKEND_MISCONFIGURED"])
|
|
125
|
+
error_validator = EnumAttributeValidator.new('String', ["INVALID_QUERY", "INVALID_MAX_RESULTS", "INVALID_FILTERS", "UNKNOWN_PARAMETER", "SEARCH_UPSTREAM_ERROR", "SEARCH_BACKEND_MISCONFIGURED"])
|
|
126
126
|
return false unless error_validator.valid?(@error)
|
|
127
127
|
true
|
|
128
128
|
end
|
|
@@ -130,7 +130,7 @@ module Weft
|
|
|
130
130
|
# Custom attribute writer method checking allowed values (enum).
|
|
131
131
|
# @param [Object] error Object to be assigned
|
|
132
132
|
def error=(error)
|
|
133
|
-
validator = EnumAttributeValidator.new('String', ["INVALID_QUERY", "SEARCH_UPSTREAM_ERROR", "SEARCH_BACKEND_MISCONFIGURED"])
|
|
133
|
+
validator = EnumAttributeValidator.new('String', ["INVALID_QUERY", "INVALID_MAX_RESULTS", "INVALID_FILTERS", "UNKNOWN_PARAMETER", "SEARCH_UPSTREAM_ERROR", "SEARCH_BACKEND_MISCONFIGURED"])
|
|
134
134
|
unless validator.valid?(error)
|
|
135
135
|
fail ArgumentError, "invalid value for \"error\", must be one of #{validator.allowable_values}."
|
|
136
136
|
end
|
|
@@ -0,0 +1,175 @@
|
|
|
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/purchases`) 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.9.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
|
+
# Structured hard constraints on the query — the weft-search-platform `FilterSpec` v1 typed subset, vendored verbatim (D1 contract). Every field is optional; an empty object is the no-filter query. Set fields are ANDed. Each sub-filter takes exactly one operator; unknown filter keys and unknown operators are rejected (`422 INVALID_FILTERS`). `price` (USD decimal strings) and `price_atomic` (integer micro-USD) are two representations of ONE price constraint — the reasoning form and the settlement form. They are MUTUALLY EXCLUSIVE: setting both is `422 INVALID_FILTERS`. A JSON number in `price` is rejected (only decimal strings), so `{lte: 5}` can never be mis-read as 5 micro-dollars. The canonical enum value sets are pinned to the platform spec by the CI drift gate (`docs/contracts/search-platform.openapi.yaml`).
|
|
18
|
+
class SearchFilterSpec < ApiModelBase
|
|
19
|
+
attr_accessor :price
|
|
20
|
+
|
|
21
|
+
attr_accessor :price_atomic
|
|
22
|
+
|
|
23
|
+
attr_accessor :type
|
|
24
|
+
|
|
25
|
+
attr_accessor :protocol
|
|
26
|
+
|
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
|
+
def self.attribute_map
|
|
29
|
+
{
|
|
30
|
+
:'price' => :'price',
|
|
31
|
+
:'price_atomic' => :'price_atomic',
|
|
32
|
+
:'type' => :'type',
|
|
33
|
+
:'protocol' => :'protocol'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns attribute mapping this model knows about
|
|
38
|
+
def self.acceptable_attribute_map
|
|
39
|
+
attribute_map
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Returns all the JSON keys this model knows about
|
|
43
|
+
def self.acceptable_attributes
|
|
44
|
+
acceptable_attribute_map.values
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute type mapping.
|
|
48
|
+
def self.openapi_types
|
|
49
|
+
{
|
|
50
|
+
:'price' => :'SearchPriceUsdFilter',
|
|
51
|
+
:'price_atomic' => :'SearchPriceAtomicFilter',
|
|
52
|
+
:'type' => :'SearchResourceTypeFilter',
|
|
53
|
+
:'protocol' => :'SearchProtocolFilter'
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# List of attributes with nullable: true
|
|
58
|
+
def self.openapi_nullable
|
|
59
|
+
Set.new([
|
|
60
|
+
])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Initializes the object
|
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
65
|
+
def initialize(attributes = {})
|
|
66
|
+
if (!attributes.is_a?(Hash))
|
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchFilterSpec` initialize method"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
71
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
72
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
73
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
74
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchFilterSpec`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
75
|
+
end
|
|
76
|
+
h[k.to_sym] = v
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if attributes.key?(:'price')
|
|
80
|
+
self.price = attributes[:'price']
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:'price_atomic')
|
|
84
|
+
self.price_atomic = attributes[:'price_atomic']
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
if attributes.key?(:'type')
|
|
88
|
+
self.type = attributes[:'type']
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'protocol')
|
|
92
|
+
self.protocol = attributes[:'protocol']
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
97
|
+
# @return Array for valid properties with the reasons
|
|
98
|
+
def list_invalid_properties
|
|
99
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
100
|
+
invalid_properties = Array.new
|
|
101
|
+
invalid_properties
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Check to see if the all the properties in the model are valid
|
|
105
|
+
# @return true if the model is valid
|
|
106
|
+
def valid?
|
|
107
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
108
|
+
true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Checks equality by comparing each attribute.
|
|
112
|
+
# @param [Object] Object to be compared
|
|
113
|
+
def ==(o)
|
|
114
|
+
return true if self.equal?(o)
|
|
115
|
+
self.class == o.class &&
|
|
116
|
+
price == o.price &&
|
|
117
|
+
price_atomic == o.price_atomic &&
|
|
118
|
+
type == o.type &&
|
|
119
|
+
protocol == o.protocol
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# @see the `==` method
|
|
123
|
+
# @param [Object] Object to be compared
|
|
124
|
+
def eql?(o)
|
|
125
|
+
self == o
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Calculates hash code according to all attributes.
|
|
129
|
+
# @return [Integer] Hash code
|
|
130
|
+
def hash
|
|
131
|
+
[price, price_atomic, type, protocol].hash
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Builds the object from hash
|
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
136
|
+
# @return [Object] Returns the model itself
|
|
137
|
+
def self.build_from_hash(attributes)
|
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
|
139
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
140
|
+
transformed_hash = {}
|
|
141
|
+
openapi_types.each_pair do |key, type|
|
|
142
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
143
|
+
transformed_hash["#{key}"] = nil
|
|
144
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
145
|
+
# check to ensure the input is an array given that the attribute
|
|
146
|
+
# is documented as an array but the input is not
|
|
147
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
148
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
149
|
+
end
|
|
150
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
151
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
new(transformed_hash)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Returns the object in the form of hash
|
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
|
159
|
+
def to_hash
|
|
160
|
+
hash = {}
|
|
161
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
162
|
+
value = self.send(attr)
|
|
163
|
+
if value.nil?
|
|
164
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
165
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
hash[param] = _to_hash(value)
|
|
169
|
+
end
|
|
170
|
+
hash
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
end
|