candidhealth 0.33.0 → 0.33.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +32 -270
  3. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +87 -75
  4. data/lib/candidhealth/pre_encounter/appointments/v_1/types/{appointment_sort_field.rb → appointment_status.rb} +5 -3
  5. data/lib/candidhealth/pre_encounter/appointments/v_1/types/mutable_appointment.rb +87 -75
  6. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +4 -4
  7. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_date.rb +87 -0
  8. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb +13 -10
  9. data/lib/candidhealth/pre_encounter/lists/client.rb +32 -0
  10. data/lib/candidhealth/pre_encounter/lists/v_1/client.rb +213 -0
  11. data/lib/candidhealth/pre_encounter/lists/v_1/types/appointment_list_item.rb +104 -0
  12. data/lib/candidhealth/pre_encounter/lists/v_1/types/appointment_list_page.rb +90 -0
  13. data/lib/candidhealth/pre_encounter/lists/v_1/types/patient_list_item.rb +104 -0
  14. data/lib/candidhealth/pre_encounter/lists/v_1/types/patient_list_page.rb +90 -0
  15. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +126 -150
  16. data/lib/candidhealth/pre_encounter/patients/v_1/types/guarantor.rb +121 -0
  17. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient.rb +32 -2
  18. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +32 -2
  19. data/lib/candidhealth/pre_encounter/patients/v_1/types/potential_duplicate_patient.rb +72 -0
  20. data/lib/candidhealth/pre_encounter/patients/v_1/types/potential_duplicate_patients_error_body.rb +84 -0
  21. data/lib/requests.rb +2 -2
  22. data/lib/types_export.rb +9 -3
  23. metadata +13 -5
  24. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_reason.rb +0 -19
  25. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_type.rb +0 -17
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module CandidApiClient
8
+ module PreEncounter
9
+ module Coverages
10
+ module V1
11
+ module Types
12
+ class PlanDate
13
+ # @return [Date]
14
+ attr_reader :start_date
15
+ # @return [Date]
16
+ attr_reader :end_date
17
+ # @return [String]
18
+ attr_reader :field_name
19
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
20
+ attr_reader :additional_properties
21
+ # @return [Object]
22
+ attr_reader :_field_set
23
+ protected :_field_set
24
+
25
+ OMIT = Object.new
26
+
27
+ # @param start_date [Date]
28
+ # @param end_date [Date]
29
+ # @param field_name [String]
30
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
31
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate]
32
+ def initialize(start_date:, field_name:, end_date: OMIT, additional_properties: nil)
33
+ @start_date = start_date
34
+ @end_date = end_date if end_date != OMIT
35
+ @field_name = field_name
36
+ @additional_properties = additional_properties
37
+ @_field_set = {
38
+ "start_date": start_date,
39
+ "end_date": end_date,
40
+ "field_name": field_name
41
+ }.reject do |_k, v|
42
+ v == OMIT
43
+ end
44
+ end
45
+
46
+ # Deserialize a JSON object to an instance of PlanDate
47
+ #
48
+ # @param json_object [String]
49
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate]
50
+ def self.from_json(json_object:)
51
+ struct = JSON.parse(json_object, object_class: OpenStruct)
52
+ parsed_json = JSON.parse(json_object)
53
+ start_date = (Date.parse(parsed_json["start_date"]) unless parsed_json["start_date"].nil?)
54
+ end_date = (Date.parse(parsed_json["end_date"]) unless parsed_json["end_date"].nil?)
55
+ field_name = struct["field_name"]
56
+ new(
57
+ start_date: start_date,
58
+ end_date: end_date,
59
+ field_name: field_name,
60
+ additional_properties: struct
61
+ )
62
+ end
63
+
64
+ # Serialize an instance of PlanDate to a JSON object
65
+ #
66
+ # @return [String]
67
+ def to_json(*_args)
68
+ @_field_set&.to_json
69
+ end
70
+
71
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
72
+ # hash and check each fields type against the current object's property
73
+ # definitions.
74
+ #
75
+ # @param obj [Object]
76
+ # @return [Void]
77
+ def self.validate_raw(obj:)
78
+ obj.start_date.is_a?(Date) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
79
+ obj.end_date&.is_a?(Date) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
80
+ obj.field_name.is_a?(String) != false || raise("Passed value for field obj.field_name is not the expected type, validation failed.")
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "date"
4
- require_relative "eligibility_status"
4
+ require_relative "plan_date"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -25,8 +25,8 @@ module CandidApiClient
25
25
  attr_reader :start_date
26
26
  # @return [Date]
27
27
  attr_reader :end_date
28
- # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus]
29
- attr_reader :eligibility_status
28
+ # @return [Array<CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate>]
29
+ attr_reader :plan_dates
30
30
  # @return [OpenStruct] Additional properties unmapped to the current class definition
31
31
  attr_reader :additional_properties
32
32
  # @return [Object]
@@ -42,11 +42,11 @@ module CandidApiClient
42
42
  # @param group_number [String]
43
43
  # @param start_date [Date]
44
44
  # @param end_date [Date]
45
- # @param eligibility_status [CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus]
45
+ # @param plan_dates [Array<CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate>]
46
46
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
47
47
  # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata]
48
48
  def initialize(insurance_type: OMIT, insurance_type_code: OMIT, plan_name: OMIT, member_id: OMIT,
49
- group_number: OMIT, start_date: OMIT, end_date: OMIT, eligibility_status: OMIT, additional_properties: nil)
49
+ group_number: OMIT, start_date: OMIT, end_date: OMIT, plan_dates: OMIT, additional_properties: nil)
50
50
  @insurance_type = insurance_type if insurance_type != OMIT
51
51
  @insurance_type_code = insurance_type_code if insurance_type_code != OMIT
52
52
  @plan_name = plan_name if plan_name != OMIT
@@ -54,7 +54,7 @@ module CandidApiClient
54
54
  @group_number = group_number if group_number != OMIT
55
55
  @start_date = start_date if start_date != OMIT
56
56
  @end_date = end_date if end_date != OMIT
57
- @eligibility_status = eligibility_status if eligibility_status != OMIT
57
+ @plan_dates = plan_dates if plan_dates != OMIT
58
58
  @additional_properties = additional_properties
59
59
  @_field_set = {
60
60
  "insurance_type": insurance_type,
@@ -64,7 +64,7 @@ module CandidApiClient
64
64
  "group_number": group_number,
65
65
  "start_date": start_date,
66
66
  "end_date": end_date,
67
- "eligibility_status": eligibility_status
67
+ "plan_dates": plan_dates
68
68
  }.reject do |_k, v|
69
69
  v == OMIT
70
70
  end
@@ -84,7 +84,10 @@ module CandidApiClient
84
84
  group_number = struct["group_number"]
85
85
  start_date = (Date.parse(parsed_json["start_date"]) unless parsed_json["start_date"].nil?)
86
86
  end_date = (Date.parse(parsed_json["end_date"]) unless parsed_json["end_date"].nil?)
87
- eligibility_status = struct["eligibility_status"]
87
+ plan_dates = parsed_json["plan_dates"]&.map do |item|
88
+ item = item.to_json
89
+ CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate.from_json(json_object: item)
90
+ end
88
91
  new(
89
92
  insurance_type: insurance_type,
90
93
  insurance_type_code: insurance_type_code,
@@ -93,7 +96,7 @@ module CandidApiClient
93
96
  group_number: group_number,
94
97
  start_date: start_date,
95
98
  end_date: end_date,
96
- eligibility_status: eligibility_status,
99
+ plan_dates: plan_dates,
97
100
  additional_properties: struct
98
101
  )
99
102
  end
@@ -119,7 +122,7 @@ module CandidApiClient
119
122
  obj.group_number&.is_a?(String) != false || raise("Passed value for field obj.group_number is not the expected type, validation failed.")
120
123
  obj.start_date&.is_a?(Date) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
121
124
  obj.end_date&.is_a?(Date) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
122
- obj.eligibility_status&.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus) != false || raise("Passed value for field obj.eligibility_status is not the expected type, validation failed.")
125
+ obj.plan_dates&.is_a?(Array) != false || raise("Passed value for field obj.plan_dates is not the expected type, validation failed.")
123
126
  end
124
127
  end
125
128
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "v_1/client"
5
+
6
+ module CandidApiClient
7
+ module PreEncounter
8
+ module Lists
9
+ class Client
10
+ # @return [CandidApiClient::PreEncounter::Lists::V1::V1Client]
11
+ attr_reader :v_1
12
+
13
+ # @param request_client [CandidApiClient::RequestClient]
14
+ # @return [CandidApiClient::PreEncounter::Lists::Client]
15
+ def initialize(request_client:)
16
+ @v_1 = CandidApiClient::PreEncounter::Lists::V1::V1Client.new(request_client: request_client)
17
+ end
18
+ end
19
+
20
+ class AsyncClient
21
+ # @return [CandidApiClient::PreEncounter::Lists::V1::AsyncV1Client]
22
+ attr_reader :v_1
23
+
24
+ # @param request_client [CandidApiClient::AsyncRequestClient]
25
+ # @return [CandidApiClient::PreEncounter::Lists::AsyncClient]
26
+ def initialize(request_client:)
27
+ @v_1 = CandidApiClient::PreEncounter::Lists::V1::AsyncV1Client.new(request_client: request_client)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,213 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../../requests"
4
+ require_relative "../../common/types/sort_direction"
5
+ require_relative "types/patient_list_page"
6
+ require_relative "types/appointment_list_page"
7
+ require "async"
8
+
9
+ module CandidApiClient
10
+ module PreEncounter
11
+ module Lists
12
+ module V1
13
+ class V1Client
14
+ # @return [CandidApiClient::RequestClient]
15
+ attr_reader :request_client
16
+
17
+ # @param request_client [CandidApiClient::RequestClient]
18
+ # @return [CandidApiClient::PreEncounter::Lists::V1::V1Client]
19
+ def initialize(request_client:)
20
+ @request_client = request_client
21
+ end
22
+
23
+ # Gets patients with dependent objects for patients that match the query
24
+ # parameters.
25
+ #
26
+ # @param page_token [String]
27
+ # @param limit [Integer]
28
+ # @param sort_field [String]
29
+ # @param sort_direction [CandidApiClient::PreEncounter::Common::Types::SortDirection] Defaults to ascending.
30
+ # @param filters [String]
31
+ # @param request_options [CandidApiClient::RequestOptions]
32
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::PatientListPage]
33
+ # @example
34
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
35
+ # api.pre_encounter.lists.v_1.get_patient_list(
36
+ # page_token: "string",
37
+ # limit: 1,
38
+ # sort_field: "string",
39
+ # sort_direction: ASC,
40
+ # filters: "string"
41
+ # )
42
+ def get_patient_list(page_token: nil, limit: nil, sort_field: nil, sort_direction: nil, filters: nil,
43
+ request_options: nil)
44
+ response = @request_client.conn.get do |req|
45
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
46
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
47
+ req.headers = {
48
+ **(req.headers || {}),
49
+ **@request_client.get_headers,
50
+ **(request_options&.additional_headers || {})
51
+ }.compact
52
+ req.params = {
53
+ **(request_options&.additional_query_parameters || {}),
54
+ "page_token": page_token,
55
+ "limit": limit,
56
+ "sort_field": sort_field,
57
+ "sort_direction": sort_direction,
58
+ "filters": filters
59
+ }.compact
60
+ req.url "#{@request_client.get_url(environment: PreEncounter,
61
+ request_options: request_options)}/lists/v1/patient"
62
+ end
63
+ CandidApiClient::PreEncounter::Lists::V1::Types::PatientListPage.from_json(json_object: response.body)
64
+ end
65
+
66
+ # Searches for appointments that match the query parameters.
67
+ #
68
+ # @param sort_field [String] The string path to the field to order by. Defaults to
69
+ # appointment.startTimestamp. Path values are camelCase.
70
+ # @param sort_direction [CandidApiClient::PreEncounter::Common::Types::SortDirection] Defaults to asc.
71
+ # @param limit [Integer] Defaults to 100.
72
+ # @param page_token [String]
73
+ # @param filters [String]
74
+ # @param request_options [CandidApiClient::RequestOptions]
75
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListPage]
76
+ # @example
77
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
78
+ # api.pre_encounter.lists.v_1.get_appointment_list(
79
+ # sort_field: "string",
80
+ # sort_direction: ASC,
81
+ # limit: 1,
82
+ # page_token: "string",
83
+ # filters: "string"
84
+ # )
85
+ def get_appointment_list(sort_field: nil, sort_direction: nil, limit: nil, page_token: nil, filters: nil,
86
+ request_options: nil)
87
+ response = @request_client.conn.get do |req|
88
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
89
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
90
+ req.headers = {
91
+ **(req.headers || {}),
92
+ **@request_client.get_headers,
93
+ **(request_options&.additional_headers || {})
94
+ }.compact
95
+ req.params = {
96
+ **(request_options&.additional_query_parameters || {}),
97
+ "sort_field": sort_field,
98
+ "sort_direction": sort_direction,
99
+ "limit": limit,
100
+ "page_token": page_token,
101
+ "filters": filters
102
+ }.compact
103
+ req.url "#{@request_client.get_url(environment: PreEncounter,
104
+ request_options: request_options)}/lists/v1/appointment"
105
+ end
106
+ CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListPage.from_json(json_object: response.body)
107
+ end
108
+ end
109
+
110
+ class AsyncV1Client
111
+ # @return [CandidApiClient::AsyncRequestClient]
112
+ attr_reader :request_client
113
+
114
+ # @param request_client [CandidApiClient::AsyncRequestClient]
115
+ # @return [CandidApiClient::PreEncounter::Lists::V1::AsyncV1Client]
116
+ def initialize(request_client:)
117
+ @request_client = request_client
118
+ end
119
+
120
+ # Gets patients with dependent objects for patients that match the query
121
+ # parameters.
122
+ #
123
+ # @param page_token [String]
124
+ # @param limit [Integer]
125
+ # @param sort_field [String]
126
+ # @param sort_direction [CandidApiClient::PreEncounter::Common::Types::SortDirection] Defaults to ascending.
127
+ # @param filters [String]
128
+ # @param request_options [CandidApiClient::RequestOptions]
129
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::PatientListPage]
130
+ # @example
131
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
132
+ # api.pre_encounter.lists.v_1.get_patient_list(
133
+ # page_token: "string",
134
+ # limit: 1,
135
+ # sort_field: "string",
136
+ # sort_direction: ASC,
137
+ # filters: "string"
138
+ # )
139
+ def get_patient_list(page_token: nil, limit: nil, sort_field: nil, sort_direction: nil, filters: nil,
140
+ request_options: nil)
141
+ Async do
142
+ response = @request_client.conn.get do |req|
143
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
144
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
145
+ req.headers = {
146
+ **(req.headers || {}),
147
+ **@request_client.get_headers,
148
+ **(request_options&.additional_headers || {})
149
+ }.compact
150
+ req.params = {
151
+ **(request_options&.additional_query_parameters || {}),
152
+ "page_token": page_token,
153
+ "limit": limit,
154
+ "sort_field": sort_field,
155
+ "sort_direction": sort_direction,
156
+ "filters": filters
157
+ }.compact
158
+ req.url "#{@request_client.get_url(environment: PreEncounter,
159
+ request_options: request_options)}/lists/v1/patient"
160
+ end
161
+ CandidApiClient::PreEncounter::Lists::V1::Types::PatientListPage.from_json(json_object: response.body)
162
+ end
163
+ end
164
+
165
+ # Searches for appointments that match the query parameters.
166
+ #
167
+ # @param sort_field [String] The string path to the field to order by. Defaults to
168
+ # appointment.startTimestamp. Path values are camelCase.
169
+ # @param sort_direction [CandidApiClient::PreEncounter::Common::Types::SortDirection] Defaults to asc.
170
+ # @param limit [Integer] Defaults to 100.
171
+ # @param page_token [String]
172
+ # @param filters [String]
173
+ # @param request_options [CandidApiClient::RequestOptions]
174
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListPage]
175
+ # @example
176
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
177
+ # api.pre_encounter.lists.v_1.get_appointment_list(
178
+ # sort_field: "string",
179
+ # sort_direction: ASC,
180
+ # limit: 1,
181
+ # page_token: "string",
182
+ # filters: "string"
183
+ # )
184
+ def get_appointment_list(sort_field: nil, sort_direction: nil, limit: nil, page_token: nil, filters: nil,
185
+ request_options: nil)
186
+ Async do
187
+ response = @request_client.conn.get do |req|
188
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
189
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
190
+ req.headers = {
191
+ **(req.headers || {}),
192
+ **@request_client.get_headers,
193
+ **(request_options&.additional_headers || {})
194
+ }.compact
195
+ req.params = {
196
+ **(request_options&.additional_query_parameters || {}),
197
+ "sort_field": sort_field,
198
+ "sort_direction": sort_direction,
199
+ "limit": limit,
200
+ "page_token": page_token,
201
+ "filters": filters
202
+ }.compact
203
+ req.url "#{@request_client.get_url(environment: PreEncounter,
204
+ request_options: request_options)}/lists/v1/appointment"
205
+ end
206
+ CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListPage.from_json(json_object: response.body)
207
+ end
208
+ end
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../appointments/v_1/types/appointment"
4
+ require_relative "../../../patients/v_1/types/mutable_patient"
5
+ require_relative "../../../coverages/v_1/types/mutable_coverage"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module CandidApiClient
10
+ module PreEncounter
11
+ module Lists
12
+ module V1
13
+ module Types
14
+ class AppointmentListItem
15
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
16
+ attr_reader :appointment
17
+ # @return [CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatient]
18
+ attr_reader :patient
19
+ # @return [CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage]
20
+ attr_reader :primary_coverage
21
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
22
+ attr_reader :additional_properties
23
+ # @return [Object]
24
+ attr_reader :_field_set
25
+ protected :_field_set
26
+
27
+ OMIT = Object.new
28
+
29
+ # @param appointment [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
30
+ # @param patient [CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatient]
31
+ # @param primary_coverage [CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage]
32
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
33
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListItem]
34
+ def initialize(appointment:, patient:, primary_coverage: OMIT, additional_properties: nil)
35
+ @appointment = appointment
36
+ @patient = patient
37
+ @primary_coverage = primary_coverage if primary_coverage != OMIT
38
+ @additional_properties = additional_properties
39
+ @_field_set = {
40
+ "appointment": appointment,
41
+ "patient": patient,
42
+ "primary_coverage": primary_coverage
43
+ }.reject do |_k, v|
44
+ v == OMIT
45
+ end
46
+ end
47
+
48
+ # Deserialize a JSON object to an instance of AppointmentListItem
49
+ #
50
+ # @param json_object [String]
51
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListItem]
52
+ def self.from_json(json_object:)
53
+ struct = JSON.parse(json_object, object_class: OpenStruct)
54
+ parsed_json = JSON.parse(json_object)
55
+ if parsed_json["appointment"].nil?
56
+ appointment = nil
57
+ else
58
+ appointment = parsed_json["appointment"].to_json
59
+ appointment = CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: appointment)
60
+ end
61
+ if parsed_json["patient"].nil?
62
+ patient = nil
63
+ else
64
+ patient = parsed_json["patient"].to_json
65
+ patient = CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatient.from_json(json_object: patient)
66
+ end
67
+ if parsed_json["primary_coverage"].nil?
68
+ primary_coverage = nil
69
+ else
70
+ primary_coverage = parsed_json["primary_coverage"].to_json
71
+ primary_coverage = CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage.from_json(json_object: primary_coverage)
72
+ end
73
+ new(
74
+ appointment: appointment,
75
+ patient: patient,
76
+ primary_coverage: primary_coverage,
77
+ additional_properties: struct
78
+ )
79
+ end
80
+
81
+ # Serialize an instance of AppointmentListItem to a JSON object
82
+ #
83
+ # @return [String]
84
+ def to_json(*_args)
85
+ @_field_set&.to_json
86
+ end
87
+
88
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
89
+ # hash and check each fields type against the current object's property
90
+ # definitions.
91
+ #
92
+ # @param obj [Object]
93
+ # @return [Void]
94
+ def self.validate_raw(obj:)
95
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.validate_raw(obj: obj.appointment)
96
+ CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatient.validate_raw(obj: obj.patient)
97
+ obj.primary_coverage.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage.validate_raw(obj: obj.primary_coverage)
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "appointment_list_item"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module CandidApiClient
8
+ module PreEncounter
9
+ module Lists
10
+ module V1
11
+ module Types
12
+ class AppointmentListPage
13
+ # @return [Array<CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListItem>]
14
+ attr_reader :items
15
+ # @return [String]
16
+ attr_reader :next_page_token
17
+ # @return [String]
18
+ attr_reader :prev_page_token
19
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
20
+ attr_reader :additional_properties
21
+ # @return [Object]
22
+ attr_reader :_field_set
23
+ protected :_field_set
24
+
25
+ OMIT = Object.new
26
+
27
+ # @param items [Array<CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListItem>]
28
+ # @param next_page_token [String]
29
+ # @param prev_page_token [String]
30
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
31
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListPage]
32
+ def initialize(items:, next_page_token: OMIT, prev_page_token: OMIT, additional_properties: nil)
33
+ @items = items
34
+ @next_page_token = next_page_token if next_page_token != OMIT
35
+ @prev_page_token = prev_page_token if prev_page_token != OMIT
36
+ @additional_properties = additional_properties
37
+ @_field_set = {
38
+ "items": items,
39
+ "next_page_token": next_page_token,
40
+ "prev_page_token": prev_page_token
41
+ }.reject do |_k, v|
42
+ v == OMIT
43
+ end
44
+ end
45
+
46
+ # Deserialize a JSON object to an instance of AppointmentListPage
47
+ #
48
+ # @param json_object [String]
49
+ # @return [CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListPage]
50
+ def self.from_json(json_object:)
51
+ struct = JSON.parse(json_object, object_class: OpenStruct)
52
+ parsed_json = JSON.parse(json_object)
53
+ items = parsed_json["items"]&.map do |item|
54
+ item = item.to_json
55
+ CandidApiClient::PreEncounter::Lists::V1::Types::AppointmentListItem.from_json(json_object: item)
56
+ end
57
+ next_page_token = struct["next_page_token"]
58
+ prev_page_token = struct["prev_page_token"]
59
+ new(
60
+ items: items,
61
+ next_page_token: next_page_token,
62
+ prev_page_token: prev_page_token,
63
+ additional_properties: struct
64
+ )
65
+ end
66
+
67
+ # Serialize an instance of AppointmentListPage to a JSON object
68
+ #
69
+ # @return [String]
70
+ def to_json(*_args)
71
+ @_field_set&.to_json
72
+ end
73
+
74
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
75
+ # hash and check each fields type against the current object's property
76
+ # definitions.
77
+ #
78
+ # @param obj [Object]
79
+ # @return [Void]
80
+ def self.validate_raw(obj:)
81
+ obj.items.is_a?(Array) != false || raise("Passed value for field obj.items is not the expected type, validation failed.")
82
+ obj.next_page_token&.is_a?(String) != false || raise("Passed value for field obj.next_page_token is not the expected type, validation failed.")
83
+ obj.prev_page_token&.is_a?(String) != false || raise("Passed value for field obj.prev_page_token is not the expected type, validation failed.")
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end