weft-sdk 0.7.0 → 0.9.1
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.1
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.19.0
|
|
@@ -14,47 +14,36 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Weft
|
|
17
|
-
#
|
|
18
|
-
class
|
|
17
|
+
# One settlement route the endpoint's own 402 challenge published — a (rail × network × asset × payee) tuple a caller can settle against directly with its own SDK.
|
|
18
|
+
class SearchPaymentOffer < ApiModelBase
|
|
19
|
+
# The payment rail (e.g. `x402`, `mpp`).
|
|
19
20
|
attr_accessor :protocol
|
|
20
21
|
|
|
21
22
|
attr_accessor :scheme
|
|
22
23
|
|
|
23
|
-
# Default per-call amount; individual skills may override via `price_usd`.
|
|
24
|
-
attr_accessor :amount_usd
|
|
25
|
-
|
|
26
|
-
# Settlement network (e.g. `base-sepolia`).
|
|
27
24
|
attr_accessor :network
|
|
28
25
|
|
|
29
|
-
|
|
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
|
|
26
|
+
attr_accessor :asset
|
|
45
27
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
attr_accessor :amount
|
|
29
|
+
|
|
30
|
+
attr_accessor :pay_to
|
|
31
|
+
|
|
32
|
+
attr_accessor :max_timeout_seconds
|
|
33
|
+
|
|
34
|
+
attr_accessor :facilitator
|
|
50
35
|
|
|
51
36
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
37
|
def self.attribute_map
|
|
53
38
|
{
|
|
54
39
|
:'protocol' => :'protocol',
|
|
55
40
|
:'scheme' => :'scheme',
|
|
56
|
-
:'
|
|
57
|
-
:'
|
|
41
|
+
:'network' => :'network',
|
|
42
|
+
:'asset' => :'asset',
|
|
43
|
+
:'amount' => :'amount',
|
|
44
|
+
:'pay_to' => :'pay_to',
|
|
45
|
+
:'max_timeout_seconds' => :'max_timeout_seconds',
|
|
46
|
+
:'facilitator' => :'facilitator'
|
|
58
47
|
}
|
|
59
48
|
end
|
|
60
49
|
|
|
@@ -73,8 +62,12 @@ module Weft
|
|
|
73
62
|
{
|
|
74
63
|
:'protocol' => :'String',
|
|
75
64
|
:'scheme' => :'String',
|
|
76
|
-
:'
|
|
77
|
-
:'
|
|
65
|
+
:'network' => :'String',
|
|
66
|
+
:'asset' => :'String',
|
|
67
|
+
:'amount' => :'String',
|
|
68
|
+
:'pay_to' => :'String',
|
|
69
|
+
:'max_timeout_seconds' => :'Integer',
|
|
70
|
+
:'facilitator' => :'String'
|
|
78
71
|
}
|
|
79
72
|
end
|
|
80
73
|
|
|
@@ -88,33 +81,51 @@ module Weft
|
|
|
88
81
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
82
|
def initialize(attributes = {})
|
|
90
83
|
if (!attributes.is_a?(Hash))
|
|
91
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::
|
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchPaymentOffer` initialize method"
|
|
92
85
|
end
|
|
93
86
|
|
|
94
87
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
95
88
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
96
89
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
97
90
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
98
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::
|
|
91
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchPaymentOffer`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
99
92
|
end
|
|
100
93
|
h[k.to_sym] = v
|
|
101
94
|
}
|
|
102
95
|
|
|
103
96
|
if attributes.key?(:'protocol')
|
|
104
97
|
self.protocol = attributes[:'protocol']
|
|
98
|
+
else
|
|
99
|
+
self.protocol = nil
|
|
105
100
|
end
|
|
106
101
|
|
|
107
102
|
if attributes.key?(:'scheme')
|
|
108
103
|
self.scheme = attributes[:'scheme']
|
|
109
104
|
end
|
|
110
105
|
|
|
111
|
-
if attributes.key?(:'amount_usd')
|
|
112
|
-
self.amount_usd = attributes[:'amount_usd']
|
|
113
|
-
end
|
|
114
|
-
|
|
115
106
|
if attributes.key?(:'network')
|
|
116
107
|
self.network = attributes[:'network']
|
|
117
108
|
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'asset')
|
|
111
|
+
self.asset = attributes[:'asset']
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'amount')
|
|
115
|
+
self.amount = attributes[:'amount']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'pay_to')
|
|
119
|
+
self.pay_to = attributes[:'pay_to']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'max_timeout_seconds')
|
|
123
|
+
self.max_timeout_seconds = attributes[:'max_timeout_seconds']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'facilitator')
|
|
127
|
+
self.facilitator = attributes[:'facilitator']
|
|
128
|
+
end
|
|
118
129
|
end
|
|
119
130
|
|
|
120
131
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -122,9 +133,8 @@ module Weft
|
|
|
122
133
|
def list_invalid_properties
|
|
123
134
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
124
135
|
invalid_properties = Array.new
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
invalid_properties.push("invalid value for \"amount_usd\", must conform to the pattern #{pattern}.")
|
|
136
|
+
if @protocol.nil?
|
|
137
|
+
invalid_properties.push('invalid value for "protocol", protocol cannot be nil.')
|
|
128
138
|
end
|
|
129
139
|
|
|
130
140
|
invalid_properties
|
|
@@ -134,35 +144,18 @@ module Weft
|
|
|
134
144
|
# @return true if the model is valid
|
|
135
145
|
def valid?
|
|
136
146
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
137
|
-
|
|
138
|
-
return false unless protocol_validator.valid?(@protocol)
|
|
139
|
-
return false if !@amount_usd.nil? && @amount_usd !~ Regexp.new(/^\d+(\.\d{1,6})?$/)
|
|
147
|
+
return false if @protocol.nil?
|
|
140
148
|
true
|
|
141
149
|
end
|
|
142
150
|
|
|
143
|
-
# Custom attribute writer method checking allowed values (enum).
|
|
144
|
-
# @param [Object] protocol Object to be assigned
|
|
145
|
-
def protocol=(protocol)
|
|
146
|
-
validator = EnumAttributeValidator.new('String', ["x402", "mpp", "free"])
|
|
147
|
-
unless validator.valid?(protocol)
|
|
148
|
-
fail ArgumentError, "invalid value for \"protocol\", must be one of #{validator.allowable_values}."
|
|
149
|
-
end
|
|
150
|
-
@protocol = protocol
|
|
151
|
-
end
|
|
152
|
-
|
|
153
151
|
# Custom attribute writer method with validation
|
|
154
|
-
# @param [Object]
|
|
155
|
-
def
|
|
156
|
-
if
|
|
157
|
-
fail ArgumentError, '
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
pattern = Regexp.new(/^\d+(\.\d{1,6})?$/)
|
|
161
|
-
if amount_usd !~ pattern
|
|
162
|
-
fail ArgumentError, "invalid value for \"amount_usd\", must conform to the pattern #{pattern}."
|
|
152
|
+
# @param [Object] protocol Value to be assigned
|
|
153
|
+
def protocol=(protocol)
|
|
154
|
+
if protocol.nil?
|
|
155
|
+
fail ArgumentError, 'protocol cannot be nil'
|
|
163
156
|
end
|
|
164
157
|
|
|
165
|
-
@
|
|
158
|
+
@protocol = protocol
|
|
166
159
|
end
|
|
167
160
|
|
|
168
161
|
# Checks equality by comparing each attribute.
|
|
@@ -172,8 +165,12 @@ module Weft
|
|
|
172
165
|
self.class == o.class &&
|
|
173
166
|
protocol == o.protocol &&
|
|
174
167
|
scheme == o.scheme &&
|
|
175
|
-
|
|
176
|
-
|
|
168
|
+
network == o.network &&
|
|
169
|
+
asset == o.asset &&
|
|
170
|
+
amount == o.amount &&
|
|
171
|
+
pay_to == o.pay_to &&
|
|
172
|
+
max_timeout_seconds == o.max_timeout_seconds &&
|
|
173
|
+
facilitator == o.facilitator
|
|
177
174
|
end
|
|
178
175
|
|
|
179
176
|
# @see the `==` method
|
|
@@ -185,7 +182,7 @@ module Weft
|
|
|
185
182
|
# Calculates hash code according to all attributes.
|
|
186
183
|
# @return [Integer] Hash code
|
|
187
184
|
def hash
|
|
188
|
-
[protocol, scheme,
|
|
185
|
+
[protocol, scheme, network, asset, amount, pay_to, max_timeout_seconds, facilitator].hash
|
|
189
186
|
end
|
|
190
187
|
|
|
191
188
|
# Builds the object from hash
|
|
@@ -0,0 +1,284 @@
|
|
|
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.1
|
|
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
|
+
# The same price constraint in integer micro-USD (1 USDC = 1_000_000 micro-USD) — the settlement form. Set exactly one operator: a scalar (`lte` / `gte` / `eq`) OR a range (`range_gte` + `range_lte` together, lower ≤ upper). Mutually exclusive with `price`. An unpriced resource is excluded from any price-filtered query.
|
|
18
|
+
class SearchPriceAtomicFilter < ApiModelBase
|
|
19
|
+
# Price ≤ this many micro-USD (inclusive ceiling).
|
|
20
|
+
attr_accessor :lte
|
|
21
|
+
|
|
22
|
+
# Price ≥ this many micro-USD (inclusive floor).
|
|
23
|
+
attr_accessor :gte
|
|
24
|
+
|
|
25
|
+
# Price exactly this many micro-USD.
|
|
26
|
+
attr_accessor :eq
|
|
27
|
+
|
|
28
|
+
# Range lower bound (inclusive), micro-USD. Set with range_lte.
|
|
29
|
+
attr_accessor :range_gte
|
|
30
|
+
|
|
31
|
+
# Range upper bound (inclusive), micro-USD. Set with range_gte.
|
|
32
|
+
attr_accessor :range_lte
|
|
33
|
+
|
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
|
+
def self.attribute_map
|
|
36
|
+
{
|
|
37
|
+
:'lte' => :'lte',
|
|
38
|
+
:'gte' => :'gte',
|
|
39
|
+
:'eq' => :'eq',
|
|
40
|
+
:'range_gte' => :'range_gte',
|
|
41
|
+
:'range_lte' => :'range_lte'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns attribute mapping this model knows about
|
|
46
|
+
def self.acceptable_attribute_map
|
|
47
|
+
attribute_map
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all the JSON keys this model knows about
|
|
51
|
+
def self.acceptable_attributes
|
|
52
|
+
acceptable_attribute_map.values
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
:'lte' => :'Integer',
|
|
59
|
+
:'gte' => :'Integer',
|
|
60
|
+
:'eq' => :'Integer',
|
|
61
|
+
:'range_gte' => :'Integer',
|
|
62
|
+
:'range_lte' => :'Integer'
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# List of attributes with nullable: true
|
|
67
|
+
def self.openapi_nullable
|
|
68
|
+
Set.new([
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Initializes the object
|
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
74
|
+
def initialize(attributes = {})
|
|
75
|
+
if (!attributes.is_a?(Hash))
|
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::SearchPriceAtomicFilter` initialize method"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
82
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::SearchPriceAtomicFilter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
84
|
+
end
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'lte')
|
|
89
|
+
self.lte = attributes[:'lte']
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if attributes.key?(:'gte')
|
|
93
|
+
self.gte = attributes[:'gte']
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'eq')
|
|
97
|
+
self.eq = attributes[:'eq']
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'range_gte')
|
|
101
|
+
self.range_gte = attributes[:'range_gte']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'range_lte')
|
|
105
|
+
self.range_lte = attributes[:'range_lte']
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
110
|
+
# @return Array for valid properties with the reasons
|
|
111
|
+
def list_invalid_properties
|
|
112
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
113
|
+
invalid_properties = Array.new
|
|
114
|
+
if !@lte.nil? && @lte < 0
|
|
115
|
+
invalid_properties.push('invalid value for "lte", must be greater than or equal to 0.')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if !@gte.nil? && @gte < 0
|
|
119
|
+
invalid_properties.push('invalid value for "gte", must be greater than or equal to 0.')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if !@eq.nil? && @eq < 0
|
|
123
|
+
invalid_properties.push('invalid value for "eq", must be greater than or equal to 0.')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if !@range_gte.nil? && @range_gte < 0
|
|
127
|
+
invalid_properties.push('invalid value for "range_gte", must be greater than or equal to 0.')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if !@range_lte.nil? && @range_lte < 0
|
|
131
|
+
invalid_properties.push('invalid value for "range_lte", must be greater than or equal to 0.')
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
invalid_properties
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Check to see if the all the properties in the model are valid
|
|
138
|
+
# @return true if the model is valid
|
|
139
|
+
def valid?
|
|
140
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
141
|
+
return false if !@lte.nil? && @lte < 0
|
|
142
|
+
return false if !@gte.nil? && @gte < 0
|
|
143
|
+
return false if !@eq.nil? && @eq < 0
|
|
144
|
+
return false if !@range_gte.nil? && @range_gte < 0
|
|
145
|
+
return false if !@range_lte.nil? && @range_lte < 0
|
|
146
|
+
true
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Custom attribute writer method with validation
|
|
150
|
+
# @param [Object] lte Value to be assigned
|
|
151
|
+
def lte=(lte)
|
|
152
|
+
if lte.nil?
|
|
153
|
+
fail ArgumentError, 'lte cannot be nil'
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if lte < 0
|
|
157
|
+
fail ArgumentError, 'invalid value for "lte", must be greater than or equal to 0.'
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
@lte = lte
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom attribute writer method with validation
|
|
164
|
+
# @param [Object] gte Value to be assigned
|
|
165
|
+
def gte=(gte)
|
|
166
|
+
if gte.nil?
|
|
167
|
+
fail ArgumentError, 'gte cannot be nil'
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if gte < 0
|
|
171
|
+
fail ArgumentError, 'invalid value for "gte", must be greater than or equal to 0.'
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
@gte = gte
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Custom attribute writer method with validation
|
|
178
|
+
# @param [Object] eq Value to be assigned
|
|
179
|
+
def eq=(eq)
|
|
180
|
+
if eq.nil?
|
|
181
|
+
fail ArgumentError, 'eq cannot be nil'
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if eq < 0
|
|
185
|
+
fail ArgumentError, 'invalid value for "eq", must be greater than or equal to 0.'
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@eq = eq
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Custom attribute writer method with validation
|
|
192
|
+
# @param [Object] range_gte Value to be assigned
|
|
193
|
+
def range_gte=(range_gte)
|
|
194
|
+
if range_gte.nil?
|
|
195
|
+
fail ArgumentError, 'range_gte cannot be nil'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if range_gte < 0
|
|
199
|
+
fail ArgumentError, 'invalid value for "range_gte", must be greater than or equal to 0.'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
@range_gte = range_gte
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Custom attribute writer method with validation
|
|
206
|
+
# @param [Object] range_lte Value to be assigned
|
|
207
|
+
def range_lte=(range_lte)
|
|
208
|
+
if range_lte.nil?
|
|
209
|
+
fail ArgumentError, 'range_lte cannot be nil'
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
if range_lte < 0
|
|
213
|
+
fail ArgumentError, 'invalid value for "range_lte", must be greater than or equal to 0.'
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
@range_lte = range_lte
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Checks equality by comparing each attribute.
|
|
220
|
+
# @param [Object] Object to be compared
|
|
221
|
+
def ==(o)
|
|
222
|
+
return true if self.equal?(o)
|
|
223
|
+
self.class == o.class &&
|
|
224
|
+
lte == o.lte &&
|
|
225
|
+
gte == o.gte &&
|
|
226
|
+
eq == o.eq &&
|
|
227
|
+
range_gte == o.range_gte &&
|
|
228
|
+
range_lte == o.range_lte
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# @see the `==` method
|
|
232
|
+
# @param [Object] Object to be compared
|
|
233
|
+
def eql?(o)
|
|
234
|
+
self == o
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Calculates hash code according to all attributes.
|
|
238
|
+
# @return [Integer] Hash code
|
|
239
|
+
def hash
|
|
240
|
+
[lte, gte, eq, range_gte, range_lte].hash
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Builds the object from hash
|
|
244
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
245
|
+
# @return [Object] Returns the model itself
|
|
246
|
+
def self.build_from_hash(attributes)
|
|
247
|
+
return nil unless attributes.is_a?(Hash)
|
|
248
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
249
|
+
transformed_hash = {}
|
|
250
|
+
openapi_types.each_pair do |key, type|
|
|
251
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
252
|
+
transformed_hash["#{key}"] = nil
|
|
253
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
254
|
+
# check to ensure the input is an array given that the attribute
|
|
255
|
+
# is documented as an array but the input is not
|
|
256
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
257
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
258
|
+
end
|
|
259
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
260
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
new(transformed_hash)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Returns the object in the form of hash
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_hash
|
|
269
|
+
hash = {}
|
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
271
|
+
value = self.send(attr)
|
|
272
|
+
if value.nil?
|
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
hash[param] = _to_hash(value)
|
|
278
|
+
end
|
|
279
|
+
hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
end
|