diff --git a/bindings_wasm/src/encoded_content.rs b/bindings_wasm/src/encoded_content.rs index 87b933b5e..3a5a7fbdd 100644 --- a/bindings_wasm/src/encoded_content.rs +++ b/bindings_wasm/src/encoded_content.rs @@ -12,6 +12,24 @@ pub struct WasmContentTypeId { pub version_minor: u32, } +#[wasm_bindgen] +impl WasmContentTypeId { + #[wasm_bindgen(constructor)] + pub fn new( + authority_id: String, + type_id: String, + version_major: u32, + version_minor: u32, + ) -> WasmContentTypeId { + WasmContentTypeId { + authority_id, + type_id, + version_major, + version_minor, + } + } +} + impl From for WasmContentTypeId { fn from(content_type_id: ContentTypeId) -> WasmContentTypeId { WasmContentTypeId { @@ -44,6 +62,26 @@ pub struct WasmEncodedContent { pub content: Uint8Array, } +#[wasm_bindgen] +impl WasmEncodedContent { + #[wasm_bindgen(constructor)] + pub fn new( + r#type: Option, + parameters: JsValue, + fallback: Option, + compression: Option, + content: Uint8Array, + ) -> WasmEncodedContent { + WasmEncodedContent { + r#type, + parameters, + fallback, + compression, + content, + } + } +} + impl From for WasmEncodedContent { fn from(content: EncodedContent) -> WasmEncodedContent { let r#type = content.r#type.map(|v| v.into());