diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 0497a4be..87ad8ed7 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -1120,6 +1120,18 @@ } } }, + "CompressionType": { + "description": "Compression requested for a binary command response. Small or incompressible responses may remain uncompressed.", + "oneOf": [ + { + "description": "Zstandard framing, detected by magic bytes `28 b5 2f fd`, around the complete MessagePack response.", + "type": "string", + "enum": [ + "zstd" + ] + } + ] + }, "CutStrategy": { "description": "What strategy (algorithm) should be used for cutting? Defaults to Automatic.", "oneOf": [ @@ -4239,6 +4251,15 @@ "description": "Export the scene to a file.\n\nThe response is a MsgPack-encoded message in a WebSocket binary frame.", "type": "object", "properties": { + "compression": { + "nullable": true, + "description": "Optional compression for the binary response. Defaults to uncompressed.", + "allOf": [ + { + "$ref": "#/components/schemas/CompressionType" + } + ] + }, "entity_ids": { "description": "IDs of the entities to be exported. If this is empty, then all entities are exported.", "type": "array", diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 696389e8..c49f923d 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -696,6 +696,9 @@ define_modeling_cmd_enum! { /// KCL source to embed in formats that support source metadata. #[serde(default, skip_serializing_if = "Option::is_none")] pub kcl_source: Option, + /// Optional compression for the binary response. Defaults to uncompressed. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, } /// Export the scene to a file. diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index 2d7c63a2..fc0d4a8a 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -20,6 +20,18 @@ pub mod safe_filepath; pub use crate::kcl_project::{KclFile, KclFileBuilder, KclProject, KclProjectBuilder}; +/// Compression requested for a binary command response. Small or incompressible responses may remain uncompressed. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "Compression.ts"))] +#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] +pub enum CompressionType { + /// Zstandard framing, detected by magic bytes `28 b5 2f fd`, around the complete MessagePack response. + Zstd, +} + /// Default tolerance values for modeling operations. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)] #[serde(rename_all = "snake_case")]