diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-13 06:24:07 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-13 06:24:07 +0800 |
| commit | 7d59c15b0efd2aa5a27aef356a265f850a2e7e2f (patch) | |
| tree | 16f30ff5a7d5d871f0358f792988f369cc532b45 /CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs | |
| parent | b202287c51438d64f769dd72c579664493ba9109 (diff) | |
Add JSON result getters for command outputs
Diffstat (limited to 'CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs')
| -rw-r--r-- | CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs b/CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs new file mode 100644 index 0000000..c965b25 --- /dev/null +++ b/CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs @@ -0,0 +1,37 @@ +using CommandLineWrapper; +using CommandLineWrapper.JsonResults; +using System.Text.Json.Serialization; + +public class ShareSeeResultGetter : JsonResultGetter<SeeShareResult> +{ + private string _shareId; + + public ShareSeeResultGetter(string shareId) + => _shareId = shareId; + + protected override Task<JVCSCommandInvoker.InvokeResult> ExecCommand(JVCSWorkspace workspace) + => workspace.ShareSee(_shareId); +} + +public struct SeeShareResult +{ + public string ShareId { get; set; } + public string Sharer { get; set; } + public string Description { get; set; } + public Dictionary<string, SheetMappingMetadata> Mappings { get; set; } +} + +public struct SheetMappingMetadata +{ + // TIPS + // Since SheetMappingMetadata in the serialized output of the command-line tool `jv sheet see <SHARE_ID>` + // comes directly from the version control repository, + // its property names use the original lowercase snake_case naming, + // so JsonPropertyName must be explicitly specified for mapping. + + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("ver")] + public string Version { get; set; } +} |
