Java Client
The sadv-client and nuva libraries are available for Java.
Adding the sadv-client Dependency
With Maven
Add the following dependency to pom.xml:
<dependency>
<groupId>com.syadem.sadv</groupId>
<artifactId>sadv-client</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
With Gradle
Add the following dependency to your build file:
repositories {
mavenCentral()
}
dependencies {
implementation "com.syadem.sadv:sadv-client:0.0.1"
}
Example of Retrieving a Diagnosis
Prerequisite: your access credentials must be set in the SADV_CLIENT_ID and SADV_CLIENT_SECRET environment variables.
public class Main {
public static void main(String[] args) {
// Instantiate a client
var client = new ApiClient(
Optional
.ofNullable(System.getenv("SADV_CLIENT_ID"))
.orElseThrow(() ->
new IllegalStateException(
"Environment variable SADV_CLIENT_ID is missing."
)
),
// Client secret
Optional
.ofNullable(System.getenv("SADV_CLIENT_SECRET"))
.orElseThrow(() ->
new IllegalStateException(
"Environment variable SADV_CLIENT_SECRET is missing."
)
),
null
);
// Configure the client
client.setBasePath("https://api.fr.sad.mesvaccins.net");
client.setDebugging(true);
// Instantiate the API
var sadvApi = new DefaultApi(client);
var diagnosticRequest = new DiagnosticRequest()
.patient(
new Patient()
.gender(GenderEnum.M)
.birthdate(LocalDate.of(2023, 1, 1))
.addPreventionActsItem(
new ImmunizationAct()
.date(LocalDate.of(2023, 1, 1))
.preventionMethodId("e05d945b-1e8c-4670-b2d0-281ebeea0a1c")
.booster(false)
)
);
try {
// Call the API
var result = sadvApi.diagnosticForPatient(diagnosticRequest);
// Display the results
System.out.println(
"The immunization conclusion is \"" + result.getConclusion() + "\"."
);
for (var diseaseDiagnostic : result.getDiagnosticPerDisease()) {
System.out.println(
"The patient has status \"" +
diseaseDiagnostic.getAdvice().getConclusion() +
"\" for " +
diseaseDiagnostic.getDisease().getName() +
"."
);
}
} catch (ApiException e) {
System.err.println(
"Exception when calling DefaultApi#diagnosticForPatient"
);
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Example Project
You can download the archive for an example project here.