summaryrefslogtreecommitdiff
path: root/CommandLineWrapper/JsonResults/Implements/ShareSeeResult.cs
blob: c965b25b2077397c6f87c3842f1e74a5d5938a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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; }
}