Back to EIP
Format Indicator
⋯
service /api/v1 on new http:Listener(8080) {
resource function post data/patient(PatientReq patintReq) returns error? {
Patient patient;
if patintReq is PatientReqV1 {
patient = {
dob: patintReq.dob,
fullName: patintReq.firstName + " " + patintReq.lastName,
diagnosis: patintReq.diagnosis
};
} else {
patient = {
dob: patintReq.patient.dob,
fullName: patintReq.patient.fullName,
diagnosis: patintReq.patient.diagnosis
};
}
_ = check patientClient->/patient.post(patient, targetType = http:Response);
}
resource function post patient(Patient patient) returns error? {
_ = check patientClient->/patient.post(patient, targetType = http:Response);
}
}