TypeScript Client: REST and conditional API #35
GenaRazmakhnin
announced in
Announcements
Replies: 1 comment
-
try {
const patients = await aidbox.resource.search('Patient')
.where('name', 'Gena')
.page(1).count(10).sort('name', 'desc')
.then(response => { return response })
console.log(patients)
const resource: Patient = {
gender: 'male',
name: [{ given: ['Gena1'], family: 'Razmakhnin1' }],
identifier: [{ system: 'Gena', value: '0001' }],
resourceType: 'Patient'
}
const patient = await aidbox.resource.conditionalCreate('Patient', resource)
.where('identifier', 'ACME|0001')
.where('organization', 'Organization/acme')
.where('name', 'Razmakhnin Gena')
console.log(patient)
} catch (error) {
if (error instanceof HTTPError) {
const exception = await error.response.json()
console.dir(exception, { depth: 5 })
return
}
console.dir(error, { depth: 10 })
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Considered Options for Conditional Operations
Our current REST API does not support the use of conditional operations. Here, we are considering the possible options.
REST API
CONDITIONAL API 1 (rejected)
Concerns:
.where()
is required in the conditional update case. However, we can't define the restriction at the type level to use it.CONDITIONAL API 2 (rejected)
Concerns:
CONDITIONAL API 3 (rejected)
CONDITIONAL API 4 (current)
Here are some further improvement ideas:
Beta Was this translation helpful? Give feedback.
All reactions