haste_operation_executor/
structs.rs1use haste_fhir_model::r4::generated::terminology::IssueType;
2use haste_fhir_operation_error::OperationOutcomeError;
3
4pub enum PluginCodeType {
5 JavaScript,
6 TypeScript,
7}
8
9impl TryFrom<&str> for PluginCodeType {
10 type Error = OperationOutcomeError;
11
12 fn try_from(value: &str) -> Result<Self, Self::Error> {
13 match value {
14 "typescript" | "text/typescript" | "application/typescript" => {
15 Ok(PluginCodeType::TypeScript)
16 }
17 "javascript" | "text/javascript" | "application/javascript" => {
18 Ok(PluginCodeType::JavaScript)
19 }
20 _ => Err(OperationOutcomeError::error(
21 IssueType::Invalid(None),
22 format!("Unsupported custom-code media-type: {value}"),
23 )),
24 }
25 }
26}