tensors-ruby 0.1.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.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +154 -0
  4. data/lib/tensors-ruby/api/auth_api.rb +387 -0
  5. data/lib/tensors-ruby/api/civit_ai_api.rb +85 -0
  6. data/lib/tensors-ruby/api/comfy_uiapi_api.rb +582 -0
  7. data/lib/tensors-ruby/api/database_api.rb +655 -0
  8. data/lib/tensors-ruby/api/default_api.rb +77 -0
  9. data/lib/tensors-ruby/api/download_api.rb +210 -0
  10. data/lib/tensors-ruby/api/gallery_api.rb +416 -0
  11. data/lib/tensors-ruby/api/search_api.rb +129 -0
  12. data/lib/tensors-ruby/api_client.rb +441 -0
  13. data/lib/tensors-ruby/api_error.rb +58 -0
  14. data/lib/tensors-ruby/api_model_base.rb +88 -0
  15. data/lib/tensors-ruby/configuration.rb +399 -0
  16. data/lib/tensors-ruby/models/cache_request.rb +165 -0
  17. data/lib/tensors-ruby/models/download_request.rb +179 -0
  18. data/lib/tensors-ruby/models/generate_request.rb +444 -0
  19. data/lib/tensors-ruby/models/generate_response.rb +213 -0
  20. data/lib/tensors-ruby/models/http_validation_error.rb +149 -0
  21. data/lib/tensors-ruby/models/location_inner.rb +103 -0
  22. data/lib/tensors-ruby/models/metadata_update.rb +181 -0
  23. data/lib/tensors-ruby/models/models_response.rb +205 -0
  24. data/lib/tensors-ruby/models/provider.rb +41 -0
  25. data/lib/tensors-ruby/models/queue_status_response.rb +161 -0
  26. data/lib/tensors-ruby/models/scan_request.rb +165 -0
  27. data/lib/tensors-ruby/models/sort_order.rb +41 -0
  28. data/lib/tensors-ruby/models/system_stats_response.rb +161 -0
  29. data/lib/tensors-ruby/models/validation_error.rb +237 -0
  30. data/lib/tensors-ruby/models/workflow_request.rb +168 -0
  31. data/lib/tensors-ruby/models/workflow_response.rb +222 -0
  32. data/lib/tensors-ruby/version.rb +15 -0
  33. data/lib/tensors-ruby.rb +64 -0
  34. data/spec/api/auth_api_spec.rb +109 -0
  35. data/spec/api/civit_ai_api_spec.rb +47 -0
  36. data/spec/api/comfy_uiapi_api_spec.rb +141 -0
  37. data/spec/api/database_api_spec.rb +155 -0
  38. data/spec/api/default_api_spec.rb +45 -0
  39. data/spec/api/download_api_spec.rb +70 -0
  40. data/spec/api/gallery_api_spec.rb +109 -0
  41. data/spec/api/search_api_spec.rb +60 -0
  42. data/spec/models/cache_request_spec.rb +36 -0
  43. data/spec/models/download_request_spec.rb +54 -0
  44. data/spec/models/generate_request_spec.rb +108 -0
  45. data/spec/models/generate_response_spec.rb +54 -0
  46. data/spec/models/http_validation_error_spec.rb +36 -0
  47. data/spec/models/location_inner_spec.rb +21 -0
  48. data/spec/models/metadata_update_spec.rb +54 -0
  49. data/spec/models/models_response_spec.rb +66 -0
  50. data/spec/models/provider_spec.rb +30 -0
  51. data/spec/models/queue_status_response_spec.rb +42 -0
  52. data/spec/models/scan_request_spec.rb +36 -0
  53. data/spec/models/sort_order_spec.rb +30 -0
  54. data/spec/models/system_stats_response_spec.rb +42 -0
  55. data/spec/models/validation_error_spec.rb +60 -0
  56. data/spec/models/workflow_request_spec.rb +36 -0
  57. data/spec/models/workflow_response_spec.rb +60 -0
  58. data/spec/spec_helper.rb +111 -0
  59. data/tensors-ruby.gemspec +41 -0
  60. metadata +194 -0
@@ -0,0 +1,416 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module TensorsApi
16
+ class GalleryApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete Image
23
+ # Delete an image and its metadata.
24
+ # @param image_id [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [Hash<String, Object>]
27
+ def delete_image_api_images_image_id_delete(image_id, opts = {})
28
+ data, _status_code, _headers = delete_image_api_images_image_id_delete_with_http_info(image_id, opts)
29
+ data
30
+ end
31
+
32
+ # Delete Image
33
+ # Delete an image and its metadata.
34
+ # @param image_id [String]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
37
+ def delete_image_api_images_image_id_delete_with_http_info(image_id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: GalleryApi.delete_image_api_images_image_id_delete ...'
40
+ end
41
+ # verify the required parameter 'image_id' is set
42
+ if @api_client.config.client_side_validation && image_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'image_id' when calling GalleryApi.delete_image_api_images_image_id_delete"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/images/{image_id}'.sub('{' + 'image_id' + '}', CGI.escape(image_id.to_s))
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:debug_body]
61
+
62
+ # return_type
63
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
64
+
65
+ # auth_names
66
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
67
+
68
+ new_options = opts.merge(
69
+ :operation => :"GalleryApi.delete_image_api_images_image_id_delete",
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => return_type
76
+ )
77
+
78
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: GalleryApi#delete_image_api_images_image_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+
85
+ # Edit Image Metadata
86
+ # Update metadata for an image.
87
+ # @param image_id [String]
88
+ # @param metadata_update [MetadataUpdate]
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Hash<String, Object>]
91
+ def edit_image_metadata_api_images_image_id_edit_post(image_id, metadata_update, opts = {})
92
+ data, _status_code, _headers = edit_image_metadata_api_images_image_id_edit_post_with_http_info(image_id, metadata_update, opts)
93
+ data
94
+ end
95
+
96
+ # Edit Image Metadata
97
+ # Update metadata for an image.
98
+ # @param image_id [String]
99
+ # @param metadata_update [MetadataUpdate]
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
102
+ def edit_image_metadata_api_images_image_id_edit_post_with_http_info(image_id, metadata_update, opts = {})
103
+ if @api_client.config.debugging
104
+ @api_client.config.logger.debug 'Calling API: GalleryApi.edit_image_metadata_api_images_image_id_edit_post ...'
105
+ end
106
+ # verify the required parameter 'image_id' is set
107
+ if @api_client.config.client_side_validation && image_id.nil?
108
+ fail ArgumentError, "Missing the required parameter 'image_id' when calling GalleryApi.edit_image_metadata_api_images_image_id_edit_post"
109
+ end
110
+ # verify the required parameter 'metadata_update' is set
111
+ if @api_client.config.client_side_validation && metadata_update.nil?
112
+ fail ArgumentError, "Missing the required parameter 'metadata_update' when calling GalleryApi.edit_image_metadata_api_images_image_id_edit_post"
113
+ end
114
+ # resource path
115
+ local_var_path = '/api/images/{image_id}/edit'.sub('{' + 'image_id' + '}', CGI.escape(image_id.to_s))
116
+
117
+ # query parameters
118
+ query_params = opts[:query_params] || {}
119
+
120
+ # header parameters
121
+ header_params = opts[:header_params] || {}
122
+ # HTTP header 'Accept' (if needed)
123
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
124
+ # HTTP header 'Content-Type'
125
+ content_type = @api_client.select_header_content_type(['application/json'])
126
+ if !content_type.nil?
127
+ header_params['Content-Type'] = content_type
128
+ end
129
+
130
+ # form parameters
131
+ form_params = opts[:form_params] || {}
132
+
133
+ # http body (model)
134
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(metadata_update)
135
+
136
+ # return_type
137
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
138
+
139
+ # auth_names
140
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
141
+
142
+ new_options = opts.merge(
143
+ :operation => :"GalleryApi.edit_image_metadata_api_images_image_id_edit_post",
144
+ :header_params => header_params,
145
+ :query_params => query_params,
146
+ :form_params => form_params,
147
+ :body => post_body,
148
+ :auth_names => auth_names,
149
+ :return_type => return_type
150
+ )
151
+
152
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "API called: GalleryApi#edit_image_metadata_api_images_image_id_edit_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+
159
+ # Gallery Stats
160
+ # Get gallery statistics.
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [Hash<String, Object>]
163
+ def gallery_stats_api_images_stats_summary_get(opts = {})
164
+ data, _status_code, _headers = gallery_stats_api_images_stats_summary_get_with_http_info(opts)
165
+ data
166
+ end
167
+
168
+ # Gallery Stats
169
+ # Get gallery statistics.
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
172
+ def gallery_stats_api_images_stats_summary_get_with_http_info(opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug 'Calling API: GalleryApi.gallery_stats_api_images_stats_summary_get ...'
175
+ end
176
+ # resource path
177
+ local_var_path = '/api/images/stats/summary'
178
+
179
+ # query parameters
180
+ query_params = opts[:query_params] || {}
181
+
182
+ # header parameters
183
+ header_params = opts[:header_params] || {}
184
+ # HTTP header 'Accept' (if needed)
185
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
186
+
187
+ # form parameters
188
+ form_params = opts[:form_params] || {}
189
+
190
+ # http body (model)
191
+ post_body = opts[:debug_body]
192
+
193
+ # return_type
194
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
195
+
196
+ # auth_names
197
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
198
+
199
+ new_options = opts.merge(
200
+ :operation => :"GalleryApi.gallery_stats_api_images_stats_summary_get",
201
+ :header_params => header_params,
202
+ :query_params => query_params,
203
+ :form_params => form_params,
204
+ :body => post_body,
205
+ :auth_names => auth_names,
206
+ :return_type => return_type
207
+ )
208
+
209
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug "API called: GalleryApi#gallery_stats_api_images_stats_summary_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
212
+ end
213
+ return data, status_code, headers
214
+ end
215
+
216
+ # Get Image
217
+ # Get an image file by ID.
218
+ # @param image_id [String]
219
+ # @param [Hash] opts the optional parameters
220
+ # @return [Object]
221
+ def get_image_api_images_image_id_get(image_id, opts = {})
222
+ data, _status_code, _headers = get_image_api_images_image_id_get_with_http_info(image_id, opts)
223
+ data
224
+ end
225
+
226
+ # Get Image
227
+ # Get an image file by ID.
228
+ # @param image_id [String]
229
+ # @param [Hash] opts the optional parameters
230
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
231
+ def get_image_api_images_image_id_get_with_http_info(image_id, opts = {})
232
+ if @api_client.config.debugging
233
+ @api_client.config.logger.debug 'Calling API: GalleryApi.get_image_api_images_image_id_get ...'
234
+ end
235
+ # verify the required parameter 'image_id' is set
236
+ if @api_client.config.client_side_validation && image_id.nil?
237
+ fail ArgumentError, "Missing the required parameter 'image_id' when calling GalleryApi.get_image_api_images_image_id_get"
238
+ end
239
+ # resource path
240
+ local_var_path = '/api/images/{image_id}'.sub('{' + 'image_id' + '}', CGI.escape(image_id.to_s))
241
+
242
+ # query parameters
243
+ query_params = opts[:query_params] || {}
244
+
245
+ # header parameters
246
+ header_params = opts[:header_params] || {}
247
+ # HTTP header 'Accept' (if needed)
248
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
249
+
250
+ # form parameters
251
+ form_params = opts[:form_params] || {}
252
+
253
+ # http body (model)
254
+ post_body = opts[:debug_body]
255
+
256
+ # return_type
257
+ return_type = opts[:debug_return_type] || 'Object'
258
+
259
+ # auth_names
260
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
261
+
262
+ new_options = opts.merge(
263
+ :operation => :"GalleryApi.get_image_api_images_image_id_get",
264
+ :header_params => header_params,
265
+ :query_params => query_params,
266
+ :form_params => form_params,
267
+ :body => post_body,
268
+ :auth_names => auth_names,
269
+ :return_type => return_type
270
+ )
271
+
272
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
273
+ if @api_client.config.debugging
274
+ @api_client.config.logger.debug "API called: GalleryApi#get_image_api_images_image_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
275
+ end
276
+ return data, status_code, headers
277
+ end
278
+
279
+ # Get Image Metadata
280
+ # Get metadata for an image.
281
+ # @param image_id [String]
282
+ # @param [Hash] opts the optional parameters
283
+ # @return [Hash<String, Object>]
284
+ def get_image_metadata_api_images_image_id_meta_get(image_id, opts = {})
285
+ data, _status_code, _headers = get_image_metadata_api_images_image_id_meta_get_with_http_info(image_id, opts)
286
+ data
287
+ end
288
+
289
+ # Get Image Metadata
290
+ # Get metadata for an image.
291
+ # @param image_id [String]
292
+ # @param [Hash] opts the optional parameters
293
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
294
+ def get_image_metadata_api_images_image_id_meta_get_with_http_info(image_id, opts = {})
295
+ if @api_client.config.debugging
296
+ @api_client.config.logger.debug 'Calling API: GalleryApi.get_image_metadata_api_images_image_id_meta_get ...'
297
+ end
298
+ # verify the required parameter 'image_id' is set
299
+ if @api_client.config.client_side_validation && image_id.nil?
300
+ fail ArgumentError, "Missing the required parameter 'image_id' when calling GalleryApi.get_image_metadata_api_images_image_id_meta_get"
301
+ end
302
+ # resource path
303
+ local_var_path = '/api/images/{image_id}/meta'.sub('{' + 'image_id' + '}', CGI.escape(image_id.to_s))
304
+
305
+ # query parameters
306
+ query_params = opts[:query_params] || {}
307
+
308
+ # header parameters
309
+ header_params = opts[:header_params] || {}
310
+ # HTTP header 'Accept' (if needed)
311
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
312
+
313
+ # form parameters
314
+ form_params = opts[:form_params] || {}
315
+
316
+ # http body (model)
317
+ post_body = opts[:debug_body]
318
+
319
+ # return_type
320
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
321
+
322
+ # auth_names
323
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
324
+
325
+ new_options = opts.merge(
326
+ :operation => :"GalleryApi.get_image_metadata_api_images_image_id_meta_get",
327
+ :header_params => header_params,
328
+ :query_params => query_params,
329
+ :form_params => form_params,
330
+ :body => post_body,
331
+ :auth_names => auth_names,
332
+ :return_type => return_type
333
+ )
334
+
335
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug "API called: GalleryApi#get_image_metadata_api_images_image_id_meta_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
338
+ end
339
+ return data, status_code, headers
340
+ end
341
+
342
+ # List Images
343
+ # List images in the gallery, paginated.
344
+ # @param [Hash] opts the optional parameters
345
+ # @option opts [Integer] :limit Max images to return (default to 50)
346
+ # @option opts [Integer] :offset Offset for pagination (default to 0)
347
+ # @option opts [Boolean] :newest_first Sort newest first (default to true)
348
+ # @return [Hash<String, Object>]
349
+ def list_images_api_images_get(opts = {})
350
+ data, _status_code, _headers = list_images_api_images_get_with_http_info(opts)
351
+ data
352
+ end
353
+
354
+ # List Images
355
+ # List images in the gallery, paginated.
356
+ # @param [Hash] opts the optional parameters
357
+ # @option opts [Integer] :limit Max images to return (default to 50)
358
+ # @option opts [Integer] :offset Offset for pagination (default to 0)
359
+ # @option opts [Boolean] :newest_first Sort newest first (default to true)
360
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
361
+ def list_images_api_images_get_with_http_info(opts = {})
362
+ if @api_client.config.debugging
363
+ @api_client.config.logger.debug 'Calling API: GalleryApi.list_images_api_images_get ...'
364
+ end
365
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
366
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling GalleryApi.list_images_api_images_get, must be smaller than or equal to 200.'
367
+ end
368
+
369
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
370
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling GalleryApi.list_images_api_images_get, must be greater than or equal to 0.'
371
+ end
372
+
373
+ # resource path
374
+ local_var_path = '/api/images'
375
+
376
+ # query parameters
377
+ query_params = opts[:query_params] || {}
378
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
379
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
380
+ query_params[:'newest_first'] = opts[:'newest_first'] if !opts[:'newest_first'].nil?
381
+
382
+ # header parameters
383
+ header_params = opts[:header_params] || {}
384
+ # HTTP header 'Accept' (if needed)
385
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
386
+
387
+ # form parameters
388
+ form_params = opts[:form_params] || {}
389
+
390
+ # http body (model)
391
+ post_body = opts[:debug_body]
392
+
393
+ # return_type
394
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
395
+
396
+ # auth_names
397
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
398
+
399
+ new_options = opts.merge(
400
+ :operation => :"GalleryApi.list_images_api_images_get",
401
+ :header_params => header_params,
402
+ :query_params => query_params,
403
+ :form_params => form_params,
404
+ :body => post_body,
405
+ :auth_names => auth_names,
406
+ :return_type => return_type
407
+ )
408
+
409
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
410
+ if @api_client.config.debugging
411
+ @api_client.config.logger.debug "API called: GalleryApi#list_images_api_images_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
412
+ end
413
+ return data, status_code, headers
414
+ end
415
+ end
416
+ end
@@ -0,0 +1,129 @@
1
+ =begin
2
+ #tensors
3
+
4
+ #API for CivitAI model management and image gallery
5
+
6
+ The version of the OpenAPI document: 0.1.18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module TensorsApi
16
+ class SearchApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Search Models
23
+ # Search models across CivitAI and/or Hugging Face. Returns results from selected provider(s). When provider=all, returns results from both CivitAI and Hugging Face in separate keys.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :query Search query
26
+ # @option opts [Provider] :provider Search provider (civitai, hf, or all)
27
+ # @option opts [String] :types Model type - CivitAI (Checkpoint, LORA, etc.)
28
+ # @option opts [String] :base_models Base model - CivitAI
29
+ # @option opts [String] :period Time period - CivitAI (AllTime, Year, Month, Week, Day)
30
+ # @option opts [String] :nsfw NSFW level - CivitAI (None, Soft, Mature, X)
31
+ # @option opts [Boolean] :sfw Exclude NSFW - CivitAI (default to false)
32
+ # @option opts [String] :commercial Commercial use - CivitAI (None, Image, Rent, Sell)
33
+ # @option opts [Integer] :page Page number - CivitAI
34
+ # @option opts [String] :pipeline Pipeline tag - HuggingFace (text-to-image, etc.)
35
+ # @option opts [SortOrder] :sort Sort order
36
+ # @option opts [Integer] :limit Max results per provider (default to 25)
37
+ # @option opts [String] :tag Filter by tag
38
+ # @option opts [String] :author Filter by author/creator
39
+ # @return [Hash<String, Object>]
40
+ def search_models_api_search_get(opts = {})
41
+ data, _status_code, _headers = search_models_api_search_get_with_http_info(opts)
42
+ data
43
+ end
44
+
45
+ # Search Models
46
+ # Search models across CivitAI and/or Hugging Face. Returns results from selected provider(s). When provider&#x3D;all, returns results from both CivitAI and Hugging Face in separate keys.
47
+ # @param [Hash] opts the optional parameters
48
+ # @option opts [String] :query Search query
49
+ # @option opts [Provider] :provider Search provider (civitai, hf, or all)
50
+ # @option opts [String] :types Model type - CivitAI (Checkpoint, LORA, etc.)
51
+ # @option opts [String] :base_models Base model - CivitAI
52
+ # @option opts [String] :period Time period - CivitAI (AllTime, Year, Month, Week, Day)
53
+ # @option opts [String] :nsfw NSFW level - CivitAI (None, Soft, Mature, X)
54
+ # @option opts [Boolean] :sfw Exclude NSFW - CivitAI (default to false)
55
+ # @option opts [String] :commercial Commercial use - CivitAI (None, Image, Rent, Sell)
56
+ # @option opts [Integer] :page Page number - CivitAI
57
+ # @option opts [String] :pipeline Pipeline tag - HuggingFace (text-to-image, etc.)
58
+ # @option opts [SortOrder] :sort Sort order
59
+ # @option opts [Integer] :limit Max results per provider (default to 25)
60
+ # @option opts [String] :tag Filter by tag
61
+ # @option opts [String] :author Filter by author/creator
62
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
63
+ def search_models_api_search_get_with_http_info(opts = {})
64
+ if @api_client.config.debugging
65
+ @api_client.config.logger.debug 'Calling API: SearchApi.search_models_api_search_get ...'
66
+ end
67
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
68
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling SearchApi.search_models_api_search_get, must be greater than or equal to 1.'
69
+ end
70
+
71
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
72
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SearchApi.search_models_api_search_get, must be smaller than or equal to 100.'
73
+ end
74
+
75
+ # resource path
76
+ local_var_path = '/api/search'
77
+
78
+ # query parameters
79
+ query_params = opts[:query_params] || {}
80
+ query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
81
+ query_params[:'provider'] = opts[:'provider'] if !opts[:'provider'].nil?
82
+ query_params[:'types'] = opts[:'types'] if !opts[:'types'].nil?
83
+ query_params[:'baseModels'] = opts[:'base_models'] if !opts[:'base_models'].nil?
84
+ query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?
85
+ query_params[:'nsfw'] = opts[:'nsfw'] if !opts[:'nsfw'].nil?
86
+ query_params[:'sfw'] = opts[:'sfw'] if !opts[:'sfw'].nil?
87
+ query_params[:'commercial'] = opts[:'commercial'] if !opts[:'commercial'].nil?
88
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
89
+ query_params[:'pipeline'] = opts[:'pipeline'] if !opts[:'pipeline'].nil?
90
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
91
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
92
+ query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
93
+ query_params[:'author'] = opts[:'author'] if !opts[:'author'].nil?
94
+
95
+ # header parameters
96
+ header_params = opts[:header_params] || {}
97
+ # HTTP header 'Accept' (if needed)
98
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
99
+
100
+ # form parameters
101
+ form_params = opts[:form_params] || {}
102
+
103
+ # http body (model)
104
+ post_body = opts[:debug_body]
105
+
106
+ # return_type
107
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
108
+
109
+ # auth_names
110
+ auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQuery']
111
+
112
+ new_options = opts.merge(
113
+ :operation => :"SearchApi.search_models_api_search_get",
114
+ :header_params => header_params,
115
+ :query_params => query_params,
116
+ :form_params => form_params,
117
+ :body => post_body,
118
+ :auth_names => auth_names,
119
+ :return_type => return_type
120
+ )
121
+
122
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
123
+ if @api_client.config.debugging
124
+ @api_client.config.logger.debug "API called: SearchApi#search_models_api_search_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
125
+ end
126
+ return data, status_code, headers
127
+ end
128
+ end
129
+ end