weft-sdk 0.24.0 → 0.32.2

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