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
|
@@ -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,12 +14,19 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Weft
|
|
17
|
-
# Compact balance snapshot returned inside `FetchErrorResponse`. Less rich than `BalanceResponse` — just the
|
|
17
|
+
# Compact balance snapshot returned inside `FetchErrorResponse`. Less rich than `BalanceResponse` — just the fields a CLI needs to explain why a fetch failed.
|
|
18
18
|
class FetchBalanceSnapshot < ApiModelBase
|
|
19
19
|
attr_accessor :promo_usd
|
|
20
20
|
|
|
21
|
+
# Live Base USDC balance.
|
|
21
22
|
attr_accessor :wallet_usdc
|
|
22
23
|
|
|
24
|
+
# Aggregated USD of allowlisted Tempo dollar tokens, exact to the micro-dollar. `null` when UNKNOWN (RPC read failed or no token allowlisted for the paired chain) — never \"0.00\" for an unread component.
|
|
25
|
+
attr_accessor :tempo_usd
|
|
26
|
+
|
|
27
|
+
# Aggregated USD balance = Base USDC + Tempo dollar tokens, exact to the micro-dollar. Equals `wallet_usdc` alone when `tempo_usd` is null. Null when the Base USDC provider is unreachable.
|
|
28
|
+
attr_accessor :total_usd
|
|
29
|
+
|
|
23
30
|
attr_accessor :spent_today_usd
|
|
24
31
|
|
|
25
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -27,6 +34,8 @@ module Weft
|
|
|
27
34
|
{
|
|
28
35
|
:'promo_usd' => :'promo_usd',
|
|
29
36
|
:'wallet_usdc' => :'wallet_usdc',
|
|
37
|
+
:'tempo_usd' => :'tempo_usd',
|
|
38
|
+
:'total_usd' => :'total_usd',
|
|
30
39
|
:'spent_today_usd' => :'spent_today_usd'
|
|
31
40
|
}
|
|
32
41
|
end
|
|
@@ -46,6 +55,8 @@ module Weft
|
|
|
46
55
|
{
|
|
47
56
|
:'promo_usd' => :'String',
|
|
48
57
|
:'wallet_usdc' => :'String',
|
|
58
|
+
:'tempo_usd' => :'String',
|
|
59
|
+
:'total_usd' => :'String',
|
|
49
60
|
:'spent_today_usd' => :'String'
|
|
50
61
|
}
|
|
51
62
|
end
|
|
@@ -84,6 +95,18 @@ module Weft
|
|
|
84
95
|
self.wallet_usdc = nil
|
|
85
96
|
end
|
|
86
97
|
|
|
98
|
+
if attributes.key?(:'tempo_usd')
|
|
99
|
+
self.tempo_usd = attributes[:'tempo_usd']
|
|
100
|
+
else
|
|
101
|
+
self.tempo_usd = nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'total_usd')
|
|
105
|
+
self.total_usd = attributes[:'total_usd']
|
|
106
|
+
else
|
|
107
|
+
self.total_usd = nil
|
|
108
|
+
end
|
|
109
|
+
|
|
87
110
|
if attributes.key?(:'spent_today_usd')
|
|
88
111
|
self.spent_today_usd = attributes[:'spent_today_usd']
|
|
89
112
|
else
|
|
@@ -104,6 +127,14 @@ module Weft
|
|
|
104
127
|
invalid_properties.push('invalid value for "wallet_usdc", wallet_usdc cannot be nil.')
|
|
105
128
|
end
|
|
106
129
|
|
|
130
|
+
if @tempo_usd.nil?
|
|
131
|
+
invalid_properties.push('invalid value for "tempo_usd", tempo_usd cannot be nil.')
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if @total_usd.nil?
|
|
135
|
+
invalid_properties.push('invalid value for "total_usd", total_usd cannot be nil.')
|
|
136
|
+
end
|
|
137
|
+
|
|
107
138
|
if @spent_today_usd.nil?
|
|
108
139
|
invalid_properties.push('invalid value for "spent_today_usd", spent_today_usd cannot be nil.')
|
|
109
140
|
end
|
|
@@ -117,6 +148,8 @@ module Weft
|
|
|
117
148
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
118
149
|
return false if @promo_usd.nil?
|
|
119
150
|
return false if @wallet_usdc.nil?
|
|
151
|
+
return false if @tempo_usd.nil?
|
|
152
|
+
return false if @total_usd.nil?
|
|
120
153
|
return false if @spent_today_usd.nil?
|
|
121
154
|
true
|
|
122
155
|
end
|
|
@@ -141,6 +174,26 @@ module Weft
|
|
|
141
174
|
@wallet_usdc = wallet_usdc
|
|
142
175
|
end
|
|
143
176
|
|
|
177
|
+
# Custom attribute writer method with validation
|
|
178
|
+
# @param [Object] tempo_usd Value to be assigned
|
|
179
|
+
def tempo_usd=(tempo_usd)
|
|
180
|
+
if tempo_usd.nil?
|
|
181
|
+
fail ArgumentError, 'tempo_usd cannot be nil'
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
@tempo_usd = tempo_usd
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Custom attribute writer method with validation
|
|
188
|
+
# @param [Object] total_usd Value to be assigned
|
|
189
|
+
def total_usd=(total_usd)
|
|
190
|
+
if total_usd.nil?
|
|
191
|
+
fail ArgumentError, 'total_usd cannot be nil'
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
@total_usd = total_usd
|
|
195
|
+
end
|
|
196
|
+
|
|
144
197
|
# Custom attribute writer method with validation
|
|
145
198
|
# @param [Object] spent_today_usd Value to be assigned
|
|
146
199
|
def spent_today_usd=(spent_today_usd)
|
|
@@ -158,6 +211,8 @@ module Weft
|
|
|
158
211
|
self.class == o.class &&
|
|
159
212
|
promo_usd == o.promo_usd &&
|
|
160
213
|
wallet_usdc == o.wallet_usdc &&
|
|
214
|
+
tempo_usd == o.tempo_usd &&
|
|
215
|
+
total_usd == o.total_usd &&
|
|
161
216
|
spent_today_usd == o.spent_today_usd
|
|
162
217
|
end
|
|
163
218
|
|
|
@@ -170,7 +225,7 @@ module Weft
|
|
|
170
225
|
# Calculates hash code according to all attributes.
|
|
171
226
|
# @return [Integer] Hash code
|
|
172
227
|
def hash
|
|
173
|
-
[promo_usd, wallet_usdc, spent_today_usd].hash
|
|
228
|
+
[promo_usd, wallet_usdc, tempo_usd, total_usd, spent_today_usd].hash
|
|
174
229
|
end
|
|
175
230
|
|
|
176
231
|
# 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 for `/api/v1/fetch`. Every error carries the buyer's current `policy`, `balance`, and a `dashboard_url` so a CLI can render an actionable message without a second round-trip. `error` values include the fixed codes listed below plus the
|
|
17
|
+
# Bespoke error envelope for `/api/v1/fetch`. Every error carries the buyer's current `policy`, `balance`, and a `dashboard_url` so a CLI can render an actionable message without a second round-trip. `error` values include the fixed codes listed below plus the `POLICY_VIOLATION_<REASON>` family, where `<REASON>` is the violated policy field (`MAX_TX`, `DAILY`, or `WEEKLY` — see `PolicyViolation::REASONS`).
|
|
18
18
|
class FetchErrorResponse < ApiModelBase
|
|
19
19
|
# Stable error code.
|
|
20
20
|
attr_accessor :error
|
|
@@ -171,7 +171,7 @@ module Weft
|
|
|
171
171
|
def valid?
|
|
172
172
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
173
173
|
return false if @error.nil?
|
|
174
|
-
error_validator = EnumAttributeValidator.new('String', ["INVALID_URL", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "SETTLEMENT_FAILED", "
|
|
174
|
+
error_validator = EnumAttributeValidator.new('String', ["INVALID_REQUEST", "UNKNOWN_PARAMETER", "INVALID_URL", "INVALID_MAX_COST_USD", "UNSUPPORTED_METHOD", "INVALID_BODY", "INVALID_HEADERS", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_CONFLICT", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "WALLET_ENVIRONMENT_MISMATCH", "SETTLEMENT_FAILED", "UNSUPPORTED_PAYMENT_METHOD", "UNSUPPORTED_ASSET", "POLICY_VIOLATION_MAX_TX", "POLICY_VIOLATION_DAILY", "POLICY_VIOLATION_WEEKLY"])
|
|
175
175
|
return false unless error_validator.valid?(@error)
|
|
176
176
|
return false if @details.nil?
|
|
177
177
|
return false if @policy.nil?
|
|
@@ -183,7 +183,7 @@ module Weft
|
|
|
183
183
|
# Custom attribute writer method checking allowed values (enum).
|
|
184
184
|
# @param [Object] error Object to be assigned
|
|
185
185
|
def error=(error)
|
|
186
|
-
validator = EnumAttributeValidator.new('String', ["INVALID_URL", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "SETTLEMENT_FAILED", "
|
|
186
|
+
validator = EnumAttributeValidator.new('String', ["INVALID_REQUEST", "UNKNOWN_PARAMETER", "INVALID_URL", "INVALID_MAX_COST_USD", "UNSUPPORTED_METHOD", "INVALID_BODY", "INVALID_HEADERS", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_CONFLICT", "EXCEEDED_MAX_COST", "INSUFFICIENT_BALANCE", "MERCHANT_RETURNED_NON_402", "ARTIFACT_TOO_LARGE", "DENYLISTED_RECIPIENT", "WALLET_ENVIRONMENT_MISMATCH", "SETTLEMENT_FAILED", "UNSUPPORTED_PAYMENT_METHOD", "UNSUPPORTED_ASSET", "POLICY_VIOLATION_MAX_TX", "POLICY_VIOLATION_DAILY", "POLICY_VIOLATION_WEEKLY"])
|
|
187
187
|
unless validator.valid?(error)
|
|
188
188
|
fail ArgumentError, "invalid value for \"error\", must be one of #{validator.allowable_values}."
|
|
189
189
|
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
|
|
@@ -26,7 +26,7 @@ module Weft
|
|
|
26
26
|
|
|
27
27
|
attr_accessor :body
|
|
28
28
|
|
|
29
|
-
# Headers forwarded to the upstream. Up to 32 headers, 4 KB total. The following are silently stripped: `host`, `authorization`, `cookie`, `proxy-authorization`, `x-forwarded-*`, `x-real-ip`, `x-payment`, `connection`, `upgrade`.
|
|
29
|
+
# Headers forwarded to the upstream. Up to 32 headers, 4 KB total. The following are silently stripped: `host`, `authorization`, `cookie`, `proxy-authorization`, `x-forwarded-*`, `x-real-ip`, `x-payment`, `connection`, `upgrade`.
|
|
30
30
|
attr_accessor :headers
|
|
31
31
|
|
|
32
32
|
class EnumAttributeValidator
|
|
@@ -158,7 +158,7 @@ module Weft
|
|
|
158
158
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
159
159
|
return false if @url.nil?
|
|
160
160
|
return false if !@max_cost_usd.nil? && @max_cost_usd !~ Regexp.new(/^\d+(\.\d{1,6})?$/)
|
|
161
|
-
method_validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE"])
|
|
161
|
+
method_validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"])
|
|
162
162
|
return false unless method_validator.valid?(@method)
|
|
163
163
|
true
|
|
164
164
|
end
|
|
@@ -191,7 +191,7 @@ module Weft
|
|
|
191
191
|
# Custom attribute writer method checking allowed values (enum).
|
|
192
192
|
# @param [Object] method Object to be assigned
|
|
193
193
|
def method=(method)
|
|
194
|
-
validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE"])
|
|
194
|
+
validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"])
|
|
195
195
|
unless validator.valid?(method)
|
|
196
196
|
fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
|
|
197
197
|
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
|
|
@@ -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
|
-
# Successful fetch envelope. `body_base64` is the upstream artifact bytes, base64-encoded. `paid_usd`, `tx_hash`, and `merchant` are populated only when the upstream charged for the response.
|
|
17
|
+
# Successful fetch envelope. `body_base64` is the upstream artifact bytes, base64-encoded. `paid_usd`, `held_usd`, `payment_status`, `tx_hash`, and `merchant` are populated only when the upstream charged for the response. `paid_usd` is \"0.00\" (never the nominal charge amount) until the charge is CONFIRMED settled on-chain — a signed-but-unsettled hold reports its amount in `held_usd` instead. This is a deliberate honesty fix: earlier versions of this endpoint returned the nominal amount in `paid_usd` unconditionally, even when the charge never settled. **Money string format.** Every USD amount on this surface is exact to the micro-dollar and never narrower than two decimals: a whole-cent amount renders \"0.50\", a sub-cent amount keeps its real precision (\"0.000892\"), and zero renders \"0.00\". Amounts are never rounded — an agent reconciling its own spend reads the truth, not a display value. Parse these as decimals; do NOT compare them as strings against a bare zero literal.
|
|
18
18
|
class FetchResponse < ApiModelBase
|
|
19
19
|
# HTTP status returned by the upstream after the paid replay.
|
|
20
20
|
attr_accessor :status
|
|
@@ -25,18 +25,46 @@ module Weft
|
|
|
25
25
|
# Base64-encoded response body. Empty string for empty bodies.
|
|
26
26
|
attr_accessor :body_base64
|
|
27
27
|
|
|
28
|
-
# USD amount actually settled.
|
|
28
|
+
# USD amount actually settled on-chain. \"0.00\" for free upstreams AND for any charge that hasn't (yet, or ever) settled — a signed hold is not yet spend. See `held_usd` for the nominal amount in that case. Exact to the micro-dollar, minimum two decimals; parse as a decimal rather than string-comparing against a bare zero literal.
|
|
29
29
|
attr_accessor :paid_usd
|
|
30
30
|
|
|
31
|
+
# The nominal charge amount when `paid_usd` is \"0.00\" — a hold awaiting settlement, or a charge that failed/expired without ever settling. `null` once `paid_usd` reflects the real settlement (or for a free upstream, where nothing was ever charged). Same format as `paid_usd`: exact to the micro-dollar, minimum two decimals.
|
|
32
|
+
attr_accessor :held_usd
|
|
33
|
+
|
|
34
|
+
# Agent-facing settlement status. `pending` = signed, no refusal signal yet (settlement may still land, e.g. x402's async facilitator webhook). `declined-pending` = the merchant refused but the authorization isn't provably dead yet. `declined` / `expired` / `reverted` are terminal — the money never moved (or, for `reverted`, moved and then reversed on-chain) and never will for this charge.
|
|
35
|
+
attr_accessor :payment_status
|
|
36
|
+
|
|
31
37
|
# Settlement transaction hash. Null for free upstreams.
|
|
32
38
|
attr_accessor :tx_hash
|
|
33
39
|
|
|
34
|
-
# Internal artifact identifier if the response was persisted.
|
|
40
|
+
# Internal artifact identifier if the response was persisted; `null` otherwise.
|
|
35
41
|
attr_accessor :artifact_id
|
|
36
42
|
|
|
37
43
|
# Merchant reputation snapshot. Null for free upstreams.
|
|
38
44
|
attr_accessor :merchant
|
|
39
45
|
|
|
46
|
+
class EnumAttributeValidator
|
|
47
|
+
attr_reader :datatype
|
|
48
|
+
attr_reader :allowable_values
|
|
49
|
+
|
|
50
|
+
def initialize(datatype, allowable_values)
|
|
51
|
+
@allowable_values = allowable_values.map do |value|
|
|
52
|
+
case datatype.to_s
|
|
53
|
+
when /Integer/i
|
|
54
|
+
value.to_i
|
|
55
|
+
when /Float/i
|
|
56
|
+
value.to_f
|
|
57
|
+
else
|
|
58
|
+
value
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def valid?(value)
|
|
64
|
+
!value || allowable_values.include?(value)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
40
68
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
69
|
def self.attribute_map
|
|
42
70
|
{
|
|
@@ -44,6 +72,8 @@ module Weft
|
|
|
44
72
|
:'headers' => :'headers',
|
|
45
73
|
:'body_base64' => :'body_base64',
|
|
46
74
|
:'paid_usd' => :'paid_usd',
|
|
75
|
+
:'held_usd' => :'held_usd',
|
|
76
|
+
:'payment_status' => :'payment_status',
|
|
47
77
|
:'tx_hash' => :'tx_hash',
|
|
48
78
|
:'artifact_id' => :'artifact_id',
|
|
49
79
|
:'merchant' => :'merchant'
|
|
@@ -67,8 +97,10 @@ module Weft
|
|
|
67
97
|
:'headers' => :'Hash<String, String>',
|
|
68
98
|
:'body_base64' => :'String',
|
|
69
99
|
:'paid_usd' => :'String',
|
|
100
|
+
:'held_usd' => :'String',
|
|
101
|
+
:'payment_status' => :'String',
|
|
70
102
|
:'tx_hash' => :'String',
|
|
71
|
-
:'artifact_id' => :'
|
|
103
|
+
:'artifact_id' => :'Integer',
|
|
72
104
|
:'merchant' => :'Merchant'
|
|
73
105
|
}
|
|
74
106
|
end
|
|
@@ -121,6 +153,18 @@ module Weft
|
|
|
121
153
|
self.paid_usd = nil
|
|
122
154
|
end
|
|
123
155
|
|
|
156
|
+
if attributes.key?(:'held_usd')
|
|
157
|
+
self.held_usd = attributes[:'held_usd']
|
|
158
|
+
else
|
|
159
|
+
self.held_usd = nil
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'payment_status')
|
|
163
|
+
self.payment_status = attributes[:'payment_status']
|
|
164
|
+
else
|
|
165
|
+
self.payment_status = nil
|
|
166
|
+
end
|
|
167
|
+
|
|
124
168
|
if attributes.key?(:'tx_hash')
|
|
125
169
|
self.tx_hash = attributes[:'tx_hash']
|
|
126
170
|
else
|
|
@@ -161,6 +205,14 @@ module Weft
|
|
|
161
205
|
invalid_properties.push('invalid value for "paid_usd", paid_usd cannot be nil.')
|
|
162
206
|
end
|
|
163
207
|
|
|
208
|
+
if @held_usd.nil?
|
|
209
|
+
invalid_properties.push('invalid value for "held_usd", held_usd cannot be nil.')
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
if @payment_status.nil?
|
|
213
|
+
invalid_properties.push('invalid value for "payment_status", payment_status cannot be nil.')
|
|
214
|
+
end
|
|
215
|
+
|
|
164
216
|
if @tx_hash.nil?
|
|
165
217
|
invalid_properties.push('invalid value for "tx_hash", tx_hash cannot be nil.')
|
|
166
218
|
end
|
|
@@ -184,6 +236,10 @@ module Weft
|
|
|
184
236
|
return false if @headers.nil?
|
|
185
237
|
return false if @body_base64.nil?
|
|
186
238
|
return false if @paid_usd.nil?
|
|
239
|
+
return false if @held_usd.nil?
|
|
240
|
+
return false if @payment_status.nil?
|
|
241
|
+
payment_status_validator = EnumAttributeValidator.new('String', ["settled", "pending", "declined-pending", "declined", "expired", "reverted"])
|
|
242
|
+
return false unless payment_status_validator.valid?(@payment_status)
|
|
187
243
|
return false if @tx_hash.nil?
|
|
188
244
|
return false if @artifact_id.nil?
|
|
189
245
|
return false if @merchant.nil?
|
|
@@ -230,6 +286,26 @@ module Weft
|
|
|
230
286
|
@paid_usd = paid_usd
|
|
231
287
|
end
|
|
232
288
|
|
|
289
|
+
# Custom attribute writer method with validation
|
|
290
|
+
# @param [Object] held_usd Value to be assigned
|
|
291
|
+
def held_usd=(held_usd)
|
|
292
|
+
if held_usd.nil?
|
|
293
|
+
fail ArgumentError, 'held_usd cannot be nil'
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
@held_usd = held_usd
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
300
|
+
# @param [Object] payment_status Object to be assigned
|
|
301
|
+
def payment_status=(payment_status)
|
|
302
|
+
validator = EnumAttributeValidator.new('String', ["settled", "pending", "declined-pending", "declined", "expired", "reverted"])
|
|
303
|
+
unless validator.valid?(payment_status)
|
|
304
|
+
fail ArgumentError, "invalid value for \"payment_status\", must be one of #{validator.allowable_values}."
|
|
305
|
+
end
|
|
306
|
+
@payment_status = payment_status
|
|
307
|
+
end
|
|
308
|
+
|
|
233
309
|
# Custom attribute writer method with validation
|
|
234
310
|
# @param [Object] tx_hash Value to be assigned
|
|
235
311
|
def tx_hash=(tx_hash)
|
|
@@ -269,6 +345,8 @@ module Weft
|
|
|
269
345
|
headers == o.headers &&
|
|
270
346
|
body_base64 == o.body_base64 &&
|
|
271
347
|
paid_usd == o.paid_usd &&
|
|
348
|
+
held_usd == o.held_usd &&
|
|
349
|
+
payment_status == o.payment_status &&
|
|
272
350
|
tx_hash == o.tx_hash &&
|
|
273
351
|
artifact_id == o.artifact_id &&
|
|
274
352
|
merchant == o.merchant
|
|
@@ -283,7 +361,7 @@ module Weft
|
|
|
283
361
|
# Calculates hash code according to all attributes.
|
|
284
362
|
# @return [Integer] Hash code
|
|
285
363
|
def hash
|
|
286
|
-
[status, headers, body_base64, paid_usd, tx_hash, artifact_id, merchant].hash
|
|
364
|
+
[status, headers, body_base64, paid_usd, held_usd, payment_status, tx_hash, artifact_id, merchant].hash
|
|
287
365
|
end
|
|
288
366
|
|
|
289
367
|
# Builds the object from hash
|
|
@@ -0,0 +1,242 @@
|
|
|
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
|
+
# RFC 6750 §3.1 `insufficient_scope` error. Returned with HTTP 403 and a `WWW-Authenticate: Bearer error=\"insufficient_scope\", scope=\"...\"` header when an OAuth access token authenticates successfully but does not carry the scope the endpoint requires. Only OAuth bearer tokens are scope-gated; `wk_`-prefixed API keys are unscoped and never see this response.
|
|
18
|
+
class InsufficientScopeResponse < ApiModelBase
|
|
19
|
+
attr_accessor :error
|
|
20
|
+
|
|
21
|
+
attr_accessor :error_description
|
|
22
|
+
|
|
23
|
+
# Space-delimited list of scopes the endpoint requires.
|
|
24
|
+
attr_accessor :scope
|
|
25
|
+
|
|
26
|
+
class EnumAttributeValidator
|
|
27
|
+
attr_reader :datatype
|
|
28
|
+
attr_reader :allowable_values
|
|
29
|
+
|
|
30
|
+
def initialize(datatype, allowable_values)
|
|
31
|
+
@allowable_values = allowable_values.map do |value|
|
|
32
|
+
case datatype.to_s
|
|
33
|
+
when /Integer/i
|
|
34
|
+
value.to_i
|
|
35
|
+
when /Float/i
|
|
36
|
+
value.to_f
|
|
37
|
+
else
|
|
38
|
+
value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def valid?(value)
|
|
44
|
+
!value || allowable_values.include?(value)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
49
|
+
def self.attribute_map
|
|
50
|
+
{
|
|
51
|
+
:'error' => :'error',
|
|
52
|
+
:'error_description' => :'error_description',
|
|
53
|
+
:'scope' => :'scope'
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Returns attribute mapping this model knows about
|
|
58
|
+
def self.acceptable_attribute_map
|
|
59
|
+
attribute_map
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Returns all the JSON keys this model knows about
|
|
63
|
+
def self.acceptable_attributes
|
|
64
|
+
acceptable_attribute_map.values
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Attribute type mapping.
|
|
68
|
+
def self.openapi_types
|
|
69
|
+
{
|
|
70
|
+
:'error' => :'String',
|
|
71
|
+
:'error_description' => :'String',
|
|
72
|
+
:'scope' => :'String'
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# List of attributes with nullable: true
|
|
77
|
+
def self.openapi_nullable
|
|
78
|
+
Set.new([
|
|
79
|
+
])
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Initializes the object
|
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
84
|
+
def initialize(attributes = {})
|
|
85
|
+
if (!attributes.is_a?(Hash))
|
|
86
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::InsufficientScopeResponse` initialize method"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
90
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
91
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
92
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
93
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::InsufficientScopeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
94
|
+
end
|
|
95
|
+
h[k.to_sym] = v
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'error')
|
|
99
|
+
self.error = attributes[:'error']
|
|
100
|
+
else
|
|
101
|
+
self.error = nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'error_description')
|
|
105
|
+
self.error_description = attributes[:'error_description']
|
|
106
|
+
else
|
|
107
|
+
self.error_description = nil
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'scope')
|
|
111
|
+
self.scope = attributes[:'scope']
|
|
112
|
+
else
|
|
113
|
+
self.scope = nil
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
118
|
+
# @return Array for valid properties with the reasons
|
|
119
|
+
def list_invalid_properties
|
|
120
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
121
|
+
invalid_properties = Array.new
|
|
122
|
+
if @error.nil?
|
|
123
|
+
invalid_properties.push('invalid value for "error", error cannot be nil.')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if @error_description.nil?
|
|
127
|
+
invalid_properties.push('invalid value for "error_description", error_description cannot be nil.')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if @scope.nil?
|
|
131
|
+
invalid_properties.push('invalid value for "scope", scope cannot be nil.')
|
|
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 @error.nil?
|
|
142
|
+
error_validator = EnumAttributeValidator.new('String', ["insufficient_scope"])
|
|
143
|
+
return false unless error_validator.valid?(@error)
|
|
144
|
+
return false if @error_description.nil?
|
|
145
|
+
return false if @scope.nil?
|
|
146
|
+
true
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
150
|
+
# @param [Object] error Object to be assigned
|
|
151
|
+
def error=(error)
|
|
152
|
+
validator = EnumAttributeValidator.new('String', ["insufficient_scope"])
|
|
153
|
+
unless validator.valid?(error)
|
|
154
|
+
fail ArgumentError, "invalid value for \"error\", must be one of #{validator.allowable_values}."
|
|
155
|
+
end
|
|
156
|
+
@error = error
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Custom attribute writer method with validation
|
|
160
|
+
# @param [Object] error_description Value to be assigned
|
|
161
|
+
def error_description=(error_description)
|
|
162
|
+
if error_description.nil?
|
|
163
|
+
fail ArgumentError, 'error_description cannot be nil'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
@error_description = error_description
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Custom attribute writer method with validation
|
|
170
|
+
# @param [Object] scope Value to be assigned
|
|
171
|
+
def scope=(scope)
|
|
172
|
+
if scope.nil?
|
|
173
|
+
fail ArgumentError, 'scope cannot be nil'
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
@scope = scope
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Checks equality by comparing each attribute.
|
|
180
|
+
# @param [Object] Object to be compared
|
|
181
|
+
def ==(o)
|
|
182
|
+
return true if self.equal?(o)
|
|
183
|
+
self.class == o.class &&
|
|
184
|
+
error == o.error &&
|
|
185
|
+
error_description == o.error_description &&
|
|
186
|
+
scope == o.scope
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# @see the `==` method
|
|
190
|
+
# @param [Object] Object to be compared
|
|
191
|
+
def eql?(o)
|
|
192
|
+
self == o
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Calculates hash code according to all attributes.
|
|
196
|
+
# @return [Integer] Hash code
|
|
197
|
+
def hash
|
|
198
|
+
[error, error_description, scope].hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Builds the object from hash
|
|
202
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
203
|
+
# @return [Object] Returns the model itself
|
|
204
|
+
def self.build_from_hash(attributes)
|
|
205
|
+
return nil unless attributes.is_a?(Hash)
|
|
206
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
207
|
+
transformed_hash = {}
|
|
208
|
+
openapi_types.each_pair do |key, type|
|
|
209
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
210
|
+
transformed_hash["#{key}"] = nil
|
|
211
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
212
|
+
# check to ensure the input is an array given that the attribute
|
|
213
|
+
# is documented as an array but the input is not
|
|
214
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
215
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
216
|
+
end
|
|
217
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
218
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
new(transformed_hash)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Returns the object in the form of hash
|
|
225
|
+
# @return [Hash] Returns the object in the form of hash
|
|
226
|
+
def to_hash
|
|
227
|
+
hash = {}
|
|
228
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
229
|
+
value = self.send(attr)
|
|
230
|
+
if value.nil?
|
|
231
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
232
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
hash[param] = _to_hash(value)
|
|
236
|
+
end
|
|
237
|
+
hash
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
end
|