candidhealth 0.35.2 → 0.35.3
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/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +12 -14
- data/lib/candidhealth/pre_encounter/client.rb +5 -5
- data/lib/candidhealth/pre_encounter/common/types/base_model.rb +104 -0
- data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage.rb +10 -10
- data/lib/candidhealth/pre_encounter/notes/client.rb +32 -0
- data/lib/candidhealth/pre_encounter/notes/v_1/client.rb +257 -0
- data/lib/candidhealth/pre_encounter/notes/v_1/types/mutable_note.rb +86 -0
- data/lib/candidhealth/pre_encounter/notes/v_1/types/note.rb +149 -0
- data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +18 -6
- data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient.rb +18 -2
- data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient_with_mrn.rb +18 -2
- data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +26 -10
- data/lib/candidhealth/pre_encounter/tags/client.rb +32 -0
- data/lib/candidhealth/pre_encounter/tags/v_1/client.rb +311 -0
- data/lib/candidhealth/pre_encounter/tags/v_1/types/mutable_tag.rb +63 -0
- data/lib/candidhealth/pre_encounter/tags/v_1/types/tag.rb +123 -0
- data/lib/candidhealth/pre_encounter/tags/v_1/types/tag_page.rb +90 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +6 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 322bb186b5d934fa214e4211428784e97434a7a8306c6c670f4f4fc59d1a6a8d
|
4
|
+
data.tar.gz: 6ee5bb4e1ec74cbaca7d0f1abb83fed9b64bc832c82a89123c110a76c4b3935b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00fbc482e506e72028c476115e64f700867a012c8815c243e14ffe9c74197eb93507cb51972f315f279bba7d8630e32a16718c81ad86ecbe4b124a942e7c7631
|
7
|
+
data.tar.gz: 8cb7ace54e4a5b6a45bdb53a7520977cf0597d39701d97dead9d8edf7e980bffe15ade49fdcfa41811a356853c5eeb06f1ea433cb92d9bf318c663aff88d8579
|
@@ -17,18 +17,17 @@ module CandidApiClient
|
|
17
17
|
class Appointment
|
18
18
|
# @return [String]
|
19
19
|
attr_reader :id
|
20
|
-
# @return [String] The organization that owns this
|
20
|
+
# @return [String] The organization that owns this object.
|
21
21
|
attr_reader :organization_id
|
22
|
-
# @return [Boolean] True if the
|
23
|
-
#
|
24
|
-
# scan.
|
22
|
+
# @return [Boolean] True if the object is deactivated. Deactivated objects are not returned in
|
23
|
+
# search results but are returned in all other endpoints including scan.
|
25
24
|
attr_reader :deactivated
|
26
|
-
# @return [Integer] The version of the
|
27
|
-
#
|
25
|
+
# @return [Integer] The version of the object. Any update to any property of an object object will
|
26
|
+
# create a new version.
|
28
27
|
attr_reader :version
|
29
28
|
# @return [DateTime]
|
30
29
|
attr_reader :updated_at
|
31
|
-
# @return [String] The user ID of the user who last updated the
|
30
|
+
# @return [String] The user ID of the user who last updated the object.
|
32
31
|
attr_reader :updating_user_id
|
33
32
|
# @return [String] The Candid-defined patient identifier.
|
34
33
|
attr_reader :patient_id
|
@@ -82,14 +81,13 @@ module CandidApiClient
|
|
82
81
|
OMIT = Object.new
|
83
82
|
|
84
83
|
# @param id [String]
|
85
|
-
# @param organization_id [String] The organization that owns this
|
86
|
-
# @param deactivated [Boolean] True if the
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
# object will create a new version.
|
84
|
+
# @param organization_id [String] The organization that owns this object.
|
85
|
+
# @param deactivated [Boolean] True if the object is deactivated. Deactivated objects are not returned in
|
86
|
+
# search results but are returned in all other endpoints including scan.
|
87
|
+
# @param version [Integer] The version of the object. Any update to any property of an object object will
|
88
|
+
# create a new version.
|
91
89
|
# @param updated_at [DateTime]
|
92
|
-
# @param updating_user_id [String] The user ID of the user who last updated the
|
90
|
+
# @param updating_user_id [String] The user ID of the user who last updated the object.
|
93
91
|
# @param patient_id [String] The Candid-defined patient identifier.
|
94
92
|
# @param start_timestamp [DateTime]
|
95
93
|
# @param status [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentStatus] Defaults to PENDING. If status is NOT_READY, work_queue must be set. If status
|
@@ -1,29 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "../../requests"
|
4
|
-
require_relative "
|
4
|
+
require_relative "tags/client"
|
5
5
|
|
6
6
|
module CandidApiClient
|
7
7
|
module PreEncounter
|
8
8
|
class Client
|
9
|
-
# @return [CandidApiClient::PreEncounter::
|
9
|
+
# @return [CandidApiClient::PreEncounter::Tags::Client]
|
10
10
|
attr_reader :pre_encounter
|
11
11
|
|
12
12
|
# @param request_client [CandidApiClient::RequestClient]
|
13
13
|
# @return [CandidApiClient::PreEncounter::Client]
|
14
14
|
def initialize(request_client:)
|
15
|
-
@pre_encounter = CandidApiClient::PreEncounter::
|
15
|
+
@pre_encounter = CandidApiClient::PreEncounter::Tags::Client.new(request_client: request_client)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
class AsyncClient
|
20
|
-
# @return [CandidApiClient::PreEncounter::
|
20
|
+
# @return [CandidApiClient::PreEncounter::Tags::AsyncClient]
|
21
21
|
attr_reader :pre_encounter
|
22
22
|
|
23
23
|
# @param request_client [CandidApiClient::AsyncRequestClient]
|
24
24
|
# @return [CandidApiClient::PreEncounter::AsyncClient]
|
25
25
|
def initialize(request_client:)
|
26
|
-
@pre_encounter = CandidApiClient::PreEncounter::
|
26
|
+
@pre_encounter = CandidApiClient::PreEncounter::Tags::AsyncClient.new(request_client: request_client)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module CandidApiClient
|
8
|
+
module PreEncounter
|
9
|
+
module Common
|
10
|
+
module Types
|
11
|
+
class BaseModel
|
12
|
+
# @return [String] The organization that owns this object.
|
13
|
+
attr_reader :organization_id
|
14
|
+
# @return [Boolean] True if the object is deactivated. Deactivated objects are not returned in
|
15
|
+
# search results but are returned in all other endpoints including scan.
|
16
|
+
attr_reader :deactivated
|
17
|
+
# @return [Integer] The version of the object. Any update to any property of an object object will
|
18
|
+
# create a new version.
|
19
|
+
attr_reader :version
|
20
|
+
# @return [DateTime]
|
21
|
+
attr_reader :updated_at
|
22
|
+
# @return [String] The user ID of the user who last updated the object.
|
23
|
+
attr_reader :updating_user_id
|
24
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
attr_reader :additional_properties
|
26
|
+
# @return [Object]
|
27
|
+
attr_reader :_field_set
|
28
|
+
protected :_field_set
|
29
|
+
|
30
|
+
OMIT = Object.new
|
31
|
+
|
32
|
+
# @param organization_id [String] The organization that owns this object.
|
33
|
+
# @param deactivated [Boolean] True if the object is deactivated. Deactivated objects are not returned in
|
34
|
+
# search results but are returned in all other endpoints including scan.
|
35
|
+
# @param version [Integer] The version of the object. Any update to any property of an object object will
|
36
|
+
# create a new version.
|
37
|
+
# @param updated_at [DateTime]
|
38
|
+
# @param updating_user_id [String] The user ID of the user who last updated the object.
|
39
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
40
|
+
# @return [CandidApiClient::PreEncounter::Common::Types::BaseModel]
|
41
|
+
def initialize(organization_id:, deactivated:, version:, updated_at:, updating_user_id:,
|
42
|
+
additional_properties: nil)
|
43
|
+
@organization_id = organization_id
|
44
|
+
@deactivated = deactivated
|
45
|
+
@version = version
|
46
|
+
@updated_at = updated_at
|
47
|
+
@updating_user_id = updating_user_id
|
48
|
+
@additional_properties = additional_properties
|
49
|
+
@_field_set = {
|
50
|
+
"organization_id": organization_id,
|
51
|
+
"deactivated": deactivated,
|
52
|
+
"version": version,
|
53
|
+
"updated_at": updated_at,
|
54
|
+
"updating_user_id": updating_user_id
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Deserialize a JSON object to an instance of BaseModel
|
59
|
+
#
|
60
|
+
# @param json_object [String]
|
61
|
+
# @return [CandidApiClient::PreEncounter::Common::Types::BaseModel]
|
62
|
+
def self.from_json(json_object:)
|
63
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
64
|
+
parsed_json = JSON.parse(json_object)
|
65
|
+
organization_id = struct["organization_id"]
|
66
|
+
deactivated = struct["deactivated"]
|
67
|
+
version = struct["version"]
|
68
|
+
updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
|
69
|
+
updating_user_id = struct["updating_user_id"]
|
70
|
+
new(
|
71
|
+
organization_id: organization_id,
|
72
|
+
deactivated: deactivated,
|
73
|
+
version: version,
|
74
|
+
updated_at: updated_at,
|
75
|
+
updating_user_id: updating_user_id,
|
76
|
+
additional_properties: struct
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Serialize an instance of BaseModel to a JSON object
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
def to_json(*_args)
|
84
|
+
@_field_set&.to_json
|
85
|
+
end
|
86
|
+
|
87
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
88
|
+
# hash and check each fields type against the current object's property
|
89
|
+
# definitions.
|
90
|
+
#
|
91
|
+
# @param obj [Object]
|
92
|
+
# @return [Void]
|
93
|
+
def self.validate_raw(obj:)
|
94
|
+
obj.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_id is not the expected type, validation failed.")
|
95
|
+
obj.deactivated.is_a?(Boolean) != false || raise("Passed value for field obj.deactivated is not the expected type, validation failed.")
|
96
|
+
obj.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
|
97
|
+
obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
|
98
|
+
obj.updating_user_id.is_a?(String) != false || raise("Passed value for field obj.updating_user_id is not the expected type, validation failed.")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -20,17 +20,17 @@ module CandidApiClient
|
|
20
20
|
class Coverage
|
21
21
|
# @return [String]
|
22
22
|
attr_reader :id
|
23
|
-
# @return [String] The organization that owns this
|
23
|
+
# @return [String] The organization that owns this object.
|
24
24
|
attr_reader :organization_id
|
25
|
-
# @return [Boolean] True if the
|
25
|
+
# @return [Boolean] True if the object is deactivated. Deactivated objects are not returned in
|
26
26
|
# search results but are returned in all other endpoints including scan.
|
27
27
|
attr_reader :deactivated
|
28
|
-
# @return [Integer] The version of the
|
29
|
-
#
|
28
|
+
# @return [Integer] The version of the object. Any update to any property of an object object will
|
29
|
+
# create a new version.
|
30
30
|
attr_reader :version
|
31
31
|
# @return [DateTime]
|
32
32
|
attr_reader :updated_at
|
33
|
-
# @return [String] The user ID of the user who last updated the
|
33
|
+
# @return [String] The user ID of the user who last updated the object.
|
34
34
|
attr_reader :updating_user_id
|
35
35
|
# @return [CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageStatus] The status indiciating if the coverage is active or not.
|
36
36
|
attr_reader :status
|
@@ -62,13 +62,13 @@ module CandidApiClient
|
|
62
62
|
OMIT = Object.new
|
63
63
|
|
64
64
|
# @param id [String]
|
65
|
-
# @param organization_id [String] The organization that owns this
|
66
|
-
# @param deactivated [Boolean] True if the
|
65
|
+
# @param organization_id [String] The organization that owns this object.
|
66
|
+
# @param deactivated [Boolean] True if the object is deactivated. Deactivated objects are not returned in
|
67
67
|
# search results but are returned in all other endpoints including scan.
|
68
|
-
# @param version [Integer] The version of the
|
69
|
-
#
|
68
|
+
# @param version [Integer] The version of the object. Any update to any property of an object object will
|
69
|
+
# create a new version.
|
70
70
|
# @param updated_at [DateTime]
|
71
|
-
# @param updating_user_id [String] The user ID of the user who last updated the
|
71
|
+
# @param updating_user_id [String] The user ID of the user who last updated the object.
|
72
72
|
# @param status [CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageStatus] The status indiciating if the coverage is active or not.
|
73
73
|
# @param subscriber [CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber] The party who has signed-up for or 'owns' the contractual relationship to the
|
74
74
|
# policy or to whom the benefit of the policy for services rendered to them or
|
@@ -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 Notes
|
9
|
+
class Client
|
10
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::V1Client]
|
11
|
+
attr_reader :v_1
|
12
|
+
|
13
|
+
# @param request_client [CandidApiClient::RequestClient]
|
14
|
+
# @return [CandidApiClient::PreEncounter::Notes::Client]
|
15
|
+
def initialize(request_client:)
|
16
|
+
@v_1 = CandidApiClient::PreEncounter::Notes::V1::V1Client.new(request_client: request_client)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class AsyncClient
|
21
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::AsyncV1Client]
|
22
|
+
attr_reader :v_1
|
23
|
+
|
24
|
+
# @param request_client [CandidApiClient::AsyncRequestClient]
|
25
|
+
# @return [CandidApiClient::PreEncounter::Notes::AsyncClient]
|
26
|
+
def initialize(request_client:)
|
27
|
+
@v_1 = CandidApiClient::PreEncounter::Notes::V1::AsyncV1Client.new(request_client: request_client)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../../requests"
|
4
|
+
require_relative "types/note"
|
5
|
+
require_relative "types/mutable_note"
|
6
|
+
require "async"
|
7
|
+
|
8
|
+
module CandidApiClient
|
9
|
+
module PreEncounter
|
10
|
+
module Notes
|
11
|
+
module V1
|
12
|
+
class V1Client
|
13
|
+
# @return [CandidApiClient::RequestClient]
|
14
|
+
attr_reader :request_client
|
15
|
+
|
16
|
+
# @param request_client [CandidApiClient::RequestClient]
|
17
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::V1Client]
|
18
|
+
def initialize(request_client:)
|
19
|
+
@request_client = request_client
|
20
|
+
end
|
21
|
+
|
22
|
+
# Gets a note by NoteId.
|
23
|
+
#
|
24
|
+
# @param id [String]
|
25
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
26
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::Note]
|
27
|
+
# @example
|
28
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
29
|
+
# api.pre_encounter.notes.v_1.get(id: "string")
|
30
|
+
def get(id:, request_options: nil)
|
31
|
+
response = @request_client.conn.get do |req|
|
32
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
33
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
34
|
+
req.headers = {
|
35
|
+
**(req.headers || {}),
|
36
|
+
**@request_client.get_headers,
|
37
|
+
**(request_options&.additional_headers || {})
|
38
|
+
}.compact
|
39
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
40
|
+
request_options: request_options)}/notes/v1/#{id}"
|
41
|
+
end
|
42
|
+
CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Adds a new note.
|
46
|
+
#
|
47
|
+
# @param request [Hash] Request of type CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote, as a Hash
|
48
|
+
# * :value (String)
|
49
|
+
# * :author_email (String)
|
50
|
+
# * :author_name (String)
|
51
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
52
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::Note]
|
53
|
+
# @example
|
54
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
55
|
+
# api.pre_encounter.notes.v_1.create(request: { value: "string", author_email: "string", author_name: "string" })
|
56
|
+
def create(request:, request_options: nil)
|
57
|
+
response = @request_client.conn.post do |req|
|
58
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
59
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
60
|
+
req.headers = {
|
61
|
+
**(req.headers || {}),
|
62
|
+
**@request_client.get_headers,
|
63
|
+
**(request_options&.additional_headers || {})
|
64
|
+
}.compact
|
65
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
66
|
+
req.url "#{@request_client.get_url(environment: PreEncounter, request_options: request_options)}/notes/v1"
|
67
|
+
end
|
68
|
+
CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Updates a note. The path must contain the most recent version to prevent races.
|
72
|
+
#
|
73
|
+
# @param id [String]
|
74
|
+
# @param version [String]
|
75
|
+
# @param request [Hash] Request of type CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote, as a Hash
|
76
|
+
# * :value (String)
|
77
|
+
# * :author_email (String)
|
78
|
+
# * :author_name (String)
|
79
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
80
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::Note]
|
81
|
+
# @example
|
82
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
83
|
+
# api.pre_encounter.notes.v_1.update(
|
84
|
+
# id: "string",
|
85
|
+
# version: "string",
|
86
|
+
# request: { value: "string", author_email: "string", author_name: "string" }
|
87
|
+
# )
|
88
|
+
def update(id:, version:, request:, request_options: nil)
|
89
|
+
response = @request_client.conn.put do |req|
|
90
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
91
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
92
|
+
req.headers = {
|
93
|
+
**(req.headers || {}),
|
94
|
+
**@request_client.get_headers,
|
95
|
+
**(request_options&.additional_headers || {})
|
96
|
+
}.compact
|
97
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
98
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
99
|
+
request_options: request_options)}/notes/v1/#{id}/#{version}"
|
100
|
+
end
|
101
|
+
CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Sets a note as deactivated. The path must contain the most recent version to
|
105
|
+
# prevent races.
|
106
|
+
#
|
107
|
+
# @param id [String]
|
108
|
+
# @param version [String]
|
109
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
110
|
+
# @return [Void]
|
111
|
+
# @example
|
112
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
113
|
+
# api.pre_encounter.notes.v_1.deactivate(id: "string", version: "string")
|
114
|
+
def deactivate(id:, version:, request_options: nil)
|
115
|
+
@request_client.conn.delete do |req|
|
116
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
117
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
118
|
+
req.headers = {
|
119
|
+
**(req.headers || {}),
|
120
|
+
**@request_client.get_headers,
|
121
|
+
**(request_options&.additional_headers || {})
|
122
|
+
}.compact
|
123
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
124
|
+
request_options: request_options)}/notes/v1/#{id}/#{version}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
class AsyncV1Client
|
130
|
+
# @return [CandidApiClient::AsyncRequestClient]
|
131
|
+
attr_reader :request_client
|
132
|
+
|
133
|
+
# @param request_client [CandidApiClient::AsyncRequestClient]
|
134
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::AsyncV1Client]
|
135
|
+
def initialize(request_client:)
|
136
|
+
@request_client = request_client
|
137
|
+
end
|
138
|
+
|
139
|
+
# Gets a note by NoteId.
|
140
|
+
#
|
141
|
+
# @param id [String]
|
142
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
143
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::Note]
|
144
|
+
# @example
|
145
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
146
|
+
# api.pre_encounter.notes.v_1.get(id: "string")
|
147
|
+
def get(id:, request_options: nil)
|
148
|
+
Async do
|
149
|
+
response = @request_client.conn.get do |req|
|
150
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
151
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
152
|
+
req.headers = {
|
153
|
+
**(req.headers || {}),
|
154
|
+
**@request_client.get_headers,
|
155
|
+
**(request_options&.additional_headers || {})
|
156
|
+
}.compact
|
157
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
158
|
+
request_options: request_options)}/notes/v1/#{id}"
|
159
|
+
end
|
160
|
+
CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Adds a new note.
|
165
|
+
#
|
166
|
+
# @param request [Hash] Request of type CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote, as a Hash
|
167
|
+
# * :value (String)
|
168
|
+
# * :author_email (String)
|
169
|
+
# * :author_name (String)
|
170
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
171
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::Note]
|
172
|
+
# @example
|
173
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
174
|
+
# api.pre_encounter.notes.v_1.create(request: { value: "string", author_email: "string", author_name: "string" })
|
175
|
+
def create(request:, request_options: nil)
|
176
|
+
Async do
|
177
|
+
response = @request_client.conn.post do |req|
|
178
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
179
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
180
|
+
req.headers = {
|
181
|
+
**(req.headers || {}),
|
182
|
+
**@request_client.get_headers,
|
183
|
+
**(request_options&.additional_headers || {})
|
184
|
+
}.compact
|
185
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
186
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
187
|
+
request_options: request_options)}/notes/v1"
|
188
|
+
end
|
189
|
+
CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Updates a note. The path must contain the most recent version to prevent races.
|
194
|
+
#
|
195
|
+
# @param id [String]
|
196
|
+
# @param version [String]
|
197
|
+
# @param request [Hash] Request of type CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote, as a Hash
|
198
|
+
# * :value (String)
|
199
|
+
# * :author_email (String)
|
200
|
+
# * :author_name (String)
|
201
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
202
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::Note]
|
203
|
+
# @example
|
204
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
205
|
+
# api.pre_encounter.notes.v_1.update(
|
206
|
+
# id: "string",
|
207
|
+
# version: "string",
|
208
|
+
# request: { value: "string", author_email: "string", author_name: "string" }
|
209
|
+
# )
|
210
|
+
def update(id:, version:, request:, request_options: nil)
|
211
|
+
Async do
|
212
|
+
response = @request_client.conn.put do |req|
|
213
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
214
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
215
|
+
req.headers = {
|
216
|
+
**(req.headers || {}),
|
217
|
+
**@request_client.get_headers,
|
218
|
+
**(request_options&.additional_headers || {})
|
219
|
+
}.compact
|
220
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
221
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
222
|
+
request_options: request_options)}/notes/v1/#{id}/#{version}"
|
223
|
+
end
|
224
|
+
CandidApiClient::PreEncounter::Notes::V1::Types::Note.from_json(json_object: response.body)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Sets a note as deactivated. The path must contain the most recent version to
|
229
|
+
# prevent races.
|
230
|
+
#
|
231
|
+
# @param id [String]
|
232
|
+
# @param version [String]
|
233
|
+
# @param request_options [CandidApiClient::RequestOptions]
|
234
|
+
# @return [Void]
|
235
|
+
# @example
|
236
|
+
# api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
|
237
|
+
# api.pre_encounter.notes.v_1.deactivate(id: "string", version: "string")
|
238
|
+
def deactivate(id:, version:, request_options: nil)
|
239
|
+
Async do
|
240
|
+
@request_client.conn.delete do |req|
|
241
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
242
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
243
|
+
req.headers = {
|
244
|
+
**(req.headers || {}),
|
245
|
+
**@request_client.get_headers,
|
246
|
+
**(request_options&.additional_headers || {})
|
247
|
+
}.compact
|
248
|
+
req.url "#{@request_client.get_url(environment: PreEncounter,
|
249
|
+
request_options: request_options)}/notes/v1/#{id}/#{version}"
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module CandidApiClient
|
7
|
+
module PreEncounter
|
8
|
+
module Notes
|
9
|
+
module V1
|
10
|
+
module Types
|
11
|
+
# An object representing a Note.
|
12
|
+
class MutableNote
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :value
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :author_email
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :author_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 value [String]
|
28
|
+
# @param author_email [String]
|
29
|
+
# @param author_name [String]
|
30
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
31
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote]
|
32
|
+
def initialize(value:, author_email: OMIT, author_name: OMIT, additional_properties: nil)
|
33
|
+
@value = value
|
34
|
+
@author_email = author_email if author_email != OMIT
|
35
|
+
@author_name = author_name if author_name != OMIT
|
36
|
+
@additional_properties = additional_properties
|
37
|
+
@_field_set = {
|
38
|
+
"value": value,
|
39
|
+
"author_email": author_email,
|
40
|
+
"author_name": author_name
|
41
|
+
}.reject do |_k, v|
|
42
|
+
v == OMIT
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Deserialize a JSON object to an instance of MutableNote
|
47
|
+
#
|
48
|
+
# @param json_object [String]
|
49
|
+
# @return [CandidApiClient::PreEncounter::Notes::V1::Types::MutableNote]
|
50
|
+
def self.from_json(json_object:)
|
51
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
52
|
+
value = struct["value"]
|
53
|
+
author_email = struct["author_email"]
|
54
|
+
author_name = struct["author_name"]
|
55
|
+
new(
|
56
|
+
value: value,
|
57
|
+
author_email: author_email,
|
58
|
+
author_name: author_name,
|
59
|
+
additional_properties: struct
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Serialize an instance of MutableNote to a JSON object
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
def to_json(*_args)
|
67
|
+
@_field_set&.to_json
|
68
|
+
end
|
69
|
+
|
70
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# hash and check each fields type against the current object's property
|
72
|
+
# definitions.
|
73
|
+
#
|
74
|
+
# @param obj [Object]
|
75
|
+
# @return [Void]
|
76
|
+
def self.validate_raw(obj:)
|
77
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
78
|
+
obj.author_email&.is_a?(String) != false || raise("Passed value for field obj.author_email is not the expected type, validation failed.")
|
79
|
+
obj.author_name&.is_a?(String) != false || raise("Passed value for field obj.author_name is not the expected type, validation failed.")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|