pulp_hugging_face_client 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +176 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +18 -0
  6. data/docs/ContentHuggingFaceApi.md +424 -0
  7. data/docs/ContentSummaryResponse.md +22 -0
  8. data/docs/DistributionsHuggingFaceApi.md +671 -0
  9. data/docs/HuggingFaceHuggingFaceContent.md +36 -0
  10. data/docs/HuggingFaceHuggingFaceContentResponse.md +42 -0
  11. data/docs/HuggingFaceHuggingFaceDistribution.md +32 -0
  12. data/docs/HuggingFaceHuggingFaceDistributionResponse.md +44 -0
  13. data/docs/HuggingFaceHuggingFacePublication.md +20 -0
  14. data/docs/HuggingFaceHuggingFacePublicationResponse.md +28 -0
  15. data/docs/HuggingFaceHuggingFaceRemote.md +62 -0
  16. data/docs/HuggingFaceHuggingFaceRemoteResponse.md +62 -0
  17. data/docs/HuggingFaceHuggingFaceRemoteResponseHiddenFieldsInner.md +20 -0
  18. data/docs/HuggingFaceHuggingFaceRepository.md +26 -0
  19. data/docs/HuggingFaceHuggingFaceRepositoryResponse.md +38 -0
  20. data/docs/PaginatedRepositoryVersionResponseList.md +24 -0
  21. data/docs/PaginatedhuggingFaceHuggingFaceContentResponseList.md +24 -0
  22. data/docs/PaginatedhuggingFaceHuggingFaceDistributionResponseList.md +24 -0
  23. data/docs/PaginatedhuggingFaceHuggingFacePublicationResponseList.md +24 -0
  24. data/docs/PaginatedhuggingFaceHuggingFaceRemoteResponseList.md +24 -0
  25. data/docs/PaginatedhuggingFaceHuggingFaceRepositoryResponseList.md +24 -0
  26. data/docs/PatchedhuggingFaceHuggingFaceDistribution.md +32 -0
  27. data/docs/PatchedhuggingFaceHuggingFaceRemote.md +62 -0
  28. data/docs/PatchedhuggingFaceHuggingFaceRepository.md +26 -0
  29. data/docs/PolicyEnum.md +15 -0
  30. data/docs/PublicationsHuggingFaceApi.md +350 -0
  31. data/docs/RemotesHuggingFaceApi.md +669 -0
  32. data/docs/Repair.md +18 -0
  33. data/docs/RepoTypeEnum.md +15 -0
  34. data/docs/RepositoriesHuggingFaceApi.md +831 -0
  35. data/docs/RepositoriesHuggingFaceVersionsApi.md +359 -0
  36. data/docs/RepositoryAddRemoveContent.md +22 -0
  37. data/docs/RepositorySyncURL.md +20 -0
  38. data/docs/RepositoryVersionResponse.md +32 -0
  39. data/docs/SetLabel.md +20 -0
  40. data/docs/SetLabelResponse.md +20 -0
  41. data/docs/UnsetLabel.md +18 -0
  42. data/docs/UnsetLabelResponse.md +20 -0
  43. data/lib/pulp_hugging_face_client/api/content_hugging_face_api.rb +441 -0
  44. data/lib/pulp_hugging_face_client/api/distributions_hugging_face_api.rb +684 -0
  45. data/lib/pulp_hugging_face_client/api/publications_hugging_face_api.rb +356 -0
  46. data/lib/pulp_hugging_face_client/api/remotes_hugging_face_api.rb +681 -0
  47. data/lib/pulp_hugging_face_client/api/repositories_hugging_face_api.rb +847 -0
  48. data/lib/pulp_hugging_face_client/api/repositories_hugging_face_versions_api.rb +374 -0
  49. data/lib/pulp_hugging_face_client/api_client.rb +438 -0
  50. data/lib/pulp_hugging_face_client/api_error.rb +58 -0
  51. data/lib/pulp_hugging_face_client/configuration.rb +392 -0
  52. data/lib/pulp_hugging_face_client/models/async_operation_response.rb +223 -0
  53. data/lib/pulp_hugging_face_client/models/content_summary_response.rb +260 -0
  54. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_content.rb +428 -0
  55. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_content_response.rb +385 -0
  56. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_distribution.rb +345 -0
  57. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_distribution_response.rb +366 -0
  58. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_publication.rb +225 -0
  59. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_publication_response.rb +264 -0
  60. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_remote.rb +745 -0
  61. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_remote_response.rb +564 -0
  62. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_remote_response_hidden_fields_inner.rb +237 -0
  63. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_repository.rb +316 -0
  64. data/lib/pulp_hugging_face_client/models/hugging_face_hugging_face_repository_response.rb +339 -0
  65. data/lib/pulp_hugging_face_client/models/paginated_repository_version_response_list.rb +259 -0
  66. data/lib/pulp_hugging_face_client/models/paginatedhugging_face_hugging_face_content_response_list.rb +259 -0
  67. data/lib/pulp_hugging_face_client/models/paginatedhugging_face_hugging_face_distribution_response_list.rb +259 -0
  68. data/lib/pulp_hugging_face_client/models/paginatedhugging_face_hugging_face_publication_response_list.rb +259 -0
  69. data/lib/pulp_hugging_face_client/models/paginatedhugging_face_hugging_face_remote_response_list.rb +259 -0
  70. data/lib/pulp_hugging_face_client/models/paginatedhugging_face_hugging_face_repository_response_list.rb +259 -0
  71. data/lib/pulp_hugging_face_client/models/patchedhugging_face_hugging_face_distribution.rb +331 -0
  72. data/lib/pulp_hugging_face_client/models/patchedhugging_face_hugging_face_remote.rb +731 -0
  73. data/lib/pulp_hugging_face_client/models/patchedhugging_face_hugging_face_repository.rb +309 -0
  74. data/lib/pulp_hugging_face_client/models/policy_enum.rb +41 -0
  75. data/lib/pulp_hugging_face_client/models/repair.rb +217 -0
  76. data/lib/pulp_hugging_face_client/models/repo_type_enum.rb +41 -0
  77. data/lib/pulp_hugging_face_client/models/repository_add_remove_content.rb +240 -0
  78. data/lib/pulp_hugging_face_client/models/repository_sync_url.rb +228 -0
  79. data/lib/pulp_hugging_face_client/models/repository_version_response.rb +283 -0
  80. data/lib/pulp_hugging_face_client/models/set_label.rb +264 -0
  81. data/lib/pulp_hugging_face_client/models/set_label_response.rb +255 -0
  82. data/lib/pulp_hugging_face_client/models/unset_label.rb +252 -0
  83. data/lib/pulp_hugging_face_client/models/unset_label_response.rb +252 -0
  84. data/lib/pulp_hugging_face_client/version.rb +15 -0
  85. data/lib/pulp_hugging_face_client.rb +77 -0
  86. data/pulp_hugging_face_client.gemspec +41 -0
  87. data/spec/api/content_hugging_face_api_spec.rb +121 -0
  88. data/spec/api/distributions_hugging_face_api_spec.rb +171 -0
  89. data/spec/api/publications_hugging_face_api_spec.rb +109 -0
  90. data/spec/api/remotes_hugging_face_api_spec.rb +170 -0
  91. data/spec/api/repositories_hugging_face_api_spec.rb +202 -0
  92. data/spec/api/repositories_hugging_face_versions_api_spec.rb +112 -0
  93. data/spec/models/async_operation_response_spec.rb +36 -0
  94. data/spec/models/content_summary_response_spec.rb +48 -0
  95. data/spec/models/hugging_face_hugging_face_content_response_spec.rb +108 -0
  96. data/spec/models/hugging_face_hugging_face_content_spec.rb +90 -0
  97. data/spec/models/hugging_face_hugging_face_distribution_response_spec.rb +114 -0
  98. data/spec/models/hugging_face_hugging_face_distribution_spec.rb +78 -0
  99. data/spec/models/hugging_face_hugging_face_publication_response_spec.rb +66 -0
  100. data/spec/models/hugging_face_hugging_face_publication_spec.rb +42 -0
  101. data/spec/models/hugging_face_hugging_face_remote_response_hidden_fields_inner_spec.rb +42 -0
  102. data/spec/models/hugging_face_hugging_face_remote_response_spec.rb +168 -0
  103. data/spec/models/hugging_face_hugging_face_remote_spec.rb +168 -0
  104. data/spec/models/hugging_face_hugging_face_repository_response_spec.rb +96 -0
  105. data/spec/models/hugging_face_hugging_face_repository_spec.rb +60 -0
  106. data/spec/models/paginated_repository_version_response_list_spec.rb +54 -0
  107. data/spec/models/paginatedhugging_face_hugging_face_content_response_list_spec.rb +54 -0
  108. data/spec/models/paginatedhugging_face_hugging_face_distribution_response_list_spec.rb +54 -0
  109. data/spec/models/paginatedhugging_face_hugging_face_publication_response_list_spec.rb +54 -0
  110. data/spec/models/paginatedhugging_face_hugging_face_remote_response_list_spec.rb +54 -0
  111. data/spec/models/paginatedhugging_face_hugging_face_repository_response_list_spec.rb +54 -0
  112. data/spec/models/patchedhugging_face_hugging_face_distribution_spec.rb +78 -0
  113. data/spec/models/patchedhugging_face_hugging_face_remote_spec.rb +168 -0
  114. data/spec/models/patchedhugging_face_hugging_face_repository_spec.rb +60 -0
  115. data/spec/models/policy_enum_spec.rb +30 -0
  116. data/spec/models/repair_spec.rb +36 -0
  117. data/spec/models/repo_type_enum_spec.rb +30 -0
  118. data/spec/models/repository_add_remove_content_spec.rb +48 -0
  119. data/spec/models/repository_sync_url_spec.rb +42 -0
  120. data/spec/models/repository_version_response_spec.rb +78 -0
  121. data/spec/models/set_label_response_spec.rb +42 -0
  122. data/spec/models/set_label_spec.rb +42 -0
  123. data/spec/models/unset_label_response_spec.rb +42 -0
  124. data/spec/models/unset_label_spec.rb +36 -0
  125. data/spec/spec_helper.rb +111 -0
  126. metadata +274 -0
@@ -0,0 +1,745 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpHuggingFaceClient
17
+ # A Serializer for HuggingFaceRemote with Hugging Face specific configuration.
18
+ class HuggingFaceHuggingFaceRemote
19
+ # A unique name for this remote.
20
+ attr_accessor :name
21
+
22
+ # The URL of an external content source.
23
+ attr_accessor :url
24
+
25
+ # A PEM encoded CA certificate used to validate the server certificate presented by the remote server.
26
+ attr_accessor :ca_cert
27
+
28
+ # A PEM encoded client certificate used for authentication.
29
+ attr_accessor :client_cert
30
+
31
+ # A PEM encoded private key used for authentication.
32
+ attr_accessor :client_key
33
+
34
+ # If True, TLS peer validation must be performed.
35
+ attr_accessor :tls_validation
36
+
37
+ # The proxy URL. Format: scheme://host:port
38
+ attr_accessor :proxy_url
39
+
40
+ # The username to authenticte to the proxy.
41
+ attr_accessor :proxy_username
42
+
43
+ # The password to authenticate to the proxy. Extra leading and trailing whitespace characters are not trimmed.
44
+ attr_accessor :proxy_password
45
+
46
+ # The username to be used for authentication when syncing.
47
+ attr_accessor :username
48
+
49
+ # The password to be used for authentication when syncing. Extra leading and trailing whitespace characters are not trimmed.
50
+ attr_accessor :password
51
+
52
+ attr_accessor :pulp_labels
53
+
54
+ # Total number of simultaneous connections. If not set then the default value will be used.
55
+ attr_accessor :download_concurrency
56
+
57
+ # Maximum number of retry attempts after a download failure. If not set then the default value (3) will be used.
58
+ attr_accessor :max_retries
59
+
60
+ # The policy to use when downloading content. The possible values include: 'immediate', 'on_demand', and 'streamed'. 'on_demand' enables pull-through caching. * `immediate` - When syncing, download all metadata and content now. * `on_demand` - When syncing, download metadata, but do not download content now. Instead, download content as clients request it, and save it in Pulp to be served for future client requests. * `streamed` - When syncing, download metadata, but do not download content now. Instead,download content as clients request it, but never save it in Pulp. This causes future requests for that same content to have to be downloaded again.
61
+ attr_accessor :policy
62
+
63
+ # aiohttp.ClientTimeout.total (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
64
+ attr_accessor :total_timeout
65
+
66
+ # aiohttp.ClientTimeout.connect (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
67
+ attr_accessor :connect_timeout
68
+
69
+ # aiohttp.ClientTimeout.sock_connect (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
70
+ attr_accessor :sock_connect_timeout
71
+
72
+ # aiohttp.ClientTimeout.sock_read (q.v.) for download-connections. The default is null, which will cause the default from the aiohttp library to be used.
73
+ attr_accessor :sock_read_timeout
74
+
75
+ # Headers for aiohttp.Clientsession
76
+ attr_accessor :headers
77
+
78
+ # Limits requests per second for each concurrent downloader
79
+ attr_accessor :rate_limit
80
+
81
+ # Base URL for Hugging Face Hub
82
+ attr_accessor :hf_hub_url
83
+
84
+ # Hugging Face authentication token for private repositories
85
+ attr_accessor :hf_token
86
+
87
+ class EnumAttributeValidator
88
+ attr_reader :datatype
89
+ attr_reader :allowable_values
90
+
91
+ def initialize(datatype, allowable_values)
92
+ @allowable_values = allowable_values.map do |value|
93
+ case datatype.to_s
94
+ when /Integer/i
95
+ value.to_i
96
+ when /Float/i
97
+ value.to_f
98
+ else
99
+ value
100
+ end
101
+ end
102
+ end
103
+
104
+ def valid?(value)
105
+ !value || allowable_values.include?(value)
106
+ end
107
+ end
108
+
109
+ # Attribute mapping from ruby-style variable name to JSON key.
110
+ def self.attribute_map
111
+ {
112
+ :'name' => :'name',
113
+ :'url' => :'url',
114
+ :'ca_cert' => :'ca_cert',
115
+ :'client_cert' => :'client_cert',
116
+ :'client_key' => :'client_key',
117
+ :'tls_validation' => :'tls_validation',
118
+ :'proxy_url' => :'proxy_url',
119
+ :'proxy_username' => :'proxy_username',
120
+ :'proxy_password' => :'proxy_password',
121
+ :'username' => :'username',
122
+ :'password' => :'password',
123
+ :'pulp_labels' => :'pulp_labels',
124
+ :'download_concurrency' => :'download_concurrency',
125
+ :'max_retries' => :'max_retries',
126
+ :'policy' => :'policy',
127
+ :'total_timeout' => :'total_timeout',
128
+ :'connect_timeout' => :'connect_timeout',
129
+ :'sock_connect_timeout' => :'sock_connect_timeout',
130
+ :'sock_read_timeout' => :'sock_read_timeout',
131
+ :'headers' => :'headers',
132
+ :'rate_limit' => :'rate_limit',
133
+ :'hf_hub_url' => :'hf_hub_url',
134
+ :'hf_token' => :'hf_token'
135
+ }
136
+ end
137
+
138
+ # Returns all the JSON keys this model knows about
139
+ def self.acceptable_attributes
140
+ attribute_map.values
141
+ end
142
+
143
+ # Attribute type mapping.
144
+ def self.openapi_types
145
+ {
146
+ :'name' => :'String',
147
+ :'url' => :'String',
148
+ :'ca_cert' => :'String',
149
+ :'client_cert' => :'String',
150
+ :'client_key' => :'String',
151
+ :'tls_validation' => :'Boolean',
152
+ :'proxy_url' => :'String',
153
+ :'proxy_username' => :'String',
154
+ :'proxy_password' => :'String',
155
+ :'username' => :'String',
156
+ :'password' => :'String',
157
+ :'pulp_labels' => :'Hash<String, String>',
158
+ :'download_concurrency' => :'Integer',
159
+ :'max_retries' => :'Integer',
160
+ :'policy' => :'PolicyEnum',
161
+ :'total_timeout' => :'Float',
162
+ :'connect_timeout' => :'Float',
163
+ :'sock_connect_timeout' => :'Float',
164
+ :'sock_read_timeout' => :'Float',
165
+ :'headers' => :'Array<Object>',
166
+ :'rate_limit' => :'Integer',
167
+ :'hf_hub_url' => :'String',
168
+ :'hf_token' => :'String'
169
+ }
170
+ end
171
+
172
+ # List of attributes with nullable: true
173
+ def self.openapi_nullable
174
+ Set.new([
175
+ :'ca_cert',
176
+ :'client_cert',
177
+ :'client_key',
178
+ :'proxy_url',
179
+ :'proxy_username',
180
+ :'proxy_password',
181
+ :'username',
182
+ :'password',
183
+ :'download_concurrency',
184
+ :'max_retries',
185
+ :'total_timeout',
186
+ :'connect_timeout',
187
+ :'sock_connect_timeout',
188
+ :'sock_read_timeout',
189
+ :'rate_limit',
190
+ :'hf_token'
191
+ ])
192
+ end
193
+
194
+ # Initializes the object
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ def initialize(attributes = {})
197
+ if (!attributes.is_a?(Hash))
198
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpHuggingFaceClient::HuggingFaceHuggingFaceRemote` initialize method"
199
+ end
200
+
201
+ # check to see if the attribute exists and convert string to symbol for hash key
202
+ attributes = attributes.each_with_object({}) { |(k, v), h|
203
+ if (!self.class.attribute_map.key?(k.to_sym))
204
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpHuggingFaceClient::HuggingFaceHuggingFaceRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
205
+ end
206
+ h[k.to_sym] = v
207
+ }
208
+
209
+ if attributes.key?(:'name')
210
+ self.name = attributes[:'name']
211
+ else
212
+ self.name = nil
213
+ end
214
+
215
+ if attributes.key?(:'url')
216
+ self.url = attributes[:'url']
217
+ else
218
+ self.url = nil
219
+ end
220
+
221
+ if attributes.key?(:'ca_cert')
222
+ self.ca_cert = attributes[:'ca_cert']
223
+ end
224
+
225
+ if attributes.key?(:'client_cert')
226
+ self.client_cert = attributes[:'client_cert']
227
+ end
228
+
229
+ if attributes.key?(:'client_key')
230
+ self.client_key = attributes[:'client_key']
231
+ end
232
+
233
+ if attributes.key?(:'tls_validation')
234
+ self.tls_validation = attributes[:'tls_validation']
235
+ end
236
+
237
+ if attributes.key?(:'proxy_url')
238
+ self.proxy_url = attributes[:'proxy_url']
239
+ end
240
+
241
+ if attributes.key?(:'proxy_username')
242
+ self.proxy_username = attributes[:'proxy_username']
243
+ end
244
+
245
+ if attributes.key?(:'proxy_password')
246
+ self.proxy_password = attributes[:'proxy_password']
247
+ end
248
+
249
+ if attributes.key?(:'username')
250
+ self.username = attributes[:'username']
251
+ end
252
+
253
+ if attributes.key?(:'password')
254
+ self.password = attributes[:'password']
255
+ end
256
+
257
+ if attributes.key?(:'pulp_labels')
258
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
259
+ self.pulp_labels = value
260
+ end
261
+ end
262
+
263
+ if attributes.key?(:'download_concurrency')
264
+ self.download_concurrency = attributes[:'download_concurrency']
265
+ end
266
+
267
+ if attributes.key?(:'max_retries')
268
+ self.max_retries = attributes[:'max_retries']
269
+ end
270
+
271
+ if attributes.key?(:'policy')
272
+ self.policy = attributes[:'policy']
273
+ end
274
+
275
+ if attributes.key?(:'total_timeout')
276
+ self.total_timeout = attributes[:'total_timeout']
277
+ end
278
+
279
+ if attributes.key?(:'connect_timeout')
280
+ self.connect_timeout = attributes[:'connect_timeout']
281
+ end
282
+
283
+ if attributes.key?(:'sock_connect_timeout')
284
+ self.sock_connect_timeout = attributes[:'sock_connect_timeout']
285
+ end
286
+
287
+ if attributes.key?(:'sock_read_timeout')
288
+ self.sock_read_timeout = attributes[:'sock_read_timeout']
289
+ end
290
+
291
+ if attributes.key?(:'headers')
292
+ if (value = attributes[:'headers']).is_a?(Array)
293
+ self.headers = value
294
+ end
295
+ end
296
+
297
+ if attributes.key?(:'rate_limit')
298
+ self.rate_limit = attributes[:'rate_limit']
299
+ end
300
+
301
+ if attributes.key?(:'hf_hub_url')
302
+ self.hf_hub_url = attributes[:'hf_hub_url']
303
+ else
304
+ self.hf_hub_url = 'https://huggingface.co'
305
+ end
306
+
307
+ if attributes.key?(:'hf_token')
308
+ self.hf_token = attributes[:'hf_token']
309
+ end
310
+ end
311
+
312
+ # Show invalid properties with the reasons. Usually used together with valid?
313
+ # @return Array for valid properties with the reasons
314
+ def list_invalid_properties
315
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
316
+ invalid_properties = Array.new
317
+ if @name.nil?
318
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
319
+ end
320
+
321
+ if @name.to_s.length < 1
322
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
323
+ end
324
+
325
+ if @url.nil?
326
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
327
+ end
328
+
329
+ if @url.to_s.length < 1
330
+ invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
331
+ end
332
+
333
+ if !@ca_cert.nil? && @ca_cert.to_s.length < 1
334
+ invalid_properties.push('invalid value for "ca_cert", the character length must be great than or equal to 1.')
335
+ end
336
+
337
+ if !@client_cert.nil? && @client_cert.to_s.length < 1
338
+ invalid_properties.push('invalid value for "client_cert", the character length must be great than or equal to 1.')
339
+ end
340
+
341
+ if !@client_key.nil? && @client_key.to_s.length < 1
342
+ invalid_properties.push('invalid value for "client_key", the character length must be great than or equal to 1.')
343
+ end
344
+
345
+ if !@proxy_url.nil? && @proxy_url.to_s.length < 1
346
+ invalid_properties.push('invalid value for "proxy_url", the character length must be great than or equal to 1.')
347
+ end
348
+
349
+ if !@proxy_username.nil? && @proxy_username.to_s.length < 1
350
+ invalid_properties.push('invalid value for "proxy_username", the character length must be great than or equal to 1.')
351
+ end
352
+
353
+ if !@proxy_password.nil? && @proxy_password.to_s.length < 1
354
+ invalid_properties.push('invalid value for "proxy_password", the character length must be great than or equal to 1.')
355
+ end
356
+
357
+ if !@username.nil? && @username.to_s.length < 1
358
+ invalid_properties.push('invalid value for "username", the character length must be great than or equal to 1.')
359
+ end
360
+
361
+ if !@password.nil? && @password.to_s.length < 1
362
+ invalid_properties.push('invalid value for "password", the character length must be great than or equal to 1.')
363
+ end
364
+
365
+ if !@download_concurrency.nil? && @download_concurrency < 1
366
+ invalid_properties.push('invalid value for "download_concurrency", must be greater than or equal to 1.')
367
+ end
368
+
369
+ if !@total_timeout.nil? && @total_timeout < 0.0
370
+ invalid_properties.push('invalid value for "total_timeout", must be greater than or equal to 0.0.')
371
+ end
372
+
373
+ if !@connect_timeout.nil? && @connect_timeout < 0.0
374
+ invalid_properties.push('invalid value for "connect_timeout", must be greater than or equal to 0.0.')
375
+ end
376
+
377
+ if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
378
+ invalid_properties.push('invalid value for "sock_connect_timeout", must be greater than or equal to 0.0.')
379
+ end
380
+
381
+ if !@sock_read_timeout.nil? && @sock_read_timeout < 0.0
382
+ invalid_properties.push('invalid value for "sock_read_timeout", must be greater than or equal to 0.0.')
383
+ end
384
+
385
+ if !@hf_hub_url.nil? && @hf_hub_url.to_s.length < 1
386
+ invalid_properties.push('invalid value for "hf_hub_url", the character length must be great than or equal to 1.')
387
+ end
388
+
389
+ invalid_properties
390
+ end
391
+
392
+ # Check to see if the all the properties in the model are valid
393
+ # @return true if the model is valid
394
+ def valid?
395
+ warn '[DEPRECATED] the `valid?` method is obsolete'
396
+ return false if @name.nil?
397
+ return false if @name.to_s.length < 1
398
+ return false if @url.nil?
399
+ return false if @url.to_s.length < 1
400
+ return false if !@ca_cert.nil? && @ca_cert.to_s.length < 1
401
+ return false if !@client_cert.nil? && @client_cert.to_s.length < 1
402
+ return false if !@client_key.nil? && @client_key.to_s.length < 1
403
+ return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1
404
+ return false if !@proxy_username.nil? && @proxy_username.to_s.length < 1
405
+ return false if !@proxy_password.nil? && @proxy_password.to_s.length < 1
406
+ return false if !@username.nil? && @username.to_s.length < 1
407
+ return false if !@password.nil? && @password.to_s.length < 1
408
+ return false if !@download_concurrency.nil? && @download_concurrency < 1
409
+ return false if !@total_timeout.nil? && @total_timeout < 0.0
410
+ return false if !@connect_timeout.nil? && @connect_timeout < 0.0
411
+ return false if !@sock_connect_timeout.nil? && @sock_connect_timeout < 0.0
412
+ return false if !@sock_read_timeout.nil? && @sock_read_timeout < 0.0
413
+ return false if !@hf_hub_url.nil? && @hf_hub_url.to_s.length < 1
414
+ true
415
+ end
416
+
417
+ # Custom attribute writer method with validation
418
+ # @param [Object] name Value to be assigned
419
+ def name=(name)
420
+ if name.nil?
421
+ fail ArgumentError, 'name cannot be nil'
422
+ end
423
+
424
+ if name.to_s.length < 1
425
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
426
+ end
427
+
428
+ @name = name
429
+ end
430
+
431
+ # Custom attribute writer method with validation
432
+ # @param [Object] url Value to be assigned
433
+ def url=(url)
434
+ if url.nil?
435
+ fail ArgumentError, 'url cannot be nil'
436
+ end
437
+
438
+ if url.to_s.length < 1
439
+ fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
440
+ end
441
+
442
+ @url = url
443
+ end
444
+
445
+ # Custom attribute writer method with validation
446
+ # @param [Object] ca_cert Value to be assigned
447
+ def ca_cert=(ca_cert)
448
+ if !ca_cert.nil? && ca_cert.to_s.length < 1
449
+ fail ArgumentError, 'invalid value for "ca_cert", the character length must be great than or equal to 1.'
450
+ end
451
+
452
+ @ca_cert = ca_cert
453
+ end
454
+
455
+ # Custom attribute writer method with validation
456
+ # @param [Object] client_cert Value to be assigned
457
+ def client_cert=(client_cert)
458
+ if !client_cert.nil? && client_cert.to_s.length < 1
459
+ fail ArgumentError, 'invalid value for "client_cert", the character length must be great than or equal to 1.'
460
+ end
461
+
462
+ @client_cert = client_cert
463
+ end
464
+
465
+ # Custom attribute writer method with validation
466
+ # @param [Object] client_key Value to be assigned
467
+ def client_key=(client_key)
468
+ if !client_key.nil? && client_key.to_s.length < 1
469
+ fail ArgumentError, 'invalid value for "client_key", the character length must be great than or equal to 1.'
470
+ end
471
+
472
+ @client_key = client_key
473
+ end
474
+
475
+ # Custom attribute writer method with validation
476
+ # @param [Object] proxy_url Value to be assigned
477
+ def proxy_url=(proxy_url)
478
+ if !proxy_url.nil? && proxy_url.to_s.length < 1
479
+ fail ArgumentError, 'invalid value for "proxy_url", the character length must be great than or equal to 1.'
480
+ end
481
+
482
+ @proxy_url = proxy_url
483
+ end
484
+
485
+ # Custom attribute writer method with validation
486
+ # @param [Object] proxy_username Value to be assigned
487
+ def proxy_username=(proxy_username)
488
+ if !proxy_username.nil? && proxy_username.to_s.length < 1
489
+ fail ArgumentError, 'invalid value for "proxy_username", the character length must be great than or equal to 1.'
490
+ end
491
+
492
+ @proxy_username = proxy_username
493
+ end
494
+
495
+ # Custom attribute writer method with validation
496
+ # @param [Object] proxy_password Value to be assigned
497
+ def proxy_password=(proxy_password)
498
+ if !proxy_password.nil? && proxy_password.to_s.length < 1
499
+ fail ArgumentError, 'invalid value for "proxy_password", the character length must be great than or equal to 1.'
500
+ end
501
+
502
+ @proxy_password = proxy_password
503
+ end
504
+
505
+ # Custom attribute writer method with validation
506
+ # @param [Object] username Value to be assigned
507
+ def username=(username)
508
+ if !username.nil? && username.to_s.length < 1
509
+ fail ArgumentError, 'invalid value for "username", the character length must be great than or equal to 1.'
510
+ end
511
+
512
+ @username = username
513
+ end
514
+
515
+ # Custom attribute writer method with validation
516
+ # @param [Object] password Value to be assigned
517
+ def password=(password)
518
+ if !password.nil? && password.to_s.length < 1
519
+ fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 1.'
520
+ end
521
+
522
+ @password = password
523
+ end
524
+
525
+ # Custom attribute writer method with validation
526
+ # @param [Object] download_concurrency Value to be assigned
527
+ def download_concurrency=(download_concurrency)
528
+ if !download_concurrency.nil? && download_concurrency < 1
529
+ fail ArgumentError, 'invalid value for "download_concurrency", must be greater than or equal to 1.'
530
+ end
531
+
532
+ @download_concurrency = download_concurrency
533
+ end
534
+
535
+ # Custom attribute writer method with validation
536
+ # @param [Object] total_timeout Value to be assigned
537
+ def total_timeout=(total_timeout)
538
+ if !total_timeout.nil? && total_timeout < 0.0
539
+ fail ArgumentError, 'invalid value for "total_timeout", must be greater than or equal to 0.0.'
540
+ end
541
+
542
+ @total_timeout = total_timeout
543
+ end
544
+
545
+ # Custom attribute writer method with validation
546
+ # @param [Object] connect_timeout Value to be assigned
547
+ def connect_timeout=(connect_timeout)
548
+ if !connect_timeout.nil? && connect_timeout < 0.0
549
+ fail ArgumentError, 'invalid value for "connect_timeout", must be greater than or equal to 0.0.'
550
+ end
551
+
552
+ @connect_timeout = connect_timeout
553
+ end
554
+
555
+ # Custom attribute writer method with validation
556
+ # @param [Object] sock_connect_timeout Value to be assigned
557
+ def sock_connect_timeout=(sock_connect_timeout)
558
+ if !sock_connect_timeout.nil? && sock_connect_timeout < 0.0
559
+ fail ArgumentError, 'invalid value for "sock_connect_timeout", must be greater than or equal to 0.0.'
560
+ end
561
+
562
+ @sock_connect_timeout = sock_connect_timeout
563
+ end
564
+
565
+ # Custom attribute writer method with validation
566
+ # @param [Object] sock_read_timeout Value to be assigned
567
+ def sock_read_timeout=(sock_read_timeout)
568
+ if !sock_read_timeout.nil? && sock_read_timeout < 0.0
569
+ fail ArgumentError, 'invalid value for "sock_read_timeout", must be greater than or equal to 0.0.'
570
+ end
571
+
572
+ @sock_read_timeout = sock_read_timeout
573
+ end
574
+
575
+ # Custom attribute writer method with validation
576
+ # @param [Object] hf_hub_url Value to be assigned
577
+ def hf_hub_url=(hf_hub_url)
578
+ if hf_hub_url.nil?
579
+ fail ArgumentError, 'hf_hub_url cannot be nil'
580
+ end
581
+
582
+ if hf_hub_url.to_s.length < 1
583
+ fail ArgumentError, 'invalid value for "hf_hub_url", the character length must be great than or equal to 1.'
584
+ end
585
+
586
+ @hf_hub_url = hf_hub_url
587
+ end
588
+
589
+ # Checks equality by comparing each attribute.
590
+ # @param [Object] Object to be compared
591
+ def ==(o)
592
+ return true if self.equal?(o)
593
+ self.class == o.class &&
594
+ name == o.name &&
595
+ url == o.url &&
596
+ ca_cert == o.ca_cert &&
597
+ client_cert == o.client_cert &&
598
+ client_key == o.client_key &&
599
+ tls_validation == o.tls_validation &&
600
+ proxy_url == o.proxy_url &&
601
+ proxy_username == o.proxy_username &&
602
+ proxy_password == o.proxy_password &&
603
+ username == o.username &&
604
+ password == o.password &&
605
+ pulp_labels == o.pulp_labels &&
606
+ download_concurrency == o.download_concurrency &&
607
+ max_retries == o.max_retries &&
608
+ policy == o.policy &&
609
+ total_timeout == o.total_timeout &&
610
+ connect_timeout == o.connect_timeout &&
611
+ sock_connect_timeout == o.sock_connect_timeout &&
612
+ sock_read_timeout == o.sock_read_timeout &&
613
+ headers == o.headers &&
614
+ rate_limit == o.rate_limit &&
615
+ hf_hub_url == o.hf_hub_url &&
616
+ hf_token == o.hf_token
617
+ end
618
+
619
+ # @see the `==` method
620
+ # @param [Object] Object to be compared
621
+ def eql?(o)
622
+ self == o
623
+ end
624
+
625
+ # Calculates hash code according to all attributes.
626
+ # @return [Integer] Hash code
627
+ def hash
628
+ [name, url, ca_cert, client_cert, client_key, tls_validation, proxy_url, proxy_username, proxy_password, username, password, pulp_labels, download_concurrency, max_retries, policy, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, headers, rate_limit, hf_hub_url, hf_token].hash
629
+ end
630
+
631
+ # Builds the object from hash
632
+ # @param [Hash] attributes Model attributes in the form of hash
633
+ # @return [Object] Returns the model itself
634
+ def self.build_from_hash(attributes)
635
+ return nil unless attributes.is_a?(Hash)
636
+ attributes = attributes.transform_keys(&:to_sym)
637
+ transformed_hash = {}
638
+ openapi_types.each_pair do |key, type|
639
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
640
+ transformed_hash["#{key}"] = nil
641
+ elsif type =~ /\AArray<(.*)>/i
642
+ # check to ensure the input is an array given that the attribute
643
+ # is documented as an array but the input is not
644
+ if attributes[attribute_map[key]].is_a?(Array)
645
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
646
+ end
647
+ elsif !attributes[attribute_map[key]].nil?
648
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
649
+ end
650
+ end
651
+ new(transformed_hash)
652
+ end
653
+
654
+ # Deserializes the data based on type
655
+ # @param string type Data type
656
+ # @param string value Value to be deserialized
657
+ # @return [Object] Deserialized data
658
+ def self._deserialize(type, value)
659
+ case type.to_sym
660
+ when :Time
661
+ Time.parse(value)
662
+ when :Date
663
+ Date.parse(value)
664
+ when :String
665
+ value.to_s
666
+ when :Integer
667
+ value.to_i
668
+ when :Float
669
+ value.to_f
670
+ when :Boolean
671
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
672
+ true
673
+ else
674
+ false
675
+ end
676
+ when :Object
677
+ # generic object (usually a Hash), return directly
678
+ value
679
+ when /\AArray<(?<inner_type>.+)>\z/
680
+ inner_type = Regexp.last_match[:inner_type]
681
+ value.map { |v| _deserialize(inner_type, v) }
682
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
683
+ k_type = Regexp.last_match[:k_type]
684
+ v_type = Regexp.last_match[:v_type]
685
+ {}.tap do |hash|
686
+ value.each do |k, v|
687
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
688
+ end
689
+ end
690
+ else # model
691
+ # models (e.g. Pet) or oneOf
692
+ klass = PulpHuggingFaceClient.const_get(type)
693
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
694
+ end
695
+ end
696
+
697
+ # Returns the string representation of the object
698
+ # @return [String] String presentation of the object
699
+ def to_s
700
+ to_hash.to_s
701
+ end
702
+
703
+ # to_body is an alias to to_hash (backward compatibility)
704
+ # @return [Hash] Returns the object in the form of hash
705
+ def to_body
706
+ to_hash
707
+ end
708
+
709
+ # Returns the object in the form of hash
710
+ # @return [Hash] Returns the object in the form of hash
711
+ def to_hash
712
+ hash = {}
713
+ self.class.attribute_map.each_pair do |attr, param|
714
+ value = self.send(attr)
715
+ if value.nil?
716
+ is_nullable = self.class.openapi_nullable.include?(attr)
717
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
718
+ end
719
+
720
+ hash[param] = _to_hash(value)
721
+ end
722
+ hash
723
+ end
724
+
725
+ # Outputs non-array value in the form of hash
726
+ # For object, use to_hash. Otherwise, just return the value
727
+ # @param [Object] value Any valid value
728
+ # @return [Hash] Returns the value in the form of hash
729
+ def _to_hash(value)
730
+ if value.is_a?(Array)
731
+ value.compact.map { |v| _to_hash(v) }
732
+ elsif value.is_a?(Hash)
733
+ {}.tap do |hash|
734
+ value.each { |k, v| hash[k] = _to_hash(v) }
735
+ end
736
+ elsif value.respond_to? :to_hash
737
+ value.to_hash
738
+ else
739
+ value
740
+ end
741
+ end
742
+
743
+ end
744
+
745
+ end