candidhealth 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/pre_encounter/appointments/client.rb +32 -0
  3. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +607 -0
  4. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +257 -0
  5. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_reason.rb +19 -0
  6. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_sort_field.rb +16 -0
  7. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_type.rb +17 -0
  8. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_work_queue.rb +17 -0
  9. data/lib/candidhealth/pre_encounter/appointments/v_1/types/mutable_appointment.rb +203 -0
  10. data/lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb +82 -0
  11. data/lib/candidhealth/pre_encounter/appointments/v_1/types/universal_service_identifier.rb +18 -0
  12. data/lib/candidhealth/pre_encounter/common/types/external_provider.rb +11 -2
  13. data/lib/candidhealth/pre_encounter/common/types/external_provider_type.rb +1 -0
  14. data/lib/candidhealth/pre_encounter/common/types/resource_page.rb +72 -0
  15. data/lib/candidhealth/pre_encounter/common/types/sort_direction.rb +14 -0
  16. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +267 -8
  17. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage.rb +31 -3
  18. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_benefits.rb +88 -0
  19. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_eligibility_check_response.rb +94 -0
  20. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb +74 -0
  21. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb +62 -0
  22. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check_metadata.rb +103 -0
  23. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check_status.rb +19 -0
  24. data/lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_type_code.rb +0 -1
  25. data/lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb +31 -3
  26. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb +86 -0
  27. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage_details.rb +124 -0
  28. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage.rb +98 -0
  29. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage_details.rb +124 -0
  30. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_type_code.rb +203 -0
  31. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +108 -24
  32. data/lib/candidhealth/pre_encounter/patients/v_1/types/contact.rb +11 -2
  33. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +4 -2
  34. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient_page.rb +90 -0
  35. data/lib/requests.rb +2 -2
  36. data/lib/types_export.rb +22 -0
  37. metadata +26 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bfe3619e7a07bdbca9a9dd58eb5decad7a20df7c87b622b1a544215d8362ecc
4
- data.tar.gz: 1e47e697d86803e556a636b369b8efd99a611e95fe072853ecb702dc5be8fe36
3
+ metadata.gz: 7050d2d13615c9d9359a7e99965bf683e999493aadf70fa3e5ca21f1b6391429
4
+ data.tar.gz: 611a6f45a868541ed4ce357362d1de00e80a4874f2ad48a308e4b4085730e427
5
5
  SHA512:
6
- metadata.gz: ba0ae49f89efa8e55a71f40deac403a83574479a14bcb1c8d4b8f1d0baee4fb7cdbcdba34803710985e961031ef9d7a8e20dd48be413abba0741d99b2f730403
7
- data.tar.gz: 5710f3dea04c0f09d8272fdeba38f59ac3c58770a174ce7912fa8d0ce99e7ddd17166cbe75642791f8dd59818412a2f901659cc0b057eb9b95b055d06a6187d6
6
+ metadata.gz: ba37abbdb804ffd7677de1e6afab36a66da7189682e234fbb4c8fdc4978c95fe1ba5a485a48bc216aad7bdd10230fdc31c4e959f0d1483592b50034b55cb8aeb
7
+ data.tar.gz: e0bd6410a9c80169d683d5d8409101b0107b0578527d2e2927b38a628ff9689eae7d51d580f65904bcfc61e3ef358031baf395c90dc8f0e0cc51f467578232e8
@@ -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 Appointments
9
+ class Client
10
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::V1Client]
11
+ attr_reader :v_1
12
+
13
+ # @param request_client [CandidApiClient::RequestClient]
14
+ # @return [CandidApiClient::PreEncounter::Appointments::Client]
15
+ def initialize(request_client:)
16
+ @v_1 = CandidApiClient::PreEncounter::Appointments::V1::V1Client.new(request_client: request_client)
17
+ end
18
+ end
19
+
20
+ class AsyncClient
21
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client]
22
+ attr_reader :v_1
23
+
24
+ # @param request_client [CandidApiClient::AsyncRequestClient]
25
+ # @return [CandidApiClient::PreEncounter::Appointments::AsyncClient]
26
+ def initialize(request_client:)
27
+ @v_1 = CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client.new(request_client: request_client)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,607 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../../requests"
4
+ require_relative "types/mutable_appointment"
5
+ require_relative "types/appointment"
6
+ require "json"
7
+ require "date"
8
+ require_relative "types/appointment_work_queue"
9
+ require_relative "types/appointment_sort_field"
10
+ require_relative "../../common/types/sort_direction"
11
+ require "async"
12
+
13
+ module CandidApiClient
14
+ module PreEncounter
15
+ module Appointments
16
+ module V1
17
+ class V1Client
18
+ # @return [CandidApiClient::RequestClient]
19
+ attr_reader :request_client
20
+
21
+ # @param request_client [CandidApiClient::RequestClient]
22
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::V1Client]
23
+ def initialize(request_client:)
24
+ @request_client = request_client
25
+ end
26
+
27
+ # Adds an appointment. VersionConflictError is returned when the
28
+ # placer_appointment_id is already in use.
29
+ #
30
+ # @param request [Hash] Request of type CandidApiClient::PreEncounter::Appointments::V1::Types::MutableAppointment, as a Hash
31
+ # * :patient_id (String)
32
+ # * :checked_in (Boolean)
33
+ # * :assigned_patient_location (String)
34
+ # * :attending_doctor (Hash)
35
+ # * :name (Hash)
36
+ # * :family (String)
37
+ # * :given (Array<String>)
38
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
39
+ # * :period (Hash)
40
+ # * :start (Date)
41
+ # * :end_ (Date)
42
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
43
+ # * :npi (String)
44
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
45
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
46
+ # * :period (Hash)
47
+ # * :start (Date)
48
+ # * :end_ (Date)
49
+ # * :canonical_id (String)
50
+ # * :referring_doctor (Hash)
51
+ # * :name (Hash)
52
+ # * :family (String)
53
+ # * :given (Array<String>)
54
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
55
+ # * :period (Hash)
56
+ # * :start (Date)
57
+ # * :end_ (Date)
58
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
59
+ # * :npi (String)
60
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
61
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
62
+ # * :period (Hash)
63
+ # * :start (Date)
64
+ # * :end_ (Date)
65
+ # * :canonical_id (String)
66
+ # * :start_timestamp (DateTime)
67
+ # * :service_duration (Integer)
68
+ # * :services (Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>)
69
+ # * :placer_appointment_id (String)
70
+ # * :appointment_reason (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason)
71
+ # * :appointment_type (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType)
72
+ # * :location_resource_id (String)
73
+ # * :work_queue (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue)
74
+ # @param request_options [CandidApiClient::RequestOptions]
75
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
76
+ # @example
77
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
78
+ # api.pre_encounter.appointments.v_1.create(request: { patient_id: "string", checked_in: true, assigned_patient_location: "string", attending_doctor: { }, referring_doctor: { }, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), service_duration: 1, services: [{ universal_service_identifier: MD_VISIT, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z) }], placer_appointment_id: "string", appointment_reason: CHECKUP, appointment_type: COMPLETE, location_resource_id: "string", work_queue: EMERGENT_ISSUE })
79
+ def create(request:, request_options: nil)
80
+ response = @request_client.conn.post do |req|
81
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
82
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
83
+ req.headers = {
84
+ **(req.headers || {}),
85
+ **@request_client.get_headers,
86
+ **(request_options&.additional_headers || {})
87
+ }.compact
88
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
89
+ req.url "#{@request_client.get_url(environment: PreEncounter,
90
+ request_options: request_options)}/appointments/v1"
91
+ end
92
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body)
93
+ end
94
+
95
+ # Gets an appointment.
96
+ #
97
+ # @param id [String]
98
+ # @param request_options [CandidApiClient::RequestOptions]
99
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
100
+ # @example
101
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
102
+ # api.pre_encounter.appointments.v_1.get(id: "string")
103
+ def get(id:, request_options: nil)
104
+ response = @request_client.conn.get do |req|
105
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
106
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
107
+ req.headers = {
108
+ **(req.headers || {}),
109
+ **@request_client.get_headers,
110
+ **(request_options&.additional_headers || {})
111
+ }.compact
112
+ req.url "#{@request_client.get_url(environment: PreEncounter,
113
+ request_options: request_options)}/appointments/v1/#{id}"
114
+ end
115
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body)
116
+ end
117
+
118
+ # Gets an appointment along with it's full history. The return list is ordered by
119
+ # version ascending.
120
+ #
121
+ # @param id [String]
122
+ # @param request_options [CandidApiClient::RequestOptions]
123
+ # @return [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>]
124
+ # @example
125
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
126
+ # api.pre_encounter.appointments.v_1.get_history(id: "string")
127
+ def get_history(id:, request_options: nil)
128
+ response = @request_client.conn.get do |req|
129
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
130
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
131
+ req.headers = {
132
+ **(req.headers || {}),
133
+ **@request_client.get_headers,
134
+ **(request_options&.additional_headers || {})
135
+ }.compact
136
+ req.url "#{@request_client.get_url(environment: PreEncounter,
137
+ request_options: request_options)}/appointments/v1/#{id}/history"
138
+ end
139
+ parsed_json = JSON.parse(response.body)
140
+ parsed_json&.map do |item|
141
+ item = item.to_json
142
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: item)
143
+ end
144
+ end
145
+
146
+ # Updates an appointment. The path must contain the most recent version to prevent
147
+ # race conditions. Updating historic versions is not supported.
148
+ #
149
+ # @param id [String]
150
+ # @param version [String]
151
+ # @param request [Hash] Request of type CandidApiClient::PreEncounter::Appointments::V1::Types::MutableAppointment, as a Hash
152
+ # * :patient_id (String)
153
+ # * :checked_in (Boolean)
154
+ # * :assigned_patient_location (String)
155
+ # * :attending_doctor (Hash)
156
+ # * :name (Hash)
157
+ # * :family (String)
158
+ # * :given (Array<String>)
159
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
160
+ # * :period (Hash)
161
+ # * :start (Date)
162
+ # * :end_ (Date)
163
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
164
+ # * :npi (String)
165
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
166
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
167
+ # * :period (Hash)
168
+ # * :start (Date)
169
+ # * :end_ (Date)
170
+ # * :canonical_id (String)
171
+ # * :referring_doctor (Hash)
172
+ # * :name (Hash)
173
+ # * :family (String)
174
+ # * :given (Array<String>)
175
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
176
+ # * :period (Hash)
177
+ # * :start (Date)
178
+ # * :end_ (Date)
179
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
180
+ # * :npi (String)
181
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
182
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
183
+ # * :period (Hash)
184
+ # * :start (Date)
185
+ # * :end_ (Date)
186
+ # * :canonical_id (String)
187
+ # * :start_timestamp (DateTime)
188
+ # * :service_duration (Integer)
189
+ # * :services (Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>)
190
+ # * :placer_appointment_id (String)
191
+ # * :appointment_reason (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason)
192
+ # * :appointment_type (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType)
193
+ # * :location_resource_id (String)
194
+ # * :work_queue (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue)
195
+ # @param request_options [CandidApiClient::RequestOptions]
196
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
197
+ # @example
198
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
199
+ # api.pre_encounter.appointments.v_1.update(
200
+ # id: "string",
201
+ # version: "string",
202
+ # request: { patient_id: "string", checked_in: true, assigned_patient_location: "string", attending_doctor: { }, referring_doctor: { }, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), service_duration: 1, services: [{ universal_service_identifier: MD_VISIT, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z) }], placer_appointment_id: "string", appointment_reason: CHECKUP, appointment_type: COMPLETE, location_resource_id: "string", work_queue: EMERGENT_ISSUE }
203
+ # )
204
+ def update(id:, version:, request:, request_options: nil)
205
+ response = @request_client.conn.put do |req|
206
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
207
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
208
+ req.headers = {
209
+ **(req.headers || {}),
210
+ **@request_client.get_headers,
211
+ **(request_options&.additional_headers || {})
212
+ }.compact
213
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
214
+ req.url "#{@request_client.get_url(environment: PreEncounter,
215
+ request_options: request_options)}/appointments/v1/#{id}/#{version}"
216
+ end
217
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body)
218
+ end
219
+
220
+ # Sets an appointment as deactivated. The path must contain the most recent
221
+ # version to prevent race conditions. Deactivating historic versions is not
222
+ # supported. Subsequent updates via PUT to the appointment will "reactivate" the
223
+ # appointment and set the deactivated flag to false.
224
+ #
225
+ # @param id [String]
226
+ # @param version [String]
227
+ # @param request_options [CandidApiClient::RequestOptions]
228
+ # @return [Void]
229
+ # @example
230
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
231
+ # api.pre_encounter.appointments.v_1.deactivate(id: "string", version: "string")
232
+ def deactivate(id:, version:, request_options: nil)
233
+ @request_client.conn.delete do |req|
234
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
235
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
236
+ req.headers = {
237
+ **(req.headers || {}),
238
+ **@request_client.get_headers,
239
+ **(request_options&.additional_headers || {})
240
+ }.compact
241
+ req.url "#{@request_client.get_url(environment: PreEncounter,
242
+ request_options: request_options)}/appointments/v1/#{id}/#{version}"
243
+ end
244
+ end
245
+
246
+ # Searches for appointments that match the query parameters.
247
+ #
248
+ # @param checked_in [Boolean]
249
+ # @param patient_id [String]
250
+ # @param min_start_timestamp [DateTime]
251
+ # @param max_start_timestamp [DateTime]
252
+ # @param placer_appointment_id [String]
253
+ # @param work_queue [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue]
254
+ # @param sort_field [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentSortField] Defaults to start_timestamp.
255
+ # @param sort_direction [CandidApiClient::PreEncounter::Common::Types::SortDirection] Defaults to asc.
256
+ # @param limit [Integer] Defaults to 1000.
257
+ # @param request_options [CandidApiClient::RequestOptions]
258
+ # @return [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>]
259
+ # @example
260
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
261
+ # api.pre_encounter.appointments.v_1.get_multi(
262
+ # checked_in: true,
263
+ # patient_id: "string",
264
+ # min_start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z),
265
+ # max_start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z),
266
+ # placer_appointment_id: "string",
267
+ # work_queue: EMERGENT_ISSUE,
268
+ # sort_field: START_TIMESTAMP,
269
+ # sort_direction: ASC,
270
+ # limit: 1
271
+ # )
272
+ def get_multi(checked_in: nil, patient_id: nil, min_start_timestamp: nil, max_start_timestamp: nil,
273
+ placer_appointment_id: nil, work_queue: nil, sort_field: nil, sort_direction: nil, limit: nil, request_options: nil)
274
+ response = @request_client.conn.get do |req|
275
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
276
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
277
+ req.headers = {
278
+ **(req.headers || {}),
279
+ **@request_client.get_headers,
280
+ **(request_options&.additional_headers || {})
281
+ }.compact
282
+ req.params = {
283
+ **(request_options&.additional_query_parameters || {}),
284
+ "checked_in": checked_in,
285
+ "patient_id": patient_id,
286
+ "min_start_timestamp": min_start_timestamp,
287
+ "max_start_timestamp": max_start_timestamp,
288
+ "placer_appointment_id": placer_appointment_id,
289
+ "work_queue": work_queue,
290
+ "sort_field": sort_field,
291
+ "sort_direction": sort_direction,
292
+ "limit": limit
293
+ }.compact
294
+ req.url "#{@request_client.get_url(environment: PreEncounter,
295
+ request_options: request_options)}/appointments/v1"
296
+ end
297
+ parsed_json = JSON.parse(response.body)
298
+ parsed_json&.map do |item|
299
+ item = item.to_json
300
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: item)
301
+ end
302
+ end
303
+ end
304
+
305
+ class AsyncV1Client
306
+ # @return [CandidApiClient::AsyncRequestClient]
307
+ attr_reader :request_client
308
+
309
+ # @param request_client [CandidApiClient::AsyncRequestClient]
310
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::AsyncV1Client]
311
+ def initialize(request_client:)
312
+ @request_client = request_client
313
+ end
314
+
315
+ # Adds an appointment. VersionConflictError is returned when the
316
+ # placer_appointment_id is already in use.
317
+ #
318
+ # @param request [Hash] Request of type CandidApiClient::PreEncounter::Appointments::V1::Types::MutableAppointment, as a Hash
319
+ # * :patient_id (String)
320
+ # * :checked_in (Boolean)
321
+ # * :assigned_patient_location (String)
322
+ # * :attending_doctor (Hash)
323
+ # * :name (Hash)
324
+ # * :family (String)
325
+ # * :given (Array<String>)
326
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
327
+ # * :period (Hash)
328
+ # * :start (Date)
329
+ # * :end_ (Date)
330
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
331
+ # * :npi (String)
332
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
333
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
334
+ # * :period (Hash)
335
+ # * :start (Date)
336
+ # * :end_ (Date)
337
+ # * :canonical_id (String)
338
+ # * :referring_doctor (Hash)
339
+ # * :name (Hash)
340
+ # * :family (String)
341
+ # * :given (Array<String>)
342
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
343
+ # * :period (Hash)
344
+ # * :start (Date)
345
+ # * :end_ (Date)
346
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
347
+ # * :npi (String)
348
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
349
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
350
+ # * :period (Hash)
351
+ # * :start (Date)
352
+ # * :end_ (Date)
353
+ # * :canonical_id (String)
354
+ # * :start_timestamp (DateTime)
355
+ # * :service_duration (Integer)
356
+ # * :services (Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>)
357
+ # * :placer_appointment_id (String)
358
+ # * :appointment_reason (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason)
359
+ # * :appointment_type (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType)
360
+ # * :location_resource_id (String)
361
+ # * :work_queue (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue)
362
+ # @param request_options [CandidApiClient::RequestOptions]
363
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
364
+ # @example
365
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
366
+ # api.pre_encounter.appointments.v_1.create(request: { patient_id: "string", checked_in: true, assigned_patient_location: "string", attending_doctor: { }, referring_doctor: { }, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), service_duration: 1, services: [{ universal_service_identifier: MD_VISIT, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z) }], placer_appointment_id: "string", appointment_reason: CHECKUP, appointment_type: COMPLETE, location_resource_id: "string", work_queue: EMERGENT_ISSUE })
367
+ def create(request:, request_options: nil)
368
+ Async do
369
+ response = @request_client.conn.post do |req|
370
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
371
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
372
+ req.headers = {
373
+ **(req.headers || {}),
374
+ **@request_client.get_headers,
375
+ **(request_options&.additional_headers || {})
376
+ }.compact
377
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
378
+ req.url "#{@request_client.get_url(environment: PreEncounter,
379
+ request_options: request_options)}/appointments/v1"
380
+ end
381
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body)
382
+ end
383
+ end
384
+
385
+ # Gets an appointment.
386
+ #
387
+ # @param id [String]
388
+ # @param request_options [CandidApiClient::RequestOptions]
389
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
390
+ # @example
391
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
392
+ # api.pre_encounter.appointments.v_1.get(id: "string")
393
+ def get(id:, request_options: nil)
394
+ Async do
395
+ response = @request_client.conn.get do |req|
396
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
397
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
398
+ req.headers = {
399
+ **(req.headers || {}),
400
+ **@request_client.get_headers,
401
+ **(request_options&.additional_headers || {})
402
+ }.compact
403
+ req.url "#{@request_client.get_url(environment: PreEncounter,
404
+ request_options: request_options)}/appointments/v1/#{id}"
405
+ end
406
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body)
407
+ end
408
+ end
409
+
410
+ # Gets an appointment along with it's full history. The return list is ordered by
411
+ # version ascending.
412
+ #
413
+ # @param id [String]
414
+ # @param request_options [CandidApiClient::RequestOptions]
415
+ # @return [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>]
416
+ # @example
417
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
418
+ # api.pre_encounter.appointments.v_1.get_history(id: "string")
419
+ def get_history(id:, request_options: nil)
420
+ Async do
421
+ response = @request_client.conn.get do |req|
422
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
423
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
424
+ req.headers = {
425
+ **(req.headers || {}),
426
+ **@request_client.get_headers,
427
+ **(request_options&.additional_headers || {})
428
+ }.compact
429
+ req.url "#{@request_client.get_url(environment: PreEncounter,
430
+ request_options: request_options)}/appointments/v1/#{id}/history"
431
+ end
432
+ parsed_json = JSON.parse(response.body)
433
+ parsed_json&.map do |item|
434
+ item = item.to_json
435
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: item)
436
+ end
437
+ end
438
+ end
439
+
440
+ # Updates an appointment. The path must contain the most recent version to prevent
441
+ # race conditions. Updating historic versions is not supported.
442
+ #
443
+ # @param id [String]
444
+ # @param version [String]
445
+ # @param request [Hash] Request of type CandidApiClient::PreEncounter::Appointments::V1::Types::MutableAppointment, as a Hash
446
+ # * :patient_id (String)
447
+ # * :checked_in (Boolean)
448
+ # * :assigned_patient_location (String)
449
+ # * :attending_doctor (Hash)
450
+ # * :name (Hash)
451
+ # * :family (String)
452
+ # * :given (Array<String>)
453
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
454
+ # * :period (Hash)
455
+ # * :start (Date)
456
+ # * :end_ (Date)
457
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
458
+ # * :npi (String)
459
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
460
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
461
+ # * :period (Hash)
462
+ # * :start (Date)
463
+ # * :end_ (Date)
464
+ # * :canonical_id (String)
465
+ # * :referring_doctor (Hash)
466
+ # * :name (Hash)
467
+ # * :family (String)
468
+ # * :given (Array<String>)
469
+ # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
470
+ # * :period (Hash)
471
+ # * :start (Date)
472
+ # * :end_ (Date)
473
+ # * :type (CandidApiClient::PreEncounter::Common::Types::ExternalProviderType)
474
+ # * :npi (String)
475
+ # * :telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
476
+ # * :addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
477
+ # * :period (Hash)
478
+ # * :start (Date)
479
+ # * :end_ (Date)
480
+ # * :canonical_id (String)
481
+ # * :start_timestamp (DateTime)
482
+ # * :service_duration (Integer)
483
+ # * :services (Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>)
484
+ # * :placer_appointment_id (String)
485
+ # * :appointment_reason (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason)
486
+ # * :appointment_type (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType)
487
+ # * :location_resource_id (String)
488
+ # * :work_queue (CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue)
489
+ # @param request_options [CandidApiClient::RequestOptions]
490
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
491
+ # @example
492
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
493
+ # api.pre_encounter.appointments.v_1.update(
494
+ # id: "string",
495
+ # version: "string",
496
+ # request: { patient_id: "string", checked_in: true, assigned_patient_location: "string", attending_doctor: { }, referring_doctor: { }, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), service_duration: 1, services: [{ universal_service_identifier: MD_VISIT, start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z) }], placer_appointment_id: "string", appointment_reason: CHECKUP, appointment_type: COMPLETE, location_resource_id: "string", work_queue: EMERGENT_ISSUE }
497
+ # )
498
+ def update(id:, version:, request:, request_options: nil)
499
+ Async do
500
+ response = @request_client.conn.put do |req|
501
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
502
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
503
+ req.headers = {
504
+ **(req.headers || {}),
505
+ **@request_client.get_headers,
506
+ **(request_options&.additional_headers || {})
507
+ }.compact
508
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
509
+ req.url "#{@request_client.get_url(environment: PreEncounter,
510
+ request_options: request_options)}/appointments/v1/#{id}/#{version}"
511
+ end
512
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: response.body)
513
+ end
514
+ end
515
+
516
+ # Sets an appointment as deactivated. The path must contain the most recent
517
+ # version to prevent race conditions. Deactivating historic versions is not
518
+ # supported. Subsequent updates via PUT to the appointment will "reactivate" the
519
+ # appointment and set the deactivated flag to false.
520
+ #
521
+ # @param id [String]
522
+ # @param version [String]
523
+ # @param request_options [CandidApiClient::RequestOptions]
524
+ # @return [Void]
525
+ # @example
526
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
527
+ # api.pre_encounter.appointments.v_1.deactivate(id: "string", version: "string")
528
+ def deactivate(id:, version:, request_options: nil)
529
+ Async do
530
+ @request_client.conn.delete do |req|
531
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
532
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
533
+ req.headers = {
534
+ **(req.headers || {}),
535
+ **@request_client.get_headers,
536
+ **(request_options&.additional_headers || {})
537
+ }.compact
538
+ req.url "#{@request_client.get_url(environment: PreEncounter,
539
+ request_options: request_options)}/appointments/v1/#{id}/#{version}"
540
+ end
541
+ end
542
+ end
543
+
544
+ # Searches for appointments that match the query parameters.
545
+ #
546
+ # @param checked_in [Boolean]
547
+ # @param patient_id [String]
548
+ # @param min_start_timestamp [DateTime]
549
+ # @param max_start_timestamp [DateTime]
550
+ # @param placer_appointment_id [String]
551
+ # @param work_queue [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue]
552
+ # @param sort_field [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentSortField] Defaults to start_timestamp.
553
+ # @param sort_direction [CandidApiClient::PreEncounter::Common::Types::SortDirection] Defaults to asc.
554
+ # @param limit [Integer] Defaults to 1000.
555
+ # @param request_options [CandidApiClient::RequestOptions]
556
+ # @return [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment>]
557
+ # @example
558
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
559
+ # api.pre_encounter.appointments.v_1.get_multi(
560
+ # checked_in: true,
561
+ # patient_id: "string",
562
+ # min_start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z),
563
+ # max_start_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z),
564
+ # placer_appointment_id: "string",
565
+ # work_queue: EMERGENT_ISSUE,
566
+ # sort_field: START_TIMESTAMP,
567
+ # sort_direction: ASC,
568
+ # limit: 1
569
+ # )
570
+ def get_multi(checked_in: nil, patient_id: nil, min_start_timestamp: nil, max_start_timestamp: nil,
571
+ placer_appointment_id: nil, work_queue: nil, sort_field: nil, sort_direction: nil, limit: nil, request_options: nil)
572
+ Async do
573
+ response = @request_client.conn.get do |req|
574
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
575
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
576
+ req.headers = {
577
+ **(req.headers || {}),
578
+ **@request_client.get_headers,
579
+ **(request_options&.additional_headers || {})
580
+ }.compact
581
+ req.params = {
582
+ **(request_options&.additional_query_parameters || {}),
583
+ "checked_in": checked_in,
584
+ "patient_id": patient_id,
585
+ "min_start_timestamp": min_start_timestamp,
586
+ "max_start_timestamp": max_start_timestamp,
587
+ "placer_appointment_id": placer_appointment_id,
588
+ "work_queue": work_queue,
589
+ "sort_field": sort_field,
590
+ "sort_direction": sort_direction,
591
+ "limit": limit
592
+ }.compact
593
+ req.url "#{@request_client.get_url(environment: PreEncounter,
594
+ request_options: request_options)}/appointments/v1"
595
+ end
596
+ parsed_json = JSON.parse(response.body)
597
+ parsed_json&.map do |item|
598
+ item = item.to_json
599
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment.from_json(json_object: item)
600
+ end
601
+ end
602
+ end
603
+ end
604
+ end
605
+ end
606
+ end
607
+ end