daytona_api_client 0.184.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/Gemfile.lock +101 -0
- data/daytona_api_client.gemspec +2 -2
- data/lib/daytona_api_client/api/api_keys_api.rb +2 -2
- data/lib/daytona_api_client/api/audit_api.rb +140 -10
- data/lib/daytona_api_client/api/config_api.rb +1 -1
- data/lib/daytona_api_client/api/docker_registry_api.rb +67 -6
- data/lib/daytona_api_client/api/health_api.rb +3 -54
- data/lib/daytona_api_client/api/object_storage_api.rb +1 -1
- data/lib/daytona_api_client/api/organizations_api.rb +155 -1075
- data/lib/daytona_api_client/api/preview_api.rb +8 -77
- data/lib/daytona_api_client/api/runners_api.rb +22 -412
- data/lib/daytona_api_client/api/sandbox_api.rb +307 -1732
- data/lib/daytona_api_client/api/snapshots_api.rb +113 -39
- data/lib/daytona_api_client/api/toolbox_api.rb +741 -741
- data/lib/daytona_api_client/api/users_api.rb +239 -2
- data/lib/daytona_api_client/api/volumes_api.rb +2 -2
- data/lib/daytona_api_client/api/webhooks_api.rb +164 -27
- data/lib/daytona_api_client/api/workspace_api.rb +955 -0
- data/lib/daytona_api_client/api_client.rb +4 -8
- data/lib/daytona_api_client/api_error.rb +1 -1
- data/lib/daytona_api_client/configuration.rb +2 -5
- data/lib/daytona_api_client/models/account_provider.rb +74 -3
- data/lib/daytona_api_client/models/announcement.rb +74 -3
- data/lib/daytona_api_client/models/api_key_list.rb +74 -3
- data/lib/daytona_api_client/models/api_key_response.rb +74 -3
- data/lib/daytona_api_client/models/audit_log.rb +75 -22
- data/lib/daytona_api_client/models/build_info.rb +78 -34
- data/lib/daytona_api_client/models/command.rb +74 -3
- data/lib/daytona_api_client/models/completion_context.rb +74 -3
- data/lib/daytona_api_client/models/completion_item.rb +74 -3
- data/lib/daytona_api_client/models/completion_list.rb +74 -3
- data/lib/daytona_api_client/models/compressed_screenshot_response.rb +74 -3
- data/lib/daytona_api_client/models/computer_use_start_response.rb +74 -3
- data/lib/daytona_api_client/models/computer_use_status_response.rb +76 -5
- data/lib/daytona_api_client/models/computer_use_stop_response.rb +74 -3
- data/lib/daytona_api_client/models/create_api_key.rb +75 -4
- data/lib/daytona_api_client/models/create_audit_log.rb +350 -0
- data/lib/daytona_api_client/models/create_build_info.rb +74 -3
- data/lib/daytona_api_client/models/create_docker_registry.rb +139 -7
- data/lib/daytona_api_client/models/create_linked_account.rb +74 -3
- data/lib/daytona_api_client/models/create_organization.rb +78 -34
- data/lib/daytona_api_client/models/create_organization_invitation.rb +76 -5
- data/lib/daytona_api_client/models/create_organization_quota.rb +74 -3
- data/lib/daytona_api_client/models/create_organization_role.rb +74 -3
- data/lib/daytona_api_client/models/create_runner.rb +386 -43
- data/lib/daytona_api_client/models/create_sandbox.rb +121 -38
- data/lib/daytona_api_client/models/create_session_request.rb +74 -3
- data/lib/daytona_api_client/models/create_snapshot.rb +88 -61
- data/lib/daytona_api_client/models/create_user.rb +77 -15
- data/lib/daytona_api_client/models/create_volume.rb +74 -3
- data/lib/daytona_api_client/models/create_workspace.rb +411 -0
- data/lib/daytona_api_client/models/daytona_configuration.rb +78 -54
- data/lib/daytona_api_client/models/display_info_response.rb +74 -3
- data/lib/daytona_api_client/models/docker_registry.rb +76 -5
- data/lib/daytona_api_client/models/download_files.rb +74 -3
- data/lib/daytona_api_client/models/execute_request.rb +74 -3
- data/lib/daytona_api_client/models/execute_response.rb +74 -3
- data/lib/daytona_api_client/models/file_info.rb +74 -3
- data/lib/daytona_api_client/models/file_status.rb +74 -3
- data/lib/daytona_api_client/models/git_add_request.rb +74 -3
- data/lib/daytona_api_client/models/git_branch_request.rb +74 -3
- data/lib/daytona_api_client/models/git_checkout_request.rb +74 -3
- data/lib/daytona_api_client/models/git_clone_request.rb +74 -3
- data/lib/daytona_api_client/models/git_commit_info.rb +74 -3
- data/lib/daytona_api_client/models/git_commit_request.rb +74 -3
- data/lib/daytona_api_client/models/git_commit_response.rb +74 -3
- data/lib/daytona_api_client/models/git_delete_branch_request.rb +74 -3
- data/lib/daytona_api_client/models/git_repo_request.rb +74 -3
- data/lib/daytona_api_client/models/git_status.rb +74 -3
- data/lib/daytona_api_client/models/health_controller_check200_response.rb +74 -3
- data/lib/daytona_api_client/models/health_controller_check200_response_info_value.rb +74 -3
- data/lib/daytona_api_client/models/health_controller_check503_response.rb +74 -3
- data/lib/daytona_api_client/models/keyboard_hotkey_request.rb +74 -3
- data/lib/daytona_api_client/models/keyboard_press_request.rb +74 -3
- data/lib/daytona_api_client/models/keyboard_type_request.rb +74 -3
- data/lib/daytona_api_client/models/list_branch_response.rb +74 -3
- data/lib/daytona_api_client/models/lsp_completion_params.rb +74 -3
- data/lib/daytona_api_client/models/lsp_document_request.rb +74 -3
- data/lib/daytona_api_client/models/lsp_location.rb +74 -3
- data/lib/daytona_api_client/models/lsp_server_request.rb +74 -3
- data/lib/daytona_api_client/models/lsp_symbol.rb +74 -3
- data/lib/daytona_api_client/models/match.rb +74 -3
- data/lib/daytona_api_client/models/mouse_click_request.rb +74 -3
- data/lib/daytona_api_client/models/mouse_click_response.rb +74 -3
- data/lib/daytona_api_client/models/mouse_drag_request.rb +74 -3
- data/lib/daytona_api_client/models/mouse_drag_response.rb +74 -3
- data/lib/daytona_api_client/models/mouse_move_request.rb +74 -3
- data/lib/daytona_api_client/models/mouse_move_response.rb +74 -3
- data/lib/daytona_api_client/models/mouse_position.rb +74 -3
- data/lib/daytona_api_client/models/mouse_scroll_request.rb +74 -3
- data/lib/daytona_api_client/models/mouse_scroll_response.rb +74 -3
- data/lib/daytona_api_client/models/oidc_config.rb +74 -3
- data/lib/daytona_api_client/models/organization.rb +159 -162
- data/lib/daytona_api_client/models/organization_invitation.rb +78 -7
- data/lib/daytona_api_client/models/organization_role.rb +74 -3
- data/lib/daytona_api_client/models/organization_sandbox_default_limited_network_egress.rb +74 -3
- data/lib/daytona_api_client/models/organization_suspension.rb +79 -10
- data/lib/daytona_api_client/models/organization_usage_overview.rb +220 -21
- data/lib/daytona_api_client/models/organization_user.rb +76 -5
- data/lib/daytona_api_client/models/paginated_audit_logs.rb +78 -17
- data/lib/daytona_api_client/models/{paginated_sandboxes_deprecated.rb → paginated_sandboxes.rb} +76 -5
- data/lib/daytona_api_client/models/paginated_snapshots.rb +74 -3
- data/lib/daytona_api_client/models/{paginated_jobs.rb → paginated_snapshots_dto.rb} +77 -6
- data/lib/daytona_api_client/models/port_preview_url.rb +88 -34
- data/lib/daytona_api_client/models/position.rb +74 -3
- data/lib/daytona_api_client/models/posthog_config.rb +74 -3
- data/lib/daytona_api_client/models/process_errors_response.rb +74 -3
- data/lib/daytona_api_client/models/process_logs_response.rb +74 -3
- data/lib/daytona_api_client/models/process_restart_response.rb +74 -3
- data/lib/daytona_api_client/models/process_status_response.rb +74 -3
- data/lib/daytona_api_client/models/project_dir_response.rb +74 -3
- data/lib/daytona_api_client/models/pty_create_request.rb +74 -3
- data/lib/daytona_api_client/models/pty_create_response.rb +74 -3
- data/lib/daytona_api_client/models/pty_list_response.rb +74 -3
- data/lib/daytona_api_client/models/pty_resize_request.rb +74 -3
- data/lib/daytona_api_client/models/pty_session_info.rb +74 -3
- data/lib/daytona_api_client/models/range.rb +74 -3
- data/lib/daytona_api_client/models/region.rb +78 -181
- data/lib/daytona_api_client/models/region_screenshot_response.rb +74 -3
- data/lib/daytona_api_client/models/registry_push_access_dto.rb +74 -3
- data/lib/daytona_api_client/models/replace_request.rb +74 -3
- data/lib/daytona_api_client/models/replace_result.rb +74 -3
- data/lib/daytona_api_client/models/runner.rb +215 -145
- data/lib/daytona_api_client/models/runner_snapshot_dto.rb +91 -3
- data/lib/daytona_api_client/models/runner_state.rb +3 -4
- data/lib/daytona_api_client/models/sandbox.rb +104 -127
- data/lib/daytona_api_client/models/sandbox_class.rb +6 -8
- data/lib/daytona_api_client/models/sandbox_desired_state.rb +3 -4
- data/lib/daytona_api_client/models/{create_region.rb → sandbox_info.rb} +113 -38
- data/lib/daytona_api_client/models/sandbox_labels.rb +74 -3
- data/lib/daytona_api_client/models/sandbox_state.rb +3 -7
- data/lib/daytona_api_client/models/sandbox_volume.rb +78 -17
- data/lib/daytona_api_client/models/screenshot_response.rb +74 -3
- data/lib/daytona_api_client/models/search_files_response.rb +74 -3
- data/lib/daytona_api_client/models/send_webhook_dto.rb +75 -26
- data/lib/daytona_api_client/models/session.rb +74 -3
- data/lib/daytona_api_client/models/session_execute_request.rb +74 -3
- data/lib/daytona_api_client/models/session_execute_response.rb +74 -3
- data/lib/daytona_api_client/models/set_snapshot_general_status_dto.rb +74 -3
- data/lib/daytona_api_client/models/snapshot_dto.rb +78 -71
- data/lib/daytona_api_client/models/snapshot_state.rb +6 -4
- data/lib/daytona_api_client/models/ssh_access_dto.rb +78 -34
- data/lib/daytona_api_client/models/ssh_access_validation_dto.rb +98 -7
- data/lib/daytona_api_client/models/storage_access_dto.rb +74 -3
- data/lib/daytona_api_client/models/update_docker_registry.rb +74 -3
- data/lib/daytona_api_client/models/update_organization_invitation.rb +76 -5
- data/lib/daytona_api_client/models/update_organization_member_access.rb +76 -5
- data/lib/daytona_api_client/models/update_organization_quota.rb +115 -93
- data/lib/daytona_api_client/models/update_organization_role.rb +74 -3
- data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +80 -29
- data/lib/daytona_api_client/models/user.rb +74 -3
- data/lib/daytona_api_client/models/user_home_dir_response.rb +74 -3
- data/lib/daytona_api_client/models/user_public_key.rb +74 -3
- data/lib/daytona_api_client/models/volume_dto.rb +74 -3
- data/lib/daytona_api_client/models/volume_state.rb +3 -4
- data/lib/daytona_api_client/models/webhook_app_portal_access.rb +75 -31
- data/lib/daytona_api_client/models/{admin_get_webhook_status200_response.rb → webhook_controller_get_status200_response.rb} +76 -5
- data/lib/daytona_api_client/models/webhook_initialization_status.rb +74 -3
- data/lib/daytona_api_client/models/windows_response.rb +74 -3
- data/lib/daytona_api_client/models/work_dir_response.rb +74 -3
- data/lib/daytona_api_client/models/{sandbox_list_item.rb → workspace.rb} +344 -180
- data/lib/daytona_api_client/version.rb +2 -2
- data/lib/daytona_api_client.rb +8 -55
- data/project.json +11 -42
- metadata +11 -62
- data/.gitignore +0 -39
- data/.openapi-generator/FILES +0 -212
- data/.openapi-generator/VERSION +0 -1
- data/.openapi-generator-ignore +0 -31
- data/.rspec +0 -2
- data/.rubocop.yml +0 -148
- data/fix-gemspec.sh +0 -11
- data/lib/daytona_api_client/api/admin_api.rb +0 -1449
- data/lib/daytona_api_client/api/jobs_api.rb +0 -299
- data/lib/daytona_api_client/api/regions_api.rb +0 -77
- data/lib/daytona_api_client/api_model_base.rb +0 -88
- data/lib/daytona_api_client/models/admin_create_runner.rb +0 -326
- data/lib/daytona_api_client/models/create_organization_region_quota.rb +0 -372
- data/lib/daytona_api_client/models/create_region_response.rb +0 -209
- data/lib/daytona_api_client/models/create_runner_response.rb +0 -192
- data/lib/daytona_api_client/models/create_sandbox_snapshot.rb +0 -165
- data/lib/daytona_api_client/models/fork_sandbox.rb +0 -148
- data/lib/daytona_api_client/models/gpu_type.rb +0 -41
- data/lib/daytona_api_client/models/job.rb +0 -366
- data/lib/daytona_api_client/models/job_status.rb +0 -43
- data/lib/daytona_api_client/models/job_type.rb +0 -53
- data/lib/daytona_api_client/models/list_sandboxes_response.rb +0 -180
- data/lib/daytona_api_client/models/log_entry.rb +0 -334
- data/lib/daytona_api_client/models/metric_data_point.rb +0 -192
- data/lib/daytona_api_client/models/metric_series.rb +0 -194
- data/lib/daytona_api_client/models/metrics_response.rb +0 -167
- data/lib/daytona_api_client/models/otel_config.rb +0 -178
- data/lib/daytona_api_client/models/paginated_logs.rb +0 -248
- data/lib/daytona_api_client/models/paginated_traces.rb +0 -248
- data/lib/daytona_api_client/models/poll_jobs_response.rb +0 -167
- data/lib/daytona_api_client/models/rate_limit_config.rb +0 -178
- data/lib/daytona_api_client/models/rate_limit_entry.rb +0 -158
- data/lib/daytona_api_client/models/regenerate_api_key_response.rb +0 -165
- data/lib/daytona_api_client/models/region_quota.rb +0 -437
- data/lib/daytona_api_client/models/region_type.rb +0 -42
- data/lib/daytona_api_client/models/region_usage_overview.rb +0 -515
- data/lib/daytona_api_client/models/resize_sandbox.rb +0 -225
- data/lib/daytona_api_client/models/runner_class.rb +0 -41
- data/lib/daytona_api_client/models/runner_full.rb +0 -747
- data/lib/daytona_api_client/models/runner_health_metrics.rb +0 -482
- data/lib/daytona_api_client/models/runner_healthcheck.rb +0 -217
- data/lib/daytona_api_client/models/runner_service_health.rb +0 -202
- data/lib/daytona_api_client/models/sandbox_list_sort_direction.rb +0 -41
- data/lib/daytona_api_client/models/sandbox_list_sort_field.rb +0 -45
- data/lib/daytona_api_client/models/signed_port_preview_url.rb +0 -246
- data/lib/daytona_api_client/models/snapshot_manager_credentials.rb +0 -192
- data/lib/daytona_api_client/models/toolbox_proxy_url.rb +0 -165
- data/lib/daytona_api_client/models/trace_span.rb +0 -332
- data/lib/daytona_api_client/models/trace_summary.rb +0 -310
- data/lib/daytona_api_client/models/update_job_status.rb +0 -207
- data/lib/daytona_api_client/models/update_organization_default_region.rb +0 -165
- data/lib/daytona_api_client/models/update_organization_region_quota.rb +0 -299
- data/lib/daytona_api_client/models/update_region.rb +0 -171
- data/lib/daytona_api_client/models/update_sandbox_network_settings.rb +0 -158
- data/lib/daytona_api_client/models/url.rb +0 -165
- data/lib/daytona_api_client/models/webhook_event.rb +0 -46
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@daytona.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.12.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module DaytonaApiClient
|
|
17
|
-
class CreateUser
|
|
17
|
+
class CreateUser
|
|
18
18
|
attr_accessor :id
|
|
19
19
|
|
|
20
20
|
attr_accessor :name
|
|
@@ -23,8 +23,6 @@ module DaytonaApiClient
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :personal_organization_quota
|
|
25
25
|
|
|
26
|
-
attr_accessor :personal_organization_default_region_id
|
|
27
|
-
|
|
28
26
|
attr_accessor :role
|
|
29
27
|
|
|
30
28
|
attr_accessor :email_verified
|
|
@@ -58,7 +56,6 @@ module DaytonaApiClient
|
|
|
58
56
|
:'name' => :'name',
|
|
59
57
|
:'email' => :'email',
|
|
60
58
|
:'personal_organization_quota' => :'personalOrganizationQuota',
|
|
61
|
-
:'personal_organization_default_region_id' => :'personalOrganizationDefaultRegionId',
|
|
62
59
|
:'role' => :'role',
|
|
63
60
|
:'email_verified' => :'emailVerified'
|
|
64
61
|
}
|
|
@@ -81,7 +78,6 @@ module DaytonaApiClient
|
|
|
81
78
|
:'name' => :'String',
|
|
82
79
|
:'email' => :'String',
|
|
83
80
|
:'personal_organization_quota' => :'CreateOrganizationQuota',
|
|
84
|
-
:'personal_organization_default_region_id' => :'String',
|
|
85
81
|
:'role' => :'String',
|
|
86
82
|
:'email_verified' => :'Boolean'
|
|
87
83
|
}
|
|
@@ -129,10 +125,6 @@ module DaytonaApiClient
|
|
|
129
125
|
self.personal_organization_quota = attributes[:'personal_organization_quota']
|
|
130
126
|
end
|
|
131
127
|
|
|
132
|
-
if attributes.key?(:'personal_organization_default_region_id')
|
|
133
|
-
self.personal_organization_default_region_id = attributes[:'personal_organization_default_region_id']
|
|
134
|
-
end
|
|
135
|
-
|
|
136
128
|
if attributes.key?(:'role')
|
|
137
129
|
self.role = attributes[:'role']
|
|
138
130
|
end
|
|
@@ -164,7 +156,7 @@ module DaytonaApiClient
|
|
|
164
156
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
165
157
|
return false if @id.nil?
|
|
166
158
|
return false if @name.nil?
|
|
167
|
-
role_validator = EnumAttributeValidator.new('String', ["admin", "user"
|
|
159
|
+
role_validator = EnumAttributeValidator.new('String', ["admin", "user"])
|
|
168
160
|
return false unless role_validator.valid?(@role)
|
|
169
161
|
true
|
|
170
162
|
end
|
|
@@ -192,7 +184,7 @@ module DaytonaApiClient
|
|
|
192
184
|
# Custom attribute writer method checking allowed values (enum).
|
|
193
185
|
# @param [Object] role Object to be assigned
|
|
194
186
|
def role=(role)
|
|
195
|
-
validator = EnumAttributeValidator.new('String', ["admin", "user"
|
|
187
|
+
validator = EnumAttributeValidator.new('String', ["admin", "user"])
|
|
196
188
|
unless validator.valid?(role)
|
|
197
189
|
fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
|
|
198
190
|
end
|
|
@@ -208,7 +200,6 @@ module DaytonaApiClient
|
|
|
208
200
|
name == o.name &&
|
|
209
201
|
email == o.email &&
|
|
210
202
|
personal_organization_quota == o.personal_organization_quota &&
|
|
211
|
-
personal_organization_default_region_id == o.personal_organization_default_region_id &&
|
|
212
203
|
role == o.role &&
|
|
213
204
|
email_verified == o.email_verified
|
|
214
205
|
end
|
|
@@ -222,7 +213,7 @@ module DaytonaApiClient
|
|
|
222
213
|
# Calculates hash code according to all attributes.
|
|
223
214
|
# @return [Integer] Hash code
|
|
224
215
|
def hash
|
|
225
|
-
[id, name, email, personal_organization_quota,
|
|
216
|
+
[id, name, email, personal_organization_quota, role, email_verified].hash
|
|
226
217
|
end
|
|
227
218
|
|
|
228
219
|
# Builds the object from hash
|
|
@@ -248,6 +239,61 @@ module DaytonaApiClient
|
|
|
248
239
|
new(transformed_hash)
|
|
249
240
|
end
|
|
250
241
|
|
|
242
|
+
# Deserializes the data based on type
|
|
243
|
+
# @param string type Data type
|
|
244
|
+
# @param string value Value to be deserialized
|
|
245
|
+
# @return [Object] Deserialized data
|
|
246
|
+
def self._deserialize(type, value)
|
|
247
|
+
case type.to_sym
|
|
248
|
+
when :Time
|
|
249
|
+
Time.parse(value)
|
|
250
|
+
when :Date
|
|
251
|
+
Date.parse(value)
|
|
252
|
+
when :String
|
|
253
|
+
value.to_s
|
|
254
|
+
when :Integer
|
|
255
|
+
value.to_i
|
|
256
|
+
when :Float
|
|
257
|
+
value.to_f
|
|
258
|
+
when :Boolean
|
|
259
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
260
|
+
true
|
|
261
|
+
else
|
|
262
|
+
false
|
|
263
|
+
end
|
|
264
|
+
when :Object
|
|
265
|
+
# generic object (usually a Hash), return directly
|
|
266
|
+
value
|
|
267
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
268
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
269
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
270
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
271
|
+
k_type = Regexp.last_match[:k_type]
|
|
272
|
+
v_type = Regexp.last_match[:v_type]
|
|
273
|
+
{}.tap do |hash|
|
|
274
|
+
value.each do |k, v|
|
|
275
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
else # model
|
|
279
|
+
# models (e.g. Pet) or oneOf
|
|
280
|
+
klass = DaytonaApiClient.const_get(type)
|
|
281
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Returns the string representation of the object
|
|
286
|
+
# @return [String] String presentation of the object
|
|
287
|
+
def to_s
|
|
288
|
+
to_hash.to_s
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
292
|
+
# @return [Hash] Returns the object in the form of hash
|
|
293
|
+
def to_body
|
|
294
|
+
to_hash
|
|
295
|
+
end
|
|
296
|
+
|
|
251
297
|
# Returns the object in the form of hash
|
|
252
298
|
# @return [Hash] Returns the object in the form of hash
|
|
253
299
|
def to_hash
|
|
@@ -264,6 +310,22 @@ module DaytonaApiClient
|
|
|
264
310
|
hash
|
|
265
311
|
end
|
|
266
312
|
|
|
313
|
+
# Outputs non-array value in the form of hash
|
|
314
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
315
|
+
# @param [Object] value Any valid value
|
|
316
|
+
# @return [Hash] Returns the value in the form of hash
|
|
317
|
+
def _to_hash(value)
|
|
318
|
+
if value.is_a?(Array)
|
|
319
|
+
value.compact.map { |v| _to_hash(v) }
|
|
320
|
+
elsif value.is_a?(Hash)
|
|
321
|
+
{}.tap do |hash|
|
|
322
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
323
|
+
end
|
|
324
|
+
elsif value.respond_to? :to_hash
|
|
325
|
+
value.to_hash
|
|
326
|
+
else
|
|
327
|
+
value
|
|
328
|
+
end
|
|
329
|
+
end
|
|
267
330
|
end
|
|
268
|
-
|
|
269
331
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@daytona.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.12.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module DaytonaApiClient
|
|
17
|
-
class CreateVolume
|
|
17
|
+
class CreateVolume
|
|
18
18
|
attr_accessor :name
|
|
19
19
|
|
|
20
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -143,6 +143,61 @@ module DaytonaApiClient
|
|
|
143
143
|
new(transformed_hash)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
+
# Deserializes the data based on type
|
|
147
|
+
# @param string type Data type
|
|
148
|
+
# @param string value Value to be deserialized
|
|
149
|
+
# @return [Object] Deserialized data
|
|
150
|
+
def self._deserialize(type, value)
|
|
151
|
+
case type.to_sym
|
|
152
|
+
when :Time
|
|
153
|
+
Time.parse(value)
|
|
154
|
+
when :Date
|
|
155
|
+
Date.parse(value)
|
|
156
|
+
when :String
|
|
157
|
+
value.to_s
|
|
158
|
+
when :Integer
|
|
159
|
+
value.to_i
|
|
160
|
+
when :Float
|
|
161
|
+
value.to_f
|
|
162
|
+
when :Boolean
|
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
164
|
+
true
|
|
165
|
+
else
|
|
166
|
+
false
|
|
167
|
+
end
|
|
168
|
+
when :Object
|
|
169
|
+
# generic object (usually a Hash), return directly
|
|
170
|
+
value
|
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
|
177
|
+
{}.tap do |hash|
|
|
178
|
+
value.each do |k, v|
|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
else # model
|
|
183
|
+
# models (e.g. Pet) or oneOf
|
|
184
|
+
klass = DaytonaApiClient.const_get(type)
|
|
185
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Returns the string representation of the object
|
|
190
|
+
# @return [String] String presentation of the object
|
|
191
|
+
def to_s
|
|
192
|
+
to_hash.to_s
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
|
197
|
+
def to_body
|
|
198
|
+
to_hash
|
|
199
|
+
end
|
|
200
|
+
|
|
146
201
|
# Returns the object in the form of hash
|
|
147
202
|
# @return [Hash] Returns the object in the form of hash
|
|
148
203
|
def to_hash
|
|
@@ -159,6 +214,22 @@ module DaytonaApiClient
|
|
|
159
214
|
hash
|
|
160
215
|
end
|
|
161
216
|
|
|
217
|
+
# Outputs non-array value in the form of hash
|
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
219
|
+
# @param [Object] value Any valid value
|
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
|
221
|
+
def _to_hash(value)
|
|
222
|
+
if value.is_a?(Array)
|
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
|
224
|
+
elsif value.is_a?(Hash)
|
|
225
|
+
{}.tap do |hash|
|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
227
|
+
end
|
|
228
|
+
elsif value.respond_to? :to_hash
|
|
229
|
+
value.to_hash
|
|
230
|
+
else
|
|
231
|
+
value
|
|
232
|
+
end
|
|
233
|
+
end
|
|
162
234
|
end
|
|
163
|
-
|
|
164
235
|
end
|
|
@@ -0,0 +1,411 @@
|
|
|
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 CreateWorkspace
|
|
18
|
+
# The image used for the workspace
|
|
19
|
+
attr_accessor :image
|
|
20
|
+
|
|
21
|
+
# The user associated with the project
|
|
22
|
+
attr_accessor :user
|
|
23
|
+
|
|
24
|
+
# Environment variables for the workspace
|
|
25
|
+
attr_accessor :env
|
|
26
|
+
|
|
27
|
+
# Labels for the workspace
|
|
28
|
+
attr_accessor :labels
|
|
29
|
+
|
|
30
|
+
# Whether the workspace http preview is publicly accessible
|
|
31
|
+
attr_accessor :public
|
|
32
|
+
|
|
33
|
+
# The workspace class type
|
|
34
|
+
attr_accessor :_class
|
|
35
|
+
|
|
36
|
+
# The target (region) where the workspace will be created
|
|
37
|
+
attr_accessor :target
|
|
38
|
+
|
|
39
|
+
# CPU cores allocated to the workspace
|
|
40
|
+
attr_accessor :cpu
|
|
41
|
+
|
|
42
|
+
# GPU units allocated to the workspace
|
|
43
|
+
attr_accessor :gpu
|
|
44
|
+
|
|
45
|
+
# Memory allocated to the workspace in GB
|
|
46
|
+
attr_accessor :memory
|
|
47
|
+
|
|
48
|
+
# Disk space allocated to the workspace in GB
|
|
49
|
+
attr_accessor :disk
|
|
50
|
+
|
|
51
|
+
# Auto-stop interval in minutes (0 means disabled)
|
|
52
|
+
attr_accessor :auto_stop_interval
|
|
53
|
+
|
|
54
|
+
# Auto-archive interval in minutes (0 means the maximum interval will be used)
|
|
55
|
+
attr_accessor :auto_archive_interval
|
|
56
|
+
|
|
57
|
+
# Array of volumes to attach to the workspace
|
|
58
|
+
attr_accessor :volumes
|
|
59
|
+
|
|
60
|
+
# Build information for the workspace
|
|
61
|
+
attr_accessor :build_info
|
|
62
|
+
|
|
63
|
+
class EnumAttributeValidator
|
|
64
|
+
attr_reader :datatype
|
|
65
|
+
attr_reader :allowable_values
|
|
66
|
+
|
|
67
|
+
def initialize(datatype, allowable_values)
|
|
68
|
+
@allowable_values = allowable_values.map do |value|
|
|
69
|
+
case datatype.to_s
|
|
70
|
+
when /Integer/i
|
|
71
|
+
value.to_i
|
|
72
|
+
when /Float/i
|
|
73
|
+
value.to_f
|
|
74
|
+
else
|
|
75
|
+
value
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def valid?(value)
|
|
81
|
+
!value || allowable_values.include?(value)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
86
|
+
def self.attribute_map
|
|
87
|
+
{
|
|
88
|
+
:'image' => :'image',
|
|
89
|
+
:'user' => :'user',
|
|
90
|
+
:'env' => :'env',
|
|
91
|
+
:'labels' => :'labels',
|
|
92
|
+
:'public' => :'public',
|
|
93
|
+
:'_class' => :'class',
|
|
94
|
+
:'target' => :'target',
|
|
95
|
+
:'cpu' => :'cpu',
|
|
96
|
+
:'gpu' => :'gpu',
|
|
97
|
+
:'memory' => :'memory',
|
|
98
|
+
:'disk' => :'disk',
|
|
99
|
+
:'auto_stop_interval' => :'autoStopInterval',
|
|
100
|
+
:'auto_archive_interval' => :'autoArchiveInterval',
|
|
101
|
+
:'volumes' => :'volumes',
|
|
102
|
+
:'build_info' => :'buildInfo'
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Returns attribute mapping this model knows about
|
|
107
|
+
def self.acceptable_attribute_map
|
|
108
|
+
attribute_map
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Returns all the JSON keys this model knows about
|
|
112
|
+
def self.acceptable_attributes
|
|
113
|
+
acceptable_attribute_map.values
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Attribute type mapping.
|
|
117
|
+
def self.openapi_types
|
|
118
|
+
{
|
|
119
|
+
:'image' => :'String',
|
|
120
|
+
:'user' => :'String',
|
|
121
|
+
:'env' => :'Hash<String, String>',
|
|
122
|
+
:'labels' => :'Hash<String, String>',
|
|
123
|
+
:'public' => :'Boolean',
|
|
124
|
+
:'_class' => :'String',
|
|
125
|
+
:'target' => :'String',
|
|
126
|
+
:'cpu' => :'Integer',
|
|
127
|
+
:'gpu' => :'Integer',
|
|
128
|
+
:'memory' => :'Integer',
|
|
129
|
+
:'disk' => :'Integer',
|
|
130
|
+
:'auto_stop_interval' => :'Integer',
|
|
131
|
+
:'auto_archive_interval' => :'Integer',
|
|
132
|
+
:'volumes' => :'Array<SandboxVolume>',
|
|
133
|
+
:'build_info' => :'CreateBuildInfo'
|
|
134
|
+
}
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# List of attributes with nullable: true
|
|
138
|
+
def self.openapi_nullable
|
|
139
|
+
Set.new([
|
|
140
|
+
])
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Initializes the object
|
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
145
|
+
def initialize(attributes = {})
|
|
146
|
+
if (!attributes.is_a?(Hash))
|
|
147
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::CreateWorkspace` initialize method"
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
151
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
152
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
153
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
154
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::CreateWorkspace`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
155
|
+
end
|
|
156
|
+
h[k.to_sym] = v
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if attributes.key?(:'image')
|
|
160
|
+
self.image = attributes[:'image']
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.key?(:'user')
|
|
164
|
+
self.user = attributes[:'user']
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'env')
|
|
168
|
+
if (value = attributes[:'env']).is_a?(Hash)
|
|
169
|
+
self.env = value
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if attributes.key?(:'labels')
|
|
174
|
+
if (value = attributes[:'labels']).is_a?(Hash)
|
|
175
|
+
self.labels = value
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
if attributes.key?(:'public')
|
|
180
|
+
self.public = attributes[:'public']
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if attributes.key?(:'_class')
|
|
184
|
+
self._class = attributes[:'_class']
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:'target')
|
|
188
|
+
self.target = attributes[:'target']
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
if attributes.key?(:'cpu')
|
|
192
|
+
self.cpu = attributes[:'cpu']
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
if attributes.key?(:'gpu')
|
|
196
|
+
self.gpu = attributes[:'gpu']
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if attributes.key?(:'memory')
|
|
200
|
+
self.memory = attributes[:'memory']
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
if attributes.key?(:'disk')
|
|
204
|
+
self.disk = attributes[:'disk']
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if attributes.key?(:'auto_stop_interval')
|
|
208
|
+
self.auto_stop_interval = attributes[:'auto_stop_interval']
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if attributes.key?(:'auto_archive_interval')
|
|
212
|
+
self.auto_archive_interval = attributes[:'auto_archive_interval']
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if attributes.key?(:'volumes')
|
|
216
|
+
if (value = attributes[:'volumes']).is_a?(Array)
|
|
217
|
+
self.volumes = value
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
if attributes.key?(:'build_info')
|
|
222
|
+
self.build_info = attributes[:'build_info']
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
227
|
+
# @return Array for valid properties with the reasons
|
|
228
|
+
def list_invalid_properties
|
|
229
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
230
|
+
invalid_properties = Array.new
|
|
231
|
+
invalid_properties
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Check to see if the all the properties in the model are valid
|
|
235
|
+
# @return true if the model is valid
|
|
236
|
+
def valid?
|
|
237
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
238
|
+
_class_validator = EnumAttributeValidator.new('String', ["small", "medium", "large"])
|
|
239
|
+
return false unless _class_validator.valid?(@_class)
|
|
240
|
+
target_validator = EnumAttributeValidator.new('String', ["eu", "us", "asia"])
|
|
241
|
+
return false unless target_validator.valid?(@target)
|
|
242
|
+
true
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
246
|
+
# @param [Object] _class Object to be assigned
|
|
247
|
+
def _class=(_class)
|
|
248
|
+
validator = EnumAttributeValidator.new('String', ["small", "medium", "large"])
|
|
249
|
+
unless validator.valid?(_class)
|
|
250
|
+
fail ArgumentError, "invalid value for \"_class\", must be one of #{validator.allowable_values}."
|
|
251
|
+
end
|
|
252
|
+
@_class = _class
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
256
|
+
# @param [Object] target Object to be assigned
|
|
257
|
+
def target=(target)
|
|
258
|
+
validator = EnumAttributeValidator.new('String', ["eu", "us", "asia"])
|
|
259
|
+
unless validator.valid?(target)
|
|
260
|
+
fail ArgumentError, "invalid value for \"target\", must be one of #{validator.allowable_values}."
|
|
261
|
+
end
|
|
262
|
+
@target = target
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Checks equality by comparing each attribute.
|
|
266
|
+
# @param [Object] Object to be compared
|
|
267
|
+
def ==(o)
|
|
268
|
+
return true if self.equal?(o)
|
|
269
|
+
self.class == o.class &&
|
|
270
|
+
image == o.image &&
|
|
271
|
+
user == o.user &&
|
|
272
|
+
env == o.env &&
|
|
273
|
+
labels == o.labels &&
|
|
274
|
+
public == o.public &&
|
|
275
|
+
_class == o._class &&
|
|
276
|
+
target == o.target &&
|
|
277
|
+
cpu == o.cpu &&
|
|
278
|
+
gpu == o.gpu &&
|
|
279
|
+
memory == o.memory &&
|
|
280
|
+
disk == o.disk &&
|
|
281
|
+
auto_stop_interval == o.auto_stop_interval &&
|
|
282
|
+
auto_archive_interval == o.auto_archive_interval &&
|
|
283
|
+
volumes == o.volumes &&
|
|
284
|
+
build_info == o.build_info
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# @see the `==` method
|
|
288
|
+
# @param [Object] Object to be compared
|
|
289
|
+
def eql?(o)
|
|
290
|
+
self == o
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Calculates hash code according to all attributes.
|
|
294
|
+
# @return [Integer] Hash code
|
|
295
|
+
def hash
|
|
296
|
+
[image, user, env, labels, public, _class, target, cpu, gpu, memory, disk, auto_stop_interval, auto_archive_interval, volumes, build_info].hash
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Builds the object from hash
|
|
300
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
301
|
+
# @return [Object] Returns the model itself
|
|
302
|
+
def self.build_from_hash(attributes)
|
|
303
|
+
return nil unless attributes.is_a?(Hash)
|
|
304
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
305
|
+
transformed_hash = {}
|
|
306
|
+
openapi_types.each_pair do |key, type|
|
|
307
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
308
|
+
transformed_hash["#{key}"] = nil
|
|
309
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
310
|
+
# check to ensure the input is an array given that the attribute
|
|
311
|
+
# is documented as an array but the input is not
|
|
312
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
313
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
314
|
+
end
|
|
315
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
316
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
new(transformed_hash)
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Deserializes the data based on type
|
|
323
|
+
# @param string type Data type
|
|
324
|
+
# @param string value Value to be deserialized
|
|
325
|
+
# @return [Object] Deserialized data
|
|
326
|
+
def self._deserialize(type, value)
|
|
327
|
+
case type.to_sym
|
|
328
|
+
when :Time
|
|
329
|
+
Time.parse(value)
|
|
330
|
+
when :Date
|
|
331
|
+
Date.parse(value)
|
|
332
|
+
when :String
|
|
333
|
+
value.to_s
|
|
334
|
+
when :Integer
|
|
335
|
+
value.to_i
|
|
336
|
+
when :Float
|
|
337
|
+
value.to_f
|
|
338
|
+
when :Boolean
|
|
339
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
340
|
+
true
|
|
341
|
+
else
|
|
342
|
+
false
|
|
343
|
+
end
|
|
344
|
+
when :Object
|
|
345
|
+
# generic object (usually a Hash), return directly
|
|
346
|
+
value
|
|
347
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
348
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
349
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
350
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
351
|
+
k_type = Regexp.last_match[:k_type]
|
|
352
|
+
v_type = Regexp.last_match[:v_type]
|
|
353
|
+
{}.tap do |hash|
|
|
354
|
+
value.each do |k, v|
|
|
355
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
356
|
+
end
|
|
357
|
+
end
|
|
358
|
+
else # model
|
|
359
|
+
# models (e.g. Pet) or oneOf
|
|
360
|
+
klass = DaytonaApiClient.const_get(type)
|
|
361
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# Returns the string representation of the object
|
|
366
|
+
# @return [String] String presentation of the object
|
|
367
|
+
def to_s
|
|
368
|
+
to_hash.to_s
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
372
|
+
# @return [Hash] Returns the object in the form of hash
|
|
373
|
+
def to_body
|
|
374
|
+
to_hash
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Returns the object in the form of hash
|
|
378
|
+
# @return [Hash] Returns the object in the form of hash
|
|
379
|
+
def to_hash
|
|
380
|
+
hash = {}
|
|
381
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
382
|
+
value = self.send(attr)
|
|
383
|
+
if value.nil?
|
|
384
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
385
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
hash[param] = _to_hash(value)
|
|
389
|
+
end
|
|
390
|
+
hash
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
# Outputs non-array value in the form of hash
|
|
394
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
395
|
+
# @param [Object] value Any valid value
|
|
396
|
+
# @return [Hash] Returns the value in the form of hash
|
|
397
|
+
def _to_hash(value)
|
|
398
|
+
if value.is_a?(Array)
|
|
399
|
+
value.compact.map { |v| _to_hash(v) }
|
|
400
|
+
elsif value.is_a?(Hash)
|
|
401
|
+
{}.tap do |hash|
|
|
402
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
403
|
+
end
|
|
404
|
+
elsif value.respond_to? :to_hash
|
|
405
|
+
value.to_hash
|
|
406
|
+
else
|
|
407
|
+
value
|
|
408
|
+
end
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
end
|