daytona_api_client 0.126.0.pre.alpha.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 (183) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +39 -0
  3. data/.openapi-generator/FILES +171 -0
  4. data/.openapi-generator/VERSION +1 -0
  5. data/.openapi-generator-ignore +33 -0
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +148 -0
  8. data/Gemfile +9 -0
  9. data/Gemfile.lock +101 -0
  10. data/Rakefile +10 -0
  11. data/daytona_api_client.gemspec +39 -0
  12. data/fix-gemspec.sh +11 -0
  13. data/lib/daytona_api_client/api/api_keys_api.rb +401 -0
  14. data/lib/daytona_api_client/api/audit_api.rb +192 -0
  15. data/lib/daytona_api_client/api/config_api.rb +77 -0
  16. data/lib/daytona_api_client/api/docker_registry_api.rb +472 -0
  17. data/lib/daytona_api_client/api/health_api.rb +75 -0
  18. data/lib/daytona_api_client/api/object_storage_api.rb +80 -0
  19. data/lib/daytona_api_client/api/organizations_api.rb +1902 -0
  20. data/lib/daytona_api_client/api/preview_api.rb +211 -0
  21. data/lib/daytona_api_client/api/regions_api.rb +83 -0
  22. data/lib/daytona_api_client/api/runners_api.rb +376 -0
  23. data/lib/daytona_api_client/api/sandbox_api.rb +1660 -0
  24. data/lib/daytona_api_client/api/snapshots_api.rb +641 -0
  25. data/lib/daytona_api_client/api/toolbox_api.rb +5108 -0
  26. data/lib/daytona_api_client/api/users_api.rb +553 -0
  27. data/lib/daytona_api_client/api/volumes_api.rb +342 -0
  28. data/lib/daytona_api_client/api/webhooks_api.rb +413 -0
  29. data/lib/daytona_api_client/api/workspace_api.rb +955 -0
  30. data/lib/daytona_api_client/api_client.rb +393 -0
  31. data/lib/daytona_api_client/api_error.rb +58 -0
  32. data/lib/daytona_api_client/configuration.rb +306 -0
  33. data/lib/daytona_api_client/models/account_provider.rb +261 -0
  34. data/lib/daytona_api_client/models/announcement.rb +246 -0
  35. data/lib/daytona_api_client/models/api_key_list.rb +384 -0
  36. data/lib/daytona_api_client/models/api_key_response.rb +344 -0
  37. data/lib/daytona_api_client/models/audit_log.rb +422 -0
  38. data/lib/daytona_api_client/models/build_info.rb +285 -0
  39. data/lib/daytona_api_client/models/command.rb +273 -0
  40. data/lib/daytona_api_client/models/completion_context.rb +244 -0
  41. data/lib/daytona_api_client/models/completion_item.rb +289 -0
  42. data/lib/daytona_api_client/models/completion_list.rb +263 -0
  43. data/lib/daytona_api_client/models/compressed_screenshot_response.rb +256 -0
  44. data/lib/daytona_api_client/models/computer_use_start_response.rb +263 -0
  45. data/lib/daytona_api_client/models/computer_use_status_response.rb +260 -0
  46. data/lib/daytona_api_client/models/computer_use_stop_response.rb +263 -0
  47. data/lib/daytona_api_client/models/create_api_key.rb +288 -0
  48. data/lib/daytona_api_client/models/create_audit_log.rb +350 -0
  49. data/lib/daytona_api_client/models/create_build_info.rb +248 -0
  50. data/lib/daytona_api_client/models/create_docker_registry.rb +388 -0
  51. data/lib/daytona_api_client/models/create_linked_account.rb +263 -0
  52. data/lib/daytona_api_client/models/create_organization.rb +263 -0
  53. data/lib/daytona_api_client/models/create_organization_invitation.rb +326 -0
  54. data/lib/daytona_api_client/models/create_organization_quota.rb +290 -0
  55. data/lib/daytona_api_client/models/create_organization_role.rb +304 -0
  56. data/lib/daytona_api_client/models/create_runner.rb +545 -0
  57. data/lib/daytona_api_client/models/create_sandbox.rb +439 -0
  58. data/lib/daytona_api_client/models/create_session_request.rb +236 -0
  59. data/lib/daytona_api_client/models/create_snapshot.rb +318 -0
  60. data/lib/daytona_api_client/models/create_user.rb +340 -0
  61. data/lib/daytona_api_client/models/create_volume.rb +235 -0
  62. data/lib/daytona_api_client/models/create_workspace.rb +411 -0
  63. data/lib/daytona_api_client/models/daytona_configuration.rb +568 -0
  64. data/lib/daytona_api_client/models/display_info_response.rb +238 -0
  65. data/lib/daytona_api_client/models/docker_registry.rb +449 -0
  66. data/lib/daytona_api_client/models/download_files.rb +238 -0
  67. data/lib/daytona_api_client/models/execute_request.rb +255 -0
  68. data/lib/daytona_api_client/models/execute_response.rb +263 -0
  69. data/lib/daytona_api_client/models/file_info.rb +417 -0
  70. data/lib/daytona_api_client/models/file_status.rb +313 -0
  71. data/lib/daytona_api_client/models/git_add_request.rb +264 -0
  72. data/lib/daytona_api_client/models/git_branch_request.rb +261 -0
  73. data/lib/daytona_api_client/models/git_checkout_request.rb +261 -0
  74. data/lib/daytona_api_client/models/git_clone_request.rb +297 -0
  75. data/lib/daytona_api_client/models/git_commit_info.rb +339 -0
  76. data/lib/daytona_api_client/models/git_commit_request.rb +325 -0
  77. data/lib/daytona_api_client/models/git_commit_response.rb +235 -0
  78. data/lib/daytona_api_client/models/git_delete_branch_request.rb +261 -0
  79. data/lib/daytona_api_client/models/git_repo_request.rb +253 -0
  80. data/lib/daytona_api_client/models/git_status.rb +290 -0
  81. data/lib/daytona_api_client/models/health_controller_check200_response.rb +253 -0
  82. data/lib/daytona_api_client/models/health_controller_check200_response_info_value.rb +235 -0
  83. data/lib/daytona_api_client/models/health_controller_check503_response.rb +253 -0
  84. data/lib/daytona_api_client/models/keyboard_hotkey_request.rb +236 -0
  85. data/lib/daytona_api_client/models/keyboard_press_request.rb +248 -0
  86. data/lib/daytona_api_client/models/keyboard_type_request.rb +246 -0
  87. data/lib/daytona_api_client/models/list_branch_response.rb +237 -0
  88. data/lib/daytona_api_client/models/lsp_completion_params.rb +325 -0
  89. data/lib/daytona_api_client/models/lsp_document_request.rb +290 -0
  90. data/lib/daytona_api_client/models/lsp_location.rb +261 -0
  91. data/lib/daytona_api_client/models/lsp_server_request.rb +263 -0
  92. data/lib/daytona_api_client/models/lsp_symbol.rb +287 -0
  93. data/lib/daytona_api_client/models/match.rb +287 -0
  94. data/lib/daytona_api_client/models/mouse_click_request.rb +283 -0
  95. data/lib/daytona_api_client/models/mouse_click_response.rb +263 -0
  96. data/lib/daytona_api_client/models/mouse_drag_request.rb +327 -0
  97. data/lib/daytona_api_client/models/mouse_drag_response.rb +263 -0
  98. data/lib/daytona_api_client/models/mouse_move_request.rb +263 -0
  99. data/lib/daytona_api_client/models/mouse_move_response.rb +263 -0
  100. data/lib/daytona_api_client/models/mouse_position.rb +263 -0
  101. data/lib/daytona_api_client/models/mouse_scroll_request.rb +300 -0
  102. data/lib/daytona_api_client/models/mouse_scroll_response.rb +236 -0
  103. data/lib/daytona_api_client/models/oidc_config.rb +290 -0
  104. data/lib/daytona_api_client/models/organization.rb +663 -0
  105. data/lib/daytona_api_client/models/organization_invitation.rb +534 -0
  106. data/lib/daytona_api_client/models/organization_role.rb +412 -0
  107. data/lib/daytona_api_client/models/organization_sandbox_default_limited_network_egress.rb +236 -0
  108. data/lib/daytona_api_client/models/organization_suspension.rb +290 -0
  109. data/lib/daytona_api_client/models/organization_usage_overview.rb +341 -0
  110. data/lib/daytona_api_client/models/organization_user.rb +451 -0
  111. data/lib/daytona_api_client/models/paginated_audit_logs.rb +325 -0
  112. data/lib/daytona_api_client/models/paginated_sandboxes.rb +315 -0
  113. data/lib/daytona_api_client/models/paginated_snapshots.rb +315 -0
  114. data/lib/daytona_api_client/models/paginated_snapshots_dto.rb +315 -0
  115. data/lib/daytona_api_client/models/port_preview_url.rb +290 -0
  116. data/lib/daytona_api_client/models/position.rb +261 -0
  117. data/lib/daytona_api_client/models/posthog_config.rb +263 -0
  118. data/lib/daytona_api_client/models/process_errors_response.rb +263 -0
  119. data/lib/daytona_api_client/models/process_logs_response.rb +263 -0
  120. data/lib/daytona_api_client/models/process_restart_response.rb +263 -0
  121. data/lib/daytona_api_client/models/process_status_response.rb +263 -0
  122. data/lib/daytona_api_client/models/project_dir_response.rb +218 -0
  123. data/lib/daytona_api_client/models/pty_create_request.rb +288 -0
  124. data/lib/daytona_api_client/models/pty_create_response.rb +236 -0
  125. data/lib/daytona_api_client/models/pty_list_response.rb +238 -0
  126. data/lib/daytona_api_client/models/pty_resize_request.rb +263 -0
  127. data/lib/daytona_api_client/models/pty_session_info.rb +425 -0
  128. data/lib/daytona_api_client/models/range.rb +261 -0
  129. data/lib/daytona_api_client/models/rate_limit_config.rb +249 -0
  130. data/lib/daytona_api_client/models/rate_limit_entry.rb +229 -0
  131. data/lib/daytona_api_client/models/region.rb +328 -0
  132. data/lib/daytona_api_client/models/region_quota.rb +339 -0
  133. data/lib/daytona_api_client/models/region_screenshot_response.rb +256 -0
  134. data/lib/daytona_api_client/models/region_usage_overview.rb +391 -0
  135. data/lib/daytona_api_client/models/registry_push_access_dto.rb +371 -0
  136. data/lib/daytona_api_client/models/replace_request.rb +289 -0
  137. data/lib/daytona_api_client/models/replace_result.rb +236 -0
  138. data/lib/daytona_api_client/models/runner.rb +780 -0
  139. data/lib/daytona_api_client/models/runner_snapshot_dto.rb +290 -0
  140. data/lib/daytona_api_client/models/runner_state.rb +43 -0
  141. data/lib/daytona_api_client/models/sandbox.rb +782 -0
  142. data/lib/daytona_api_client/models/sandbox_class.rb +41 -0
  143. data/lib/daytona_api_client/models/sandbox_desired_state.rb +43 -0
  144. data/lib/daytona_api_client/models/sandbox_info.rb +273 -0
  145. data/lib/daytona_api_client/models/sandbox_labels.rb +238 -0
  146. data/lib/daytona_api_client/models/sandbox_state.rb +54 -0
  147. data/lib/daytona_api_client/models/sandbox_volume.rb +273 -0
  148. data/lib/daytona_api_client/models/screenshot_response.rb +256 -0
  149. data/lib/daytona_api_client/models/search_files_response.rb +237 -0
  150. data/lib/daytona_api_client/models/send_webhook_dto.rb +273 -0
  151. data/lib/daytona_api_client/models/session.rb +251 -0
  152. data/lib/daytona_api_client/models/session_execute_request.rb +256 -0
  153. data/lib/daytona_api_client/models/session_execute_response.rb +239 -0
  154. data/lib/daytona_api_client/models/set_snapshot_general_status_dto.rb +236 -0
  155. data/lib/daytona_api_client/models/snapshot_dto.rb +569 -0
  156. data/lib/daytona_api_client/models/snapshot_state.rb +46 -0
  157. data/lib/daytona_api_client/models/ssh_access_dto.rb +371 -0
  158. data/lib/daytona_api_client/models/ssh_access_validation_dto.rb +263 -0
  159. data/lib/daytona_api_client/models/storage_access_dto.rb +371 -0
  160. data/lib/daytona_api_client/models/update_docker_registry.rb +310 -0
  161. data/lib/daytona_api_client/models/update_organization_default_region.rb +236 -0
  162. data/lib/daytona_api_client/models/update_organization_invitation.rb +299 -0
  163. data/lib/daytona_api_client/models/update_organization_member_access.rb +289 -0
  164. data/lib/daytona_api_client/models/update_organization_quota.rb +317 -0
  165. data/lib/daytona_api_client/models/update_organization_region_quota.rb +245 -0
  166. data/lib/daytona_api_client/models/update_organization_role.rb +304 -0
  167. data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +270 -0
  168. data/lib/daytona_api_client/models/user.rb +346 -0
  169. data/lib/daytona_api_client/models/user_home_dir_response.rb +218 -0
  170. data/lib/daytona_api_client/models/user_public_key.rb +263 -0
  171. data/lib/daytona_api_client/models/volume_dto.rb +417 -0
  172. data/lib/daytona_api_client/models/volume_state.rb +45 -0
  173. data/lib/daytona_api_client/models/webhook_app_portal_access.rb +236 -0
  174. data/lib/daytona_api_client/models/webhook_controller_get_status200_response.rb +218 -0
  175. data/lib/daytona_api_client/models/webhook_initialization_status.rb +343 -0
  176. data/lib/daytona_api_client/models/windows_response.rb +265 -0
  177. data/lib/daytona_api_client/models/work_dir_response.rb +218 -0
  178. data/lib/daytona_api_client/models/workspace.rb +834 -0
  179. data/lib/daytona_api_client/models/workspace_port_preview_url.rb +263 -0
  180. data/lib/daytona_api_client/version.rb +15 -0
  181. data/lib/daytona_api_client.rb +201 -0
  182. data/project.json +59 -0
  183. metadata +261 -0
@@ -0,0 +1,288 @@
1
+ =begin
2
+ #Daytona
3
+
4
+ #Daytona AI platform API Docs
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@daytona.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DaytonaApiClient
17
+ class PtyCreateRequest
18
+ # The unique identifier for the PTY session
19
+ attr_accessor :id
20
+
21
+ # Starting directory for the PTY session, defaults to the sandbox's working directory
22
+ attr_accessor :cwd
23
+
24
+ # Environment variables for the PTY session
25
+ attr_accessor :envs
26
+
27
+ # Number of terminal columns
28
+ attr_accessor :cols
29
+
30
+ # Number of terminal rows
31
+ attr_accessor :rows
32
+
33
+ # Whether to start the PTY session lazily (only start when first client connects)
34
+ attr_accessor :lazy_start
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'id' => :'id',
40
+ :'cwd' => :'cwd',
41
+ :'envs' => :'envs',
42
+ :'cols' => :'cols',
43
+ :'rows' => :'rows',
44
+ :'lazy_start' => :'lazyStart'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'id' => :'String',
62
+ :'cwd' => :'String',
63
+ :'envs' => :'Object',
64
+ :'cols' => :'Float',
65
+ :'rows' => :'Float',
66
+ :'lazy_start' => :'Boolean'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::PtyCreateRequest` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::PtyCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'id')
93
+ self.id = attributes[:'id']
94
+ else
95
+ self.id = nil
96
+ end
97
+
98
+ if attributes.key?(:'cwd')
99
+ self.cwd = attributes[:'cwd']
100
+ end
101
+
102
+ if attributes.key?(:'envs')
103
+ self.envs = attributes[:'envs']
104
+ end
105
+
106
+ if attributes.key?(:'cols')
107
+ self.cols = attributes[:'cols']
108
+ end
109
+
110
+ if attributes.key?(:'rows')
111
+ self.rows = attributes[:'rows']
112
+ end
113
+
114
+ if attributes.key?(:'lazy_start')
115
+ self.lazy_start = attributes[:'lazy_start']
116
+ else
117
+ self.lazy_start = false
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @id.nil?
127
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @id.nil?
138
+ true
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] id Value to be assigned
143
+ def id=(id)
144
+ if id.nil?
145
+ fail ArgumentError, 'id cannot be nil'
146
+ end
147
+
148
+ @id = id
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ id == o.id &&
157
+ cwd == o.cwd &&
158
+ envs == o.envs &&
159
+ cols == o.cols &&
160
+ rows == o.rows &&
161
+ lazy_start == o.lazy_start
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [id, cwd, envs, cols, rows, lazy_start].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ transformed_hash = {}
183
+ openapi_types.each_pair do |key, type|
184
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = nil
186
+ elsif type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[attribute_map[key]].is_a?(Array)
190
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
191
+ end
192
+ elsif !attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
194
+ end
195
+ end
196
+ new(transformed_hash)
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def self._deserialize(type, value)
204
+ case type.to_sym
205
+ when :Time
206
+ Time.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ # models (e.g. Pet) or oneOf
237
+ klass = DaytonaApiClient.const_get(type)
238
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #Daytona
3
+
4
+ #Daytona AI platform API Docs
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@daytona.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DaytonaApiClient
17
+ class PtyCreateResponse
18
+ # The unique identifier for the created PTY session
19
+ attr_accessor :session_id
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'session_id' => :'sessionId'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'session_id' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::PtyCreateResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::PtyCreateResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'session_id')
68
+ self.session_id = attributes[:'session_id']
69
+ else
70
+ self.session_id = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @session_id.nil?
80
+ invalid_properties.push('invalid value for "session_id", session_id cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @session_id.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] session_id Value to be assigned
96
+ def session_id=(session_id)
97
+ if session_id.nil?
98
+ fail ArgumentError, 'session_id cannot be nil'
99
+ end
100
+
101
+ @session_id = session_id
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ session_id == o.session_id
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [session_id].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def self._deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = DaytonaApiClient.const_get(type)
186
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+ end
236
+ end