weft-sdk 0.6.2 → 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 +10 -13
- 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 +43 -0
- data/docs/Error.md +0 -1
- data/docs/ErrorResponse.md +0 -1
- data/docs/Fetch403Response.md +48 -0
- data/docs/FetchApi.md +10 -7
- data/docs/FetchBalanceSnapshot.md +5 -2
- data/docs/FetchErrorResponse.md +0 -1
- data/docs/FetchRequest.md +0 -1
- data/docs/FetchRequestBody.md +0 -1
- data/docs/FetchResponse.md +6 -3
- data/docs/InsufficientScopeResponse.md +21 -0
- data/docs/MeApiKey.md +25 -0
- data/docs/MeApiKeyCreator.md +21 -0
- 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 +23 -0
- data/docs/ResourceEnrollmentResponse.md +17 -0
- data/docs/ResourceStats.md +29 -0
- data/docs/ResourcesApi.md +71 -0
- 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 +5 -2
- 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 +90 -0
- 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 +94 -85
- 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 +474 -0
- 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 +104 -0
- data/lib/weft/generated/models/fetch_balance_snapshot.rb +59 -4
- 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 +85 -7
- data/lib/weft/generated/models/insufficient_scope_response.rb +242 -0
- data/lib/weft/generated/models/{search_skill.rb → me_api_key.rb} +50 -92
- data/lib/weft/generated/models/me_api_key_creator.rb +200 -0
- 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/purchase_artifact.rb +237 -0
- 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/{search_agent_card.rb → resource_enrollment_request.rb} +59 -75
- data/lib/weft/generated/models/resource_enrollment_response.rb +164 -0
- data/lib/weft/generated/models/resource_stats.rb +323 -0
- 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_endpoint_price.rb +223 -0
- 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 +366 -30
- 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 +58 -4
- data/lib/weft/generated/version.rb +3 -3
- data/lib/weft/generated.rb +10 -4
- data/lib/weft/sdk.rb +1 -1
- metadata +75 -17
- 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/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
|
@@ -0,0 +1,200 @@
|
|
|
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
|
+
# Payment-protocol constraint. Set exactly one of `eq` / `in`.
|
|
18
|
+
class SearchProtocolFilter < ApiModelBase
|
|
19
|
+
# Primary protocol is exactly this value.
|
|
20
|
+
attr_accessor :eq
|
|
21
|
+
|
|
22
|
+
# Primary protocol is one of these values.
|
|
23
|
+
attr_accessor :_in
|
|
24
|
+
|
|
25
|
+
class EnumAttributeValidator
|
|
26
|
+
attr_reader :datatype
|
|
27
|
+
attr_reader :allowable_values
|
|
28
|
+
|
|
29
|
+
def initialize(datatype, allowable_values)
|
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
|
31
|
+
case datatype.to_s
|
|
32
|
+
when /Integer/i
|
|
33
|
+
value.to_i
|
|
34
|
+
when /Float/i
|
|
35
|
+
value.to_f
|
|
36
|
+
else
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def valid?(value)
|
|
43
|
+
!value || allowable_values.include?(value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
|
+
def self.attribute_map
|
|
49
|
+
{
|
|
50
|
+
:'eq' => :'eq',
|
|
51
|
+
:'_in' => :'in'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns attribute mapping this model knows about
|
|
56
|
+
def self.acceptable_attribute_map
|
|
57
|
+
attribute_map
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns all the JSON keys this model knows about
|
|
61
|
+
def self.acceptable_attributes
|
|
62
|
+
acceptable_attribute_map.values
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute type mapping.
|
|
66
|
+
def self.openapi_types
|
|
67
|
+
{
|
|
68
|
+
:'eq' => :'String',
|
|
69
|
+
:'_in' => :'Array<String>'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List of attributes with nullable: true
|
|
74
|
+
def self.openapi_nullable
|
|
75
|
+
Set.new([
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchProtocolFilter` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchProtocolFilter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'eq')
|
|
96
|
+
self.eq = attributes[:'eq']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'_in')
|
|
100
|
+
if (value = attributes[:'_in']).is_a?(Array)
|
|
101
|
+
self._in = value
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
107
|
+
# @return Array for valid properties with the reasons
|
|
108
|
+
def list_invalid_properties
|
|
109
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
110
|
+
invalid_properties = Array.new
|
|
111
|
+
if !@_in.nil? && @_in.length < 1
|
|
112
|
+
invalid_properties.push('invalid value for "_in", number of items must be greater than or equal to 1.')
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
invalid_properties
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Check to see if the all the properties in the model are valid
|
|
119
|
+
# @return true if the model is valid
|
|
120
|
+
def valid?
|
|
121
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
122
|
+
eq_validator = EnumAttributeValidator.new('String', ["x402", "a2a", "mpp", "erc_8004"])
|
|
123
|
+
return false unless eq_validator.valid?(@eq)
|
|
124
|
+
return false if !@_in.nil? && @_in.length < 1
|
|
125
|
+
true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
129
|
+
# @param [Object] eq Object to be assigned
|
|
130
|
+
def eq=(eq)
|
|
131
|
+
validator = EnumAttributeValidator.new('String', ["x402", "a2a", "mpp", "erc_8004"])
|
|
132
|
+
unless validator.valid?(eq)
|
|
133
|
+
fail ArgumentError, "invalid value for \"eq\", must be one of #{validator.allowable_values}."
|
|
134
|
+
end
|
|
135
|
+
@eq = eq
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Checks equality by comparing each attribute.
|
|
139
|
+
# @param [Object] Object to be compared
|
|
140
|
+
def ==(o)
|
|
141
|
+
return true if self.equal?(o)
|
|
142
|
+
self.class == o.class &&
|
|
143
|
+
eq == o.eq &&
|
|
144
|
+
_in == o._in
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# @see the `==` method
|
|
148
|
+
# @param [Object] Object to be compared
|
|
149
|
+
def eql?(o)
|
|
150
|
+
self == o
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Calculates hash code according to all attributes.
|
|
154
|
+
# @return [Integer] Hash code
|
|
155
|
+
def hash
|
|
156
|
+
[eq, _in].hash
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Builds the object from hash
|
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
161
|
+
# @return [Object] Returns the model itself
|
|
162
|
+
def self.build_from_hash(attributes)
|
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
|
164
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
165
|
+
transformed_hash = {}
|
|
166
|
+
openapi_types.each_pair do |key, type|
|
|
167
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
168
|
+
transformed_hash["#{key}"] = nil
|
|
169
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
170
|
+
# check to ensure the input is an array given that the attribute
|
|
171
|
+
# is documented as an array but the input is not
|
|
172
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
173
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
174
|
+
end
|
|
175
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
176
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
new(transformed_hash)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Returns the object in the form of hash
|
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
|
184
|
+
def to_hash
|
|
185
|
+
hash = {}
|
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
187
|
+
value = self.send(attr)
|
|
188
|
+
if value.nil?
|
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
hash[param] = _to_hash(value)
|
|
194
|
+
end
|
|
195
|
+
hash
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
end
|
|
@@ -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,25 +14,19 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Weft
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
attr_accessor :a2a
|
|
17
|
+
class SearchProviderRef < ApiModelBase
|
|
18
|
+
attr_accessor :provider_id
|
|
20
19
|
|
|
21
|
-
attr_accessor :
|
|
20
|
+
attr_accessor :display_name
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
attr_accessor :openapi
|
|
25
|
-
|
|
26
|
-
# Base URL the `weft_fetch` MCP tool should target for this agent.
|
|
27
|
-
attr_accessor :weft_fetch_target
|
|
22
|
+
attr_accessor :origin_domains
|
|
28
23
|
|
|
29
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
30
25
|
def self.attribute_map
|
|
31
26
|
{
|
|
32
|
-
:'
|
|
33
|
-
:'
|
|
34
|
-
:'
|
|
35
|
-
:'weft_fetch_target' => :'weft_fetch_target'
|
|
27
|
+
:'provider_id' => :'provider_id',
|
|
28
|
+
:'display_name' => :'display_name',
|
|
29
|
+
:'origin_domains' => :'origin_domains'
|
|
36
30
|
}
|
|
37
31
|
end
|
|
38
32
|
|
|
@@ -49,10 +43,9 @@ module Weft
|
|
|
49
43
|
# Attribute type mapping.
|
|
50
44
|
def self.openapi_types
|
|
51
45
|
{
|
|
52
|
-
:'
|
|
53
|
-
:'
|
|
54
|
-
:'
|
|
55
|
-
:'weft_fetch_target' => :'String'
|
|
46
|
+
:'provider_id' => :'String',
|
|
47
|
+
:'display_name' => :'String',
|
|
48
|
+
:'origin_domains' => :'Array<String>'
|
|
56
49
|
}
|
|
57
50
|
end
|
|
58
51
|
|
|
@@ -66,32 +59,30 @@ module Weft
|
|
|
66
59
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
67
60
|
def initialize(attributes = {})
|
|
68
61
|
if (!attributes.is_a?(Hash))
|
|
69
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::
|
|
62
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchProviderRef` initialize method"
|
|
70
63
|
end
|
|
71
64
|
|
|
72
65
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
73
66
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
74
67
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
75
68
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
76
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::
|
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchProviderRef`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
77
70
|
end
|
|
78
71
|
h[k.to_sym] = v
|
|
79
72
|
}
|
|
80
73
|
|
|
81
|
-
if attributes.key?(:'
|
|
82
|
-
self.
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
if attributes.key?(:'mcp')
|
|
86
|
-
self.mcp = attributes[:'mcp']
|
|
74
|
+
if attributes.key?(:'provider_id')
|
|
75
|
+
self.provider_id = attributes[:'provider_id']
|
|
87
76
|
end
|
|
88
77
|
|
|
89
|
-
if attributes.key?(:'
|
|
90
|
-
self.
|
|
78
|
+
if attributes.key?(:'display_name')
|
|
79
|
+
self.display_name = attributes[:'display_name']
|
|
91
80
|
end
|
|
92
81
|
|
|
93
|
-
if attributes.key?(:'
|
|
94
|
-
|
|
82
|
+
if attributes.key?(:'origin_domains')
|
|
83
|
+
if (value = attributes[:'origin_domains']).is_a?(Array)
|
|
84
|
+
self.origin_domains = value
|
|
85
|
+
end
|
|
95
86
|
end
|
|
96
87
|
end
|
|
97
88
|
|
|
@@ -115,10 +106,9 @@ module Weft
|
|
|
115
106
|
def ==(o)
|
|
116
107
|
return true if self.equal?(o)
|
|
117
108
|
self.class == o.class &&
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
weft_fetch_target == o.weft_fetch_target
|
|
109
|
+
provider_id == o.provider_id &&
|
|
110
|
+
display_name == o.display_name &&
|
|
111
|
+
origin_domains == o.origin_domains
|
|
122
112
|
end
|
|
123
113
|
|
|
124
114
|
# @see the `==` method
|
|
@@ -130,7 +120,7 @@ module Weft
|
|
|
130
120
|
# Calculates hash code according to all attributes.
|
|
131
121
|
# @return [Integer] Hash code
|
|
132
122
|
def hash
|
|
133
|
-
[
|
|
123
|
+
[provider_id, display_name, origin_domains].hash
|
|
134
124
|
end
|
|
135
125
|
|
|
136
126
|
# 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
|
|
@@ -18,8 +18,8 @@ module Weft
|
|
|
18
18
|
# Free-text query. Required and non-empty.
|
|
19
19
|
attr_accessor :query
|
|
20
20
|
|
|
21
|
-
# Max number of hits to return.
|
|
22
|
-
attr_accessor :
|
|
21
|
+
# Max number of hits to return. Invalid values are rejected, not clamped.
|
|
22
|
+
attr_accessor :max_results
|
|
23
23
|
|
|
24
24
|
attr_accessor :filters
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ module Weft
|
|
|
27
27
|
def self.attribute_map
|
|
28
28
|
{
|
|
29
29
|
:'query' => :'query',
|
|
30
|
-
:'
|
|
30
|
+
:'max_results' => :'max_results',
|
|
31
31
|
:'filters' => :'filters'
|
|
32
32
|
}
|
|
33
33
|
end
|
|
@@ -46,8 +46,8 @@ module Weft
|
|
|
46
46
|
def self.openapi_types
|
|
47
47
|
{
|
|
48
48
|
:'query' => :'String',
|
|
49
|
-
:'
|
|
50
|
-
:'filters' => :'
|
|
49
|
+
:'max_results' => :'Integer',
|
|
50
|
+
:'filters' => :'SearchFilterSpec'
|
|
51
51
|
}
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -79,10 +79,10 @@ module Weft
|
|
|
79
79
|
self.query = nil
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
if attributes.key?(:'
|
|
83
|
-
self.
|
|
82
|
+
if attributes.key?(:'max_results')
|
|
83
|
+
self.max_results = attributes[:'max_results']
|
|
84
84
|
else
|
|
85
|
-
self.
|
|
85
|
+
self.max_results = 10
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
if attributes.key?(:'filters')
|
|
@@ -99,16 +99,20 @@ module Weft
|
|
|
99
99
|
invalid_properties.push('invalid value for "query", query cannot be nil.')
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
+
if @query.to_s.length > 2000
|
|
103
|
+
invalid_properties.push('invalid value for "query", the character length must be smaller than or equal to 2000.')
|
|
104
|
+
end
|
|
105
|
+
|
|
102
106
|
if @query.to_s.length < 1
|
|
103
107
|
invalid_properties.push('invalid value for "query", the character length must be greater than or equal to 1.')
|
|
104
108
|
end
|
|
105
109
|
|
|
106
|
-
if !@
|
|
107
|
-
invalid_properties.push('invalid value for "
|
|
110
|
+
if !@max_results.nil? && @max_results > 50
|
|
111
|
+
invalid_properties.push('invalid value for "max_results", must be smaller than or equal to 50.')
|
|
108
112
|
end
|
|
109
113
|
|
|
110
|
-
if !@
|
|
111
|
-
invalid_properties.push('invalid value for "
|
|
114
|
+
if !@max_results.nil? && @max_results < 1
|
|
115
|
+
invalid_properties.push('invalid value for "max_results", must be greater than or equal to 1.')
|
|
112
116
|
end
|
|
113
117
|
|
|
114
118
|
invalid_properties
|
|
@@ -119,9 +123,10 @@ module Weft
|
|
|
119
123
|
def valid?
|
|
120
124
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
121
125
|
return false if @query.nil?
|
|
126
|
+
return false if @query.to_s.length > 2000
|
|
122
127
|
return false if @query.to_s.length < 1
|
|
123
|
-
return false if !@
|
|
124
|
-
return false if !@
|
|
128
|
+
return false if !@max_results.nil? && @max_results > 50
|
|
129
|
+
return false if !@max_results.nil? && @max_results < 1
|
|
125
130
|
true
|
|
126
131
|
end
|
|
127
132
|
|
|
@@ -132,6 +137,10 @@ module Weft
|
|
|
132
137
|
fail ArgumentError, 'query cannot be nil'
|
|
133
138
|
end
|
|
134
139
|
|
|
140
|
+
if query.to_s.length > 2000
|
|
141
|
+
fail ArgumentError, 'invalid value for "query", the character length must be smaller than or equal to 2000.'
|
|
142
|
+
end
|
|
143
|
+
|
|
135
144
|
if query.to_s.length < 1
|
|
136
145
|
fail ArgumentError, 'invalid value for "query", the character length must be greater than or equal to 1.'
|
|
137
146
|
end
|
|
@@ -140,21 +149,21 @@ module Weft
|
|
|
140
149
|
end
|
|
141
150
|
|
|
142
151
|
# Custom attribute writer method with validation
|
|
143
|
-
# @param [Object]
|
|
144
|
-
def
|
|
145
|
-
if
|
|
146
|
-
fail ArgumentError, '
|
|
152
|
+
# @param [Object] max_results Value to be assigned
|
|
153
|
+
def max_results=(max_results)
|
|
154
|
+
if max_results.nil?
|
|
155
|
+
fail ArgumentError, 'max_results cannot be nil'
|
|
147
156
|
end
|
|
148
157
|
|
|
149
|
-
if
|
|
150
|
-
fail ArgumentError, 'invalid value for "
|
|
158
|
+
if max_results > 50
|
|
159
|
+
fail ArgumentError, 'invalid value for "max_results", must be smaller than or equal to 50.'
|
|
151
160
|
end
|
|
152
161
|
|
|
153
|
-
if
|
|
154
|
-
fail ArgumentError, 'invalid value for "
|
|
162
|
+
if max_results < 1
|
|
163
|
+
fail ArgumentError, 'invalid value for "max_results", must be greater than or equal to 1.'
|
|
155
164
|
end
|
|
156
165
|
|
|
157
|
-
@
|
|
166
|
+
@max_results = max_results
|
|
158
167
|
end
|
|
159
168
|
|
|
160
169
|
# Checks equality by comparing each attribute.
|
|
@@ -163,7 +172,7 @@ module Weft
|
|
|
163
172
|
return true if self.equal?(o)
|
|
164
173
|
self.class == o.class &&
|
|
165
174
|
query == o.query &&
|
|
166
|
-
|
|
175
|
+
max_results == o.max_results &&
|
|
167
176
|
filters == o.filters
|
|
168
177
|
end
|
|
169
178
|
|
|
@@ -176,7 +185,7 @@ module Weft
|
|
|
176
185
|
# Calculates hash code according to all attributes.
|
|
177
186
|
# @return [Integer] Hash code
|
|
178
187
|
def hash
|
|
179
|
-
[query,
|
|
188
|
+
[query, max_results, filters].hash
|
|
180
189
|
end
|
|
181
190
|
|
|
182
191
|
# Builds the object from hash
|
|
@@ -0,0 +1,200 @@
|
|
|
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
|
+
# Resource-type constraint. Set exactly one of `eq` / `in`.
|
|
18
|
+
class SearchResourceTypeFilter < ApiModelBase
|
|
19
|
+
# Resource type is exactly this value.
|
|
20
|
+
attr_accessor :eq
|
|
21
|
+
|
|
22
|
+
# Resource type is one of these values.
|
|
23
|
+
attr_accessor :_in
|
|
24
|
+
|
|
25
|
+
class EnumAttributeValidator
|
|
26
|
+
attr_reader :datatype
|
|
27
|
+
attr_reader :allowable_values
|
|
28
|
+
|
|
29
|
+
def initialize(datatype, allowable_values)
|
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
|
31
|
+
case datatype.to_s
|
|
32
|
+
when /Integer/i
|
|
33
|
+
value.to_i
|
|
34
|
+
when /Float/i
|
|
35
|
+
value.to_f
|
|
36
|
+
else
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def valid?(value)
|
|
43
|
+
!value || allowable_values.include?(value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
|
+
def self.attribute_map
|
|
49
|
+
{
|
|
50
|
+
:'eq' => :'eq',
|
|
51
|
+
:'_in' => :'in'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns attribute mapping this model knows about
|
|
56
|
+
def self.acceptable_attribute_map
|
|
57
|
+
attribute_map
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns all the JSON keys this model knows about
|
|
61
|
+
def self.acceptable_attributes
|
|
62
|
+
acceptable_attribute_map.values
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute type mapping.
|
|
66
|
+
def self.openapi_types
|
|
67
|
+
{
|
|
68
|
+
:'eq' => :'String',
|
|
69
|
+
:'_in' => :'Array<String>'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List of attributes with nullable: true
|
|
74
|
+
def self.openapi_nullable
|
|
75
|
+
Set.new([
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchResourceTypeFilter` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchResourceTypeFilter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'eq')
|
|
96
|
+
self.eq = attributes[:'eq']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'_in')
|
|
100
|
+
if (value = attributes[:'_in']).is_a?(Array)
|
|
101
|
+
self._in = value
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
107
|
+
# @return Array for valid properties with the reasons
|
|
108
|
+
def list_invalid_properties
|
|
109
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
110
|
+
invalid_properties = Array.new
|
|
111
|
+
if !@_in.nil? && @_in.length < 1
|
|
112
|
+
invalid_properties.push('invalid value for "_in", number of items must be greater than or equal to 1.')
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
invalid_properties
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Check to see if the all the properties in the model are valid
|
|
119
|
+
# @return true if the model is valid
|
|
120
|
+
def valid?
|
|
121
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
122
|
+
eq_validator = EnumAttributeValidator.new('String', ["api", "agent", "mcp_tool", "webpage", "feed", "document", "dataset"])
|
|
123
|
+
return false unless eq_validator.valid?(@eq)
|
|
124
|
+
return false if !@_in.nil? && @_in.length < 1
|
|
125
|
+
true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
129
|
+
# @param [Object] eq Object to be assigned
|
|
130
|
+
def eq=(eq)
|
|
131
|
+
validator = EnumAttributeValidator.new('String', ["api", "agent", "mcp_tool", "webpage", "feed", "document", "dataset"])
|
|
132
|
+
unless validator.valid?(eq)
|
|
133
|
+
fail ArgumentError, "invalid value for \"eq\", must be one of #{validator.allowable_values}."
|
|
134
|
+
end
|
|
135
|
+
@eq = eq
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Checks equality by comparing each attribute.
|
|
139
|
+
# @param [Object] Object to be compared
|
|
140
|
+
def ==(o)
|
|
141
|
+
return true if self.equal?(o)
|
|
142
|
+
self.class == o.class &&
|
|
143
|
+
eq == o.eq &&
|
|
144
|
+
_in == o._in
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# @see the `==` method
|
|
148
|
+
# @param [Object] Object to be compared
|
|
149
|
+
def eql?(o)
|
|
150
|
+
self == o
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Calculates hash code according to all attributes.
|
|
154
|
+
# @return [Integer] Hash code
|
|
155
|
+
def hash
|
|
156
|
+
[eq, _in].hash
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Builds the object from hash
|
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
161
|
+
# @return [Object] Returns the model itself
|
|
162
|
+
def self.build_from_hash(attributes)
|
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
|
164
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
165
|
+
transformed_hash = {}
|
|
166
|
+
openapi_types.each_pair do |key, type|
|
|
167
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
168
|
+
transformed_hash["#{key}"] = nil
|
|
169
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
170
|
+
# check to ensure the input is an array given that the attribute
|
|
171
|
+
# is documented as an array but the input is not
|
|
172
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
173
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
174
|
+
end
|
|
175
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
176
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
new(transformed_hash)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Returns the object in the form of hash
|
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
|
184
|
+
def to_hash
|
|
185
|
+
hash = {}
|
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
187
|
+
value = self.send(attr)
|
|
188
|
+
if value.nil?
|
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
hash[param] = _to_hash(value)
|
|
194
|
+
end
|
|
195
|
+
hash
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
end
|