From b49ceff5a043a8efd56a99e1d7b294564eb84ae3 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Fri, 22 Sep 2023 10:26:52 -0700 Subject: [PATCH 1/9] Fixing tests --- ...se_Nullable_False_KeepCandidCase_True.snap | 8 ++-- ...lse_Nullable_True_KeepCandidCase_True.snap | 8 ++-- ...ue_Nullable_False_KeepCandidCase_True.snap | 8 ++-- ...rue_Nullable_True_KeepCandidCase_True.snap | 8 ++-- ...se_Nullable_False_KeepCandidCase_True.snap | 40 +++++++++---------- ...lse_Nullable_True_KeepCandidCase_True.snap | 40 +++++++++---------- ...ue_Nullable_False_KeepCandidCase_True.snap | 40 +++++++++---------- ...rue_Nullable_True_KeepCandidCase_True.snap | 40 +++++++++---------- 8 files changed, 96 insertions(+), 96 deletions(-) diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap index c214dad0..0cac2d7b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task>> a() + public async Task)>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>>(this.Converter); + return reply.ToObjects)>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap index 2fd21dd7..a62bf5ec 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task>> a() + public async Task)>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>>(this.Converter); + return reply.ToObjects)>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap index c214dad0..0cac2d7b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task>> a() + public async Task)>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>>(this.Converter); + return reply.ToObjects)>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap index 2fd21dd7..a62bf5ec 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task>> a() + public async Task)>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>>(this.Converter); + return reply.ToObjects)>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap index 29e1324d..63312330 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test.Models { public class Governance { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test.Models public ulong short_voting_period_seconds { get; set; } - public Dictionary proposals { get; set; } + public List<(ulong, ProposalData)> proposals { get; set; } - public Dictionary in_flight_commands { get; set; } + public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } - public Dictionary neurons { get; set; } + public List<(ulong, Neuron)> neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test.Models { public class GovernanceCachedMetrics { - public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public Dictionary not_dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test.Models public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public Dictionary dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public Dictionary dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test.Models { public class ListNeuronsResponse { - public Dictionary neuron_infos { get; set; } + public List<(ulong, NeuronInfo)> neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test.Models public OptionalValue dissolve_state { get; set; } - public Dictionary followees { get; set; } + public List<(int, Followees)> followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test.Models public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test.Models { public class SetDefaultFollowees { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } - public SetDefaultFollowees(Dictionary defaultFollowees) + public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) { this.default_followees = defaultFollowees; } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap index 21dd66b2..6bd16b53 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test.Models { public class Governance { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test.Models public ulong short_voting_period_seconds { get; set; } - public Dictionary proposals { get; set; } + public List<(ulong, ProposalData)> proposals { get; set; } - public Dictionary in_flight_commands { get; set; } + public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } - public Dictionary neurons { get; set; } + public List<(ulong, Neuron)> neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test.Models { public class GovernanceCachedMetrics { - public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public Dictionary not_dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test.Models public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public Dictionary dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public Dictionary dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test.Models { public class ListNeuronsResponse { - public Dictionary neuron_infos { get; set; } + public List<(ulong, NeuronInfo)> neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test.Models public OptionalValue dissolve_state { get; set; } - public Dictionary followees { get; set; } + public List<(int, Followees)> followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test.Models public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test.Models { public class SetDefaultFollowees { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } - public SetDefaultFollowees(Dictionary defaultFollowees) + public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) { this.default_followees = defaultFollowees; } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap index 2d7dbb65..289f3523 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test { public class Governance { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test public ulong short_voting_period_seconds { get; set; } - public Dictionary proposals { get; set; } + public List<(ulong, ProposalData)> proposals { get; set; } - public Dictionary in_flight_commands { get; set; } + public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } - public Dictionary neurons { get; set; } + public List<(ulong, Neuron)> neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test { public class GovernanceCachedMetrics { - public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public Dictionary not_dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public Dictionary dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public Dictionary dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test { public class ListNeuronsResponse { - public Dictionary neuron_infos { get; set; } + public List<(ulong, NeuronInfo)> neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test public OptionalValue dissolve_state { get; set; } - public Dictionary followees { get; set; } + public List<(int, Followees)> followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test { public class SetDefaultFollowees { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } - public SetDefaultFollowees(Dictionary defaultFollowees) + public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) { this.default_followees = defaultFollowees; } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap index 046b9314..3f15ad87 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test { public class Governance { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test public ulong short_voting_period_seconds { get; set; } - public Dictionary proposals { get; set; } + public List<(ulong, ProposalData)> proposals { get; set; } - public Dictionary in_flight_commands { get; set; } + public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } - public Dictionary neurons { get; set; } + public List<(ulong, Neuron)> neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test { public class GovernanceCachedMetrics { - public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public Dictionary not_dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public Dictionary dissolving_neurons_count_buckets { get; set; } + public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public Dictionary dissolving_neurons_e8s_buckets { get; set; } + public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test { public class ListNeuronsResponse { - public Dictionary neuron_infos { get; set; } + public List<(ulong, NeuronInfo)> neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test public OptionalValue dissolve_state { get; set; } - public Dictionary followees { get; set; } + public List<(int, Followees)> followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public Dictionary ballots { get; set; } + public List<(ulong, Ballot)> ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test { public class SetDefaultFollowees { - public Dictionary default_followees { get; set; } + public List<(int, Followees)> default_followees { get; set; } - public SetDefaultFollowees(Dictionary defaultFollowees) + public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) { this.default_followees = defaultFollowees; } From 5a87a6a189e9af678ea505604f76c2a653a18bdd Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Fri, 22 Sep 2023 10:40:43 -0700 Subject: [PATCH 2/9] Fixing tests --- ...se_Nullable_False_KeepCandidCase_True.snap | 8 ++-- ...lse_Nullable_True_KeepCandidCase_True.snap | 8 ++-- ...ue_Nullable_False_KeepCandidCase_True.snap | 8 ++-- ...rue_Nullable_True_KeepCandidCase_True.snap | 8 ++-- ...se_Nullable_False_KeepCandidCase_True.snap | 40 +++++++++---------- ...lse_Nullable_True_KeepCandidCase_True.snap | 40 +++++++++---------- ...ue_Nullable_False_KeepCandidCase_True.snap | 40 +++++++++---------- ...rue_Nullable_True_KeepCandidCase_True.snap | 40 +++++++++---------- 8 files changed, 96 insertions(+), 96 deletions(-) diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap index 0cac2d7b..c214dad0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task)>> a() + public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects)>>(this.Converter); + return reply.ToObjects>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap index a62bf5ec..2fd21dd7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task)>> a() + public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects)>>(this.Converter); + return reply.ToObjects>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap index 0cac2d7b..c214dad0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task)>> a() + public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects)>>(this.Converter); + return reply.ToObjects>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap index a62bf5ec..2fd21dd7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap @@ -22,20 +22,20 @@ namespace Test this.Converter = converter; } - public async Task)>> a() + public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects)>>(this.Converter); + return reply.ToObjects>>(this.Converter); } - public async Task> b() + public async Task> b() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap index 63312330..29e1324d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test.Models { public class Governance { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test.Models public ulong short_voting_period_seconds { get; set; } - public List<(ulong, ProposalData)> proposals { get; set; } + public Dictionary proposals { get; set; } - public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } + public Dictionary in_flight_commands { get; set; } - public List<(ulong, Neuron)> neurons { get; set; } + public Dictionary neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test.Models { public class GovernanceCachedMetrics { - public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } + public Dictionary not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test.Models public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } + public Dictionary dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } + public Dictionary dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test.Models { public class ListNeuronsResponse { - public List<(ulong, NeuronInfo)> neuron_infos { get; set; } + public Dictionary neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test.Models public OptionalValue dissolve_state { get; set; } - public List<(int, Followees)> followees { get; set; } + public Dictionary followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test.Models public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test.Models { public class SetDefaultFollowees { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } - public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) + public SetDefaultFollowees(Dictionary defaultFollowees) { this.default_followees = defaultFollowees; } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap index 6bd16b53..21dd66b2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test.Models { public class Governance { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test.Models public ulong short_voting_period_seconds { get; set; } - public List<(ulong, ProposalData)> proposals { get; set; } + public Dictionary proposals { get; set; } - public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } + public Dictionary in_flight_commands { get; set; } - public List<(ulong, Neuron)> neurons { get; set; } + public Dictionary neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test.Models { public class GovernanceCachedMetrics { - public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } + public Dictionary not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test.Models public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } + public Dictionary dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } + public Dictionary dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test.Models { public class ListNeuronsResponse { - public List<(ulong, NeuronInfo)> neuron_infos { get; set; } + public Dictionary neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test.Models public OptionalValue dissolve_state { get; set; } - public List<(int, Followees)> followees { get; set; } + public Dictionary followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test.Models public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test.Models public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test.Models public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test.Models { public class SetDefaultFollowees { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } - public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) + public SetDefaultFollowees(Dictionary defaultFollowees) { this.default_followees = defaultFollowees; } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap index 289f3523..2d7dbb65 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test { public class Governance { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test public ulong short_voting_period_seconds { get; set; } - public List<(ulong, ProposalData)> proposals { get; set; } + public Dictionary proposals { get; set; } - public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } + public Dictionary in_flight_commands { get; set; } - public List<(ulong, Neuron)> neurons { get; set; } + public Dictionary neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test { public class GovernanceCachedMetrics { - public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } + public Dictionary not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } + public Dictionary dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } + public Dictionary dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test { public class ListNeuronsResponse { - public List<(ulong, NeuronInfo)> neuron_infos { get; set; } + public Dictionary neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test public OptionalValue dissolve_state { get; set; } - public List<(int, Followees)> followees { get; set; } + public Dictionary followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test { public class SetDefaultFollowees { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } - public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) + public SetDefaultFollowees(Dictionary defaultFollowees) { this.default_followees = defaultFollowees; } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap index 3f15ad87..046b9314 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap @@ -1547,7 +1547,7 @@ namespace Test { public class Governance { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } public ulong wait_for_quiet_threshold_seconds { get; set; } @@ -1563,15 +1563,15 @@ namespace Test public ulong short_voting_period_seconds { get; set; } - public List<(ulong, ProposalData)> proposals { get; set; } + public Dictionary proposals { get; set; } - public List<(ulong, NeuronInFlightCommand)> in_flight_commands { get; set; } + public Dictionary in_flight_commands { get; set; } - public List<(ulong, Neuron)> neurons { get; set; } + public Dictionary neurons { get; set; } public ulong genesis_timestamp_seconds { get; set; } - public Governance(List<(int, Followees)> defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) { this.default_followees = defaultFollowees; this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; @@ -1601,13 +1601,13 @@ namespace Test { public class GovernanceCachedMetrics { - public List<(ulong, double)> not_dissolving_neurons_e8s_buckets { get; set; } + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } public ulong garbage_collectable_neurons_count { get; set; } public ulong neurons_with_invalid_stake_count { get; set; } - public List<(ulong, ulong)> not_dissolving_neurons_count_buckets { get; set; } + public Dictionary not_dissolving_neurons_count_buckets { get; set; } public ulong total_supply_icp { get; set; } @@ -1623,17 +1623,17 @@ namespace Test public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } - public List<(ulong, ulong)> dissolving_neurons_count_buckets { get; set; } + public Dictionary dissolving_neurons_count_buckets { get; set; } public ulong dissolving_neurons_count { get; set; } - public List<(ulong, double)> dissolving_neurons_e8s_buckets { get; set; } + public Dictionary dissolving_neurons_e8s_buckets { get; set; } public ulong community_fund_total_staked_e8s { get; set; } public ulong timestamp_seconds { get; set; } - public GovernanceCachedMetrics(List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; @@ -1804,11 +1804,11 @@ namespace Test { public class ListNeuronsResponse { - public List<(ulong, NeuronInfo)> neuron_infos { get; set; } + public Dictionary neuron_infos { get; set; } public List full_neurons { get; set; } - public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) { this.neuron_infos = neuronInfos; this.full_neurons = fullNeurons; @@ -2129,7 +2129,7 @@ namespace Test public OptionalValue dissolve_state { get; set; } - public List<(int, Followees)> followees { get; set; } + public Dictionary followees { get; set; } public ulong neuron_fees_e8s { get; set; } @@ -2137,7 +2137,7 @@ namespace Test public OptionalValue known_neuron_data { get; set; } - public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) { this.id = id; this.controller = controller; @@ -2589,7 +2589,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2611,7 +2611,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) { this.id = id; this.failure_reason = failureReason; @@ -2652,7 +2652,7 @@ namespace Test public OptionalValue failure_reason { get; set; } - public List<(ulong, Ballot)> ballots { get; set; } + public Dictionary ballots { get; set; } public ulong proposal_timestamp_seconds { get; set; } @@ -2676,7 +2676,7 @@ namespace Test public ulong executed_timestamp_seconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.id = id; this.status = status; @@ -3345,9 +3345,9 @@ namespace Test { public class SetDefaultFollowees { - public List<(int, Followees)> default_followees { get; set; } + public Dictionary default_followees { get; set; } - public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) + public SetDefaultFollowees(Dictionary defaultFollowees) { this.default_followees = defaultFollowees; } From 8a80e85372e6962b95e3191aec5307de765093b5 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Fri, 22 Sep 2023 17:35:53 -0700 Subject: [PATCH 3/9] Making custom config less tedious --- .../Governance/Models/AccountId.cs | 6 +- .../Sample.Shared/Governance/Models/Action.cs | 11 +- .../Governance/Models/Governance.cs | 10 +- .../Models/GovernanceCachedMetrics.cs | 14 +- .../Governance/Models/ListNeuronsResponse.cs | 4 +- .../Sample.Shared/Governance/Models/Neuron.cs | 4 +- .../Governance/Models/ProposalData.cs | 4 +- .../Governance/Models/ProposalInfo.cs | 4 +- .../Governance/Models/SetDefaultFollowees.cs | 4 +- .../ICRC1Ledger/ICRC1LedgerApiClient.cs | 4 +- .../ICRC1Ledger/Models/InitArgs.cs | 6 +- .../ICRC1Ledger/Models/UpgradeArgs.cs | 4 +- .../Sample.Shared/ICRC1Ledger/Models/Value.cs | 2 +- samples/Sample.Shared/candid-client.toml | 23 ++- src/ClientGenerator/API.md | 171 +++++------------- src/ClientGenerator/API.xml | 78 ++------ src/ClientGenerator/ClientCodeGenerator.cs | 43 ++--- .../ClientGenerationOptions.cs | 96 +++------- src/ClientGenerator/README.md | 92 ++++++++-- src/ClientGenerator/ResolvedName.cs | 19 +- src/ClientGenerator/TomlConfigParser.cs | 48 ++--- 21 files changed, 251 insertions(+), 396 deletions(-) diff --git a/samples/Sample.Shared/Governance/Models/AccountId.cs b/samples/Sample.Shared/Governance/Models/AccountId.cs index 490a3deb..e89a3d43 100644 --- a/samples/Sample.Shared/Governance/Models/AccountId.cs +++ b/samples/Sample.Shared/Governance/Models/AccountId.cs @@ -5,11 +5,11 @@ namespace Sample.Shared.Governance.Models public class AccountId { [CandidName("hash")] - public byte[] Hazh { get; set; } + public byte[] Hash { get; set; } - public AccountId(byte[] hazh) + public AccountId(byte[] hash) { - this.Hazh = hazh; + this.Hash = hash; } public AccountId() diff --git a/samples/Sample.Shared/Governance/Models/Action.cs b/samples/Sample.Shared/Governance/Models/Action.cs index 459c794d..494c7c54 100644 --- a/samples/Sample.Shared/Governance/Models/Action.cs +++ b/samples/Sample.Shared/Governance/Models/Action.cs @@ -23,9 +23,9 @@ protected Action() { } - public static Action RegisterKnownNeuron(KnownNeuron info) + public static Action RegisterNeuron(KnownNeuron info) { - return new Action(ActionTag.RegisterKnownNeuron, info); + return new Action(ActionTag.RegisterNeuron, info); } public static Action ManageNeuron(ManageNeuron info) @@ -88,9 +88,9 @@ public static Action Motion(Motion info) return new Action(ActionTag.Motion, info); } - public KnownNeuron AsRegisterKnownNeuron() + public KnownNeuron AsRegisterNeuron() { - this.ValidateTag(ActionTag.RegisterKnownNeuron); + this.ValidateTag(ActionTag.RegisterNeuron); return (KnownNeuron)this.Value!; } @@ -177,8 +177,9 @@ private void ValidateTag(ActionTag tag) public enum ActionTag { + [CandidName("RegisterKnownNeuron")] [VariantOptionType(typeof(KnownNeuron))] - RegisterKnownNeuron, + RegisterNeuron, [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, [VariantOptionType(typeof(CreateServiceNervousSystem))] diff --git a/samples/Sample.Shared/Governance/Models/Governance.cs b/samples/Sample.Shared/Governance/Models/Governance.cs index c5145755..d78caf94 100644 --- a/samples/Sample.Shared/Governance/Models/Governance.cs +++ b/samples/Sample.Shared/Governance/Models/Governance.cs @@ -8,7 +8,7 @@ namespace Sample.Shared.Governance.Models public class Governance { [CandidName("default_followees")] - public Dictionary DefaultFollowees { get; set; } + public List<(int, Followees)> DefaultFollowees { get; set; } [CandidName("making_sns_proposal")] public OptionalValue MakingSnsProposal { get; set; } @@ -53,18 +53,18 @@ public class Governance public OptionalValue Migrations { get; set; } [CandidName("proposals")] - public List<(ulong, ProposalData)> Proposals { get; set; } + public Dictionary Proposals { get; set; } [CandidName("in_flight_commands")] - public List<(ulong, NeuronInFlightCommand)> InFlightCommands { get; set; } + public Dictionary InFlightCommands { get; set; } [CandidName("neurons")] - public List<(ulong, Neuron)> Neurons { get; set; } + public Dictionary Neurons { get; set; } [CandidName("genesis_timestamp_seconds")] public ulong GenesisTimestampSeconds { get; set; } - public Governance(Dictionary defaultFollowees, OptionalValue makingSnsProposal, OptionalValue mostRecentMonthlyNodeProviderRewards, OptionalValue maturityModulationLastUpdatedAtTimestampSeconds, ulong waitForQuietThresholdSeconds, OptionalValue metrics, OptionalValue neuronManagementVotingPeriodSeconds, List nodeProviders, OptionalValue cachedDailyMaturityModulationBasisPoints, OptionalValue economics, OptionalValue spawningNeurons, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, OptionalValue migrations, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) + public Governance(List<(int, Followees)> defaultFollowees, OptionalValue makingSnsProposal, OptionalValue mostRecentMonthlyNodeProviderRewards, OptionalValue maturityModulationLastUpdatedAtTimestampSeconds, ulong waitForQuietThresholdSeconds, OptionalValue metrics, OptionalValue neuronManagementVotingPeriodSeconds, List nodeProviders, OptionalValue cachedDailyMaturityModulationBasisPoints, OptionalValue economics, OptionalValue spawningNeurons, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, OptionalValue migrations, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) { this.DefaultFollowees = defaultFollowees; this.MakingSnsProposal = makingSnsProposal; diff --git a/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs b/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs index b53d4e11..dfb23b66 100644 --- a/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs +++ b/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs @@ -9,7 +9,7 @@ public class GovernanceCachedMetrics public ulong TotalMaturityE8sEquivalent { get; set; } [CandidName("not_dissolving_neurons_e8s_buckets")] - public List<(ulong, double)> NotDissolvingNeuronsE8sBuckets { get; set; } + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } [CandidName("dissolving_neurons_staked_maturity_e8s_equivalent_sum")] public ulong DissolvingNeuronsStakedMaturityE8sEquivalentSum { get; set; } @@ -18,13 +18,13 @@ public class GovernanceCachedMetrics public ulong GarbageCollectableNeuronsCount { get; set; } [CandidName("dissolving_neurons_staked_maturity_e8s_equivalent_buckets")] - public List<(ulong, double)> DissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } + public Dictionary DissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } [CandidName("neurons_with_invalid_stake_count")] public ulong NeuronsWithInvalidStakeCount { get; set; } [CandidName("not_dissolving_neurons_count_buckets")] - public List<(ulong, ulong)> NotDissolvingNeuronsCountBuckets { get; set; } + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } [CandidName("total_supply_icp")] public ulong TotalSupplyIcp { get; set; } @@ -63,16 +63,16 @@ public class GovernanceCachedMetrics public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } [CandidName("not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets")] - public List<(ulong, double)> NotDissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } + public Dictionary NotDissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } [CandidName("dissolving_neurons_count_buckets")] - public List<(ulong, ulong)> DissolvingNeuronsCountBuckets { get; set; } + public Dictionary DissolvingNeuronsCountBuckets { get; set; } [CandidName("dissolving_neurons_count")] public ulong DissolvingNeuronsCount { get; set; } [CandidName("dissolving_neurons_e8s_buckets")] - public List<(ulong, double)> DissolvingNeuronsE8sBuckets { get; set; } + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } [CandidName("community_fund_total_staked_e8s")] public ulong CommunityFundTotalStakedE8s { get; set; } @@ -80,7 +80,7 @@ public class GovernanceCachedMetrics [CandidName("timestamp_seconds")] public ulong TimestampSeconds { get; set; } - public GovernanceCachedMetrics(ulong totalMaturityE8sEquivalent, List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong dissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong garbageCollectableNeuronsCount, List<(ulong, double)> dissolvingNeuronsStakedMaturityE8sEquivalentBuckets, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong communityFundTotalMaturityE8sEquivalent, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong totalLockedE8s, ulong neuronsFundTotalActiveNeurons, ulong totalStakedMaturityE8sEquivalent, ulong notDissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, double)> notDissolvingNeuronsStakedMaturityE8sEquivalentBuckets, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(ulong totalMaturityE8sEquivalent, Dictionary notDissolvingNeuronsE8sBuckets, ulong dissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong garbageCollectableNeuronsCount, Dictionary dissolvingNeuronsStakedMaturityE8sEquivalentBuckets, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong communityFundTotalMaturityE8sEquivalent, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong totalLockedE8s, ulong neuronsFundTotalActiveNeurons, ulong totalStakedMaturityE8sEquivalent, ulong notDissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary notDissolvingNeuronsStakedMaturityE8sEquivalentBuckets, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.TotalMaturityE8sEquivalent = totalMaturityE8sEquivalent; this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; diff --git a/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs b/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs index f6e59051..f9848755 100644 --- a/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs +++ b/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs @@ -7,12 +7,12 @@ namespace Sample.Shared.Governance.Models public class ListNeuronsResponse { [CandidName("neuron_infos")] - public List<(ulong, NeuronInfo)> NeuronInfos { get; set; } + public Dictionary NeuronInfos { get; set; } [CandidName("full_neurons")] public List FullNeurons { get; set; } - public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) { this.NeuronInfos = neuronInfos; this.FullNeurons = fullNeurons; diff --git a/samples/Sample.Shared/Governance/Models/Neuron.cs b/samples/Sample.Shared/Governance/Models/Neuron.cs index 7c41f897..224303e4 100644 --- a/samples/Sample.Shared/Governance/Models/Neuron.cs +++ b/samples/Sample.Shared/Governance/Models/Neuron.cs @@ -53,7 +53,7 @@ public class Neuron public OptionalValue DissolveState { get; set; } [CandidName("followees")] - public List<(int, Followees)> Followees { get; set; } + public Dictionary Followees { get; set; } [CandidName("neuron_fees_e8s")] public ulong NeuronFeesE8s { get; set; } @@ -67,7 +67,7 @@ public class Neuron [CandidName("spawn_at_timestamp_seconds")] public OptionalValue SpawnAtTimestampSeconds { get; set; } - public Neuron(OptionalValue id, OptionalValue stakedMaturityE8sEquivalent, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, OptionalValue autoStakeMaturity, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData, OptionalValue spawnAtTimestampSeconds) + public Neuron(OptionalValue id, OptionalValue stakedMaturityE8sEquivalent, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, OptionalValue autoStakeMaturity, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData, OptionalValue spawnAtTimestampSeconds) { this.Id = id; this.StakedMaturityE8sEquivalent = stakedMaturityE8sEquivalent; diff --git a/samples/Sample.Shared/Governance/Models/ProposalData.cs b/samples/Sample.Shared/Governance/Models/ProposalData.cs index ef2ba797..d627e6e2 100644 --- a/samples/Sample.Shared/Governance/Models/ProposalData.cs +++ b/samples/Sample.Shared/Governance/Models/ProposalData.cs @@ -17,7 +17,7 @@ public class ProposalData public List CfParticipants { get; set; } [CandidName("ballots")] - public List<(ulong, Ballot)> Ballots { get; set; } + public Dictionary Ballots { get; set; } [CandidName("proposal_timestamp_seconds")] public ulong ProposalTimestampSeconds { get; set; } @@ -58,7 +58,7 @@ public class ProposalData [CandidName("original_total_community_fund_maturity_e8s_equivalent")] public OptionalValue OriginalTotalCommunityFundMaturityE8sEquivalent { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, List cfParticipants, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, OptionalValue snsTokenSwapLifecycle, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds, OptionalValue originalTotalCommunityFundMaturityE8sEquivalent) + public ProposalData(OptionalValue id, OptionalValue failureReason, List cfParticipants, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, OptionalValue snsTokenSwapLifecycle, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds, OptionalValue originalTotalCommunityFundMaturityE8sEquivalent) { this.Id = id; this.FailureReason = failureReason; diff --git a/samples/Sample.Shared/Governance/Models/ProposalInfo.cs b/samples/Sample.Shared/Governance/Models/ProposalInfo.cs index 05066afd..ccf6b71b 100644 --- a/samples/Sample.Shared/Governance/Models/ProposalInfo.cs +++ b/samples/Sample.Shared/Governance/Models/ProposalInfo.cs @@ -20,7 +20,7 @@ public class ProposalInfo public OptionalValue FailureReason { get; set; } [CandidName("ballots")] - public List<(ulong, Ballot)> Ballots { get; set; } + public Dictionary Ballots { get; set; } [CandidName("proposal_timestamp_seconds")] public ulong ProposalTimestampSeconds { get; set; } @@ -58,7 +58,7 @@ public class ProposalInfo [CandidName("executed_timestamp_seconds")] public ulong ExecutedTimestampSeconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.Id = id; this.Status = status; diff --git a/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs b/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs index 4b37295d..de99b77b 100644 --- a/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs +++ b/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs @@ -7,9 +7,9 @@ namespace Sample.Shared.Governance.Models public class SetDefaultFollowees { [CandidName("default_followees")] - public List<(int, Followees)> DefaultFollowees { get; set; } + public Dictionary DefaultFollowees { get; set; } - public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) + public SetDefaultFollowees(Dictionary defaultFollowees) { this.DefaultFollowees = defaultFollowees; } diff --git a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs index b32b1c8f..a6f61318 100644 --- a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs +++ b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs @@ -49,12 +49,12 @@ public async Task Icrc1Decimals() return reply.ToObjects(this.Converter); } - public async Task> Icrc1Metadata() + public async Task> Icrc1Metadata() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_metadata", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } public async Task Icrc1TotalSupply() diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs index c09e86f1..0de1d2ca 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs @@ -23,15 +23,15 @@ public class InitArgs public string TokenName { get; set; } [CandidName("metadata")] - public List<(string, MetadataValue)> Metadata { get; set; } + public Dictionary Metadata { get; set; } [CandidName("initial_balances")] - public List<(Account, ulong)> InitialBalances { get; set; } + public Dictionary InitialBalances { get; set; } [CandidName("archive_options")] public InitArgs.ArchiveOptionsInfo ArchiveOptions { get; set; } - public InitArgs(Account mintingAccount, OptionalValue feeCollectorAccount, ulong transferFee, string tokenSymbol, string tokenName, List<(string, MetadataValue)> metadata, List<(Account, ulong)> initialBalances, InitArgs.ArchiveOptionsInfo archiveOptions) + public InitArgs(Account mintingAccount, OptionalValue feeCollectorAccount, ulong transferFee, string tokenSymbol, string tokenName, Dictionary metadata, Dictionary initialBalances, InitArgs.ArchiveOptionsInfo archiveOptions) { this.MintingAccount = mintingAccount; this.FeeCollectorAccount = feeCollectorAccount; diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs index de2d6107..18ef012f 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs @@ -8,7 +8,7 @@ namespace Sample.Shared.ICRC1Ledger.Models public class UpgradeArgs { [CandidName("metadata")] - public OptionalValue> Metadata { get; set; } + public OptionalValue> Metadata { get; set; } [CandidName("token_symbol")] public OptionalValue TokenSymbol { get; set; } @@ -25,7 +25,7 @@ public class UpgradeArgs [CandidName("max_memo_length")] public OptionalValue MaxMemoLength { get; set; } - public UpgradeArgs(OptionalValue> metadata, OptionalValue tokenSymbol, OptionalValue tokenName, OptionalValue transferFee, OptionalValue changeFeeCollector, OptionalValue maxMemoLength) + public UpgradeArgs(OptionalValue> metadata, OptionalValue tokenSymbol, OptionalValue tokenName, OptionalValue transferFee, OptionalValue changeFeeCollector, OptionalValue maxMemoLength) { this.Metadata = metadata; this.TokenSymbol = tokenSymbol; diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs index a283f459..55cff77e 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using EdjCase.ICP.Candid.Models; using System; -using Map = System.Collections.Generic.List>; +using Map = System.Collections.Generic.Dictionary; namespace Sample.Shared.ICRC1Ledger.Models { diff --git a/samples/Sample.Shared/candid-client.toml b/samples/Sample.Shared/candid-client.toml index 0332eb74..442df9ce 100644 --- a/samples/Sample.Shared/candid-client.toml +++ b/samples/Sample.Shared/candid-client.toml @@ -25,15 +25,18 @@ keep-candid-case = true name = "Governance" type = "canister" canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" -[clients.types.AccountIdentifier] -type = "record" +[clients.types.AccountIdentifier] name = "AccountId" -[clients.types.AccountIdentifier.fields.hash] -type = "vec" -name = "Hazh" +[clients.types.AccountIdentifier.fields.hash] representation = "Array" -[clients.types.Governance] -type = "record" -[clients.types.Governance.fields.default_followees] -type = "vec" -representation = "Dictionary" \ No newline at end of file + +[clients.types.Governance.fields.default_followees] +representation = "List" + + +[clients.types.Action.fields.RegisterKnownNeuron] +name = "RegisterNeuron" # Rename RegisterKnownNeuron -> RegisterNeuron +[clients.types.Action.fields.RegisterKnownNeuron.fields.id] +name = "ID" +[clients.types.Action.fields.RegisterKnownNeuron.fields.id.innerType.fields.id] +name = "ID" \ No newline at end of file diff --git a/src/ClientGenerator/API.md b/src/ClientGenerator/API.md index 46c00a71..3484007a 100644 --- a/src/ClientGenerator/API.md +++ b/src/ClientGenerator/API.md @@ -28,29 +28,19 @@ - [GenerateFileContents()](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-GenerateFileContents 'EdjCase.ICP.ClientGenerator.ClientSyntax.GenerateFileContents') - [GenerateFileContents(syntax)](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-GenerateFileContents-Microsoft-CodeAnalysis-CSharp-Syntax-CompilationUnitSyntax- 'EdjCase.ICP.ClientGenerator.ClientSyntax.GenerateFileContents(Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax)') - [Rewrite(rewriter)](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-Rewrite-Microsoft-CodeAnalysis-CSharp-CSharpSyntaxRewriter- 'EdjCase.ICP.ClientGenerator.ClientSyntax.Rewrite(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter)') -- [ITypeOptions](#T-EdjCase-ICP-ClientGenerator-ITypeOptions 'EdjCase.ICP.ClientGenerator.ITypeOptions') - - [Type](#P-EdjCase-ICP-ClientGenerator-ITypeOptions-Type 'EdjCase.ICP.ClientGenerator.ITypeOptions.Type') - [NamedTypeOptions](#T-EdjCase-ICP-ClientGenerator-NamedTypeOptions 'EdjCase.ICP.ClientGenerator.NamedTypeOptions') - - [#ctor(nameOverride,typeOptions)](#M-EdjCase-ICP-ClientGenerator-NamedTypeOptions-#ctor-System-String,EdjCase-ICP-ClientGenerator-ITypeOptions- 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.#ctor(System.String,EdjCase.ICP.ClientGenerator.ITypeOptions)') + - [#ctor(nameOverride,typeOptions)](#M-EdjCase-ICP-ClientGenerator-NamedTypeOptions-#ctor-System-String,EdjCase-ICP-ClientGenerator-TypeOptions- 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.#ctor(System.String,EdjCase.ICP.ClientGenerator.TypeOptions)') - [NameOverride](#P-EdjCase-ICP-ClientGenerator-NamedTypeOptions-NameOverride 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.NameOverride') - [TypeOptions](#P-EdjCase-ICP-ClientGenerator-NamedTypeOptions-TypeOptions 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.TypeOptions') -- [RecordTypeOptions](#T-EdjCase-ICP-ClientGenerator-RecordTypeOptions 'EdjCase.ICP.ClientGenerator.RecordTypeOptions') - - [#ctor(fields)](#M-EdjCase-ICP-ClientGenerator-RecordTypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.RecordTypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') - - [Fields](#P-EdjCase-ICP-ClientGenerator-RecordTypeOptions-Fields 'EdjCase.ICP.ClientGenerator.RecordTypeOptions.Fields') - - [Type](#P-EdjCase-ICP-ClientGenerator-RecordTypeOptions-Type 'EdjCase.ICP.ClientGenerator.RecordTypeOptions.Type') -- [VariantTypeOptions](#T-EdjCase-ICP-ClientGenerator-VariantTypeOptions 'EdjCase.ICP.ClientGenerator.VariantTypeOptions') - - [#ctor(options)](#M-EdjCase-ICP-ClientGenerator-VariantTypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.VariantTypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') - - [Options](#P-EdjCase-ICP-ClientGenerator-VariantTypeOptions-Options 'EdjCase.ICP.ClientGenerator.VariantTypeOptions.Options') - - [Type](#P-EdjCase-ICP-ClientGenerator-VariantTypeOptions-Type 'EdjCase.ICP.ClientGenerator.VariantTypeOptions.Type') -- [VectorRepresentation](#T-EdjCase-ICP-ClientGenerator-VectorRepresentation 'EdjCase.ICP.ClientGenerator.VectorRepresentation') - - [Array](#F-EdjCase-ICP-ClientGenerator-VectorRepresentation-Array 'EdjCase.ICP.ClientGenerator.VectorRepresentation.Array') - - [Dictionary](#F-EdjCase-ICP-ClientGenerator-VectorRepresentation-Dictionary 'EdjCase.ICP.ClientGenerator.VectorRepresentation.Dictionary') - - [List](#F-EdjCase-ICP-ClientGenerator-VectorRepresentation-List 'EdjCase.ICP.ClientGenerator.VectorRepresentation.List') -- [VectorTypeOptions](#T-EdjCase-ICP-ClientGenerator-VectorTypeOptions 'EdjCase.ICP.ClientGenerator.VectorTypeOptions') - - [#ctor(representation,elementType)](#M-EdjCase-ICP-ClientGenerator-VectorTypeOptions-#ctor-System-Nullable{EdjCase-ICP-ClientGenerator-VectorRepresentation},EdjCase-ICP-ClientGenerator-ITypeOptions- 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.#ctor(System.Nullable{EdjCase.ICP.ClientGenerator.VectorRepresentation},EdjCase.ICP.ClientGenerator.ITypeOptions)') - - [ElementType](#P-EdjCase-ICP-ClientGenerator-VectorTypeOptions-ElementType 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.ElementType') - - [Representation](#P-EdjCase-ICP-ClientGenerator-VectorTypeOptions-Representation 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.Representation') - - [Type](#P-EdjCase-ICP-ClientGenerator-VectorTypeOptions-Type 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.Type') +- [TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') + - [#ctor(fields,innerType,representation)](#M-EdjCase-ICP-ClientGenerator-TypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions},EdjCase-ICP-ClientGenerator-TypeOptions,System-Nullable{EdjCase-ICP-ClientGenerator-TypeRepresentation}- 'EdjCase.ICP.ClientGenerator.TypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions},EdjCase.ICP.ClientGenerator.TypeOptions,System.Nullable{EdjCase.ICP.ClientGenerator.TypeRepresentation})') + - [Fields](#P-EdjCase-ICP-ClientGenerator-TypeOptions-Fields 'EdjCase.ICP.ClientGenerator.TypeOptions.Fields') + - [InnerType](#P-EdjCase-ICP-ClientGenerator-TypeOptions-InnerType 'EdjCase.ICP.ClientGenerator.TypeOptions.InnerType') + - [Representation](#P-EdjCase-ICP-ClientGenerator-TypeOptions-Representation 'EdjCase.ICP.ClientGenerator.TypeOptions.Representation') +- [TypeRepresentation](#T-EdjCase-ICP-ClientGenerator-TypeRepresentation 'EdjCase.ICP.ClientGenerator.TypeRepresentation') + - [Array](#F-EdjCase-ICP-ClientGenerator-TypeRepresentation-Array 'EdjCase.ICP.ClientGenerator.TypeRepresentation.Array') + - [Dictionary](#F-EdjCase-ICP-ClientGenerator-TypeRepresentation-Dictionary 'EdjCase.ICP.ClientGenerator.TypeRepresentation.Dictionary') + - [List](#F-EdjCase-ICP-ClientGenerator-TypeRepresentation-List 'EdjCase.ICP.ClientGenerator.TypeRepresentation.List') ## ClientCodeGenerator `type` @@ -308,24 +298,6 @@ Updated client syntax | ---- | ---- | ----------- | | rewriter | [Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter](#T-Microsoft-CodeAnalysis-CSharp-CSharpSyntaxRewriter 'Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter') | A \`CSharpSyntaxRewriter\` to rewrite the csharp syntax | - -## ITypeOptions `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator - -##### Summary - -Interface to specify generation options for specific types in the candid - - -### Type `property` - -##### Summary - -The candid type of the implementation class - ## NamedTypeOptions `type` @@ -337,7 +309,7 @@ EdjCase.ICP.ClientGenerator Type options for a record field or variant option - + ### #ctor(nameOverride,typeOptions) `constructor` ##### Parameters @@ -345,7 +317,7 @@ Type options for a record field or variant option | Name | Type | Description | | ---- | ---- | ----------- | | nameOverride | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | Optional. The C# type name to use instead of the default | -| typeOptions | [EdjCase.ICP.ClientGenerator.ITypeOptions](#T-EdjCase-ICP-ClientGenerator-ITypeOptions 'EdjCase.ICP.ClientGenerator.ITypeOptions') | Optional. The field or option type information | +| typeOptions | [EdjCase.ICP.ClientGenerator.TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') | Optional. The field or option type information | ### NameOverride `property` @@ -361,8 +333,8 @@ Optional. The C# type name to use instead of the default Optional. The field or option type information - -## RecordTypeOptions `type` + +## TypeOptions `type` ##### Namespace @@ -370,67 +342,48 @@ EdjCase.ICP.ClientGenerator ##### Summary -Type generation options for record candid types +Interface to specify generation options for specific types in the candid - -### #ctor(fields) `constructor` + +### #ctor(fields,innerType,representation) `constructor` ##### Parameters | Name | Type | Description | | ---- | ---- | ----------- | -| fields | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the records fields | - - -### Fields `property` - -##### Summary - -Optional. The type options for each of the records fields +| fields | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the records fields or variant options | +| innerType | [EdjCase.ICP.ClientGenerator.TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') | Optional. The type options for the sub type of a vec or opt | +| representation | [System.Nullable{EdjCase.ICP.ClientGenerator.TypeRepresentation}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{EdjCase.ICP.ClientGenerator.TypeRepresentation}') | Optional. How the type should be represented in C# | - -### Type `property` +##### Exceptions -##### Summary - -*Inherit from parent.* +| Name | Description | +| ---- | ----------- | +| [System.ArgumentNullException](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.ArgumentNullException 'System.ArgumentNullException') | | - -## VariantTypeOptions `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator + +### Fields `property` ##### Summary -Type generation options for variant candid types - - -### #ctor(options) `constructor` - -##### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| options | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the variant options | +Optional. The type options for each of the records fields or variant options - -### Options `property` + +### InnerType `property` ##### Summary -Optional. The type options for each of the variant options +Optional. The type options for the sub type of a vec or opt - -### Type `property` + +### Representation `property` ##### Summary -*Inherit from parent.* +Optional. How the type should be represented in C# - -## VectorRepresentation `type` + +## TypeRepresentation `type` ##### Namespace @@ -440,65 +393,23 @@ EdjCase.ICP.ClientGenerator C# type representations for the vec type - + ### Array `constants` ##### Summary -Vector will be an array +Array - + ### Dictionary `constants` ##### Summary -Vector will be a dictionary, only if the element type is a record with 2 fields +Dictionary - + ### List `constants` ##### Summary -Vector will be a List - - -## VectorTypeOptions `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator - -##### Summary - -Type generation options for vec candid types - - -### #ctor(representation,elementType) `constructor` - -##### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| representation | [System.Nullable{EdjCase.ICP.ClientGenerator.VectorRepresentation}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{EdjCase.ICP.ClientGenerator.VectorRepresentation}') | Optional. The representation the vec should take in the generated code | -| elementType | [EdjCase.ICP.ClientGenerator.ITypeOptions](#T-EdjCase-ICP-ClientGenerator-ITypeOptions 'EdjCase.ICP.ClientGenerator.ITypeOptions') | Optional. The type options for the element type in the vec | - - -### ElementType `property` - -##### Summary - -Optional. The type options for the element type in the vec - - -### Representation `property` - -##### Summary - -Optional. The representation the vec should take in the generated code - - -### Type `property` - -##### Summary - -*Inherit from parent.* +List diff --git a/src/ClientGenerator/API.xml b/src/ClientGenerator/API.xml index 6e5db3da..20c9194a 100644 --- a/src/ClientGenerator/API.xml +++ b/src/ClientGenerator/API.xml @@ -122,94 +122,56 @@ Optional. The field or option type information - + Optional. The C# type name to use instead of the default Optional. The field or option type information - + Interface to specify generation options for specific types in the candid - + - The candid type of the implementation class + Optional. The type options for each of the records fields or variant options - + - Type generation options for record candid types + Optional. The type options for the sub type of a vec or opt - - - - - - Optional. The type options for each of the records fields - - - - Optional. The type options for each of the records fields - - - - Type generation options for vec candid types - - - - - - - - Optional. The representation the vec should take in the generated code - - - + - Optional. The type options for the element type in the vec + Optional. How the type should be represented in C# - - Optional. The representation the vec should take in the generated code - Optional. The type options for the element type in the vec + + Optional. The type options for each of the records fields or variant options + Optional. The type options for the sub type of a vec or opt + Optional. How the type should be represented in C# + - + C# type representations for the vec type - - - Vector will be a List - - - + - Vector will be an array + List - + - Vector will be a dictionary, only if the element type is a record with 2 fields + Array - + - Type generation options for variant candid types + Dictionary - - - - - - Optional. The type options for each of the variant options - - - - Optional. The type options for each of the variant options - A model containing the client code to be rendered diff --git a/src/ClientGenerator/ClientCodeGenerator.cs b/src/ClientGenerator/ClientCodeGenerator.cs index 5ff7eb1f..e8cb848d 100644 --- a/src/ClientGenerator/ClientCodeGenerator.cs +++ b/src/ClientGenerator/ClientCodeGenerator.cs @@ -4,6 +4,7 @@ using EdjCase.ICP.Candid.Models.Values; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Org.BouncyCastle.Crypto.Agreement; using System; using System.Collections.Generic; using System.Linq; @@ -148,18 +149,8 @@ ClientGenerationOptions options private static SourceCodeType ResolveSourceCodeType( CandidType type, NameHelper nameHelper, - ITypeOptions? typeOptions) + TypeOptions? typeOptions) { - T? GetTypeOptions() - where T : class, ITypeOptions - { - if (typeOptions != null - && typeOptions is not T) - { - throw new Exception($"Type is '{typeOptions.GetType()}' but type options assume '{typeof(T)}'. Fix config"); - } - return typeOptions as T; - } switch (type) { @@ -198,24 +189,24 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidVectorType v: { - VectorTypeOptions? vTypeOptions = GetTypeOptions(); - ITypeOptions? innerTypeOptions = vTypeOptions?.ElementType; + TypeOptions? innerTypeOptions = typeOptions?.InnerType; SourceCodeType innerType = ResolveSourceCodeType( v.InnerType, nameHelper, innerTypeOptions ); bool isDictionaryCompatible = innerType is TupleSourceCodeType t && t.Fields.Count == 2; - VectorRepresentation defaultRepresentation = isDictionaryCompatible - ? VectorRepresentation.Dictionary - : VectorRepresentation.List; - switch (vTypeOptions?.Representation ?? defaultRepresentation) + TypeRepresentation defaultRepresentation = isDictionaryCompatible + ? TypeRepresentation.Dictionary + : TypeRepresentation.List; + TypeRepresentation rep = typeOptions?.Representation ?? defaultRepresentation; + switch (rep) { - case VectorRepresentation.Array: + case TypeRepresentation.Array: return new ArraySourceCodeType(innerType); - case VectorRepresentation.List: + case TypeRepresentation.List: return new ListSourceCodeType(innerType); - case VectorRepresentation.Dictionary: + case TypeRepresentation.Dictionary: if (!isDictionaryCompatible) { throw new Exception("List to dictionary conversion is only compatible with `vec record { a; b }` candid types"); @@ -225,7 +216,7 @@ private static SourceCodeType ResolveSourceCodeType( SourceCodeType valueType = tuple.Fields[1]; return new DictionarySourceCodeType(keyType, valueType); default: - throw new NotImplementedException(); + throw new Exception($"Vec types do not support representation: '{rep}'"); } } case CandidOptionalType o: @@ -240,7 +231,6 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidRecordType o: { - RecordTypeOptions? rTypeOptions = GetTypeOptions(); // Check if tuple (tag ids are 0...N) bool isTuple = o.Fields.Any() @@ -251,12 +241,12 @@ private static SourceCodeType ResolveSourceCodeType( // Only be a tuple if it doesnt reference itself && !o.Fields.Any(f => f.Value is CandidReferenceType r && r.Id == o.RecursiveId); - if(isTuple ) + if(isTuple) { List tupleFields = o.Fields .Select(f => { - NamedTypeOptions? fieldTypeOptions = rTypeOptions?.Fields.GetValueOrDefault(f.Key.ToString()); + NamedTypeOptions? fieldTypeOptions = typeOptions?.Fields.GetValueOrDefault(f.Key.ToString()); return ResolveSourceCodeType( f.Value, nameHelper, @@ -271,7 +261,7 @@ private static SourceCodeType ResolveSourceCodeType( .Select(f => { CandidType fCandidType = f.Value; - NamedTypeOptions? fieldTypeOptions = f.Key.Name == null ? null : rTypeOptions?.Fields.GetValueOrDefault(f.Key.Name); + NamedTypeOptions? fieldTypeOptions = f.Key.Name == null ? null : typeOptions?.Fields.GetValueOrDefault(f.Key.Name); SourceCodeType fType = ResolveSourceCodeType(fCandidType, nameHelper, fieldTypeOptions?.TypeOptions); ResolvedName fieldName = nameHelper.ResolveName(f.Key, fieldTypeOptions?.NameOverride); return (fieldName, fType); @@ -282,11 +272,10 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidVariantType va: { - VariantTypeOptions? variantTypeOptions = GetTypeOptions(); List<(ResolvedName Key, SourceCodeType? Type)> fields = va.Options .Select(f => { - NamedTypeOptions? innerTypeOptions = f.Key.Name == null ? null : variantTypeOptions?.Options.GetValueOrDefault(f.Key.Name); + NamedTypeOptions? innerTypeOptions = f.Key.Name == null ? null : typeOptions?.Fields.GetValueOrDefault(f.Key.Name); // If type is null, then just be a typeless variant SourceCodeType? sourceCodeType = f.Value == CandidType.Null() ? null diff --git a/src/ClientGenerator/ClientGenerationOptions.cs b/src/ClientGenerator/ClientGenerationOptions.cs index 04d394ea..761b1144 100644 --- a/src/ClientGenerator/ClientGenerationOptions.cs +++ b/src/ClientGenerator/ClientGenerationOptions.cs @@ -121,13 +121,13 @@ public class NamedTypeOptions /// /// Optional. The field or option type information /// - public ITypeOptions? TypeOptions { get; } + public TypeOptions? TypeOptions { get; } /// Optional. The C# type name to use instead of the default /// Optional. The field or option type information public NamedTypeOptions( string? nameOverride = null, - ITypeOptions? typeOptions = null + TypeOptions? typeOptions = null ) { this.NameOverride = nameOverride; @@ -138,105 +138,53 @@ public NamedTypeOptions( /// /// Interface to specify generation options for specific types in the candid /// - public interface ITypeOptions + public class TypeOptions { - //public string? NameOverride { get; init; } // TODO - /// - /// The candid type of the implementation class - /// - public CandidTypeCode Type { get; } - - } - - /// - /// Type generation options for record candid types - /// - public class RecordTypeOptions : ITypeOptions - { - - /// - public CandidTypeCode Type { get; } = CandidTypeCode.Record; - /// - /// Optional. The type options for each of the records fields + /// Optional. The type options for each of the records fields or variant options /// public Dictionary Fields { get; } - - /// Optional. The type options for each of the records fields - public RecordTypeOptions( - Dictionary? fields = null - ) - { - this.Fields = fields ?? new Dictionary(); - } - - } - - /// - /// Type generation options for vec candid types - /// - public class VectorTypeOptions : ITypeOptions - { - /// - public CandidTypeCode Type { get; } = CandidTypeCode.Vector; /// - /// Optional. The representation the vec should take in the generated code + /// Optional. The type options for the sub type of a vec or opt /// - public VectorRepresentation? Representation { get; } + public TypeOptions? InnerType { get; } /// - /// Optional. The type options for the element type in the vec + /// Optional. How the type should be represented in C# /// - public ITypeOptions? ElementType { get; } + public TypeRepresentation? Representation { get; } - /// Optional. The representation the vec should take in the generated code - /// Optional. The type options for the element type in the vec - public VectorTypeOptions( - VectorRepresentation? representation = null, - ITypeOptions? elementType = null + /// Optional. The type options for each of the records fields or variant options + /// Optional. The type options for the sub type of a vec or opt + /// Optional. How the type should be represented in C# + /// + public TypeOptions( + Dictionary? fields, + TypeOptions? innerType, + TypeRepresentation? representation ) { + this.Fields = fields ?? new Dictionary(); + this.InnerType = innerType; this.Representation = representation; - this.ElementType = elementType; } } /// /// C# type representations for the vec type /// - public enum VectorRepresentation + public enum TypeRepresentation { /// - /// Vector will be a List + /// List /// List, /// - /// Vector will be an array + /// Array /// Array, /// - /// Vector will be a dictionary, only if the element type is a record with 2 fields + /// Dictionary /// Dictionary } - - /// - /// Type generation options for variant candid types - /// - public class VariantTypeOptions : ITypeOptions - { - /// - public CandidTypeCode Type { get; } = CandidTypeCode.Vector; - /// - /// Optional. The type options for each of the variant options - /// - public Dictionary Options { get; } - - /// Optional. The type options for each of the variant options - public VariantTypeOptions( - Dictionary? options = null - ) - { - this.Options = options ?? new Dictionary(); - } - } } diff --git a/src/ClientGenerator/README.md b/src/ClientGenerator/README.md index 1e089806..b442d7b3 100644 --- a/src/ClientGenerator/README.md +++ b/src/ClientGenerator/README.md @@ -24,23 +24,19 @@ Creates `candid-client.toml` file to update in specified directory Example: ``` -namespace = "My.Namespace" # Base namespace used for generated files -output-directory = "./Clients" # Directory to put clients. Each client will get its own sub folder based on its name. If not specified, will use current directory -no-folders = false # If true, will put all the files in a single directory +namespace = "My.Namespace" +output-directory = "./Clients" +no-folders = false [[clients]] -name = "Dex" # Used for the name of the folder and client class -type = "file" # Create client based on service definition file -file-path = "./ServiceDefinitionFiles/Dex.did" # Service definition file path -output-directory = "./Clients/D" # Override base output directory, but this specifies the subfolder -no-folders = false # If true, will put all the files in a single directory +name = "Dex" +type = "file" +file-path = "./ServiceDefinitionFiles/Dex.did" - -# Can specify multiple clients by defining another [[clients]] name = "Governance" -type = "canister" # Create client based on canister -canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" # Canister to create client for +type = "canister" +canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" ``` ### Generate clients @@ -80,8 +76,78 @@ candid-client-generator gen ./ - `feature-nullable` - (Bool) Optional. Sets whether to use the C# nullable feature when generating the client (like `object?`). Defaults to true. Overrides the top level `feature-nullable` - `keep-candid-case` - (Bool) Optional. If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier. Defaults to false. Overrides the top level `keep-candid-case` +#### Type Customization: + +##### All Types + +`[clients.types.{CandidTypeId}]` + +`{CandidTypeId}` is any named type in the candid definition + +- `name` - Optional. (Text) Overrides the name of the C# type/alias generated + +--- + +##### Record Types Options + +- `[clients.types.{CandidTypeId}.fields.{CandidFieldId}]` + + `{CandidFieldId}` is a record field in the record type `{CandidTypeId}` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section + +--- + +##### Variant Types Options + +- `[clients.types.{CandidTypeId}.fields.{CandidOptionId}]` + + `{CandidOptionId}` is a variant option in the variant type `{CandidTypeId}` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section + +--- + +##### Vec Types Options + +- `representation` - Optional (Text) Sets what C# type should be generated. (Defaults to Dictionary if possible, otherwise a List) + + - `Array` - Uses a C# array + - `List` - Uses a C# `List` + - `Dictionary` - Uses a C# `Dictionary`. Only works if the `vec` contains a `record` with 2 unamed fields (tuple). The first will be the key, the second will be the value + +- `[clients.types.{CandidTypeId}.innerType]` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section, but `name` is not supported + +##### Opt Types Options + +- `[clients.types.{CandidTypeId}.innerType]` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section, but `name` is not supported + +##### Type Customization Example: + +``` +[clients] +... + +[clients.types.AccountIdentifier] +name = "AccountId" +[clients.types.AccountIdentifier.fields.hash] +name = "Hash" +representation = "Array" + +[clients.types.Action.fields.RegisterKnownNeuron] +name = "RegisterNeuron" # Rename RegisterKnownNeuron -> RegisterNeuron +[clients.types.Action.fields.RegisterKnownNeuron.fields.id] # Update the type's field `id` +name = "ID" # Rename id -> ID +[clients.types.Action.fields.RegisterKnownNeuron.fields.id.innerType.fields.id] # Update the opt's inner record type's field `id` +name = "ID" # Rename id -> ID +``` # Custom Client Generators via Code + Due to the complexity of different use cases, custom tweaks to the output of the client generators might be helpful. This process can be handled with calling the `ClientCodeGenerator` manually and using the .NET `CSharpSyntaxRewriter` (tutorial can be found [HERE](https://joshvarty.com/2014/08/15/learn-roslyn-now-part-5-csharpsyntaxrewriter/)) @@ -98,4 +164,4 @@ var rewriter = new MyCustomCSharpSyntaxRewriter(); syntax = syntax.Rewrite(rewriter); (string clientFile, List<(string Name, string Contents)> typeFiles) = syntax.GenerateFileContents(); // Write string contents to files... -``` \ No newline at end of file +``` diff --git a/src/ClientGenerator/ResolvedName.cs b/src/ClientGenerator/ResolvedName.cs index d3a10bfa..a1f786bf 100644 --- a/src/ClientGenerator/ResolvedName.cs +++ b/src/ClientGenerator/ResolvedName.cs @@ -80,21 +80,22 @@ public ResolvedName ResolveName(CandidTag tag, string? nameOverride = null) stringValue = "F" + stringValue; } stringValue = this.KeepCandidCase ? stringValue : StringUtil.ToPascalCase(stringValue); - if (IsKeyword(stringValue)) + stringValue = Escape(stringValue); + return new ResolvedName(stringValue, tag); + } + + private static string Escape(string value) + { + if (IsKeyword(value)) { // Add @ before reserved words - stringValue = "@" + stringValue; + value = "@" + value; } - if (stringValue.StartsWith("set_") || stringValue.StartsWith("get_")) + if (value.StartsWith("set_") || value.StartsWith("get_")) { // Add _ before getters/setters words - stringValue = "_" + stringValue; + value = "_" + value; } - return new ResolvedName(stringValue, tag); - } - - private static string Escape(string value) - { return value; } diff --git a/src/ClientGenerator/TomlConfigParser.cs b/src/ClientGenerator/TomlConfigParser.cs index b5046f8f..91c4df32 100644 --- a/src/ClientGenerator/TomlConfigParser.cs +++ b/src/ClientGenerator/TomlConfigParser.cs @@ -131,50 +131,24 @@ private static Dictionary BuildTypes(TomlTable? typeTa throw new Exception($"Options for type '{key}' cannot be parsed"); } string? name = GetOptional(t, "name"); - ITypeOptions? typeOptions = BuildTypeOptions(t); + TypeOptions? typeOptions = BuildTypeOptions(t); types.Add(key, new NamedTypeOptions(name, typeOptions)); } } return types; } - private static ITypeOptions? BuildTypeOptions(TomlTable t) + private static TypeOptions BuildTypeOptions(TomlTable t) { - string? typeType = GetOptional(t, "type"); - if (string.IsNullOrWhiteSpace(typeType)) - { - return null; - } - switch (typeType.ToLower()) - { - case "record": - { - TomlTable? fieldTypeTable = GetOptional(t, "fields"); - Dictionary fields = BuildTypes(fieldTypeTable); - return new RecordTypeOptions( - fields: fields - ); - } - case "vec": - { - ITypeOptions? elementType = GetOptional(t, "elementType"); - VectorRepresentation? representation = GetEnumOptional(t, "representation"); - return new VectorTypeOptions( - representation: representation, - elementType: elementType - ); - } - case "variant": - { - TomlTable? optionTypeTable = GetOptional(t, "options"); - Dictionary options = BuildTypes(optionTypeTable); - return new VariantTypeOptions( - options: options - ); - } - default: - throw new Exception($"Type '{typeType.ToLower()}' is invalid"); - } + TypeRepresentation? representation = GetEnumOptional(t, "representation"); + + TomlTable? optionTypeTable = GetOptional(t, "fields"); + Dictionary options = BuildTypes(optionTypeTable); + + TomlTable? innerTypeTable = GetOptional(t, "innerType"); + TypeOptions? innerType = innerTypeTable == null ? null : BuildTypeOptions(innerTypeTable); + + return new TypeOptions(options, innerType, representation); } private static T GetRequired(TomlTable table, string key, string? prefix = null) From 92e19c27581b3f95b6941ff1586edae6f485a748 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Mon, 25 Sep 2023 08:53:44 -0700 Subject: [PATCH 4/9] Adding SimpleVariant --- src/Candid/Mapping/IResolvableTypeInfo.cs | 10 +++ .../Mapping/Mappers/SimpleVariantMapper.cs | 86 +++++++++++++++++++ src/Candid/Models/SimpleVariant.cs | 41 +++++++++ src/ClientGenerator/ClientCodeGenerator.cs | 15 +++- .../ClientGenerationOptions.cs | 4 +- src/ClientGenerator/RoslynTypeResolver.cs | 74 ++++++++++------ src/ClientGenerator/SourceCodeType.cs | 4 +- src/ClientGenerator/TomlConfigParser.cs | 7 -- 8 files changed, 204 insertions(+), 37 deletions(-) create mode 100644 src/Candid/Mapping/Mappers/SimpleVariantMapper.cs create mode 100644 src/Candid/Models/SimpleVariant.cs diff --git a/src/Candid/Mapping/IResolvableTypeInfo.cs b/src/Candid/Mapping/IResolvableTypeInfo.cs index e4851feb..b56134fa 100644 --- a/src/Candid/Mapping/IResolvableTypeInfo.cs +++ b/src/Candid/Mapping/IResolvableTypeInfo.cs @@ -6,6 +6,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Reflection; @@ -322,6 +323,10 @@ private static IResolvableTypeInfo BuildTypeInfo(Type objType) { return BuildStruct(CandidType.Empty(), new EmptyValue(), CandidValue.Empty); } + if(objType == typeof(SimpleVariant)) + { + return BuildSimpleVariant(); + } // Variants are objects with a [Variant] on the class VariantAttribute? variantAttribute = objType.GetCustomAttribute(); @@ -335,6 +340,11 @@ private static IResolvableTypeInfo BuildTypeInfo(Type objType) return BuildRecord(objType); } + private static IResolvableTypeInfo BuildSimpleVariant() + { + return new SimpleVariantMapper(candidType, options); + } + private static IResolvableTypeInfo BuildStruct(CandidType candidType, T value, Func valueGetter) where T : struct { diff --git a/src/Candid/Mapping/Mappers/SimpleVariantMapper.cs b/src/Candid/Mapping/Mappers/SimpleVariantMapper.cs new file mode 100644 index 00000000..528c7a17 --- /dev/null +++ b/src/Candid/Mapping/Mappers/SimpleVariantMapper.cs @@ -0,0 +1,86 @@ +using EdjCase.ICP.Candid.Models.Types; +using EdjCase.ICP.Candid.Models.Values; +using EdjCase.ICP.Candid.Models; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Linq; + +namespace EdjCase.ICP.Candid.Mapping.Mappers +{ + internal class SimpleVariantMapper : ICandidValueMapper + { + public CandidType CandidType { get; } + public Dictionary Options { get; } + + public SimpleVariantMapper( + CandidVariantType candidType, + Dictionary options + ) + { + this.CandidType = candidType ?? throw new ArgumentNullException(nameof(candidType)); + this.Options = options; + } + + public object Map(CandidValue value, CandidConverter converter) + { + CandidVariant variant = value.AsVariant(); + + if (!this.Options.TryGetValue(variant.Tag, out Option optionInfo)) + { + throw new Exception($"Could not map candid variant. Type is missing option '{variant.Tag}'"); + } + + + object? variantValue; + if (optionInfo.Type != null) + { + variantValue = converter.ToObject(optionInfo.Type, variant.Value); + } + else + { + variantValue = null; + } + return new SimpleVariant(optionInfo.Name, variantValue); + } + + public CandidValue Map(object obj, CandidConverter converter) + { + SimpleVariant variant = (SimpleVariant)obj; + + if (!this.Options.TryGetValue(variant.Tag, out Option optionInfo)) + { + throw new Exception($"Could not map a candid variant. Variant is missing option '{variant.Tag}'"); + } + + + CandidValue innerValue; + if (optionInfo.Type != null) + { + innerValue = converter.FromObject(variant.Value!); + } + else + { + innerValue = CandidValue.Null(); + } + return new CandidVariant(variant.Tag, innerValue); + } + + public CandidType? GetMappedCandidType(Type type) + { + return this.CandidType; + } + + public class Option + { + public string Name { get; } + public Type? Type { get; } + + public Option(string name, Type? type) + { + this.Name = name ?? throw new ArgumentNullException(nameof(name)); + this.Type = type; + } + } + } +} diff --git a/src/Candid/Models/SimpleVariant.cs b/src/Candid/Models/SimpleVariant.cs new file mode 100644 index 00000000..9b8ecb2e --- /dev/null +++ b/src/Candid/Models/SimpleVariant.cs @@ -0,0 +1,41 @@ +using EdjCase.ICP.Candid.Models; +using System; +using System.Collections.Generic; +using System.Text; + +namespace EdjCase.ICP.Candid.Models +{ + /// + /// A simple representation of a variant + /// + public class SimpleVariant + { + /// + /// The variant option name + /// + public string Tag { get; } + + /// + /// The variant option value + /// + public object? Value { get; } + + /// The variant option name + /// The variant option value + public SimpleVariant(string tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + /// + /// Helper function to cast and get value as a type, if value is unset, will return default(T) + /// + /// Type to cast value to + /// Option value + public T? GetValueOrDefault() + { + return this.Value == null ? default : (T)this.Value; + } + } +} diff --git a/src/ClientGenerator/ClientCodeGenerator.cs b/src/ClientGenerator/ClientCodeGenerator.cs index e8cb848d..d489a889 100644 --- a/src/ClientGenerator/ClientCodeGenerator.cs +++ b/src/ClientGenerator/ClientCodeGenerator.cs @@ -272,6 +272,19 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidVariantType va: { + TypeRepresentation rep = typeOptions?.Representation ?? TypeRepresentation.TypedVariant; + bool typed; + switch (rep) + { + case TypeRepresentation.TypedVariant: + typed = true; + break; + case TypeRepresentation.SimpleVariant: + typed = false; + break; + default: + throw new Exception($"Variant types do not support representation: '{rep}'"); + } List<(ResolvedName Key, SourceCodeType? Type)> fields = va.Options .Select(f => { @@ -284,7 +297,7 @@ private static SourceCodeType ResolveSourceCodeType( return (optionName, sourceCodeType); }) .ToList(); - return new VariantSourceCodeType(fields); + return new VariantSourceCodeType(fields, typed); } default: throw new NotImplementedException(); diff --git a/src/ClientGenerator/ClientGenerationOptions.cs b/src/ClientGenerator/ClientGenerationOptions.cs index 761b1144..31ef82e1 100644 --- a/src/ClientGenerator/ClientGenerationOptions.cs +++ b/src/ClientGenerator/ClientGenerationOptions.cs @@ -185,6 +185,8 @@ public enum TypeRepresentation /// /// Dictionary /// - Dictionary + Dictionary, + TypedVariant, + SimpleVariant } } diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index 53df4768..83621533 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -14,6 +14,8 @@ using EdjCase.ICP.Candid; using System.Xml.Linq; using System.Reflection; +using Org.BouncyCastle.Asn1.Cms; +using EdjCase.ICP.Agent.Models; namespace EdjCase.ICP.ClientGenerator { @@ -101,7 +103,7 @@ private ResolvedType ResolveTypeInner( ResolvedType resolvedValueType = this.ResolveType(d.ValueType, nameContext + "Value", parentType); MemberDeclarationSyntax[] generatedSyntax = (resolvedKeyType.GeneratedSyntax ?? Array.Empty()) .Concat(resolvedValueType.GeneratedSyntax ?? Array.Empty()) - .ToArray();; + .ToArray(); ; var name = new DictionaryTypeName(resolvedKeyType.Name, resolvedValueType.Name); return new ResolvedType(name, generatedSyntax); } @@ -158,12 +160,17 @@ private ResolvedType ResolveTypeInner( case VariantSourceCodeType v: { TypeName variantName = this.BuildType(nameContext, parentType); - (ClassDeclarationSyntax? classSyntax, EnumDeclarationSyntax enumSyntax) = this.GenerateVariant(variantName, v, parentType); - if (classSyntax != null) + (ClassDeclarationSyntax? ClassSyntax, EnumDeclarationSyntax EnumSyntax)? result = this.GenerateVariant(variantName, v, parentType); + if (result == null) { - return new ResolvedType(variantName, new MemberDeclarationSyntax[] { classSyntax, enumSyntax }); + // If null, then its a simple variant + return new ResolvedType(SimpleTypeName.FromType()); } - return new ResolvedType(variantName, new MemberDeclarationSyntax []{ enumSyntax }); + if (result.Value.ClassSyntax != null) + { + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.Value.ClassSyntax, result.Value.EnumSyntax }); + } + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.Value.EnumSyntax }); } case RecordSourceCodeType r: { @@ -226,7 +233,7 @@ public ClassDeclarationSyntax GenerateClient( } - internal (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type) GenerateVariant( + internal (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type)? GenerateVariant( TypeName variantTypeName, VariantSourceCodeType variant, TypeName? parentType @@ -254,7 +261,21 @@ public ClassDeclarationSyntax GenerateClient( .Select(ResolveOption) .ToList(); + if (variant.Typed) + { + return this.GenerateTypedVariant(variant, variantTypeName, parentType, resolvedOptions); + } + return null; + } + + private (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type) GenerateTypedVariant( + VariantSourceCodeType variant, + TypeName variantTypeName, + TypeName? parentType, + List<(ResolvedName Name, ResolvedType? Type)> resolvedOptions + ) + { List<(ResolvedName Name, TypeName? Type)> enumOptions = resolvedOptions .Select(o => (o.Name, o.Type?.Name)) .ToList(); @@ -315,29 +336,28 @@ public ClassDeclarationSyntax GenerateClient( methods.Add(this.GenerateVariantValidateTypeMethod(enumTypeName, tagName)); } List properties = new() - { - new ClassProperty( - tagName, - enumTypeName, - access: AccessType.Public, - hasSetter: true, - AttributeInfo.FromType() - ), - new ClassProperty( - valueName, - SimpleTypeName.FromType(isNullable: this.FeatureNullable), - access: AccessType.Public, - hasSetter: true, - AttributeInfo.FromType() - ) - }; + { + new ClassProperty( + tagName, + enumTypeName, + access: AccessType.Public, + hasSetter: true, + AttributeInfo.FromType() + ), + new ClassProperty( + valueName, + SimpleTypeName.FromType(isNullable: this.FeatureNullable), + access: AccessType.Public, + hasSetter: true, + AttributeInfo.FromType() + ) + }; List attributes = new() - { - // [Variant(typeof({enumType})] - this.GenerateAttribute(AttributeInfo.FromType(enumTypeName)) - }; - + { + // [Variant(typeof({enumType})] + this.GenerateAttribute(AttributeInfo.FromType(enumTypeName)) + }; ClassDeclarationSyntax classSyntax = this.GenerateClass( name: variantTypeName, properties: properties, diff --git a/src/ClientGenerator/SourceCodeType.cs b/src/ClientGenerator/SourceCodeType.cs index e1fe9b30..10911eb6 100644 --- a/src/ClientGenerator/SourceCodeType.cs +++ b/src/ClientGenerator/SourceCodeType.cs @@ -113,11 +113,13 @@ public RecordSourceCodeType(List<(ResolvedName Tag, SourceCodeType Type)> fields internal class VariantSourceCodeType : SourceCodeType { public List<(ResolvedName Tag, SourceCodeType? Type)> Options { get; } + public bool Typed { get; } public override bool IsPredefinedType { get; } = false; - public VariantSourceCodeType(List<(ResolvedName Tag, SourceCodeType? Type)> options) + public VariantSourceCodeType(List<(ResolvedName Tag, SourceCodeType? Type)> options, bool typed) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); + this.Typed = typed; } } diff --git a/src/ClientGenerator/TomlConfigParser.cs b/src/ClientGenerator/TomlConfigParser.cs index 91c4df32..210d53ae 100644 --- a/src/ClientGenerator/TomlConfigParser.cs +++ b/src/ClientGenerator/TomlConfigParser.cs @@ -173,13 +173,6 @@ private static T GetRequired(TomlTable table, string key, string? prefix = nu return default; } - private static TEnum GetEnumRequired(TomlTable table, string key) - where TEnum : struct - { - string stringValue = GetRequired(table, key); - return (TEnum)Enum.Parse(typeof(TEnum), stringValue); - } - private static TEnum? GetEnumOptional(TomlTable table, string key) where TEnum : struct { From 434c4144881a709596f47c7312a5eee5b7136720 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Mon, 25 Sep 2023 11:40:23 -0700 Subject: [PATCH 5/9] Making Variants not have typed attributes --- .../Dex/Models/CancelOrderReceipt.cs | 4 +- .../Dex/Models/DepositReceipt.cs | 4 +- .../Dex/Models/OrderPlacementReceipt.cs | 4 +- .../Dex/Models/WithdrawReceipt.cs | 4 +- .../Sample.Shared/Governance/Models/Action.cs | 15 +- samples/Sample.Shared/Governance/Models/By.cs | 5 +- .../Sample.Shared/Governance/Models/Change.cs | 4 +- .../Governance/Models/Command.cs | 14 +- .../Governance/Models/Command1.cs | 15 +- .../Governance/Models/Command2.cs | 11 +- .../Governance/Models/DissolveState.cs | 4 +- .../Governance/Models/NeuronIdOrSubaccount.cs | 4 +- .../Governance/Models/Operation.cs | 11 +- .../Governance/Models/Progress.cs | 3 +- .../Sample.Shared/Governance/Models/Result.cs | 3 +- .../Governance/Models/Result1.cs | 4 +- .../Governance/Models/Result2.cs | 4 +- .../Governance/Models/Result3.cs | 4 +- .../Governance/Models/Result4.cs | 4 +- .../Governance/Models/Result5.cs | 4 +- .../Governance/Models/Result6.cs | 4 +- .../Governance/Models/Result7.cs | 4 +- .../Governance/Models/RewardMode.cs | 4 +- .../ICRC1Ledger/ICRC1LedgerApiClient.cs | 72 ++--- .../ICRC1Ledger/Models/Allowance.cs | 25 ++ .../ICRC1Ledger/Models/AllowanceArgs.cs | 24 ++ .../ICRC1Ledger/Models/Approve.cs | 51 ++++ .../ICRC1Ledger/Models/ApproveArgs.cs | 51 ++++ .../ICRC1Ledger/Models/ApproveError.cs | 246 +++++++++++++++++ .../ICRC1Ledger/Models/ApproveResult.cs | 63 +++++ .../Sample.Shared/ICRC1Ledger/Models/Burn.cs | 39 +++ .../ICRC1Ledger/Models/ChangeFeeCollector.cs | 3 +- .../ICRC1Ledger/Models/FeatureFlags.cs | 19 ++ .../ICRC1Ledger/Models/HttpRequest.cs | 32 +++ .../ICRC1Ledger/Models/HttpResponse.cs | 28 ++ .../ICRC1Ledger/Models/InitArgs.cs | 32 ++- .../ICRC1Ledger/Models/LedgerArg.cs | 4 +- .../ICRC1Ledger/Models/MetadataValue.cs | 6 +- .../Sample.Shared/ICRC1Ledger/Models/Mint.cs | 35 +++ .../ICRC1Ledger/Models/StandardRecord.cs | 23 ++ .../ICRC1Ledger/Models/Transaction.cs | 114 +------- .../ICRC1Ledger/Models/Transfer.cs | 47 ++++ .../ICRC1Ledger/Models/TransferError.cs | 13 +- .../ICRC1Ledger/Models/TransferFromArgs.cs | 49 ++++ .../ICRC1Ledger/Models/TransferFromError.cs | 247 ++++++++++++++++++ .../ICRC1Ledger/Models/TransferFromResult.cs | 63 +++++ .../ICRC1Ledger/Models/TransferResult.cs | 4 +- .../ICRC1Ledger/Models/UpgradeArgs.cs | 16 +- .../Sample.Shared/ICRC1Ledger/Models/Value.cs | 9 +- .../Standards/ICRC1/Models/MetaDataValue.cs | 6 +- .../Standards/ICRC1/Models/TransferError.cs | 8 +- .../Standards/ICRC1/Models/TransferResult.cs | 4 +- src/Candid/API.md | 44 +--- src/Candid/API.xml | 17 +- src/Candid/Mapping/IResolvableTypeInfo.cs | 82 +++--- src/Candid/Mapping/MapperAttributes.cs | 27 +- src/Candid/Mapping/Mappers/RawCandidMapper.cs | 34 +++ .../Mapping/Mappers/SimpleVariantMapper.cs | 86 ------ src/Candid/Models/SimpleVariant.cs | 41 --- src/ClientGenerator/ClientCodeGenerator.cs | 15 +- .../ClientGenerationOptions.cs | 4 +- src/ClientGenerator/RoslynTypeResolver.cs | 35 +-- src/ClientGenerator/SourceCodeType.cs | 4 +- test/Candid.Tests/CandidConverterTests.cs | 14 +- ...e_Nullable_False_KeepCandidCase_False.snap | 16 +- ...se_Nullable_False_KeepCandidCase_True.snap | 16 +- ...se_Nullable_True_KeepCandidCase_False.snap | 16 +- ...lse_Nullable_True_KeepCandidCase_True.snap | 16 +- ...e_Nullable_False_KeepCandidCase_False.snap | 16 +- ...ue_Nullable_False_KeepCandidCase_True.snap | 16 +- ...ue_Nullable_True_KeepCandidCase_False.snap | 16 +- ...rue_Nullable_True_KeepCandidCase_True.snap | 16 +- ...e_Nullable_False_KeepCandidCase_False.snap | 102 ++------ ...se_Nullable_False_KeepCandidCase_True.snap | 102 ++------ ...se_Nullable_True_KeepCandidCase_False.snap | 102 ++------ ...lse_Nullable_True_KeepCandidCase_True.snap | 102 ++------ ...e_Nullable_False_KeepCandidCase_False.snap | 102 ++------ ...ue_Nullable_False_KeepCandidCase_True.snap | 102 ++------ ...ue_Nullable_True_KeepCandidCase_False.snap | 102 ++------ ...rue_Nullable_True_KeepCandidCase_True.snap | 102 ++------ 80 files changed, 1458 insertions(+), 1359 deletions(-) create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs create mode 100644 samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs create mode 100644 src/Candid/Mapping/Mappers/RawCandidMapper.cs delete mode 100644 src/Candid/Mapping/Mappers/SimpleVariantMapper.cs delete mode 100644 src/Candid/Models/SimpleVariant.cs diff --git a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs index 74763204..816cf2c0 100644 --- a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.Dex.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(CancelOrderReceiptTag tag) public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs index 10ab793d..a0aea27f 100644 --- a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.Dex.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(DepositReceiptTag tag) public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs index 15d35793..bba0c9ac 100644 --- a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.Dex.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(OrderPlacementReceiptTag tag) public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs index 8fcea13b..775d4e78 100644 --- a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.Dex.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(WithdrawReceiptTag tag) public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Action.cs b/samples/Sample.Shared/Governance/Models/Action.cs index 494c7c54..f6c1d09c 100644 --- a/samples/Sample.Shared/Governance/Models/Action.cs +++ b/samples/Sample.Shared/Governance/Models/Action.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -178,31 +178,18 @@ private void ValidateTag(ActionTag tag) public enum ActionTag { [CandidName("RegisterKnownNeuron")] - [VariantOptionType(typeof(KnownNeuron))] RegisterNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(CreateServiceNervousSystem))] CreateServiceNervousSystem, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(OpenSnsTokenSwap))] OpenSnsTokenSwap, - [VariantOptionType(typeof(SetSnsTokenSwapOpenTimeWindow))] SetSnsTokenSwapOpenTimeWindow, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/By.cs b/samples/Sample.Shared/Governance/Models/By.cs index 8dfcf936..07345192 100644 --- a/samples/Sample.Shared/Governance/Models/By.cs +++ b/samples/Sample.Shared/Governance/Models/By.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -74,11 +74,8 @@ public NeuronIdOrSubaccountInfo() public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Change.cs b/samples/Sample.Shared/Governance/Models/Change.cs index 4f918ff8..563b885d 100644 --- a/samples/Sample.Shared/Governance/Models/Change.cs +++ b/samples/Sample.Shared/Governance/Models/Change.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(ChangeTag tag) public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Command.cs b/samples/Sample.Shared/Governance/Models/Command.cs index 5e6b9fb8..6ecab138 100644 --- a/samples/Sample.Shared/Governance/Models/Command.cs +++ b/samples/Sample.Shared/Governance/Models/Command.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -166,29 +166,17 @@ private void ValidateTag(CommandTag tag) public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(StakeMaturity))] StakeMaturity, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Command1.cs b/samples/Sample.Shared/Governance/Models/Command1.cs index 3aa2170b..4b974821 100644 --- a/samples/Sample.Shared/Governance/Models/Command1.cs +++ b/samples/Sample.Shared/Governance/Models/Command1.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -198,31 +198,18 @@ public RegisterVoteInfo() public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(MergeResponse))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(StakeMaturityResponse))] StakeMaturity, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Command2.cs b/samples/Sample.Shared/Governance/Models/Command2.cs index 37abc799..43deeefd 100644 --- a/samples/Sample.Shared/Governance/Models/Command2.cs +++ b/samples/Sample.Shared/Governance/Models/Command2.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -140,23 +140,14 @@ public SyncCommandInfo() public enum Command2Tag { - [VariantOptionType(typeof(NeuronId))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Command2.SyncCommandInfo))] SyncCommand, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/DissolveState.cs b/samples/Sample.Shared/Governance/Models/DissolveState.cs index e8dc96c2..96dca45d 100644 --- a/samples/Sample.Shared/Governance/Models/DissolveState.cs +++ b/samples/Sample.Shared/Governance/Models/DissolveState.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(DissolveStateTag tag) public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs index b473cb5e..4822b6d1 100644 --- a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs +++ b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(NeuronIdOrSubaccountTag tag) public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Operation.cs b/samples/Sample.Shared/Governance/Models/Operation.cs index e08204af..fc3612bd 100644 --- a/samples/Sample.Shared/Governance/Models/Operation.cs +++ b/samples/Sample.Shared/Governance/Models/Operation.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -161,23 +161,14 @@ public LeaveCommunityFundInfo() public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(ChangeAutoStakeMaturity))] ChangeAutoStakeMaturity, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(Operation.LeaveCommunityFundInfo))] LeaveCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Progress.cs b/samples/Sample.Shared/Governance/Models/Progress.cs index afa81c07..d94733f3 100644 --- a/samples/Sample.Shared/Governance/Models/Progress.cs +++ b/samples/Sample.Shared/Governance/Models/Progress.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ProgressTag))] + [Variant()] public class Progress { [VariantTagProperty()] @@ -45,7 +45,6 @@ private void ValidateTag(ProgressTag tag) public enum ProgressTag { - [VariantOptionType(typeof(NeuronId))] LastNeuronId } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result.cs b/samples/Sample.Shared/Governance/Models/Result.cs index da620e48..a28ad572 100644 --- a/samples/Sample.Shared/Governance/Models/Result.cs +++ b/samples/Sample.Shared/Governance/Models/Result.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -51,7 +51,6 @@ private void ValidateTag(ResultTag tag) public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result1.cs b/samples/Sample.Shared/Governance/Models/Result1.cs index 65890925..fd43e2ba 100644 --- a/samples/Sample.Shared/Governance/Models/Result1.cs +++ b/samples/Sample.Shared/Governance/Models/Result1.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result1Tag tag) public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result2.cs b/samples/Sample.Shared/Governance/Models/Result2.cs index 81253fa8..673f09fc 100644 --- a/samples/Sample.Shared/Governance/Models/Result2.cs +++ b/samples/Sample.Shared/Governance/Models/Result2.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result2Tag tag) public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result3.cs b/samples/Sample.Shared/Governance/Models/Result3.cs index 28f97c56..d1f83ee0 100644 --- a/samples/Sample.Shared/Governance/Models/Result3.cs +++ b/samples/Sample.Shared/Governance/Models/Result3.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result3Tag tag) public enum Result3Tag { - [VariantOptionType(typeof(GovernanceCachedMetrics))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result4.cs b/samples/Sample.Shared/Governance/Models/Result4.cs index 5d4ba0d3..039d7ac3 100644 --- a/samples/Sample.Shared/Governance/Models/Result4.cs +++ b/samples/Sample.Shared/Governance/Models/Result4.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result4Tag tag) public enum Result4Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result5.cs b/samples/Sample.Shared/Governance/Models/Result5.cs index 45fa0267..0a5758fa 100644 --- a/samples/Sample.Shared/Governance/Models/Result5.cs +++ b/samples/Sample.Shared/Governance/Models/Result5.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result5Tag tag) public enum Result5Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result6.cs b/samples/Sample.Shared/Governance/Models/Result6.cs index 7df769c1..e4226631 100644 --- a/samples/Sample.Shared/Governance/Models/Result6.cs +++ b/samples/Sample.Shared/Governance/Models/Result6.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result6Tag))] + [Variant()] public class Result6 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result6Tag tag) public enum Result6Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result7.cs b/samples/Sample.Shared/Governance/Models/Result7.cs index 41434dd2..ac88252a 100644 --- a/samples/Sample.Shared/Governance/Models/Result7.cs +++ b/samples/Sample.Shared/Governance/Models/Result7.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result7Tag))] + [Variant()] public class Result7 { [VariantTagProperty()] @@ -63,9 +63,7 @@ public AbortedInfo() public enum Result7Tag { - [VariantOptionType(typeof(Committed))] Committed, - [VariantOptionType(typeof(Result7.AbortedInfo))] Aborted } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/RewardMode.cs b/samples/Sample.Shared/Governance/Models/RewardMode.cs index aa724c41..dd6a8b8a 100644 --- a/samples/Sample.Shared/Governance/Models/RewardMode.cs +++ b/samples/Sample.Shared/Governance/Models/RewardMode.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(RewardModeTag tag) public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs index a6f61318..2e9f01c9 100644 --- a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs +++ b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs @@ -2,10 +2,9 @@ using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; +using Sample.Shared.ICRC1Ledger; using EdjCase.ICP.Agent.Responses; using System.Collections.Generic; -using Sample.Shared.ICRC1Ledger; -using EdjCase.ICP.Candid.Mapping; using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger @@ -25,6 +24,30 @@ public ICRC1LedgerApiClient(IAgent agent, Principal canisterId, CandidConverter? this.Converter = converter; } + public async Task GetTransactions(Models.GetTransactionsRequest arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_transactions", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetBlocks(Models.GetBlocksArgs arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_blocks", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetDataCertificate() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_data_certificate", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + public async Task Icrc1Name() { CandidArg arg = CandidArg.FromCandid(); @@ -96,55 +119,34 @@ public async Task Icrc1BalanceOf(Models.Account arg0) return reply.ToObjects(this.Converter); } - public async Task> Icrc1SupportedStandards() + public async Task> Icrc1SupportedStandards() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } - public async Task GetTransactions(Models.GetTransactionsRequest arg0) + public async Task Icrc2Approve(Models.ApproveArgs arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_transactions", arg); - CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects(this.Converter); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "icrc2_approve", arg); + return reply.ToObjects(this.Converter); } - public async Task GetBlocks(Models.GetBlocksArgs arg0) + public async Task Icrc2Allowance(Models.AllowanceArgs arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_blocks", arg); - CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects(this.Converter); - } - - public async Task GetDataCertificate() - { - CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_data_certificate", arg); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc2_allowance", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects(this.Converter); + return reply.ToObjects(this.Converter); } - public class Icrc1SupportedStandardsArg0Item + public async Task Icrc2TransferFrom(Models.TransferFromArgs arg0) { - [CandidName("name")] - public string Name { get; set; } - - [CandidName("url")] - public string Url { get; set; } - - public Icrc1SupportedStandardsArg0Item(string name, string url) - { - this.Name = name; - this.Url = url; - } - - public Icrc1SupportedStandardsArg0Item() - { - } + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "icrc2_transfer_from", arg); + return reply.ToObjects(this.Converter); } } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs new file mode 100644 index 00000000..c08cf43d --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs @@ -0,0 +1,25 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Allowance + { + [CandidName("allowance")] + public UnboundedUInt Allowance_ { get; set; } + + [CandidName("expires_at")] + public OptionalValue ExpiresAt { get; set; } + + public Allowance(UnboundedUInt allowance, OptionalValue expiresAt) + { + this.Allowance_ = allowance; + this.ExpiresAt = expiresAt; + } + + public Allowance() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs new file mode 100644 index 00000000..7c91a196 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs @@ -0,0 +1,24 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class AllowanceArgs + { + [CandidName("account")] + public Account Account { get; set; } + + [CandidName("spender")] + public Account Spender { get; set; } + + public AllowanceArgs(Account account, Account spender) + { + this.Account = account; + this.Spender = spender; + } + + public AllowanceArgs() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs new file mode 100644 index 00000000..6fd28296 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs @@ -0,0 +1,51 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Sample.Shared.ICRC1Ledger.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Approve + { + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("from")] + public Account From { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("expected_allowance")] + public OptionalValue ExpectedAllowance { get; set; } + + [CandidName("expires_at")] + public OptionalValue ExpiresAt { get; set; } + + [CandidName("spender")] + public Account Spender { get; set; } + + public Approve(OptionalValue fee, Account from, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue expectedAllowance, OptionalValue expiresAt, Account spender) + { + this.Fee = fee; + this.From = from; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.ExpectedAllowance = expectedAllowance; + this.ExpiresAt = expiresAt; + this.Spender = spender; + } + + public Approve() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs new file mode 100644 index 00000000..06f8f664 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs @@ -0,0 +1,51 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Sample.Shared.ICRC1Ledger.Models; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class ApproveArgs + { + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("from_subaccount")] + public OptionalValue> FromSubaccount { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("expected_allowance")] + public OptionalValue ExpectedAllowance { get; set; } + + [CandidName("expires_at")] + public OptionalValue ExpiresAt { get; set; } + + [CandidName("spender")] + public Account Spender { get; set; } + + public ApproveArgs(OptionalValue fee, OptionalValue> memo, OptionalValue> fromSubaccount, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue expectedAllowance, OptionalValue expiresAt, Account spender) + { + this.Fee = fee; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.ExpectedAllowance = expectedAllowance; + this.ExpiresAt = expiresAt; + this.Spender = spender; + } + + public ApproveArgs() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs new file mode 100644 index 00000000..c7a67d1b --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs @@ -0,0 +1,246 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using EdjCase.ICP.Candid.Models; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class ApproveError + { + [VariantTagProperty()] + public ApproveErrorTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ApproveError(ApproveErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected ApproveError() + { + } + + public static ApproveError GenericError(ApproveError.GenericErrorInfo info) + { + return new ApproveError(ApproveErrorTag.GenericError, info); + } + + public static ApproveError TemporarilyUnavailable() + { + return new ApproveError(ApproveErrorTag.TemporarilyUnavailable, null); + } + + public static ApproveError Duplicate(ApproveError.DuplicateInfo info) + { + return new ApproveError(ApproveErrorTag.Duplicate, info); + } + + public static ApproveError BadFee(ApproveError.BadFeeInfo info) + { + return new ApproveError(ApproveErrorTag.BadFee, info); + } + + public static ApproveError AllowanceChanged(ApproveError.AllowanceChangedInfo info) + { + return new ApproveError(ApproveErrorTag.AllowanceChanged, info); + } + + public static ApproveError CreatedInFuture(ApproveError.CreatedInFutureInfo info) + { + return new ApproveError(ApproveErrorTag.CreatedInFuture, info); + } + + public static ApproveError TooOld() + { + return new ApproveError(ApproveErrorTag.TooOld, null); + } + + public static ApproveError Expired(ApproveError.ExpiredInfo info) + { + return new ApproveError(ApproveErrorTag.Expired, info); + } + + public static ApproveError InsufficientFunds(ApproveError.InsufficientFundsInfo info) + { + return new ApproveError(ApproveErrorTag.InsufficientFunds, info); + } + + public ApproveError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(ApproveErrorTag.GenericError); + return (ApproveError.GenericErrorInfo)this.Value!; + } + + public ApproveError.DuplicateInfo AsDuplicate() + { + this.ValidateTag(ApproveErrorTag.Duplicate); + return (ApproveError.DuplicateInfo)this.Value!; + } + + public ApproveError.BadFeeInfo AsBadFee() + { + this.ValidateTag(ApproveErrorTag.BadFee); + return (ApproveError.BadFeeInfo)this.Value!; + } + + public ApproveError.AllowanceChangedInfo AsAllowanceChanged() + { + this.ValidateTag(ApproveErrorTag.AllowanceChanged); + return (ApproveError.AllowanceChangedInfo)this.Value!; + } + + public ApproveError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(ApproveErrorTag.CreatedInFuture); + return (ApproveError.CreatedInFutureInfo)this.Value!; + } + + public ApproveError.ExpiredInfo AsExpired() + { + this.ValidateTag(ApproveErrorTag.Expired); + return (ApproveError.ExpiredInfo)this.Value!; + } + + public ApproveError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(ApproveErrorTag.InsufficientFunds); + return (ApproveError.InsufficientFundsInfo)this.Value!; + } + + private void ValidateTag(ApproveErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + + public class GenericErrorInfo + { + [CandidName("message")] + public string Message { get; set; } + + [CandidName("error_code")] + public UnboundedUInt ErrorCode { get; set; } + + public GenericErrorInfo(string message, UnboundedUInt errorCode) + { + this.Message = message; + this.ErrorCode = errorCode; + } + + public GenericErrorInfo() + { + } + } + + public class DuplicateInfo + { + [CandidName("duplicate_of")] + public BlockIndex DuplicateOf { get; set; } + + public DuplicateInfo(BlockIndex duplicateOf) + { + this.DuplicateOf = duplicateOf; + } + + public DuplicateInfo() + { + } + } + + public class BadFeeInfo + { + [CandidName("expected_fee")] + public UnboundedUInt ExpectedFee { get; set; } + + public BadFeeInfo(UnboundedUInt expectedFee) + { + this.ExpectedFee = expectedFee; + } + + public BadFeeInfo() + { + } + } + + public class AllowanceChangedInfo + { + [CandidName("current_allowance")] + public UnboundedUInt CurrentAllowance { get; set; } + + public AllowanceChangedInfo(UnboundedUInt currentAllowance) + { + this.CurrentAllowance = currentAllowance; + } + + public AllowanceChangedInfo() + { + } + } + + public class CreatedInFutureInfo + { + [CandidName("ledger_time")] + public Timestamp LedgerTime { get; set; } + + public CreatedInFutureInfo(Timestamp ledgerTime) + { + this.LedgerTime = ledgerTime; + } + + public CreatedInFutureInfo() + { + } + } + + public class ExpiredInfo + { + [CandidName("ledger_time")] + public Timestamp LedgerTime { get; set; } + + public ExpiredInfo(Timestamp ledgerTime) + { + this.LedgerTime = ledgerTime; + } + + public ExpiredInfo() + { + } + } + + public class InsufficientFundsInfo + { + [CandidName("balance")] + public UnboundedUInt Balance { get; set; } + + public InsufficientFundsInfo(UnboundedUInt balance) + { + this.Balance = balance; + } + + public InsufficientFundsInfo() + { + } + } + } + + public enum ApproveErrorTag + { + GenericError, + TemporarilyUnavailable, + Duplicate, + BadFee, + AllowanceChanged, + CreatedInFuture, + TooOld, + Expired, + InsufficientFunds + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs new file mode 100644 index 00000000..5fd7c701 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs @@ -0,0 +1,63 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class ApproveResult + { + [VariantTagProperty()] + public ApproveResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ApproveResult(ApproveResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected ApproveResult() + { + } + + public static ApproveResult Ok(BlockIndex info) + { + return new ApproveResult(ApproveResultTag.Ok, info); + } + + public static ApproveResult Err(ApproveError info) + { + return new ApproveResult(ApproveResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(ApproveResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public ApproveError AsErr() + { + this.ValidateTag(ApproveResultTag.Err); + return (ApproveError)this.Value!; + } + + private void ValidateTag(ApproveResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + } + + public enum ApproveResultTag + { + Ok, + Err + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs new file mode 100644 index 00000000..634db7b7 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs @@ -0,0 +1,39 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Burn + { + [CandidName("from")] + public Account From { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("spender")] + public OptionalValue Spender { get; set; } + + public Burn(Account from, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue spender) + { + this.From = from; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.Spender = spender; + } + + public Burn() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs index eee7c158..deddac03 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(ChangeFeeCollectorTag))] + [Variant()] public class ChangeFeeCollector { [VariantTagProperty()] @@ -51,7 +51,6 @@ private void ValidateTag(ChangeFeeCollectorTag tag) public enum ChangeFeeCollectorTag { Unset, - [VariantOptionType(typeof(Account))] SetTo } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs b/samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs new file mode 100644 index 00000000..8ef6e274 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs @@ -0,0 +1,19 @@ +using EdjCase.ICP.Candid.Mapping; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class FeatureFlags + { + [CandidName("icrc2")] + public bool Icrc2 { get; set; } + + public FeatureFlags(bool icrc2) + { + this.Icrc2 = icrc2; + } + + public FeatureFlags() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs b/samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs new file mode 100644 index 00000000..4fa32fc4 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs @@ -0,0 +1,32 @@ +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class HttpRequest + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("method")] + public string Method { get; set; } + + [CandidName("body")] + public List Body { get; set; } + + [CandidName("headers")] + public Dictionary Headers { get; set; } + + public HttpRequest(string url, string method, List body, Dictionary headers) + { + this.Url = url; + this.Method = method; + this.Body = body; + this.Headers = headers; + } + + public HttpRequest() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs b/samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs new file mode 100644 index 00000000..25b0fa54 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs @@ -0,0 +1,28 @@ +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class HttpResponse + { + [CandidName("body")] + public List Body { get; set; } + + [CandidName("headers")] + public Dictionary Headers { get; set; } + + [CandidName("status_code")] + public ushort StatusCode { get; set; } + + public HttpResponse(List body, Dictionary headers, ushort statusCode) + { + this.Body = body; + this.Headers = headers; + this.StatusCode = statusCode; + } + + public HttpResponse() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs index 0de1d2ca..db458f8a 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs @@ -14,7 +14,13 @@ public class InitArgs public OptionalValue FeeCollectorAccount { get; set; } [CandidName("transfer_fee")] - public ulong TransferFee { get; set; } + public UnboundedUInt TransferFee { get; set; } + + [CandidName("decimals")] + public OptionalValue Decimals { get; set; } + + [CandidName("max_memo_length")] + public OptionalValue MaxMemoLength { get; set; } [CandidName("token_symbol")] public string TokenSymbol { get; set; } @@ -26,20 +32,34 @@ public class InitArgs public Dictionary Metadata { get; set; } [CandidName("initial_balances")] - public Dictionary InitialBalances { get; set; } + public Dictionary InitialBalances { get; set; } + + [CandidName("feature_flags")] + public OptionalValue FeatureFlags { get; set; } + + [CandidName("maximum_number_of_accounts")] + public OptionalValue MaximumNumberOfAccounts { get; set; } + + [CandidName("accounts_overflow_trim_quantity")] + public OptionalValue AccountsOverflowTrimQuantity { get; set; } [CandidName("archive_options")] public InitArgs.ArchiveOptionsInfo ArchiveOptions { get; set; } - public InitArgs(Account mintingAccount, OptionalValue feeCollectorAccount, ulong transferFee, string tokenSymbol, string tokenName, Dictionary metadata, Dictionary initialBalances, InitArgs.ArchiveOptionsInfo archiveOptions) + public InitArgs(Account mintingAccount, OptionalValue feeCollectorAccount, UnboundedUInt transferFee, OptionalValue decimals, OptionalValue maxMemoLength, string tokenSymbol, string tokenName, Dictionary metadata, Dictionary initialBalances, OptionalValue featureFlags, OptionalValue maximumNumberOfAccounts, OptionalValue accountsOverflowTrimQuantity, InitArgs.ArchiveOptionsInfo archiveOptions) { this.MintingAccount = mintingAccount; this.FeeCollectorAccount = feeCollectorAccount; this.TransferFee = transferFee; + this.Decimals = decimals; + this.MaxMemoLength = maxMemoLength; this.TokenSymbol = tokenSymbol; this.TokenName = tokenName; this.Metadata = metadata; this.InitialBalances = initialBalances; + this.FeatureFlags = featureFlags; + this.MaximumNumberOfAccounts = maximumNumberOfAccounts; + this.AccountsOverflowTrimQuantity = accountsOverflowTrimQuantity; this.ArchiveOptions = archiveOptions; } @@ -52,6 +72,9 @@ public class ArchiveOptionsInfo [CandidName("num_blocks_to_archive")] public ulong NumBlocksToArchive { get; set; } + [CandidName("max_transactions_per_response")] + public OptionalValue MaxTransactionsPerResponse { get; set; } + [CandidName("trigger_threshold")] public ulong TriggerThreshold { get; set; } @@ -67,9 +90,10 @@ public class ArchiveOptionsInfo [CandidName("controller_id")] public Principal ControllerId { get; set; } - public ArchiveOptionsInfo(ulong numBlocksToArchive, ulong triggerThreshold, OptionalValue maxMessageSizeBytes, OptionalValue cyclesForArchiveCreation, OptionalValue nodeMaxMemorySizeBytes, Principal controllerId) + public ArchiveOptionsInfo(ulong numBlocksToArchive, OptionalValue maxTransactionsPerResponse, ulong triggerThreshold, OptionalValue maxMessageSizeBytes, OptionalValue cyclesForArchiveCreation, OptionalValue nodeMaxMemorySizeBytes, Principal controllerId) { this.NumBlocksToArchive = numBlocksToArchive; + this.MaxTransactionsPerResponse = maxTransactionsPerResponse; this.TriggerThreshold = triggerThreshold; this.MaxMessageSizeBytes = maxMessageSizeBytes; this.CyclesForArchiveCreation = cyclesForArchiveCreation; diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs index b95810b7..9945c6d5 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(LedgerArgTag))] + [Variant()] public class LedgerArg { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(LedgerArgTag tag) public enum LedgerArgTag { - [VariantOptionType(typeof(InitArgs))] Init, - [VariantOptionType(typeof(OptionalValue))] Upgrade } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs index f8bc73b7..4aabcdd6 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs @@ -6,7 +6,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(MetadataValueTag))] + [Variant()] public class MetadataValue { [VariantTagProperty()] @@ -80,13 +80,9 @@ private void ValidateTag(MetadataValueTag tag) public enum MetadataValueTag { - [VariantOptionType(typeof(UnboundedUInt))] Nat, - [VariantOptionType(typeof(UnboundedInt))] Int, - [VariantOptionType(typeof(string))] Text, - [VariantOptionType(typeof(List))] Blob } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs new file mode 100644 index 00000000..ce9c09b6 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs @@ -0,0 +1,35 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Mint + { + [CandidName("to")] + public Account To { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + public Mint(Account to, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount) + { + this.To = to; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + } + + public Mint() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs b/samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs new file mode 100644 index 00000000..f6da1df8 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs @@ -0,0 +1,23 @@ +using EdjCase.ICP.Candid.Mapping; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class StandardRecord + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("name")] + public string Name { get; set; } + + public StandardRecord(string url, string name) + { + this.Url = url; + this.Name = name; + } + + public StandardRecord() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs index be04dfc9..252fb72e 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs @@ -1,128 +1,42 @@ using EdjCase.ICP.Candid.Mapping; using EdjCase.ICP.Candid.Models; using Sample.Shared.ICRC1Ledger.Models; -using System.Collections.Generic; using Timestamp = System.UInt64; namespace Sample.Shared.ICRC1Ledger.Models { public class Transaction { + [CandidName("burn")] + public OptionalValue Burn { get; set; } + [CandidName("kind")] public string Kind { get; set; } [CandidName("mint")] - public OptionalValue Mint { get; set; } + public OptionalValue Mint { get; set; } - [CandidName("burn")] - public OptionalValue Burn { get; set; } - - [CandidName("transfer")] - public OptionalValue Transfer { get; set; } + [CandidName("approve")] + public OptionalValue Approve { get; set; } [CandidName("timestamp")] - public ulong Timestamp { get; set; } + public Timestamp Timestamp { get; set; } - public Transaction(string kind, OptionalValue mint, OptionalValue burn, OptionalValue transfer, ulong timestamp) + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + public Transaction(OptionalValue burn, string kind, OptionalValue mint, OptionalValue approve, Timestamp timestamp, OptionalValue transfer) { + this.Burn = burn; this.Kind = kind; this.Mint = mint; - this.Burn = burn; - this.Transfer = transfer; + this.Approve = approve; this.Timestamp = timestamp; + this.Transfer = transfer; } public Transaction() { } - - public class MintValue - { - [CandidName("amount")] - public UnboundedUInt Amount { get; set; } - - [CandidName("to")] - public Account To { get; set; } - - [CandidName("memo")] - public OptionalValue> Memo { get; set; } - - [CandidName("created_at_time")] - public OptionalValue CreatedAtTime { get; set; } - - public MintValue(UnboundedUInt amount, Account to, OptionalValue> memo, OptionalValue createdAtTime) - { - this.Amount = amount; - this.To = to; - this.Memo = memo; - this.CreatedAtTime = createdAtTime; - } - - public MintValue() - { - } - } - - public class BurnValue - { - [CandidName("amount")] - public UnboundedUInt Amount { get; set; } - - [CandidName("from")] - public Account From { get; set; } - - [CandidName("memo")] - public OptionalValue> Memo { get; set; } - - [CandidName("created_at_time")] - public OptionalValue CreatedAtTime { get; set; } - - public BurnValue(UnboundedUInt amount, Account from, OptionalValue> memo, OptionalValue createdAtTime) - { - this.Amount = amount; - this.From = from; - this.Memo = memo; - this.CreatedAtTime = createdAtTime; - } - - public BurnValue() - { - } - } - - public class TransferValue - { - [CandidName("amount")] - public UnboundedUInt Amount { get; set; } - - [CandidName("from")] - public Account From { get; set; } - - [CandidName("to")] - public Account To { get; set; } - - [CandidName("memo")] - public OptionalValue> Memo { get; set; } - - [CandidName("created_at_time")] - public OptionalValue CreatedAtTime { get; set; } - - [CandidName("fee")] - public OptionalValue Fee { get; set; } - - public TransferValue(UnboundedUInt amount, Account from, Account to, OptionalValue> memo, OptionalValue createdAtTime, OptionalValue fee) - { - this.Amount = amount; - this.From = from; - this.To = to; - this.Memo = memo; - this.CreatedAtTime = createdAtTime; - this.Fee = fee; - } - - public TransferValue() - { - } - } } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs new file mode 100644 index 00000000..e6a65b54 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs @@ -0,0 +1,47 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Transfer + { + [CandidName("to")] + public Account To { get; set; } + + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("from")] + public Account From { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("spender")] + public OptionalValue Spender { get; set; } + + public Transfer(Account to, OptionalValue fee, Account from, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue spender) + { + this.To = to; + this.Fee = fee; + this.From = from; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.Spender = spender; + } + + public Transfer() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs index de52303f..2ed753c7 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs @@ -3,11 +3,12 @@ using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; +using Timestamp = System.UInt64; using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(TransferErrorTag))] + [Variant()] public class TransferError { [VariantTagProperty()] @@ -158,9 +159,9 @@ public InsufficientFundsInfo() public class CreatedInFutureInfo { [CandidName("ledger_time")] - public ulong LedgerTime { get; set; } + public Timestamp LedgerTime { get; set; } - public CreatedInFutureInfo(ulong ledgerTime) + public CreatedInFutureInfo(Timestamp ledgerTime) { this.LedgerTime = ledgerTime; } @@ -207,19 +208,13 @@ public GenericErrorInfo() public enum TransferErrorTag { - [VariantOptionType(typeof(TransferError.BadFeeInfo))] BadFee, - [VariantOptionType(typeof(TransferError.BadBurnInfo))] BadBurn, - [VariantOptionType(typeof(TransferError.InsufficientFundsInfo))] InsufficientFunds, TooOld, - [VariantOptionType(typeof(TransferError.CreatedInFutureInfo))] CreatedInFuture, TemporarilyUnavailable, - [VariantOptionType(typeof(TransferError.DuplicateInfo))] Duplicate, - [VariantOptionType(typeof(TransferError.GenericErrorInfo))] GenericError } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs new file mode 100644 index 00000000..1236cc33 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs @@ -0,0 +1,49 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Sample.Shared.ICRC1Ledger.Models; +using System.Collections.Generic; +using Subaccount = System.Collections.Generic.List; +using Timestamp = System.UInt64; +using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class TransferFromArgs + { + [CandidName("spender_subaccount")] + public OptionalValue SpenderSubaccount { get; set; } + + [CandidName("from")] + public Account From { get; set; } + + [CandidName("to")] + public Account To { get; set; } + + [CandidName("amount")] + public Tokens Amount { get; set; } + + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + public TransferFromArgs(OptionalValue spenderSubaccount, Account from, Account to, Tokens amount, OptionalValue fee, OptionalValue> memo, OptionalValue createdAtTime) + { + this.SpenderSubaccount = spenderSubaccount; + this.From = from; + this.To = to; + this.Amount = amount; + this.Fee = fee; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + } + + public TransferFromArgs() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs new file mode 100644 index 00000000..04f193d4 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs @@ -0,0 +1,247 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using EdjCase.ICP.Candid.Models; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; +using Timestamp = System.UInt64; +using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class TransferFromError + { + [VariantTagProperty()] + public TransferFromErrorTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public TransferFromError(TransferFromErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected TransferFromError() + { + } + + public static TransferFromError BadFee(TransferFromError.BadFeeInfo info) + { + return new TransferFromError(TransferFromErrorTag.BadFee, info); + } + + public static TransferFromError BadBurn(TransferFromError.BadBurnInfo info) + { + return new TransferFromError(TransferFromErrorTag.BadBurn, info); + } + + public static TransferFromError InsufficientFunds(TransferFromError.InsufficientFundsInfo info) + { + return new TransferFromError(TransferFromErrorTag.InsufficientFunds, info); + } + + public static TransferFromError InsufficientAllowance(TransferFromError.InsufficientAllowanceInfo info) + { + return new TransferFromError(TransferFromErrorTag.InsufficientAllowance, info); + } + + public static TransferFromError TooOld() + { + return new TransferFromError(TransferFromErrorTag.TooOld, null); + } + + public static TransferFromError CreatedInFuture(TransferFromError.CreatedInFutureInfo info) + { + return new TransferFromError(TransferFromErrorTag.CreatedInFuture, info); + } + + public static TransferFromError Duplicate(TransferFromError.DuplicateInfo info) + { + return new TransferFromError(TransferFromErrorTag.Duplicate, info); + } + + public static TransferFromError TemporarilyUnavailable() + { + return new TransferFromError(TransferFromErrorTag.TemporarilyUnavailable, null); + } + + public static TransferFromError GenericError(TransferFromError.GenericErrorInfo info) + { + return new TransferFromError(TransferFromErrorTag.GenericError, info); + } + + public TransferFromError.BadFeeInfo AsBadFee() + { + this.ValidateTag(TransferFromErrorTag.BadFee); + return (TransferFromError.BadFeeInfo)this.Value!; + } + + public TransferFromError.BadBurnInfo AsBadBurn() + { + this.ValidateTag(TransferFromErrorTag.BadBurn); + return (TransferFromError.BadBurnInfo)this.Value!; + } + + public TransferFromError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(TransferFromErrorTag.InsufficientFunds); + return (TransferFromError.InsufficientFundsInfo)this.Value!; + } + + public TransferFromError.InsufficientAllowanceInfo AsInsufficientAllowance() + { + this.ValidateTag(TransferFromErrorTag.InsufficientAllowance); + return (TransferFromError.InsufficientAllowanceInfo)this.Value!; + } + + public TransferFromError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(TransferFromErrorTag.CreatedInFuture); + return (TransferFromError.CreatedInFutureInfo)this.Value!; + } + + public TransferFromError.DuplicateInfo AsDuplicate() + { + this.ValidateTag(TransferFromErrorTag.Duplicate); + return (TransferFromError.DuplicateInfo)this.Value!; + } + + public TransferFromError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(TransferFromErrorTag.GenericError); + return (TransferFromError.GenericErrorInfo)this.Value!; + } + + private void ValidateTag(TransferFromErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + + public class BadFeeInfo + { + [CandidName("expected_fee")] + public Tokens ExpectedFee { get; set; } + + public BadFeeInfo(Tokens expectedFee) + { + this.ExpectedFee = expectedFee; + } + + public BadFeeInfo() + { + } + } + + public class BadBurnInfo + { + [CandidName("min_burn_amount")] + public Tokens MinBurnAmount { get; set; } + + public BadBurnInfo(Tokens minBurnAmount) + { + this.MinBurnAmount = minBurnAmount; + } + + public BadBurnInfo() + { + } + } + + public class InsufficientFundsInfo + { + [CandidName("balance")] + public Tokens Balance { get; set; } + + public InsufficientFundsInfo(Tokens balance) + { + this.Balance = balance; + } + + public InsufficientFundsInfo() + { + } + } + + public class InsufficientAllowanceInfo + { + [CandidName("allowance")] + public Tokens Allowance { get; set; } + + public InsufficientAllowanceInfo(Tokens allowance) + { + this.Allowance = allowance; + } + + public InsufficientAllowanceInfo() + { + } + } + + public class CreatedInFutureInfo + { + [CandidName("ledger_time")] + public Timestamp LedgerTime { get; set; } + + public CreatedInFutureInfo(Timestamp ledgerTime) + { + this.LedgerTime = ledgerTime; + } + + public CreatedInFutureInfo() + { + } + } + + public class DuplicateInfo + { + [CandidName("duplicate_of")] + public BlockIndex DuplicateOf { get; set; } + + public DuplicateInfo(BlockIndex duplicateOf) + { + this.DuplicateOf = duplicateOf; + } + + public DuplicateInfo() + { + } + } + + public class GenericErrorInfo + { + [CandidName("error_code")] + public UnboundedUInt ErrorCode { get; set; } + + [CandidName("message")] + public string Message { get; set; } + + public GenericErrorInfo(UnboundedUInt errorCode, string message) + { + this.ErrorCode = errorCode; + this.Message = message; + } + + public GenericErrorInfo() + { + } + } + } + + public enum TransferFromErrorTag + { + BadFee, + BadBurn, + InsufficientFunds, + InsufficientAllowance, + TooOld, + CreatedInFuture, + Duplicate, + TemporarilyUnavailable, + GenericError + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs new file mode 100644 index 00000000..2fab0fc0 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs @@ -0,0 +1,63 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class TransferFromResult + { + [VariantTagProperty()] + public TransferFromResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public TransferFromResult(TransferFromResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected TransferFromResult() + { + } + + public static TransferFromResult Ok(BlockIndex info) + { + return new TransferFromResult(TransferFromResultTag.Ok, info); + } + + public static TransferFromResult Err(TransferFromError info) + { + return new TransferFromResult(TransferFromResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(TransferFromResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public TransferFromError AsErr() + { + this.ValidateTag(TransferFromResultTag.Err); + return (TransferFromError)this.Value!; + } + + private void ValidateTag(TransferFromResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + } + + public enum TransferFromResultTag + { + Ok, + Err + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs index f8a83732..dd528fc0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(TransferResultTag))] + [Variant()] public class TransferResult { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(TransferResultTag tag) public enum TransferResultTag { - [VariantOptionType(typeof(BlockIndex))] Ok, - [VariantOptionType(typeof(TransferError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs index 18ef012f..7ce67ec9 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs @@ -17,7 +17,7 @@ public class UpgradeArgs public OptionalValue TokenName { get; set; } [CandidName("transfer_fee")] - public OptionalValue TransferFee { get; set; } + public OptionalValue TransferFee { get; set; } [CandidName("change_fee_collector")] public OptionalValue ChangeFeeCollector { get; set; } @@ -25,7 +25,16 @@ public class UpgradeArgs [CandidName("max_memo_length")] public OptionalValue MaxMemoLength { get; set; } - public UpgradeArgs(OptionalValue> metadata, OptionalValue tokenSymbol, OptionalValue tokenName, OptionalValue transferFee, OptionalValue changeFeeCollector, OptionalValue maxMemoLength) + [CandidName("feature_flags")] + public OptionalValue FeatureFlags { get; set; } + + [CandidName("maximum_number_of_accounts")] + public OptionalValue MaximumNumberOfAccounts { get; set; } + + [CandidName("accounts_overflow_trim_quantity")] + public OptionalValue AccountsOverflowTrimQuantity { get; set; } + + public UpgradeArgs(OptionalValue> metadata, OptionalValue tokenSymbol, OptionalValue tokenName, OptionalValue transferFee, OptionalValue changeFeeCollector, OptionalValue maxMemoLength, OptionalValue featureFlags, OptionalValue maximumNumberOfAccounts, OptionalValue accountsOverflowTrimQuantity) { this.Metadata = metadata; this.TokenSymbol = tokenSymbol; @@ -33,6 +42,9 @@ public UpgradeArgs(OptionalValue> metadata, Op this.TransferFee = transferFee; this.ChangeFeeCollector = changeFeeCollector; this.MaxMemoLength = maxMemoLength; + this.FeatureFlags = featureFlags; + this.MaximumNumberOfAccounts = maximumNumberOfAccounts; + this.AccountsOverflowTrimQuantity = accountsOverflowTrimQuantity; } public UpgradeArgs() diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs index 55cff77e..8aca17d0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs @@ -7,7 +7,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(ValueTag))] + [Variant()] public class Value { [VariantTagProperty()] @@ -114,19 +114,12 @@ private void ValidateTag(ValueTag tag) public enum ValueTag { - [VariantOptionType(typeof(List))] Blob, - [VariantOptionType(typeof(string))] Text, - [VariantOptionType(typeof(UnboundedUInt))] Nat, - [VariantOptionType(typeof(ulong))] Nat64, - [VariantOptionType(typeof(UnboundedInt))] Int, - [VariantOptionType(typeof(List))] Array, - [VariantOptionType(typeof(Map))] Map } } \ No newline at end of file diff --git a/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs b/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs index 0c9d884d..aa6638a8 100644 --- a/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs +++ b/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs @@ -37,7 +37,7 @@ public MetaData(string key, MetaDataValue value) /// /// A model representing the metadata value from an icrc1 token /// - [Variant(typeof(MetaDataValueTag))] + [Variant] public class MetaDataValue { /// @@ -163,22 +163,18 @@ public enum MetaDataValueTag /// /// Nat value /// - [VariantOptionType(typeof(UnboundedUInt))] Nat, /// /// Int value /// - [VariantOptionType(typeof(UnboundedInt))] Int, /// /// Text value /// - [VariantOptionType(typeof(string))] Text, /// /// Blob value /// - [VariantOptionType(typeof(byte[]))] Blob, } } \ No newline at end of file diff --git a/src/Agent/Standards/ICRC1/Models/TransferError.cs b/src/Agent/Standards/ICRC1/Models/TransferError.cs index a5ebe398..d1d3c096 100644 --- a/src/Agent/Standards/ICRC1/Models/TransferError.cs +++ b/src/Agent/Standards/ICRC1/Models/TransferError.cs @@ -8,7 +8,7 @@ namespace EdjCase.ICP.Agent.Standards.ICRC1.Models /// /// This class represents an error that can occur during a transfer /// - [Variant(typeof(TransferErrorTag))] + [Variant] public class TransferError { /// @@ -327,19 +327,16 @@ public enum TransferErrorTag /// /// Indicates an error due to an incorrect fee /// - [VariantOptionType(typeof(BadFeeError))] BadFee, /// /// Indicates an error due to an incorrect burn amount /// - [VariantOptionType(typeof(BadBurnError))] BadBurn, /// /// Indicates an error due to insufficient funds for the transaction /// - [VariantOptionType(typeof(InsufficientFundsError))] InsufficientFunds, /// @@ -350,13 +347,11 @@ public enum TransferErrorTag /// /// Indicates an error due to a transaction being created in the future /// - [VariantOptionType(typeof(CreatedInFutureError))] CreatedInFuture, /// /// Indicates an error due to a transaction being a duplicate /// - [VariantOptionType(typeof(DuplicateError))] Duplicate, /// @@ -367,7 +362,6 @@ public enum TransferErrorTag /// /// Indicates a generic error that can occur during a transfer /// - [VariantOptionType(typeof(GenericError))] GenericError } } \ No newline at end of file diff --git a/src/Agent/Standards/ICRC1/Models/TransferResult.cs b/src/Agent/Standards/ICRC1/Models/TransferResult.cs index 5368de0c..a735acbd 100644 --- a/src/Agent/Standards/ICRC1/Models/TransferResult.cs +++ b/src/Agent/Standards/ICRC1/Models/TransferResult.cs @@ -8,7 +8,7 @@ namespace EdjCase.ICP.Agent.Standards.ICRC1.Models /// /// Represents the result of a transfer operation, which can either be Ok with a value or Err with an error object /// - [Variant(typeof(TransferResultTag))] + [Variant] public class TransferResult { /// @@ -96,12 +96,10 @@ public enum TransferResultTag /// /// Indicates a successful transfer operation with the associated UnboundedUInt value /// - [VariantOptionType(typeof(UnboundedUInt))] Ok, /// /// Indicates a failed transfer operation with the associated TransferError object containing information about the error /// - [VariantOptionType(typeof(TransferError))] Err } diff --git a/src/Candid/API.md b/src/Candid/API.md index a2e2579e..29a5fd93 100644 --- a/src/Candid/API.md +++ b/src/Candid/API.md @@ -683,11 +683,9 @@ - [UnboundedUIntExtensions](#T-EdjCase-ICP-Candid-Models-UnboundedUIntExtensions 'EdjCase.ICP.Candid.Models.UnboundedUIntExtensions') - [ToUnbounded(value)](#M-EdjCase-ICP-Candid-Models-UnboundedUIntExtensions-ToUnbounded-System-UInt64- 'EdjCase.ICP.Candid.Models.UnboundedUIntExtensions.ToUnbounded(System.UInt64)') - [VariantAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantAttribute 'EdjCase.ICP.Candid.Mapping.VariantAttribute') - - [#ctor(enumType)](#M-EdjCase-ICP-Candid-Mapping-VariantAttribute-#ctor-System-Type- 'EdjCase.ICP.Candid.Mapping.VariantAttribute.#ctor(System.Type)') - - [TagType](#P-EdjCase-ICP-Candid-Mapping-VariantAttribute-TagType 'EdjCase.ICP.Candid.Mapping.VariantAttribute.TagType') -- [VariantOptionTypeAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantOptionTypeAttribute 'EdjCase.ICP.Candid.Mapping.VariantOptionTypeAttribute') - - [#ctor(optionType)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionTypeAttribute-#ctor-System-Type- 'EdjCase.ICP.Candid.Mapping.VariantOptionTypeAttribute.#ctor(System.Type)') - - [OptionType](#P-EdjCase-ICP-Candid-Mapping-VariantOptionTypeAttribute-OptionType 'EdjCase.ICP.Candid.Mapping.VariantOptionTypeAttribute.OptionType') +- [VariantOptionAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute') + - [#ctor(tag)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-#ctor-EdjCase-ICP-Candid-Models-CandidTag- 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.#ctor(EdjCase.ICP.Candid.Models.CandidTag)') + - [Tag](#P-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-Tag 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.Tag') - [VariantTagPropertyAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantTagPropertyAttribute 'EdjCase.ICP.Candid.Mapping.VariantTagPropertyAttribute') - [VariantValuePropertyAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantValuePropertyAttribute 'EdjCase.ICP.Candid.Mapping.VariantValuePropertyAttribute') @@ -9195,30 +9193,8 @@ An attribute to put on a class to identify it as a variant type for serializatio Requires the use of \`VariantTagPropertyAttribute\`, \`VariantOptionTypeAttribute\` and \`VariantValuePropertyAttribute\` attributes if used - -### #ctor(enumType) `constructor` - -##### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| enumType | [System.Type](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Type 'System.Type') | The enum type to use for specifying the tags of the variant | - -##### Exceptions - -| Name | Description | -| ---- | ----------- | -| [System.ArgumentException](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.ArgumentException 'System.ArgumentException') | Throws if the type is not an enum | - - -### TagType `property` - -##### Summary - -The enum type to use for specifying the tags of the variant - - -## VariantOptionTypeAttribute `type` + +## VariantOptionAttribute `type` ##### Namespace @@ -9229,17 +9205,17 @@ EdjCase.ICP.Candid.Mapping An attribute to put on an enum option to specify if the tag has an attached value in the variant, otherwise the attached type will be null - -### #ctor(optionType) `constructor` + +### #ctor(tag) `constructor` ##### Parameters | Name | Type | Description | | ---- | ---- | ----------- | -| optionType | [System.Type](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Type 'System.Type') | The type of the variant option value to use | +| tag | [EdjCase.ICP.Candid.Models.CandidTag](#T-EdjCase-ICP-Candid-Models-CandidTag 'EdjCase.ICP.Candid.Models.CandidTag') | The tag of the variant option | - -### OptionType `property` + +### Tag `property` ##### Summary diff --git a/src/Candid/API.xml b/src/Candid/API.xml index 827937bf..170e9176 100644 --- a/src/Candid/API.xml +++ b/src/Candid/API.xml @@ -465,15 +465,6 @@ `VariantValuePropertyAttribute` attributes if used - - - The enum type to use for specifying the tags of the variant - - - - The enum type to use for specifying the tags of the variant - Throws if the type is not an enum - An attribute to put on a property/field that indicates where to hold the @@ -486,19 +477,19 @@ tag value object. The type must be compatible with all value types, recommend using `object?` - + An attribute to put on an enum option to specify if the tag has an attached value in the variant, otherwise the attached type will be null - + The type of the variant option value to use - - The type of the variant option value to use + + The tag of the variant option diff --git a/src/Candid/Mapping/IResolvableTypeInfo.cs b/src/Candid/Mapping/IResolvableTypeInfo.cs index b56134fa..e093d436 100644 --- a/src/Candid/Mapping/IResolvableTypeInfo.cs +++ b/src/Candid/Mapping/IResolvableTypeInfo.cs @@ -323,10 +323,6 @@ private static IResolvableTypeInfo BuildTypeInfo(Type objType) { return BuildStruct(CandidType.Empty(), new EmptyValue(), CandidValue.Empty); } - if(objType == typeof(SimpleVariant)) - { - return BuildSimpleVariant(); - } // Variants are objects with a [Variant] on the class VariantAttribute? variantAttribute = objType.GetCustomAttribute(); @@ -340,11 +336,6 @@ private static IResolvableTypeInfo BuildTypeInfo(Type objType) return BuildRecord(objType); } - private static IResolvableTypeInfo BuildSimpleVariant() - { - return new SimpleVariantMapper(candidType, options); - } - private static IResolvableTypeInfo BuildStruct(CandidType candidType, T value, Func valueGetter) where T : struct { @@ -447,18 +438,61 @@ private static IResolvableTypeInfo BuildEnumVariant(Type enumType) private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute attribute) { + List properties = objType + .GetProperties(BindingFlags.Instance | BindingFlags.Public) + .ToList(); + const string defaultTypePropertyName = "Tag"; + PropertyInfo? variantTagProperty = properties + .FirstOrDefault(p => p.GetCustomAttribute() != null) + ?? properties.FirstOrDefault(p => p.Name == defaultTypePropertyName); + if (variantTagProperty == null) + { + throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultTypePropertyName}' or have the '{typeof(VariantTagPropertyAttribute).FullName}' attribute on a property"); + } object? variant = Activator.CreateInstance(objType, nonPublic: true); - Dictionary options = attribute.TagType.GetEnumValues() + if (!variantTagProperty.PropertyType.IsEnum) + { + throw new Exception($"Variant tag type must be an enum of all the variant options, not type '{variantTagProperty.PropertyType}'"); + } + Dictionary tagEnumValues = variantTagProperty.PropertyType + .GetEnumValues() .Cast() - .Select(tagEnum => + .ToDictionary( + t => (CandidTag)Enum.GetName(variantTagProperty.PropertyType, t), + t => t + ); + + var optionTypes = new Dictionary(); + foreach(MethodInfo classMethod in objType.GetMethods(BindingFlags.Instance | BindingFlags.Public)) + { + CandidTag tag; + var optionAttribute = classMethod.GetCustomAttribute(); + if (optionAttribute != null) { - string tagName = Enum.GetName(attribute.TagType, tagEnum); - MemberInfo field = attribute.TagType.GetMember(tagName).First(); - var typeAttribute = field.GetCustomAttribute(); - Type? optionType = typeAttribute?.OptionType; - var tagAttribute = field.GetCustomAttribute(); - CandidTag tag = tagAttribute?.Tag ?? CandidTag.FromName(tagName); + tag = optionAttribute.Tag; + } + else if (classMethod.Name.StartsWith("As")) + { + tag = classMethod.Name.Substring(2); + } + else + { + continue; + } + + optionTypes.Add(tag, classMethod.ReturnType); + } + + Dictionary options = tagEnumValues + .Select(t => + { + CandidTag tagName = t.Key; + Enum tagEnum = t.Value; + MemberInfo enumOption = variantTagProperty.PropertyType.GetMember(tagName.Name).First(); + Type? optionType = optionTypes.GetValueOrDefault(tagName); + var tagAttribute = enumOption.GetCustomAttribute(); + CandidTag tag = tagAttribute?.Tag ?? tagName; return (tag, new VariantMapper.Option(tagEnum, optionType)); }) .ToDictionary(k => k.Item1, k => k.Item2); @@ -469,18 +503,6 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a .Distinct() .ToList(); - List properties = objType - .GetProperties(BindingFlags.Instance | BindingFlags.Public) - .ToList(); - - const string defaultTypePropertyName = "Tag"; - PropertyInfo? typeProperty = properties - .FirstOrDefault(p => p.GetCustomAttribute() != null) - ?? properties.FirstOrDefault(p => p.Name == defaultTypePropertyName); - if (typeProperty == null) - { - throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultTypePropertyName}' or have the '{typeof(VariantTagPropertyAttribute).FullName}' attribute on a property"); - } const string defaultValuePropertyName = "Value"; PropertyInfo? valueProperty = properties .FirstOrDefault(p => p.GetCustomAttribute() != null) @@ -505,7 +527,7 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a ); var type = new CandidVariantType(optionCandidTypes); - var mapper = new VariantMapper(type, objType, typeProperty, valueProperty, options); + var mapper = new VariantMapper(type, objType, variantTagProperty, valueProperty, options); return (mapper, type); }); } diff --git a/src/Candid/Mapping/MapperAttributes.cs b/src/Candid/Mapping/MapperAttributes.cs index 0075eb30..26ee82ce 100644 --- a/src/Candid/Mapping/MapperAttributes.cs +++ b/src/Candid/Mapping/MapperAttributes.cs @@ -63,21 +63,6 @@ public class CandidIgnoreAttribute : Attribute [AttributeUsage(AttributeTargets.Class)] public class VariantAttribute : Attribute { - /// - /// The enum type to use for specifying the tags of the variant - /// - public Type TagType { get; } - - /// The enum type to use for specifying the tags of the variant - /// Throws if the type is not an enum - public VariantAttribute(Type enumType) - { - if (!enumType.IsEnum) - { - throw new ArgumentException("Type must be an enum"); - } - this.TagType = enumType; - } } /// @@ -102,18 +87,18 @@ public class VariantValuePropertyAttribute : Attribute /// An attribute to put on an enum option to specify if the tag has an attached /// value in the variant, otherwise the attached type will be null /// - [AttributeUsage(AttributeTargets.Field)] - public class VariantOptionTypeAttribute : Attribute + [AttributeUsage(AttributeTargets.Method)] + public class VariantOptionAttribute : Attribute { /// /// The type of the variant option value to use /// - public Type OptionType { get; } + public CandidTag Tag { get; } - /// The type of the variant option value to use - public VariantOptionTypeAttribute(Type optionType) + /// The tag of the variant option + public VariantOptionAttribute(CandidTag tag) { - this.OptionType = optionType; + this.Tag = tag; } } } diff --git a/src/Candid/Mapping/Mappers/RawCandidMapper.cs b/src/Candid/Mapping/Mappers/RawCandidMapper.cs new file mode 100644 index 00000000..370ad56e --- /dev/null +++ b/src/Candid/Mapping/Mappers/RawCandidMapper.cs @@ -0,0 +1,34 @@ +using EdjCase.ICP.Candid.Models.Types; +using EdjCase.ICP.Candid.Models.Values; +using EdjCase.ICP.Candid.Models; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Linq; + +namespace EdjCase.ICP.Candid.Mapping.Mappers +{ + internal class RawCandidMapper : ICandidValueMapper + { + public CandidType CandidType { get; set; } + public RawCandidMapper(CandidType candidType) + { + this.CandidType = candidType; + } + + public object Map(CandidValue value, CandidConverter converter) + { + return value; + } + + public CandidValue Map(object obj, CandidConverter converter) + { + return (CandidValue)obj; + } + + public CandidType? GetMappedCandidType(Type type) + { + return this.CandidType; + } + } +} diff --git a/src/Candid/Mapping/Mappers/SimpleVariantMapper.cs b/src/Candid/Mapping/Mappers/SimpleVariantMapper.cs deleted file mode 100644 index 528c7a17..00000000 --- a/src/Candid/Mapping/Mappers/SimpleVariantMapper.cs +++ /dev/null @@ -1,86 +0,0 @@ -using EdjCase.ICP.Candid.Models.Types; -using EdjCase.ICP.Candid.Models.Values; -using EdjCase.ICP.Candid.Models; -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Linq; - -namespace EdjCase.ICP.Candid.Mapping.Mappers -{ - internal class SimpleVariantMapper : ICandidValueMapper - { - public CandidType CandidType { get; } - public Dictionary Options { get; } - - public SimpleVariantMapper( - CandidVariantType candidType, - Dictionary options - ) - { - this.CandidType = candidType ?? throw new ArgumentNullException(nameof(candidType)); - this.Options = options; - } - - public object Map(CandidValue value, CandidConverter converter) - { - CandidVariant variant = value.AsVariant(); - - if (!this.Options.TryGetValue(variant.Tag, out Option optionInfo)) - { - throw new Exception($"Could not map candid variant. Type is missing option '{variant.Tag}'"); - } - - - object? variantValue; - if (optionInfo.Type != null) - { - variantValue = converter.ToObject(optionInfo.Type, variant.Value); - } - else - { - variantValue = null; - } - return new SimpleVariant(optionInfo.Name, variantValue); - } - - public CandidValue Map(object obj, CandidConverter converter) - { - SimpleVariant variant = (SimpleVariant)obj; - - if (!this.Options.TryGetValue(variant.Tag, out Option optionInfo)) - { - throw new Exception($"Could not map a candid variant. Variant is missing option '{variant.Tag}'"); - } - - - CandidValue innerValue; - if (optionInfo.Type != null) - { - innerValue = converter.FromObject(variant.Value!); - } - else - { - innerValue = CandidValue.Null(); - } - return new CandidVariant(variant.Tag, innerValue); - } - - public CandidType? GetMappedCandidType(Type type) - { - return this.CandidType; - } - - public class Option - { - public string Name { get; } - public Type? Type { get; } - - public Option(string name, Type? type) - { - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - this.Type = type; - } - } - } -} diff --git a/src/Candid/Models/SimpleVariant.cs b/src/Candid/Models/SimpleVariant.cs deleted file mode 100644 index 9b8ecb2e..00000000 --- a/src/Candid/Models/SimpleVariant.cs +++ /dev/null @@ -1,41 +0,0 @@ -using EdjCase.ICP.Candid.Models; -using System; -using System.Collections.Generic; -using System.Text; - -namespace EdjCase.ICP.Candid.Models -{ - /// - /// A simple representation of a variant - /// - public class SimpleVariant - { - /// - /// The variant option name - /// - public string Tag { get; } - - /// - /// The variant option value - /// - public object? Value { get; } - - /// The variant option name - /// The variant option value - public SimpleVariant(string tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - /// - /// Helper function to cast and get value as a type, if value is unset, will return default(T) - /// - /// Type to cast value to - /// Option value - public T? GetValueOrDefault() - { - return this.Value == null ? default : (T)this.Value; - } - } -} diff --git a/src/ClientGenerator/ClientCodeGenerator.cs b/src/ClientGenerator/ClientCodeGenerator.cs index d489a889..e8cb848d 100644 --- a/src/ClientGenerator/ClientCodeGenerator.cs +++ b/src/ClientGenerator/ClientCodeGenerator.cs @@ -272,19 +272,6 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidVariantType va: { - TypeRepresentation rep = typeOptions?.Representation ?? TypeRepresentation.TypedVariant; - bool typed; - switch (rep) - { - case TypeRepresentation.TypedVariant: - typed = true; - break; - case TypeRepresentation.SimpleVariant: - typed = false; - break; - default: - throw new Exception($"Variant types do not support representation: '{rep}'"); - } List<(ResolvedName Key, SourceCodeType? Type)> fields = va.Options .Select(f => { @@ -297,7 +284,7 @@ private static SourceCodeType ResolveSourceCodeType( return (optionName, sourceCodeType); }) .ToList(); - return new VariantSourceCodeType(fields, typed); + return new VariantSourceCodeType(fields); } default: throw new NotImplementedException(); diff --git a/src/ClientGenerator/ClientGenerationOptions.cs b/src/ClientGenerator/ClientGenerationOptions.cs index 31ef82e1..761b1144 100644 --- a/src/ClientGenerator/ClientGenerationOptions.cs +++ b/src/ClientGenerator/ClientGenerationOptions.cs @@ -185,8 +185,6 @@ public enum TypeRepresentation /// /// Dictionary /// - Dictionary, - TypedVariant, - SimpleVariant + Dictionary } } diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index 83621533..cb8c9ba1 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -160,17 +160,12 @@ private ResolvedType ResolveTypeInner( case VariantSourceCodeType v: { TypeName variantName = this.BuildType(nameContext, parentType); - (ClassDeclarationSyntax? ClassSyntax, EnumDeclarationSyntax EnumSyntax)? result = this.GenerateVariant(variantName, v, parentType); - if (result == null) + (ClassDeclarationSyntax? ClassSyntax, EnumDeclarationSyntax EnumSyntax) result = this.GenerateVariant(variantName, v, parentType); + if (result.ClassSyntax != null) { - // If null, then its a simple variant - return new ResolvedType(SimpleTypeName.FromType()); + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.ClassSyntax, result.EnumSyntax }); } - if (result.Value.ClassSyntax != null) - { - return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.Value.ClassSyntax, result.Value.EnumSyntax }); - } - return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.Value.EnumSyntax }); + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.EnumSyntax }); } case RecordSourceCodeType r: { @@ -233,7 +228,7 @@ public ClassDeclarationSyntax GenerateClient( } - internal (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type)? GenerateVariant( + internal (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type) GenerateVariant( TypeName variantTypeName, VariantSourceCodeType variant, TypeName? parentType @@ -261,11 +256,7 @@ public ClassDeclarationSyntax GenerateClient( .Select(ResolveOption) .ToList(); - if (variant.Typed) - { - return this.GenerateTypedVariant(variant, variantTypeName, parentType, resolvedOptions); - } - return null; + return this.GenerateTypedVariant(variant, variantTypeName, parentType, resolvedOptions); } @@ -355,8 +346,8 @@ public ClassDeclarationSyntax GenerateClient( List attributes = new() { - // [Variant(typeof({enumType})] - this.GenerateAttribute(AttributeInfo.FromType(enumTypeName)) + // [Variant] + this.GenerateAttribute(AttributeInfo.FromType()) }; ClassDeclarationSyntax classSyntax = this.GenerateClass( name: variantTypeName, @@ -551,6 +542,7 @@ string valueName ) ) ); + return this.GenerateMethod( body: body, access: AccessType.Public, @@ -759,15 +751,6 @@ private EnumDeclarationSyntax GenerateEnum(TypeName enumName, List<(ResolvedName new AttributeInfo(SimpleTypeName.FromType(), v.Name.CandidTag.Name!) )); } - - if (v.Type != null) - { - // [VariantOptionType(typeof({type}))] - attributeList.Add(this.GenerateAttribute( - new AttributeInfo(SimpleTypeName.FromType(), v.Type) - )); - - } return SyntaxFactory // {optionName}, .EnumMemberDeclaration(SyntaxFactory.Identifier(v.Name.Name)) diff --git a/src/ClientGenerator/SourceCodeType.cs b/src/ClientGenerator/SourceCodeType.cs index 10911eb6..e1fe9b30 100644 --- a/src/ClientGenerator/SourceCodeType.cs +++ b/src/ClientGenerator/SourceCodeType.cs @@ -113,13 +113,11 @@ public RecordSourceCodeType(List<(ResolvedName Tag, SourceCodeType Type)> fields internal class VariantSourceCodeType : SourceCodeType { public List<(ResolvedName Tag, SourceCodeType? Type)> Options { get; } - public bool Typed { get; } public override bool IsPredefinedType { get; } = false; - public VariantSourceCodeType(List<(ResolvedName Tag, SourceCodeType? Type)> options, bool typed) + public VariantSourceCodeType(List<(ResolvedName Tag, SourceCodeType? Type)> options) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); - this.Typed = typed; } } diff --git a/test/Candid.Tests/CandidConverterTests.cs b/test/Candid.Tests/CandidConverterTests.cs index c4933c6a..4cac9669 100644 --- a/test/Candid.Tests/CandidConverterTests.cs +++ b/test/Candid.Tests/CandidConverterTests.cs @@ -136,7 +136,7 @@ public void Record_From_Class() - [Variant(typeof(VariantValueClassType))] + [Variant] public class VariantValueClass { [VariantTagProperty] @@ -144,6 +144,15 @@ public class VariantValueClass [VariantValueProperty] public object? Value { get; set; } + + public int AsV3() + { + return (int)this.Value!; + } + public OptionalValue AsV4() + { + return (OptionalValue)this.Value!; + } } public enum VariantValueClassType @@ -151,13 +160,10 @@ public enum VariantValueClassType [CandidName("v1")] V1, [CandidName("v2")] - [VariantOptionType(typeof(string))] V2, [CandidName("v3")] - [VariantOptionType(typeof(int))] V3, [CandidName("v4")] - [VariantOptionType(typeof(OptionalValue))] V4 } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap index ea1050f6..334e66c5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap index ba605c16..3f0ec588 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap index 4c6404c4..34e52ac8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap index 5da894d4..004814b3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap index 01e2ecb0..f07476f8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap index 90baba40..ce4ef123 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap index 411b151e..5a6b4eac 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap index 69abc387..aab98794 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap index f81374fc..c94d34b5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap @@ -210,7 +210,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test.Models public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test.Models public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test.Models public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test.Models public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test.Models public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test.Models public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test.Models public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap index 29e1324d..2990e855 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap @@ -208,7 +208,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test.Models public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test.Models public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test.Models public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test.Models public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test.Models public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test.Models public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test.Models public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap index 25c8b48e..67007143 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap @@ -210,7 +210,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test.Models public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test.Models public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test.Models public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test.Models public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test.Models public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test.Models public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test.Models public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap index 21dd66b2..82654955 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap @@ -208,7 +208,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test.Models public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test.Models public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test.Models public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test.Models public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test.Models public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test.Models public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test.Models public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap index b3bb5ae1..154ea6cf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap @@ -210,7 +210,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap index 2d7dbb65..9e60204e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap @@ -208,7 +208,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap index db622c42..f9968368 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap @@ -210,7 +210,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap index 046b9314..cd38a5ef 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap @@ -208,7 +208,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } From a9fc0fc7dea512d579c1b4abbff54b2d66b4d3fb Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Mon, 25 Sep 2023 13:33:02 -0700 Subject: [PATCH 6/9] Revising Variants z --- src/Candid/API.md | 10 + src/Candid/API.xml | 3 + src/Candid/Mapping/IResolvableTypeInfo.cs | 58 +++++- src/Candid/Mapping/MapperAttributes.cs | 8 +- src/ClientGenerator/RoslynTypeResolver.cs | 231 +++++++++++++++++----- 5 files changed, 254 insertions(+), 56 deletions(-) diff --git a/src/Candid/API.md b/src/Candid/API.md index 29a5fd93..a9e94214 100644 --- a/src/Candid/API.md +++ b/src/Candid/API.md @@ -685,6 +685,7 @@ - [VariantAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantAttribute 'EdjCase.ICP.Candid.Mapping.VariantAttribute') - [VariantOptionAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute') - [#ctor(tag)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-#ctor-EdjCase-ICP-Candid-Models-CandidTag- 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.#ctor(EdjCase.ICP.Candid.Models.CandidTag)') + - [#ctor(tag)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-#ctor-System-String- 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.#ctor(System.String)') - [Tag](#P-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-Tag 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.Tag') - [VariantTagPropertyAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantTagPropertyAttribute 'EdjCase.ICP.Candid.Mapping.VariantTagPropertyAttribute') - [VariantValuePropertyAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantValuePropertyAttribute 'EdjCase.ICP.Candid.Mapping.VariantValuePropertyAttribute') @@ -9214,6 +9215,15 @@ value in the variant, otherwise the attached type will be null | ---- | ---- | ----------- | | tag | [EdjCase.ICP.Candid.Models.CandidTag](#T-EdjCase-ICP-Candid-Models-CandidTag 'EdjCase.ICP.Candid.Models.CandidTag') | The tag of the variant option | + +### #ctor(tag) `constructor` + +##### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| tag | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The tag of the variant option | + ### Tag `property` diff --git a/src/Candid/API.xml b/src/Candid/API.xml index 170e9176..6bef96f2 100644 --- a/src/Candid/API.xml +++ b/src/Candid/API.xml @@ -491,6 +491,9 @@ The tag of the variant option + + The tag of the variant option + A model representing a candid arg. Used as the list of arguments for a function diff --git a/src/Candid/Mapping/IResolvableTypeInfo.cs b/src/Candid/Mapping/IResolvableTypeInfo.cs index e093d436..c5365613 100644 --- a/src/Candid/Mapping/IResolvableTypeInfo.cs +++ b/src/Candid/Mapping/IResolvableTypeInfo.cs @@ -449,13 +449,22 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a { throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultTypePropertyName}' or have the '{typeof(VariantTagPropertyAttribute).FullName}' attribute on a property"); } + const string defaultValuePropertyName = "Value"; + PropertyInfo? valueProperty = properties + .FirstOrDefault(p => p.GetCustomAttribute() != null) + ?? properties.FirstOrDefault(p => p.Name == defaultValuePropertyName); + if (valueProperty == null) + { + throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultValuePropertyName}' or have the '{typeof(VariantValuePropertyAttribute).FullName}' attribute on a property"); + } object? variant = Activator.CreateInstance(objType, nonPublic: true); if (!variantTagProperty.PropertyType.IsEnum) { throw new Exception($"Variant tag type must be an enum of all the variant options, not type '{variantTagProperty.PropertyType}'"); } - Dictionary tagEnumValues = variantTagProperty.PropertyType + Type variantEnumType = variantTagProperty.PropertyType; + Dictionary tagEnumValues = variantEnumType .GetEnumValues() .Cast() .ToDictionary( @@ -474,7 +483,7 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a } else if (classMethod.Name.StartsWith("As")) { - tag = classMethod.Name.Substring(2); + tag = classMethod.Name[2..]; // Remove As prefix } else { @@ -483,6 +492,43 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a optionTypes.Add(tag, classMethod.ReturnType); } + foreach(PropertyInfo property in properties) + { + if(property == variantTagProperty || property == valueProperty) + { + // Skip tag and value properties + continue; + } + CandidTag tag; + var optionAttribute = property.GetCustomAttribute(); + if (optionAttribute != null) + { + // If property has the attribute + tag = optionAttribute.Tag; + } + else if (variantEnumType.IsEnumDefined(property.Name)) + { + // If property is the same name as the enum value + tag = property.Name; + } + else + { + continue; + } + if (!optionTypes.TryGetValue(tag, out Type optionType)) + { + // Add if not already added by a method + optionTypes.Add(tag, property.PropertyType); + } + else + { + if (optionType != property.PropertyType) + { + throw new Exception($"Conflict: Variant '{objType.FullName}' defines a property '{property.Name}' and a method with different types for an option"); + } + // Method and Property, skip adding... + } + } Dictionary options = tagEnumValues .Select(t => @@ -503,14 +549,6 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a .Distinct() .ToList(); - const string defaultValuePropertyName = "Value"; - PropertyInfo? valueProperty = properties - .FirstOrDefault(p => p.GetCustomAttribute() != null) - ?? properties.FirstOrDefault(p => p.Name == defaultValuePropertyName); - if (valueProperty == null) - { - throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultValuePropertyName}' or have the '{typeof(VariantValuePropertyAttribute).FullName}' attribute on a property"); - } return new ComplexTypeInfo(objType, dependencies, (resolvedDependencies) => { Dictionary optionCandidTypes = options diff --git a/src/Candid/Mapping/MapperAttributes.cs b/src/Candid/Mapping/MapperAttributes.cs index 26ee82ce..81a84c38 100644 --- a/src/Candid/Mapping/MapperAttributes.cs +++ b/src/Candid/Mapping/MapperAttributes.cs @@ -87,7 +87,7 @@ public class VariantValuePropertyAttribute : Attribute /// An attribute to put on an enum option to specify if the tag has an attached /// value in the variant, otherwise the attached type will be null /// - [AttributeUsage(AttributeTargets.Method)] + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)] public class VariantOptionAttribute : Attribute { /// @@ -100,5 +100,11 @@ public VariantOptionAttribute(CandidTag tag) { this.Tag = tag; } + + /// The tag of the variant option + public VariantOptionAttribute(string tag) : this(CandidTag.FromName(tag)) + { + + } } } diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index cb8c9ba1..bdf49d5b 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -256,17 +256,6 @@ public ClassDeclarationSyntax GenerateClient( .Select(ResolveOption) .ToList(); - return this.GenerateTypedVariant(variant, variantTypeName, parentType, resolvedOptions); - } - - - private (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type) GenerateTypedVariant( - VariantSourceCodeType variant, - TypeName variantTypeName, - TypeName? parentType, - List<(ResolvedName Name, ResolvedType? Type)> resolvedOptions - ) - { List<(ResolvedName Name, TypeName? Type)> enumOptions = resolvedOptions .Select(o => (o.Name, o.Type?.Name)) .ToList(); @@ -283,25 +272,6 @@ public ClassDeclarationSyntax GenerateClient( { TypeName enumTypeName = this.BuildType(variantTypeName.BuildName(false) + "Tag", parentType); - - List methods = new(); - - - // Creation methods - // public static {VariantType} {OptionName}({VariantOptionType} value) - // or if there is no type: - // public static {VariantType} {OptionName}() - methods.AddRange( - resolvedOptions - .Select(o => this.GenerateVariantOptionCreationMethod( - variantTypeName, - enumTypeName, - o.Name, - o.Type, - "info" - )) - ); - // TODO auto change the property values of all class types if it matches the name bool containsClashingTag = variantTypeName.BuildName(false) == "Tag" || variant.Options.Any(o => o.Tag.Name == "Tag"); @@ -311,21 +281,6 @@ public ClassDeclarationSyntax GenerateClient( || variant.Options.Any(o => o.Tag.Name == "Value"); string valueName = containsClashingValue ? "Value_" : "Value"; - // 'As{X}' methods (if has option type) - methods.AddRange( - resolvedOptions - .Where(r => r.Type != null) - .Select(o => this.GenerateVariantOptionAsMethod(enumTypeName, o.Name, o.Type!, valueName)) - ); - - - bool anyOptionsWithType = resolvedOptions.Any(o => o.Type != null); - if (anyOptionsWithType) - { - // If there are any types, then create the helper method 'ValidateType' that - // they all use - methods.Add(this.GenerateVariantValidateTypeMethod(enumTypeName, tagName)); - } List properties = new() { new ClassProperty( @@ -343,6 +298,31 @@ public ClassDeclarationSyntax GenerateClient( AttributeInfo.FromType() ) }; + List methods; + List? customProperties; + if (false) // TODO + { + methods = this.GenerateVariantMethods( + variantTypeName, + enumTypeName, + valueName, + tagName, + resolvedOptions + ); + customProperties = null; + } + else + { + methods = new List(); + + customProperties = this.GenerateVariantProperties( + variantTypeName, + enumTypeName, + valueName, + tagName, + resolvedOptions + ); + } List attributes = new() { @@ -353,6 +333,7 @@ public ClassDeclarationSyntax GenerateClient( name: variantTypeName, properties: properties, optionalProperties: null, + customProperties: customProperties, methods: methods, attributes: attributes, emptyConstructorAccess: AccessType.Protected, @@ -365,6 +346,160 @@ public ClassDeclarationSyntax GenerateClient( } } + private List GenerateVariantProperties( + TypeName variantTypeName, + TypeName enumTypeName, + string valueName, + string tagName, + List<(ResolvedName Name, ResolvedType? Type)> resolvedOptions + ) + { + // Properties with types + // public {OptionType}? {OptionName} { + // get => this.Tag == {EnumName}.{OptionName} ? ({OptionType})this.Value : default; + // set => (this.Tag, this.Value) = ({EnumName}.{OptionName}, value); + // } + return resolvedOptions + .Where(o => o.Type != null) + .Select(o => + { + List accessors = new() + { + // Add getter + SyntaxFactory + .AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) + .WithExpressionBody(SyntaxFactory.ArrowExpressionClause( + SyntaxFactory.ConditionalExpression( + // this.Tag == {EnumName}.{OptionName} + SyntaxFactory.BinaryExpression( + SyntaxKind.EqualsExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(tagName) + ), + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + enumTypeName.ToTypeSyntax(), + SyntaxFactory.IdentifierName(o.Name.Name) + ) + ), + // ({OptionType}) this.Value + SyntaxFactory.CastExpression( + o.Type!.Name.ToTypeSyntax(), + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(valueName) + ) + ), + // default + SyntaxFactory.LiteralExpression( + SyntaxKind.DefaultLiteralExpression, + SyntaxFactory.Token(SyntaxKind.DefaultKeyword) + ) + ) + )), + // Add setter + SyntaxFactory + .AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) + .WithExpressionBody(SyntaxFactory.ArrowExpressionClause( + SyntaxFactory.AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + SyntaxFactory.TupleExpression( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[]{ + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(tagName) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(valueName) + ) + ) + } + ) + ), + SyntaxFactory.TupleExpression( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[]{ + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + enumTypeName.ToTypeSyntax(), + SyntaxFactory.IdentifierName(o.Name.Name) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName("value") + ) + } + ) + ) + ) + )) + }; + return SyntaxFactory.PropertyDeclaration( + o.Type!.Name.ToTypeSyntax(), + o.Name.Name + ) + .WithAccessorList(SyntaxFactory.AccessorList( + SyntaxFactory.List(accessors) + )); + }) + .ToList(); + + } + + private List GenerateVariantMethods( + TypeName variantTypeName, + TypeName enumTypeName, + string valueName, + string tagName, + List<(ResolvedName Name, ResolvedType? Type)> resolvedOptions + ) + { + // Creation methods + // public static {VariantType} {OptionName}({VariantOptionType} value) + // or if there is no type: + // public static {VariantType} {OptionName}() + List methods = resolvedOptions + .Select(o => this.GenerateVariantOptionCreationMethod( + variantTypeName, + enumTypeName, + o.Name, + o.Type, + "info" + )) + .ToList(); + + + // 'As{X}' methods (if has option type) + methods.AddRange( + resolvedOptions + .Where(r => r.Type != null) + .Select(o => this.GenerateVariantOptionAsMethod(enumTypeName, o.Name, o.Type!, valueName)) + ); + + + bool anyOptionsWithType = resolvedOptions.Any(o => o.Type != null); + if (anyOptionsWithType) + { + // If there are any types, then create the helper method 'ValidateType' that + // they all use + methods.Add(this.GenerateVariantValidateTypeMethod(enumTypeName, tagName)); + } + return methods; + } + private TypeName BuildType(string name, TypeName? parentType) { string @namespace; @@ -1413,6 +1548,7 @@ private ClassDeclarationSyntax GenerateClass( List properties, List? optionalProperties = null, List? methods = null, + List? customProperties = null, List? implementTypes = null, List? attributes = null, AccessType? emptyConstructorAccess = null, @@ -1451,11 +1587,16 @@ ClassProperty FixDuplicates(ClassProperty property) .Concat(optionalProperties ?? new List()) .Select(this.GenerateProperty) .Where(p => p != null)!; + if (customProperties != null) + { + properySyntaxList = properySyntaxList.Concat(customProperties); + } if (properties.Any()) { // Only create constructor if there are properties constructors.Add(this.GenerateConstructor(name, AccessType.Public, properties, optionalProperties)); } + if (emptyConstructorAccess != null) { // Empty Constrcutor for reflection From 66f88772e5cc40659de9f3b0132283b1944be015 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Mon, 25 Sep 2023 13:42:12 -0700 Subject: [PATCH 7/9] Adding getter/setter for variants --- .../Dex/Models/CancelOrderReceipt.cs | 35 +--- .../Dex/Models/DepositReceipt.cs | 35 +--- .../Dex/Models/OrderPlacementReceipt.cs | 35 +--- .../Dex/Models/WithdrawReceipt.cs | 35 +--- .../Sample.Shared/Governance/Models/Action.cs | 160 ++---------------- samples/Sample.Shared/Governance/Models/By.cs | 48 +----- .../Sample.Shared/Governance/Models/Change.cs | 35 +--- .../Governance/Models/Command.cs | 149 ++-------------- .../Governance/Models/Command1.cs | 160 ++---------------- .../Governance/Models/Command2.cs | 116 ++----------- .../Governance/Models/DissolveState.cs | 35 +--- .../Governance/Models/NeuronIdOrSubaccount.cs | 35 +--- .../Governance/Models/Operation.cs | 116 ++----------- .../Governance/Models/Progress.cs | 22 +-- .../Sample.Shared/Governance/Models/Result.cs | 27 +-- .../Governance/Models/Result1.cs | 35 +--- .../Governance/Models/Result2.cs | 35 +--- .../Governance/Models/Result3.cs | 35 +--- .../Governance/Models/Result4.cs | 35 +--- .../Governance/Models/Result5.cs | 35 +--- .../Governance/Models/Result6.cs | 35 +--- .../Governance/Models/Result7.cs | 35 +--- .../Governance/Models/RewardMode.cs | 35 +--- .../ICRC1Ledger/Models/ApproveError.cs | 104 ++---------- .../ICRC1Ledger/Models/ApproveResult.cs | 35 +--- .../ICRC1Ledger/Models/ChangeFeeCollector.cs | 27 +-- .../ICRC1Ledger/Models/LedgerArg.cs | 35 +--- .../ICRC1Ledger/Models/MetadataValue.cs | 61 +------ .../ICRC1Ledger/Models/TransferError.cs | 93 ++-------- .../ICRC1Ledger/Models/TransferFromError.cs | 104 ++---------- .../ICRC1Ledger/Models/TransferFromResult.cs | 35 +--- .../ICRC1Ledger/Models/TransferResult.cs | 35 +--- .../Sample.Shared/ICRC1Ledger/Models/Value.cs | 94 ++-------- src/ClientGenerator/RoslynTypeResolver.cs | 18 +- 34 files changed, 231 insertions(+), 1733 deletions(-) diff --git a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs index 816cf2c0..76579c2f 100644 --- a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; -using System; using OrderId = System.UInt32; namespace Sample.Shared.Dex.Models @@ -14,6 +13,10 @@ public class CancelOrderReceipt [VariantValueProperty()] public object? Value { get; set; } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) protected CancelOrderReceipt() { } - - public static CancelOrderReceipt Err(CancelOrderErr info) - { - return new CancelOrderReceipt(CancelOrderReceiptTag.Err, info); - } - - public static CancelOrderReceipt Ok(OrderId info) - { - return new CancelOrderReceipt(CancelOrderReceiptTag.Ok, info); - } - - public CancelOrderErr AsErr() - { - this.ValidateTag(CancelOrderReceiptTag.Err); - return (CancelOrderErr)this.Value!; - } - - public OrderId AsOk() - { - this.ValidateTag(CancelOrderReceiptTag.Ok); - return (OrderId)this.Value!; - } - - private void ValidateTag(CancelOrderReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum CancelOrderReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs index a0aea27f..b9857b86 100644 --- a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { @@ -14,6 +13,10 @@ public class DepositReceipt [VariantValueProperty()] public object? Value { get; set; } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public DepositReceipt(DepositReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public DepositReceipt(DepositReceiptTag tag, object? value) protected DepositReceipt() { } - - public static DepositReceipt Err(DepositErr info) - { - return new DepositReceipt(DepositReceiptTag.Err, info); - } - - public static DepositReceipt Ok(UnboundedUInt info) - { - return new DepositReceipt(DepositReceiptTag.Ok, info); - } - - public DepositErr AsErr() - { - this.ValidateTag(DepositReceiptTag.Err); - return (DepositErr)this.Value!; - } - - public UnboundedUInt AsOk() - { - this.ValidateTag(DepositReceiptTag.Ok); - return (UnboundedUInt)this.Value!; - } - - private void ValidateTag(DepositReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum DepositReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs index bba0c9ac..67d197bb 100644 --- a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { @@ -14,6 +13,10 @@ public class OrderPlacementReceipt [VariantValueProperty()] public object? Value { get; set; } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) protected OrderPlacementReceipt() { } - - public static OrderPlacementReceipt Err(OrderPlacementErr info) - { - return new OrderPlacementReceipt(OrderPlacementReceiptTag.Err, info); - } - - public static OrderPlacementReceipt Ok(OptionalValue info) - { - return new OrderPlacementReceipt(OrderPlacementReceiptTag.Ok, info); - } - - public OrderPlacementErr AsErr() - { - this.ValidateTag(OrderPlacementReceiptTag.Err); - return (OrderPlacementErr)this.Value!; - } - - public OptionalValue AsOk() - { - this.ValidateTag(OrderPlacementReceiptTag.Ok); - return (OptionalValue)this.Value!; - } - - private void ValidateTag(OrderPlacementReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum OrderPlacementReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs index 775d4e78..43d01546 100644 --- a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { @@ -14,6 +13,10 @@ public class WithdrawReceipt [VariantValueProperty()] public object? Value { get; set; } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public WithdrawReceipt(WithdrawReceiptTag tag, object? value) protected WithdrawReceipt() { } - - public static WithdrawReceipt Err(WithdrawErr info) - { - return new WithdrawReceipt(WithdrawReceiptTag.Err, info); - } - - public static WithdrawReceipt Ok(UnboundedUInt info) - { - return new WithdrawReceipt(WithdrawReceiptTag.Ok, info); - } - - public WithdrawErr AsErr() - { - this.ValidateTag(WithdrawReceiptTag.Err); - return (WithdrawErr)this.Value!; - } - - public UnboundedUInt AsOk() - { - this.ValidateTag(WithdrawReceiptTag.Ok); - return (UnboundedUInt)this.Value!; - } - - private void ValidateTag(WithdrawReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum WithdrawReceiptTag diff --git a/samples/Sample.Shared/Governance/Models/Action.cs b/samples/Sample.Shared/Governance/Models/Action.cs index f6c1d09c..ca7bc017 100644 --- a/samples/Sample.Shared/Governance/Models/Action.cs +++ b/samples/Sample.Shared/Governance/Models/Action.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,165 +12,40 @@ public class Action [VariantValueProperty()] public object? Value { get; set; } - public Action(ActionTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected Action() - { - } - - public static Action RegisterNeuron(KnownNeuron info) - { - return new Action(ActionTag.RegisterNeuron, info); - } - - public static Action ManageNeuron(ManageNeuron info) - { - return new Action(ActionTag.ManageNeuron, info); - } - - public static Action CreateServiceNervousSystem(CreateServiceNervousSystem info) - { - return new Action(ActionTag.CreateServiceNervousSystem, info); - } - - public static Action ExecuteNnsFunction(ExecuteNnsFunction info) - { - return new Action(ActionTag.ExecuteNnsFunction, info); - } - - public static Action RewardNodeProvider(RewardNodeProvider info) - { - return new Action(ActionTag.RewardNodeProvider, info); - } - - public static Action OpenSnsTokenSwap(OpenSnsTokenSwap info) - { - return new Action(ActionTag.OpenSnsTokenSwap, info); - } - - public static Action SetSnsTokenSwapOpenTimeWindow(SetSnsTokenSwapOpenTimeWindow info) - { - return new Action(ActionTag.SetSnsTokenSwapOpenTimeWindow, info); - } - - public static Action SetDefaultFollowees(SetDefaultFollowees info) - { - return new Action(ActionTag.SetDefaultFollowees, info); - } - - public static Action RewardNodeProviders(RewardNodeProviders info) - { - return new Action(ActionTag.RewardNodeProviders, info); - } - - public static Action ManageNetworkEconomics(NetworkEconomics info) - { - return new Action(ActionTag.ManageNetworkEconomics, info); - } + public KnownNeuron? RegisterNeuron { get => this.Tag == ActionTag.RegisterNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterNeuron, value); } - public static Action ApproveGenesisKyc(ApproveGenesisKyc info) - { - return new Action(ActionTag.ApproveGenesisKyc, info); - } + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public static Action AddOrRemoveNodeProvider(AddOrRemoveNodeProvider info) - { - return new Action(ActionTag.AddOrRemoveNodeProvider, info); - } + public CreateServiceNervousSystem? CreateServiceNervousSystem { get => this.Tag == ActionTag.CreateServiceNervousSystem ? (CreateServiceNervousSystem)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.CreateServiceNervousSystem, value); } - public static Action Motion(Motion info) - { - return new Action(ActionTag.Motion, info); - } + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public KnownNeuron AsRegisterNeuron() - { - this.ValidateTag(ActionTag.RegisterNeuron); - return (KnownNeuron)this.Value!; - } + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public ManageNeuron AsManageNeuron() - { - this.ValidateTag(ActionTag.ManageNeuron); - return (ManageNeuron)this.Value!; - } - - public CreateServiceNervousSystem AsCreateServiceNervousSystem() - { - this.ValidateTag(ActionTag.CreateServiceNervousSystem); - return (CreateServiceNervousSystem)this.Value!; - } - - public ExecuteNnsFunction AsExecuteNnsFunction() - { - this.ValidateTag(ActionTag.ExecuteNnsFunction); - return (ExecuteNnsFunction)this.Value!; - } - - public RewardNodeProvider AsRewardNodeProvider() - { - this.ValidateTag(ActionTag.RewardNodeProvider); - return (RewardNodeProvider)this.Value!; - } + public OpenSnsTokenSwap? OpenSnsTokenSwap { get => this.Tag == ActionTag.OpenSnsTokenSwap ? (OpenSnsTokenSwap)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.OpenSnsTokenSwap, value); } - public OpenSnsTokenSwap AsOpenSnsTokenSwap() - { - this.ValidateTag(ActionTag.OpenSnsTokenSwap); - return (OpenSnsTokenSwap)this.Value!; - } + public SetSnsTokenSwapOpenTimeWindow? SetSnsTokenSwapOpenTimeWindow { get => this.Tag == ActionTag.SetSnsTokenSwapOpenTimeWindow ? (SetSnsTokenSwapOpenTimeWindow)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetSnsTokenSwapOpenTimeWindow, value); } - public SetSnsTokenSwapOpenTimeWindow AsSetSnsTokenSwapOpenTimeWindow() - { - this.ValidateTag(ActionTag.SetSnsTokenSwapOpenTimeWindow); - return (SetSnsTokenSwapOpenTimeWindow)this.Value!; - } + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public SetDefaultFollowees AsSetDefaultFollowees() - { - this.ValidateTag(ActionTag.SetDefaultFollowees); - return (SetDefaultFollowees)this.Value!; - } + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public RewardNodeProviders AsRewardNodeProviders() - { - this.ValidateTag(ActionTag.RewardNodeProviders); - return (RewardNodeProviders)this.Value!; - } + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public NetworkEconomics AsManageNetworkEconomics() - { - this.ValidateTag(ActionTag.ManageNetworkEconomics); - return (NetworkEconomics)this.Value!; - } + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public ApproveGenesisKyc AsApproveGenesisKyc() - { - this.ValidateTag(ActionTag.ApproveGenesisKyc); - return (ApproveGenesisKyc)this.Value!; - } + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public AddOrRemoveNodeProvider AsAddOrRemoveNodeProvider() - { - this.ValidateTag(ActionTag.AddOrRemoveNodeProvider); - return (AddOrRemoveNodeProvider)this.Value!; - } + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } - public Motion AsMotion() + public Action(ActionTag tag, object? value) { - this.ValidateTag(ActionTag.Motion); - return (Motion)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(ActionTag tag) + protected Action() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } } diff --git a/samples/Sample.Shared/Governance/Models/By.cs b/samples/Sample.Shared/Governance/Models/By.cs index 07345192..76cca6d5 100644 --- a/samples/Sample.Shared/Governance/Models/By.cs +++ b/samples/Sample.Shared/Governance/Models/By.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,12 @@ public class By [VariantValueProperty()] public object? Value { get; set; } + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public By(ByTag tag, object? value) { this.Tag = tag; @@ -23,47 +28,6 @@ protected By() { } - public static By NeuronIdOrSubaccount(By.NeuronIdOrSubaccountInfo info) - { - return new By(ByTag.NeuronIdOrSubaccount, info); - } - - public static By MemoAndController(ClaimOrRefreshNeuronFromAccount info) - { - return new By(ByTag.MemoAndController, info); - } - - public static By Memo(ulong info) - { - return new By(ByTag.Memo, info); - } - - public By.NeuronIdOrSubaccountInfo AsNeuronIdOrSubaccount() - { - this.ValidateTag(ByTag.NeuronIdOrSubaccount); - return (By.NeuronIdOrSubaccountInfo)this.Value!; - } - - public ClaimOrRefreshNeuronFromAccount AsMemoAndController() - { - this.ValidateTag(ByTag.MemoAndController); - return (ClaimOrRefreshNeuronFromAccount)this.Value!; - } - - public ulong AsMemo() - { - this.ValidateTag(ByTag.Memo); - return (ulong)this.Value!; - } - - private void ValidateTag(ByTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } - public class NeuronIdOrSubaccountInfo { public NeuronIdOrSubaccountInfo() diff --git a/samples/Sample.Shared/Governance/Models/Change.cs b/samples/Sample.Shared/Governance/Models/Change.cs index 563b885d..649b8e6e 100644 --- a/samples/Sample.Shared/Governance/Models/Change.cs +++ b/samples/Sample.Shared/Governance/Models/Change.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Change [VariantValueProperty()] public object? Value { get; set; } + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public Change(ChangeTag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Change(ChangeTag tag, object? value) protected Change() { } - - public static Change ToRemove(NodeProvider info) - { - return new Change(ChangeTag.ToRemove, info); - } - - public static Change ToAdd(NodeProvider info) - { - return new Change(ChangeTag.ToAdd, info); - } - - public NodeProvider AsToRemove() - { - this.ValidateTag(ChangeTag.ToRemove); - return (NodeProvider)this.Value!; - } - - public NodeProvider AsToAdd() - { - this.ValidateTag(ChangeTag.ToAdd); - return (NodeProvider)this.Value!; - } - - private void ValidateTag(ChangeTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum ChangeTag diff --git a/samples/Sample.Shared/Governance/Models/Command.cs b/samples/Sample.Shared/Governance/Models/Command.cs index 6ecab138..cefb4f2d 100644 --- a/samples/Sample.Shared/Governance/Models/Command.cs +++ b/samples/Sample.Shared/Governance/Models/Command.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,154 +12,38 @@ public class Command [VariantValueProperty()] public object? Value { get; set; } - public Command(CommandTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected Command() - { - } + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public static Command Spawn(Spawn info) - { - return new Command(CommandTag.Spawn, info); - } + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public static Command Split(Split info) - { - return new Command(CommandTag.Split, info); - } + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public static Command Follow(Follow info) - { - return new Command(CommandTag.Follow, info); - } - - public static Command ClaimOrRefresh(ClaimOrRefresh info) - { - return new Command(CommandTag.ClaimOrRefresh, info); - } + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public static Command Configure(Configure info) - { - return new Command(CommandTag.Configure, info); - } + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public static Command RegisterVote(RegisterVote info) - { - return new Command(CommandTag.RegisterVote, info); - } + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public static Command Merge(Merge info) - { - return new Command(CommandTag.Merge, info); - } + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public static Command DisburseToNeuron(DisburseToNeuron info) - { - return new Command(CommandTag.DisburseToNeuron, info); - } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public static Command MakeProposal(Proposal info) - { - return new Command(CommandTag.MakeProposal, info); - } + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public static Command StakeMaturity(StakeMaturity info) - { - return new Command(CommandTag.StakeMaturity, info); - } + public StakeMaturity? StakeMaturity { get => this.Tag == CommandTag.StakeMaturity ? (StakeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.StakeMaturity, value); } - public static Command MergeMaturity(MergeMaturity info) - { - return new Command(CommandTag.MergeMaturity, info); - } + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public static Command Disburse(Disburse info) - { - return new Command(CommandTag.Disburse, info); - } + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } - public Spawn AsSpawn() - { - this.ValidateTag(CommandTag.Spawn); - return (Spawn)this.Value!; - } - - public Split AsSplit() - { - this.ValidateTag(CommandTag.Split); - return (Split)this.Value!; - } - - public Follow AsFollow() - { - this.ValidateTag(CommandTag.Follow); - return (Follow)this.Value!; - } - - public ClaimOrRefresh AsClaimOrRefresh() - { - this.ValidateTag(CommandTag.ClaimOrRefresh); - return (ClaimOrRefresh)this.Value!; - } - - public Configure AsConfigure() - { - this.ValidateTag(CommandTag.Configure); - return (Configure)this.Value!; - } - - public RegisterVote AsRegisterVote() - { - this.ValidateTag(CommandTag.RegisterVote); - return (RegisterVote)this.Value!; - } - - public Merge AsMerge() - { - this.ValidateTag(CommandTag.Merge); - return (Merge)this.Value!; - } - - public DisburseToNeuron AsDisburseToNeuron() - { - this.ValidateTag(CommandTag.DisburseToNeuron); - return (DisburseToNeuron)this.Value!; - } - - public Proposal AsMakeProposal() - { - this.ValidateTag(CommandTag.MakeProposal); - return (Proposal)this.Value!; - } - - public StakeMaturity AsStakeMaturity() - { - this.ValidateTag(CommandTag.StakeMaturity); - return (StakeMaturity)this.Value!; - } - - public MergeMaturity AsMergeMaturity() - { - this.ValidateTag(CommandTag.MergeMaturity); - return (MergeMaturity)this.Value!; - } - - public Disburse AsDisburse() + public Command(CommandTag tag, object? value) { - this.ValidateTag(CommandTag.Disburse); - return (Disburse)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(CommandTag tag) + protected Command() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } } diff --git a/samples/Sample.Shared/Governance/Models/Command1.cs b/samples/Sample.Shared/Governance/Models/Command1.cs index 4b974821..cc6fc372 100644 --- a/samples/Sample.Shared/Governance/Models/Command1.cs +++ b/samples/Sample.Shared/Governance/Models/Command1.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,165 +12,40 @@ public class Command1 [VariantValueProperty()] public object? Value { get; set; } - public Command1(Command1Tag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected Command1() - { - } - - public static Command1 Error(GovernanceError info) - { - return new Command1(Command1Tag.Error, info); - } - - public static Command1 Spawn(SpawnResponse info) - { - return new Command1(Command1Tag.Spawn, info); - } - - public static Command1 Split(SpawnResponse info) - { - return new Command1(Command1Tag.Split, info); - } - - public static Command1 Follow(Command1.FollowInfo info) - { - return new Command1(Command1Tag.Follow, info); - } - - public static Command1 ClaimOrRefresh(ClaimOrRefreshResponse info) - { - return new Command1(Command1Tag.ClaimOrRefresh, info); - } - - public static Command1 Configure(Command1.ConfigureInfo info) - { - return new Command1(Command1Tag.Configure, info); - } - - public static Command1 RegisterVote(Command1.RegisterVoteInfo info) - { - return new Command1(Command1Tag.RegisterVote, info); - } - - public static Command1 Merge(MergeResponse info) - { - return new Command1(Command1Tag.Merge, info); - } - - public static Command1 DisburseToNeuron(SpawnResponse info) - { - return new Command1(Command1Tag.DisburseToNeuron, info); - } - - public static Command1 MakeProposal(MakeProposalResponse info) - { - return new Command1(Command1Tag.MakeProposal, info); - } + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } - public static Command1 StakeMaturity(StakeMaturityResponse info) - { - return new Command1(Command1Tag.StakeMaturity, info); - } + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } - public static Command1 MergeMaturity(MergeMaturityResponse info) - { - return new Command1(Command1Tag.MergeMaturity, info); - } + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } - public static Command1 Disburse(DisburseResponse info) - { - return new Command1(Command1Tag.Disburse, info); - } + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } - public GovernanceError AsError() - { - this.ValidateTag(Command1Tag.Error); - return (GovernanceError)this.Value!; - } + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } - public SpawnResponse AsSpawn() - { - this.ValidateTag(Command1Tag.Spawn); - return (SpawnResponse)this.Value!; - } + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } - public SpawnResponse AsSplit() - { - this.ValidateTag(Command1Tag.Split); - return (SpawnResponse)this.Value!; - } + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } - public Command1.FollowInfo AsFollow() - { - this.ValidateTag(Command1Tag.Follow); - return (Command1.FollowInfo)this.Value!; - } + public MergeResponse? Merge { get => this.Tag == Command1Tag.Merge ? (MergeResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } - public ClaimOrRefreshResponse AsClaimOrRefresh() - { - this.ValidateTag(Command1Tag.ClaimOrRefresh); - return (ClaimOrRefreshResponse)this.Value!; - } + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } - public Command1.ConfigureInfo AsConfigure() - { - this.ValidateTag(Command1Tag.Configure); - return (Command1.ConfigureInfo)this.Value!; - } + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } - public Command1.RegisterVoteInfo AsRegisterVote() - { - this.ValidateTag(Command1Tag.RegisterVote); - return (Command1.RegisterVoteInfo)this.Value!; - } + public StakeMaturityResponse? StakeMaturity { get => this.Tag == Command1Tag.StakeMaturity ? (StakeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.StakeMaturity, value); } - public MergeResponse AsMerge() - { - this.ValidateTag(Command1Tag.Merge); - return (MergeResponse)this.Value!; - } - - public SpawnResponse AsDisburseToNeuron() - { - this.ValidateTag(Command1Tag.DisburseToNeuron); - return (SpawnResponse)this.Value!; - } + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } - public MakeProposalResponse AsMakeProposal() - { - this.ValidateTag(Command1Tag.MakeProposal); - return (MakeProposalResponse)this.Value!; - } - - public StakeMaturityResponse AsStakeMaturity() - { - this.ValidateTag(Command1Tag.StakeMaturity); - return (StakeMaturityResponse)this.Value!; - } + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } - public MergeMaturityResponse AsMergeMaturity() - { - this.ValidateTag(Command1Tag.MergeMaturity); - return (MergeMaturityResponse)this.Value!; - } - - public DisburseResponse AsDisburse() + public Command1(Command1Tag tag, object? value) { - this.ValidateTag(Command1Tag.Disburse); - return (DisburseResponse)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(Command1Tag tag) + protected Command1() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } public class FollowInfo diff --git a/samples/Sample.Shared/Governance/Models/Command2.cs b/samples/Sample.Shared/Governance/Models/Command2.cs index 43deeefd..d33c44a0 100644 --- a/samples/Sample.Shared/Governance/Models/Command2.cs +++ b/samples/Sample.Shared/Governance/Models/Command2.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,121 +12,32 @@ public class Command2 [VariantValueProperty()] public object? Value { get; set; } - public Command2(Command2Tag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected Command2() - { - } - - public static Command2 Spawn(NeuronId info) - { - return new Command2(Command2Tag.Spawn, info); - } - - public static Command2 Split(Split info) - { - return new Command2(Command2Tag.Split, info); - } - - public static Command2 Configure(Configure info) - { - return new Command2(Command2Tag.Configure, info); - } - - public static Command2 Merge(Merge info) - { - return new Command2(Command2Tag.Merge, info); - } - - public static Command2 DisburseToNeuron(DisburseToNeuron info) - { - return new Command2(Command2Tag.DisburseToNeuron, info); - } - - public static Command2 SyncCommand(Command2.SyncCommandInfo info) - { - return new Command2(Command2Tag.SyncCommand, info); - } - - public static Command2 ClaimOrRefreshNeuron(ClaimOrRefresh info) - { - return new Command2(Command2Tag.ClaimOrRefreshNeuron, info); - } + public NeuronId? Spawn { get => this.Tag == Command2Tag.Spawn ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } - public static Command2 MergeMaturity(MergeMaturity info) - { - return new Command2(Command2Tag.MergeMaturity, info); - } + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } - public static Command2 Disburse(Disburse info) - { - return new Command2(Command2Tag.Disburse, info); - } + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } - public NeuronId AsSpawn() - { - this.ValidateTag(Command2Tag.Spawn); - return (NeuronId)this.Value!; - } + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } - public Split AsSplit() - { - this.ValidateTag(Command2Tag.Split); - return (Split)this.Value!; - } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } - public Configure AsConfigure() - { - this.ValidateTag(Command2Tag.Configure); - return (Configure)this.Value!; - } + public Command2.SyncCommandInfo? SyncCommand { get => this.Tag == Command2Tag.SyncCommand ? (Command2.SyncCommandInfo)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.SyncCommand, value); } - public Merge AsMerge() - { - this.ValidateTag(Command2Tag.Merge); - return (Merge)this.Value!; - } + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } - public DisburseToNeuron AsDisburseToNeuron() - { - this.ValidateTag(Command2Tag.DisburseToNeuron); - return (DisburseToNeuron)this.Value!; - } + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } - public Command2.SyncCommandInfo AsSyncCommand() - { - this.ValidateTag(Command2Tag.SyncCommand); - return (Command2.SyncCommandInfo)this.Value!; - } - - public ClaimOrRefresh AsClaimOrRefreshNeuron() - { - this.ValidateTag(Command2Tag.ClaimOrRefreshNeuron); - return (ClaimOrRefresh)this.Value!; - } - - public MergeMaturity AsMergeMaturity() - { - this.ValidateTag(Command2Tag.MergeMaturity); - return (MergeMaturity)this.Value!; - } + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } - public Disburse AsDisburse() + public Command2(Command2Tag tag, object? value) { - this.ValidateTag(Command2Tag.Disburse); - return (Disburse)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(Command2Tag tag) + protected Command2() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } public class SyncCommandInfo diff --git a/samples/Sample.Shared/Governance/Models/DissolveState.cs b/samples/Sample.Shared/Governance/Models/DissolveState.cs index 96dca45d..d93a67ee 100644 --- a/samples/Sample.Shared/Governance/Models/DissolveState.cs +++ b/samples/Sample.Shared/Governance/Models/DissolveState.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class DissolveState [VariantValueProperty()] public object? Value { get; set; } + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public DissolveState(DissolveStateTag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public DissolveState(DissolveStateTag tag, object? value) protected DissolveState() { } - - public static DissolveState DissolveDelaySeconds(ulong info) - { - return new DissolveState(DissolveStateTag.DissolveDelaySeconds, info); - } - - public static DissolveState WhenDissolvedTimestampSeconds(ulong info) - { - return new DissolveState(DissolveStateTag.WhenDissolvedTimestampSeconds, info); - } - - public ulong AsDissolveDelaySeconds() - { - this.ValidateTag(DissolveStateTag.DissolveDelaySeconds); - return (ulong)this.Value!; - } - - public ulong AsWhenDissolvedTimestampSeconds() - { - this.ValidateTag(DissolveStateTag.WhenDissolvedTimestampSeconds); - return (ulong)this.Value!; - } - - private void ValidateTag(DissolveStateTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum DissolveStateTag diff --git a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs index 4822b6d1..2d81edf0 100644 --- a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs +++ b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; using System.Collections.Generic; -using System; namespace Sample.Shared.Governance.Models { @@ -14,6 +13,10 @@ public class NeuronIdOrSubaccount [VariantValueProperty()] public object? Value { get; set; } + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) protected NeuronIdOrSubaccount() { } - - public static NeuronIdOrSubaccount Subaccount(List info) - { - return new NeuronIdOrSubaccount(NeuronIdOrSubaccountTag.Subaccount, info); - } - - public static NeuronIdOrSubaccount NeuronId(NeuronId info) - { - return new NeuronIdOrSubaccount(NeuronIdOrSubaccountTag.NeuronId, info); - } - - public List AsSubaccount() - { - this.ValidateTag(NeuronIdOrSubaccountTag.Subaccount); - return (List)this.Value!; - } - - public NeuronId AsNeuronId() - { - this.ValidateTag(NeuronIdOrSubaccountTag.NeuronId); - return (NeuronId)this.Value!; - } - - private void ValidateTag(NeuronIdOrSubaccountTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum NeuronIdOrSubaccountTag diff --git a/samples/Sample.Shared/Governance/Models/Operation.cs b/samples/Sample.Shared/Governance/Models/Operation.cs index fc3612bd..30bc5eaa 100644 --- a/samples/Sample.Shared/Governance/Models/Operation.cs +++ b/samples/Sample.Shared/Governance/Models/Operation.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,121 +12,32 @@ public class Operation [VariantValueProperty()] public object? Value { get; set; } - public Operation(OperationTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected Operation() - { - } - - public static Operation RemoveHotKey(RemoveHotKey info) - { - return new Operation(OperationTag.RemoveHotKey, info); - } - - public static Operation AddHotKey(AddHotKey info) - { - return new Operation(OperationTag.AddHotKey, info); - } - - public static Operation ChangeAutoStakeMaturity(ChangeAutoStakeMaturity info) - { - return new Operation(OperationTag.ChangeAutoStakeMaturity, info); - } - - public static Operation StopDissolving(Operation.StopDissolvingInfo info) - { - return new Operation(OperationTag.StopDissolving, info); - } - - public static Operation StartDissolving(Operation.StartDissolvingInfo info) - { - return new Operation(OperationTag.StartDissolving, info); - } - - public static Operation IncreaseDissolveDelay(IncreaseDissolveDelay info) - { - return new Operation(OperationTag.IncreaseDissolveDelay, info); - } - - public static Operation JoinCommunityFund(Operation.JoinCommunityFundInfo info) - { - return new Operation(OperationTag.JoinCommunityFund, info); - } + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public static Operation LeaveCommunityFund(Operation.LeaveCommunityFundInfo info) - { - return new Operation(OperationTag.LeaveCommunityFund, info); - } + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public static Operation SetDissolveTimestamp(SetDissolveTimestamp info) - { - return new Operation(OperationTag.SetDissolveTimestamp, info); - } + public ChangeAutoStakeMaturity? ChangeAutoStakeMaturity { get => this.Tag == OperationTag.ChangeAutoStakeMaturity ? (ChangeAutoStakeMaturity)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.ChangeAutoStakeMaturity, value); } - public RemoveHotKey AsRemoveHotKey() - { - this.ValidateTag(OperationTag.RemoveHotKey); - return (RemoveHotKey)this.Value!; - } + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public AddHotKey AsAddHotKey() - { - this.ValidateTag(OperationTag.AddHotKey); - return (AddHotKey)this.Value!; - } + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public ChangeAutoStakeMaturity AsChangeAutoStakeMaturity() - { - this.ValidateTag(OperationTag.ChangeAutoStakeMaturity); - return (ChangeAutoStakeMaturity)this.Value!; - } + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.StopDissolvingInfo AsStopDissolving() - { - this.ValidateTag(OperationTag.StopDissolving); - return (Operation.StopDissolvingInfo)this.Value!; - } + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public Operation.StartDissolvingInfo AsStartDissolving() - { - this.ValidateTag(OperationTag.StartDissolving); - return (Operation.StartDissolvingInfo)this.Value!; - } + public Operation.LeaveCommunityFundInfo? LeaveCommunityFund { get => this.Tag == OperationTag.LeaveCommunityFund ? (Operation.LeaveCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.LeaveCommunityFund, value); } - public IncreaseDissolveDelay AsIncreaseDissolveDelay() - { - this.ValidateTag(OperationTag.IncreaseDissolveDelay); - return (IncreaseDissolveDelay)this.Value!; - } - - public Operation.JoinCommunityFundInfo AsJoinCommunityFund() - { - this.ValidateTag(OperationTag.JoinCommunityFund); - return (Operation.JoinCommunityFundInfo)this.Value!; - } - - public Operation.LeaveCommunityFundInfo AsLeaveCommunityFund() - { - this.ValidateTag(OperationTag.LeaveCommunityFund); - return (Operation.LeaveCommunityFundInfo)this.Value!; - } + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } - public SetDissolveTimestamp AsSetDissolveTimestamp() + public Operation(OperationTag tag, object? value) { - this.ValidateTag(OperationTag.SetDissolveTimestamp); - return (SetDissolveTimestamp)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(OperationTag tag) + protected Operation() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } public class StopDissolvingInfo diff --git a/samples/Sample.Shared/Governance/Models/Progress.cs b/samples/Sample.Shared/Governance/Models/Progress.cs index d94733f3..0301433a 100644 --- a/samples/Sample.Shared/Governance/Models/Progress.cs +++ b/samples/Sample.Shared/Governance/Models/Progress.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,8 @@ public class Progress [VariantValueProperty()] public object? Value { get; set; } + public NeuronId? LastNeuronId { get => this.Tag == ProgressTag.LastNeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (ProgressTag.LastNeuronId, value); } + public Progress(ProgressTag tag, object? value) { this.Tag = tag; @@ -22,25 +23,6 @@ public Progress(ProgressTag tag, object? value) protected Progress() { } - - public static Progress LastNeuronId(NeuronId info) - { - return new Progress(ProgressTag.LastNeuronId, info); - } - - public NeuronId AsLastNeuronId() - { - this.ValidateTag(ProgressTag.LastNeuronId); - return (NeuronId)this.Value!; - } - - private void ValidateTag(ProgressTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum ProgressTag diff --git a/samples/Sample.Shared/Governance/Models/Result.cs b/samples/Sample.Shared/Governance/Models/Result.cs index a28ad572..0105448f 100644 --- a/samples/Sample.Shared/Governance/Models/Result.cs +++ b/samples/Sample.Shared/Governance/Models/Result.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,8 @@ public class Result [VariantValueProperty()] public object? Value { get; set; } + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public Result(ResultTag tag, object? value) { this.Tag = tag; @@ -22,30 +23,6 @@ public Result(ResultTag tag, object? value) protected Result() { } - - public static Result Ok() - { - return new Result(ResultTag.Ok, null); - } - - public static Result Err(GovernanceError info) - { - return new Result(ResultTag.Err, info); - } - - public GovernanceError AsErr() - { - this.ValidateTag(ResultTag.Err); - return (GovernanceError)this.Value!; - } - - private void ValidateTag(ResultTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum ResultTag diff --git a/samples/Sample.Shared/Governance/Models/Result1.cs b/samples/Sample.Shared/Governance/Models/Result1.cs index fd43e2ba..beb4b916 100644 --- a/samples/Sample.Shared/Governance/Models/Result1.cs +++ b/samples/Sample.Shared/Governance/Models/Result1.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result1 [VariantValueProperty()] public object? Value { get; set; } + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + public Result1(Result1Tag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Result1(Result1Tag tag, object? value) protected Result1() { } - - public static Result1 Error(GovernanceError info) - { - return new Result1(Result1Tag.Error, info); - } - - public static Result1 NeuronId(NeuronId info) - { - return new Result1(Result1Tag.NeuronId, info); - } - - public GovernanceError AsError() - { - this.ValidateTag(Result1Tag.Error); - return (GovernanceError)this.Value!; - } - - public NeuronId AsNeuronId() - { - this.ValidateTag(Result1Tag.NeuronId); - return (NeuronId)this.Value!; - } - - private void ValidateTag(Result1Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum Result1Tag diff --git a/samples/Sample.Shared/Governance/Models/Result2.cs b/samples/Sample.Shared/Governance/Models/Result2.cs index 673f09fc..dd5b0d7a 100644 --- a/samples/Sample.Shared/Governance/Models/Result2.cs +++ b/samples/Sample.Shared/Governance/Models/Result2.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result2 [VariantValueProperty()] public object? Value { get; set; } + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + public Result2(Result2Tag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Result2(Result2Tag tag, object? value) protected Result2() { } - - public static Result2 Ok(Neuron info) - { - return new Result2(Result2Tag.Ok, info); - } - - public static Result2 Err(GovernanceError info) - { - return new Result2(Result2Tag.Err, info); - } - - public Neuron AsOk() - { - this.ValidateTag(Result2Tag.Ok); - return (Neuron)this.Value!; - } - - public GovernanceError AsErr() - { - this.ValidateTag(Result2Tag.Err); - return (GovernanceError)this.Value!; - } - - private void ValidateTag(Result2Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum Result2Tag diff --git a/samples/Sample.Shared/Governance/Models/Result3.cs b/samples/Sample.Shared/Governance/Models/Result3.cs index d1f83ee0..902e764f 100644 --- a/samples/Sample.Shared/Governance/Models/Result3.cs +++ b/samples/Sample.Shared/Governance/Models/Result3.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result3 [VariantValueProperty()] public object? Value { get; set; } + public GovernanceCachedMetrics? Ok { get => this.Tag == Result3Tag.Ok ? (GovernanceCachedMetrics)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + public Result3(Result3Tag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Result3(Result3Tag tag, object? value) protected Result3() { } - - public static Result3 Ok(GovernanceCachedMetrics info) - { - return new Result3(Result3Tag.Ok, info); - } - - public static Result3 Err(GovernanceError info) - { - return new Result3(Result3Tag.Err, info); - } - - public GovernanceCachedMetrics AsOk() - { - this.ValidateTag(Result3Tag.Ok); - return (GovernanceCachedMetrics)this.Value!; - } - - public GovernanceError AsErr() - { - this.ValidateTag(Result3Tag.Err); - return (GovernanceError)this.Value!; - } - - private void ValidateTag(Result3Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum Result3Tag diff --git a/samples/Sample.Shared/Governance/Models/Result4.cs b/samples/Sample.Shared/Governance/Models/Result4.cs index 039d7ac3..9fb942dd 100644 --- a/samples/Sample.Shared/Governance/Models/Result4.cs +++ b/samples/Sample.Shared/Governance/Models/Result4.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result4 [VariantValueProperty()] public object? Value { get; set; } + public RewardNodeProviders? Ok { get => this.Tag == Result4Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + public Result4(Result4Tag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Result4(Result4Tag tag, object? value) protected Result4() { } - - public static Result4 Ok(RewardNodeProviders info) - { - return new Result4(Result4Tag.Ok, info); - } - - public static Result4 Err(GovernanceError info) - { - return new Result4(Result4Tag.Err, info); - } - - public RewardNodeProviders AsOk() - { - this.ValidateTag(Result4Tag.Ok); - return (RewardNodeProviders)this.Value!; - } - - public GovernanceError AsErr() - { - this.ValidateTag(Result4Tag.Err); - return (GovernanceError)this.Value!; - } - - private void ValidateTag(Result4Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum Result4Tag diff --git a/samples/Sample.Shared/Governance/Models/Result5.cs b/samples/Sample.Shared/Governance/Models/Result5.cs index 0a5758fa..a384e9b0 100644 --- a/samples/Sample.Shared/Governance/Models/Result5.cs +++ b/samples/Sample.Shared/Governance/Models/Result5.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result5 [VariantValueProperty()] public object? Value { get; set; } + public NeuronInfo? Ok { get => this.Tag == Result5Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + public Result5(Result5Tag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Result5(Result5Tag tag, object? value) protected Result5() { } - - public static Result5 Ok(NeuronInfo info) - { - return new Result5(Result5Tag.Ok, info); - } - - public static Result5 Err(GovernanceError info) - { - return new Result5(Result5Tag.Err, info); - } - - public NeuronInfo AsOk() - { - this.ValidateTag(Result5Tag.Ok); - return (NeuronInfo)this.Value!; - } - - public GovernanceError AsErr() - { - this.ValidateTag(Result5Tag.Err); - return (GovernanceError)this.Value!; - } - - private void ValidateTag(Result5Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum Result5Tag diff --git a/samples/Sample.Shared/Governance/Models/Result6.cs b/samples/Sample.Shared/Governance/Models/Result6.cs index e4226631..0e47dab5 100644 --- a/samples/Sample.Shared/Governance/Models/Result6.cs +++ b/samples/Sample.Shared/Governance/Models/Result6.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result6 [VariantValueProperty()] public object? Value { get; set; } + public NodeProvider? Ok { get => this.Tag == Result6Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result6Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result6Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result6Tag.Err, value); } + public Result6(Result6Tag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public Result6(Result6Tag tag, object? value) protected Result6() { } - - public static Result6 Ok(NodeProvider info) - { - return new Result6(Result6Tag.Ok, info); - } - - public static Result6 Err(GovernanceError info) - { - return new Result6(Result6Tag.Err, info); - } - - public NodeProvider AsOk() - { - this.ValidateTag(Result6Tag.Ok); - return (NodeProvider)this.Value!; - } - - public GovernanceError AsErr() - { - this.ValidateTag(Result6Tag.Err); - return (GovernanceError)this.Value!; - } - - private void ValidateTag(Result6Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum Result6Tag diff --git a/samples/Sample.Shared/Governance/Models/Result7.cs b/samples/Sample.Shared/Governance/Models/Result7.cs index ac88252a..f506ba8c 100644 --- a/samples/Sample.Shared/Governance/Models/Result7.cs +++ b/samples/Sample.Shared/Governance/Models/Result7.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class Result7 [VariantValueProperty()] public object? Value { get; set; } + public Committed? Committed { get => this.Tag == Result7Tag.Committed ? (Committed)this.Value : default; set => (this.Tag, this.Value) = (Result7Tag.Committed, value); } + + public Result7.AbortedInfo? Aborted { get => this.Tag == Result7Tag.Aborted ? (Result7.AbortedInfo)this.Value : default; set => (this.Tag, this.Value) = (Result7Tag.Aborted, value); } + public Result7(Result7Tag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ protected Result7() { } - public static Result7 Committed(Committed info) - { - return new Result7(Result7Tag.Committed, info); - } - - public static Result7 Aborted(Result7.AbortedInfo info) - { - return new Result7(Result7Tag.Aborted, info); - } - - public Committed AsCommitted() - { - this.ValidateTag(Result7Tag.Committed); - return (Committed)this.Value!; - } - - public Result7.AbortedInfo AsAborted() - { - this.ValidateTag(Result7Tag.Aborted); - return (Result7.AbortedInfo)this.Value!; - } - - private void ValidateTag(Result7Tag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } - public class AbortedInfo { public AbortedInfo() diff --git a/samples/Sample.Shared/Governance/Models/RewardMode.cs b/samples/Sample.Shared/Governance/Models/RewardMode.cs index dd6a8b8a..66b3306c 100644 --- a/samples/Sample.Shared/Governance/Models/RewardMode.cs +++ b/samples/Sample.Shared/Governance/Models/RewardMode.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; -using System; namespace Sample.Shared.Governance.Models { @@ -13,6 +12,10 @@ public class RewardMode [VariantValueProperty()] public object? Value { get; set; } + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardMode(RewardModeTag tag, object? value) { this.Tag = tag; @@ -22,36 +25,6 @@ public RewardMode(RewardModeTag tag, object? value) protected RewardMode() { } - - public static RewardMode RewardToNeuron(RewardToNeuron info) - { - return new RewardMode(RewardModeTag.RewardToNeuron, info); - } - - public static RewardMode RewardToAccount(RewardToAccount info) - { - return new RewardMode(RewardModeTag.RewardToAccount, info); - } - - public RewardToNeuron AsRewardToNeuron() - { - this.ValidateTag(RewardModeTag.RewardToNeuron); - return (RewardToNeuron)this.Value!; - } - - public RewardToAccount AsRewardToAccount() - { - this.ValidateTag(RewardModeTag.RewardToAccount); - return (RewardToAccount)this.Value!; - } - - private void ValidateTag(RewardModeTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum RewardModeTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs index c7a67d1b..61822f94 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; using Timestamp = System.UInt64; @@ -16,109 +15,28 @@ public class ApproveError [VariantValueProperty()] public object? Value { get; set; } - public ApproveError(ApproveErrorTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected ApproveError() - { - } - - public static ApproveError GenericError(ApproveError.GenericErrorInfo info) - { - return new ApproveError(ApproveErrorTag.GenericError, info); - } - - public static ApproveError TemporarilyUnavailable() - { - return new ApproveError(ApproveErrorTag.TemporarilyUnavailable, null); - } - - public static ApproveError Duplicate(ApproveError.DuplicateInfo info) - { - return new ApproveError(ApproveErrorTag.Duplicate, info); - } - - public static ApproveError BadFee(ApproveError.BadFeeInfo info) - { - return new ApproveError(ApproveErrorTag.BadFee, info); - } - - public static ApproveError AllowanceChanged(ApproveError.AllowanceChangedInfo info) - { - return new ApproveError(ApproveErrorTag.AllowanceChanged, info); - } - - public static ApproveError CreatedInFuture(ApproveError.CreatedInFutureInfo info) - { - return new ApproveError(ApproveErrorTag.CreatedInFuture, info); - } + public ApproveError.GenericErrorInfo? GenericError { get => this.Tag == ApproveErrorTag.GenericError ? (ApproveError.GenericErrorInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.GenericError, value); } - public static ApproveError TooOld() - { - return new ApproveError(ApproveErrorTag.TooOld, null); - } + public ApproveError.DuplicateInfo? Duplicate { get => this.Tag == ApproveErrorTag.Duplicate ? (ApproveError.DuplicateInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.Duplicate, value); } - public static ApproveError Expired(ApproveError.ExpiredInfo info) - { - return new ApproveError(ApproveErrorTag.Expired, info); - } + public ApproveError.BadFeeInfo? BadFee { get => this.Tag == ApproveErrorTag.BadFee ? (ApproveError.BadFeeInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.BadFee, value); } - public static ApproveError InsufficientFunds(ApproveError.InsufficientFundsInfo info) - { - return new ApproveError(ApproveErrorTag.InsufficientFunds, info); - } + public ApproveError.AllowanceChangedInfo? AllowanceChanged { get => this.Tag == ApproveErrorTag.AllowanceChanged ? (ApproveError.AllowanceChangedInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.AllowanceChanged, value); } - public ApproveError.GenericErrorInfo AsGenericError() - { - this.ValidateTag(ApproveErrorTag.GenericError); - return (ApproveError.GenericErrorInfo)this.Value!; - } + public ApproveError.CreatedInFutureInfo? CreatedInFuture { get => this.Tag == ApproveErrorTag.CreatedInFuture ? (ApproveError.CreatedInFutureInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.CreatedInFuture, value); } - public ApproveError.DuplicateInfo AsDuplicate() - { - this.ValidateTag(ApproveErrorTag.Duplicate); - return (ApproveError.DuplicateInfo)this.Value!; - } + public ApproveError.ExpiredInfo? Expired { get => this.Tag == ApproveErrorTag.Expired ? (ApproveError.ExpiredInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.Expired, value); } - public ApproveError.BadFeeInfo AsBadFee() - { - this.ValidateTag(ApproveErrorTag.BadFee); - return (ApproveError.BadFeeInfo)this.Value!; - } + public ApproveError.InsufficientFundsInfo? InsufficientFunds { get => this.Tag == ApproveErrorTag.InsufficientFunds ? (ApproveError.InsufficientFundsInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.InsufficientFunds, value); } - public ApproveError.AllowanceChangedInfo AsAllowanceChanged() - { - this.ValidateTag(ApproveErrorTag.AllowanceChanged); - return (ApproveError.AllowanceChangedInfo)this.Value!; - } - - public ApproveError.CreatedInFutureInfo AsCreatedInFuture() - { - this.ValidateTag(ApproveErrorTag.CreatedInFuture); - return (ApproveError.CreatedInFutureInfo)this.Value!; - } - - public ApproveError.ExpiredInfo AsExpired() - { - this.ValidateTag(ApproveErrorTag.Expired); - return (ApproveError.ExpiredInfo)this.Value!; - } - - public ApproveError.InsufficientFundsInfo AsInsufficientFunds() + public ApproveError(ApproveErrorTag tag, object? value) { - this.ValidateTag(ApproveErrorTag.InsufficientFunds); - return (ApproveError.InsufficientFundsInfo)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(ApproveErrorTag tag) + protected ApproveError() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } public class GenericErrorInfo diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs index 5fd7c701..e825b1fa 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models @@ -14,6 +13,10 @@ public class ApproveResult [VariantValueProperty()] public object? Value { get; set; } + public BlockIndex? Ok { get => this.Tag == ApproveResultTag.Ok ? (BlockIndex)this.Value : default; set => (this.Tag, this.Value) = (ApproveResultTag.Ok, value); } + + public ApproveError? Err { get => this.Tag == ApproveResultTag.Err ? (ApproveError)this.Value : default; set => (this.Tag, this.Value) = (ApproveResultTag.Err, value); } + public ApproveResult(ApproveResultTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public ApproveResult(ApproveResultTag tag, object? value) protected ApproveResult() { } - - public static ApproveResult Ok(BlockIndex info) - { - return new ApproveResult(ApproveResultTag.Ok, info); - } - - public static ApproveResult Err(ApproveError info) - { - return new ApproveResult(ApproveResultTag.Err, info); - } - - public BlockIndex AsOk() - { - this.ValidateTag(ApproveResultTag.Ok); - return (BlockIndex)this.Value!; - } - - public ApproveError AsErr() - { - this.ValidateTag(ApproveResultTag.Err); - return (ApproveError)this.Value!; - } - - private void ValidateTag(ApproveResultTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum ApproveResultTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs index deddac03..53df9b99 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; namespace Sample.Shared.ICRC1Ledger.Models { @@ -13,6 +12,8 @@ public class ChangeFeeCollector [VariantValueProperty()] public object? Value { get; set; } + public Account? SetTo { get => this.Tag == ChangeFeeCollectorTag.SetTo ? (Account)this.Value : default; set => (this.Tag, this.Value) = (ChangeFeeCollectorTag.SetTo, value); } + public ChangeFeeCollector(ChangeFeeCollectorTag tag, object? value) { this.Tag = tag; @@ -22,30 +23,6 @@ public ChangeFeeCollector(ChangeFeeCollectorTag tag, object? value) protected ChangeFeeCollector() { } - - public static ChangeFeeCollector Unset() - { - return new ChangeFeeCollector(ChangeFeeCollectorTag.Unset, null); - } - - public static ChangeFeeCollector SetTo(Account info) - { - return new ChangeFeeCollector(ChangeFeeCollectorTag.SetTo, info); - } - - public Account AsSetTo() - { - this.ValidateTag(ChangeFeeCollectorTag.SetTo); - return (Account)this.Value!; - } - - private void ValidateTag(ChangeFeeCollectorTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum ChangeFeeCollectorTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs index 9945c6d5..e17c821d 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.ICRC1Ledger.Models { @@ -14,6 +13,10 @@ public class LedgerArg [VariantValueProperty()] public object? Value { get; set; } + public InitArgs? Init { get => this.Tag == LedgerArgTag.Init ? (InitArgs)this.Value : default; set => (this.Tag, this.Value) = (LedgerArgTag.Init, value); } + + public OptionalValue? Upgrade { get => this.Tag == LedgerArgTag.Upgrade ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (LedgerArgTag.Upgrade, value); } + public LedgerArg(LedgerArgTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public LedgerArg(LedgerArgTag tag, object? value) protected LedgerArg() { } - - public static LedgerArg Init(InitArgs info) - { - return new LedgerArg(LedgerArgTag.Init, info); - } - - public static LedgerArg Upgrade(OptionalValue info) - { - return new LedgerArg(LedgerArgTag.Upgrade, info); - } - - public InitArgs AsInit() - { - this.ValidateTag(LedgerArgTag.Init); - return (InitArgs)this.Value!; - } - - public OptionalValue AsUpgrade() - { - this.ValidateTag(LedgerArgTag.Upgrade); - return (OptionalValue)this.Value!; - } - - private void ValidateTag(LedgerArgTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum LedgerArgTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs index 4aabcdd6..e00f0a53 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs @@ -2,7 +2,6 @@ using Sample.Shared.ICRC1Ledger.Models; using EdjCase.ICP.Candid.Models; using System.Collections.Generic; -using System; namespace Sample.Shared.ICRC1Ledger.Models { @@ -15,66 +14,22 @@ public class MetadataValue [VariantValueProperty()] public object? Value { get; set; } - public MetadataValue(MetadataValueTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected MetadataValue() - { - } + public UnboundedUInt? Nat { get => this.Tag == MetadataValueTag.Nat ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Nat, value); } - public static MetadataValue Nat(UnboundedUInt info) - { - return new MetadataValue(MetadataValueTag.Nat, info); - } + public UnboundedInt? Int { get => this.Tag == MetadataValueTag.Int ? (UnboundedInt)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Int, value); } - public static MetadataValue Int(UnboundedInt info) - { - return new MetadataValue(MetadataValueTag.Int, info); - } + public string? Text { get => this.Tag == MetadataValueTag.Text ? (string)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Text, value); } - public static MetadataValue Text(string info) - { - return new MetadataValue(MetadataValueTag.Text, info); - } + public List? Blob { get => this.Tag == MetadataValueTag.Blob ? (List)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Blob, value); } - public static MetadataValue Blob(List info) - { - return new MetadataValue(MetadataValueTag.Blob, info); - } - - public UnboundedUInt AsNat() - { - this.ValidateTag(MetadataValueTag.Nat); - return (UnboundedUInt)this.Value!; - } - - public UnboundedInt AsInt() - { - this.ValidateTag(MetadataValueTag.Int); - return (UnboundedInt)this.Value!; - } - - public string AsText() - { - this.ValidateTag(MetadataValueTag.Text); - return (string)this.Value!; - } - - public List AsBlob() + public MetadataValue(MetadataValueTag tag, object? value) { - this.ValidateTag(MetadataValueTag.Blob); - return (List)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(MetadataValueTag tag) + protected MetadataValue() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } } diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs index 2ed753c7..4ac2f391 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; using Timestamp = System.UInt64; @@ -17,98 +16,26 @@ public class TransferError [VariantValueProperty()] public object? Value { get; set; } - public TransferError(TransferErrorTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } + public TransferError.BadFeeInfo? BadFee { get => this.Tag == TransferErrorTag.BadFee ? (TransferError.BadFeeInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.BadFee, value); } - protected TransferError() - { - } + public TransferError.BadBurnInfo? BadBurn { get => this.Tag == TransferErrorTag.BadBurn ? (TransferError.BadBurnInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.BadBurn, value); } - public static TransferError BadFee(TransferError.BadFeeInfo info) - { - return new TransferError(TransferErrorTag.BadFee, info); - } + public TransferError.InsufficientFundsInfo? InsufficientFunds { get => this.Tag == TransferErrorTag.InsufficientFunds ? (TransferError.InsufficientFundsInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.InsufficientFunds, value); } - public static TransferError BadBurn(TransferError.BadBurnInfo info) - { - return new TransferError(TransferErrorTag.BadBurn, info); - } + public TransferError.CreatedInFutureInfo? CreatedInFuture { get => this.Tag == TransferErrorTag.CreatedInFuture ? (TransferError.CreatedInFutureInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.CreatedInFuture, value); } - public static TransferError InsufficientFunds(TransferError.InsufficientFundsInfo info) - { - return new TransferError(TransferErrorTag.InsufficientFunds, info); - } - - public static TransferError TooOld() - { - return new TransferError(TransferErrorTag.TooOld, null); - } - - public static TransferError CreatedInFuture(TransferError.CreatedInFutureInfo info) - { - return new TransferError(TransferErrorTag.CreatedInFuture, info); - } - - public static TransferError TemporarilyUnavailable() - { - return new TransferError(TransferErrorTag.TemporarilyUnavailable, null); - } + public TransferError.DuplicateInfo? Duplicate { get => this.Tag == TransferErrorTag.Duplicate ? (TransferError.DuplicateInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.Duplicate, value); } - public static TransferError Duplicate(TransferError.DuplicateInfo info) - { - return new TransferError(TransferErrorTag.Duplicate, info); - } + public TransferError.GenericErrorInfo? GenericError { get => this.Tag == TransferErrorTag.GenericError ? (TransferError.GenericErrorInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.GenericError, value); } - public static TransferError GenericError(TransferError.GenericErrorInfo info) - { - return new TransferError(TransferErrorTag.GenericError, info); - } - - public TransferError.BadFeeInfo AsBadFee() - { - this.ValidateTag(TransferErrorTag.BadFee); - return (TransferError.BadFeeInfo)this.Value!; - } - - public TransferError.BadBurnInfo AsBadBurn() - { - this.ValidateTag(TransferErrorTag.BadBurn); - return (TransferError.BadBurnInfo)this.Value!; - } - - public TransferError.InsufficientFundsInfo AsInsufficientFunds() - { - this.ValidateTag(TransferErrorTag.InsufficientFunds); - return (TransferError.InsufficientFundsInfo)this.Value!; - } - - public TransferError.CreatedInFutureInfo AsCreatedInFuture() - { - this.ValidateTag(TransferErrorTag.CreatedInFuture); - return (TransferError.CreatedInFutureInfo)this.Value!; - } - - public TransferError.DuplicateInfo AsDuplicate() - { - this.ValidateTag(TransferErrorTag.Duplicate); - return (TransferError.DuplicateInfo)this.Value!; - } - - public TransferError.GenericErrorInfo AsGenericError() + public TransferError(TransferErrorTag tag, object? value) { - this.ValidateTag(TransferErrorTag.GenericError); - return (TransferError.GenericErrorInfo)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(TransferErrorTag tag) + protected TransferError() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } public class BadFeeInfo diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs index 04f193d4..935df949 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; using Timestamp = System.UInt64; @@ -17,109 +16,28 @@ public class TransferFromError [VariantValueProperty()] public object? Value { get; set; } - public TransferFromError(TransferFromErrorTag tag, object? value) - { - this.Tag = tag; - this.Value = value; - } - - protected TransferFromError() - { - } - - public static TransferFromError BadFee(TransferFromError.BadFeeInfo info) - { - return new TransferFromError(TransferFromErrorTag.BadFee, info); - } - - public static TransferFromError BadBurn(TransferFromError.BadBurnInfo info) - { - return new TransferFromError(TransferFromErrorTag.BadBurn, info); - } - - public static TransferFromError InsufficientFunds(TransferFromError.InsufficientFundsInfo info) - { - return new TransferFromError(TransferFromErrorTag.InsufficientFunds, info); - } - - public static TransferFromError InsufficientAllowance(TransferFromError.InsufficientAllowanceInfo info) - { - return new TransferFromError(TransferFromErrorTag.InsufficientAllowance, info); - } - - public static TransferFromError TooOld() - { - return new TransferFromError(TransferFromErrorTag.TooOld, null); - } - - public static TransferFromError CreatedInFuture(TransferFromError.CreatedInFutureInfo info) - { - return new TransferFromError(TransferFromErrorTag.CreatedInFuture, info); - } + public TransferFromError.BadFeeInfo? BadFee { get => this.Tag == TransferFromErrorTag.BadFee ? (TransferFromError.BadFeeInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.BadFee, value); } - public static TransferFromError Duplicate(TransferFromError.DuplicateInfo info) - { - return new TransferFromError(TransferFromErrorTag.Duplicate, info); - } + public TransferFromError.BadBurnInfo? BadBurn { get => this.Tag == TransferFromErrorTag.BadBurn ? (TransferFromError.BadBurnInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.BadBurn, value); } - public static TransferFromError TemporarilyUnavailable() - { - return new TransferFromError(TransferFromErrorTag.TemporarilyUnavailable, null); - } + public TransferFromError.InsufficientFundsInfo? InsufficientFunds { get => this.Tag == TransferFromErrorTag.InsufficientFunds ? (TransferFromError.InsufficientFundsInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.InsufficientFunds, value); } - public static TransferFromError GenericError(TransferFromError.GenericErrorInfo info) - { - return new TransferFromError(TransferFromErrorTag.GenericError, info); - } + public TransferFromError.InsufficientAllowanceInfo? InsufficientAllowance { get => this.Tag == TransferFromErrorTag.InsufficientAllowance ? (TransferFromError.InsufficientAllowanceInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.InsufficientAllowance, value); } - public TransferFromError.BadFeeInfo AsBadFee() - { - this.ValidateTag(TransferFromErrorTag.BadFee); - return (TransferFromError.BadFeeInfo)this.Value!; - } + public TransferFromError.CreatedInFutureInfo? CreatedInFuture { get => this.Tag == TransferFromErrorTag.CreatedInFuture ? (TransferFromError.CreatedInFutureInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.CreatedInFuture, value); } - public TransferFromError.BadBurnInfo AsBadBurn() - { - this.ValidateTag(TransferFromErrorTag.BadBurn); - return (TransferFromError.BadBurnInfo)this.Value!; - } + public TransferFromError.DuplicateInfo? Duplicate { get => this.Tag == TransferFromErrorTag.Duplicate ? (TransferFromError.DuplicateInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.Duplicate, value); } - public TransferFromError.InsufficientFundsInfo AsInsufficientFunds() - { - this.ValidateTag(TransferFromErrorTag.InsufficientFunds); - return (TransferFromError.InsufficientFundsInfo)this.Value!; - } + public TransferFromError.GenericErrorInfo? GenericError { get => this.Tag == TransferFromErrorTag.GenericError ? (TransferFromError.GenericErrorInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.GenericError, value); } - public TransferFromError.InsufficientAllowanceInfo AsInsufficientAllowance() - { - this.ValidateTag(TransferFromErrorTag.InsufficientAllowance); - return (TransferFromError.InsufficientAllowanceInfo)this.Value!; - } - - public TransferFromError.CreatedInFutureInfo AsCreatedInFuture() - { - this.ValidateTag(TransferFromErrorTag.CreatedInFuture); - return (TransferFromError.CreatedInFutureInfo)this.Value!; - } - - public TransferFromError.DuplicateInfo AsDuplicate() - { - this.ValidateTag(TransferFromErrorTag.Duplicate); - return (TransferFromError.DuplicateInfo)this.Value!; - } - - public TransferFromError.GenericErrorInfo AsGenericError() + public TransferFromError(TransferFromErrorTag tag, object? value) { - this.ValidateTag(TransferFromErrorTag.GenericError); - return (TransferFromError.GenericErrorInfo)this.Value!; + this.Tag = tag; + this.Value = value; } - private void ValidateTag(TransferFromErrorTag tag) + protected TransferFromError() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } public class BadFeeInfo diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs index 2fab0fc0..7ec88404 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models @@ -14,6 +13,10 @@ public class TransferFromResult [VariantValueProperty()] public object? Value { get; set; } + public BlockIndex? Ok { get => this.Tag == TransferFromResultTag.Ok ? (BlockIndex)this.Value : default; set => (this.Tag, this.Value) = (TransferFromResultTag.Ok, value); } + + public TransferFromError? Err { get => this.Tag == TransferFromResultTag.Err ? (TransferFromError)this.Value : default; set => (this.Tag, this.Value) = (TransferFromResultTag.Err, value); } + public TransferFromResult(TransferFromResultTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public TransferFromResult(TransferFromResultTag tag, object? value) protected TransferFromResult() { } - - public static TransferFromResult Ok(BlockIndex info) - { - return new TransferFromResult(TransferFromResultTag.Ok, info); - } - - public static TransferFromResult Err(TransferFromError info) - { - return new TransferFromResult(TransferFromResultTag.Err, info); - } - - public BlockIndex AsOk() - { - this.ValidateTag(TransferFromResultTag.Ok); - return (BlockIndex)this.Value!; - } - - public TransferFromError AsErr() - { - this.ValidateTag(TransferFromResultTag.Err); - return (TransferFromError)this.Value!; - } - - private void ValidateTag(TransferFromResultTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum TransferFromResultTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs index dd528fc0..3c9e4613 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; -using System; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models @@ -14,6 +13,10 @@ public class TransferResult [VariantValueProperty()] public object? Value { get; set; } + public BlockIndex? Ok { get => this.Tag == TransferResultTag.Ok ? (BlockIndex)this.Value : default; set => (this.Tag, this.Value) = (TransferResultTag.Ok, value); } + + public TransferError? Err { get => this.Tag == TransferResultTag.Err ? (TransferError)this.Value : default; set => (this.Tag, this.Value) = (TransferResultTag.Err, value); } + public TransferResult(TransferResultTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public TransferResult(TransferResultTag tag, object? value) protected TransferResult() { } - - public static TransferResult Ok(BlockIndex info) - { - return new TransferResult(TransferResultTag.Ok, info); - } - - public static TransferResult Err(TransferError info) - { - return new TransferResult(TransferResultTag.Err, info); - } - - public BlockIndex AsOk() - { - this.ValidateTag(TransferResultTag.Ok); - return (BlockIndex)this.Value!; - } - - public TransferError AsErr() - { - this.ValidateTag(TransferResultTag.Err); - return (TransferError)this.Value!; - } - - private void ValidateTag(TransferResultTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum TransferResultTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs index 8aca17d0..bd5c3f53 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs @@ -2,7 +2,6 @@ using Sample.Shared.ICRC1Ledger.Models; using System.Collections.Generic; using EdjCase.ICP.Candid.Models; -using System; using Map = System.Collections.Generic.Dictionary; namespace Sample.Shared.ICRC1Ledger.Models @@ -16,99 +15,28 @@ public class Value [VariantValueProperty()] public object? Value_ { get; set; } - public Value(ValueTag tag, object? value) - { - this.Tag = tag; - this.Value_ = value; - } - - protected Value() - { - } - - public static Value Blob(List info) - { - return new Value(ValueTag.Blob, info); - } - - public static Value Text(string info) - { - return new Value(ValueTag.Text, info); - } - - public static Value Nat(UnboundedUInt info) - { - return new Value(ValueTag.Nat, info); - } - - public static Value Nat64(ulong info) - { - return new Value(ValueTag.Nat64, info); - } - - public static Value Int(UnboundedInt info) - { - return new Value(ValueTag.Int, info); - } + public List? Blob { get => this.Tag == ValueTag.Blob ? (List)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Blob, value); } - public static Value Array(List info) - { - return new Value(ValueTag.Array, info); - } + public string? Text { get => this.Tag == ValueTag.Text ? (string)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Text, value); } - public static Value Map(Map info) - { - return new Value(ValueTag.Map, info); - } + public UnboundedUInt? Nat { get => this.Tag == ValueTag.Nat ? (UnboundedUInt)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Nat, value); } - public List AsBlob() - { - this.ValidateTag(ValueTag.Blob); - return (List)this.Value_!; - } + public ulong? Nat64 { get => this.Tag == ValueTag.Nat64 ? (ulong)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Nat64, value); } - public string AsText() - { - this.ValidateTag(ValueTag.Text); - return (string)this.Value_!; - } + public UnboundedInt? Int { get => this.Tag == ValueTag.Int ? (UnboundedInt)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Int, value); } - public UnboundedUInt AsNat() - { - this.ValidateTag(ValueTag.Nat); - return (UnboundedUInt)this.Value_!; - } + public List? Array { get => this.Tag == ValueTag.Array ? (List)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Array, value); } - public ulong AsNat64() - { - this.ValidateTag(ValueTag.Nat64); - return (ulong)this.Value_!; - } - - public UnboundedInt AsInt() - { - this.ValidateTag(ValueTag.Int); - return (UnboundedInt)this.Value_!; - } + public Map? Map { get => this.Tag == ValueTag.Map ? (Map)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Map, value); } - public List AsArray() - { - this.ValidateTag(ValueTag.Array); - return (List)this.Value_!; - } - - public Map AsMap() + public Value(ValueTag tag, object? value) { - this.ValidateTag(ValueTag.Map); - return (Map)this.Value_!; + this.Tag = tag; + this.Value_ = value; } - private void ValidateTag(ValueTag tag) + protected Value() { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } } } diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index bdf49d5b..8ec286ab 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -399,7 +399,10 @@ private List GenerateVariantProperties( SyntaxFactory.Token(SyntaxKind.DefaultKeyword) ) ) - )), + )) + .WithSemicolonToken( + SyntaxFactory.Token(SyntaxKind.SemicolonToken) + ), // Add setter SyntaxFactory .AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) @@ -446,11 +449,22 @@ private List GenerateVariantProperties( ) ) )) + .WithSemicolonToken( + SyntaxFactory.Token(SyntaxKind.SemicolonToken) + ) }; + TypeName fixedTypeName = this.FeatureNullable + ? new NullableTypeName(o.Type.Name) + : o.Type.Name; return SyntaxFactory.PropertyDeclaration( - o.Type!.Name.ToTypeSyntax(), + fixedTypeName.ToTypeSyntax(), o.Name.Name ) + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.PublicKeyword) + ) + ) .WithAccessorList(SyntaxFactory.AccessorList( SyntaxFactory.List(accessors) )); From b60910d8ef6445a3effe25efc0de85b5b2ede840 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Mon, 25 Sep 2023 14:10:13 -0700 Subject: [PATCH 8/9] Fixing tests --- .../Dex/Models/CancelOrderReceipt.cs | 35 +- .../Dex/Models/DepositReceipt.cs | 35 +- .../Dex/Models/OrderPlacementReceipt.cs | 35 +- .../Dex/Models/WithdrawReceipt.cs | 35 +- .../Sample.Shared/Governance/Models/Action.cs | 160 +- samples/Sample.Shared/Governance/Models/By.cs | 48 +- .../Sample.Shared/Governance/Models/Change.cs | 35 +- .../Governance/Models/Command.cs | 149 +- .../Governance/Models/Command1.cs | 160 +- .../Governance/Models/Command2.cs | 116 +- .../Governance/Models/DissolveState.cs | 35 +- .../Governance/Models/NeuronIdOrSubaccount.cs | 35 +- .../Governance/Models/Operation.cs | 116 +- .../Governance/Models/Progress.cs | 22 +- .../Sample.Shared/Governance/Models/Result.cs | 27 +- .../Governance/Models/Result1.cs | 35 +- .../Governance/Models/Result2.cs | 35 +- .../Governance/Models/Result3.cs | 35 +- .../Governance/Models/Result4.cs | 35 +- .../Governance/Models/Result5.cs | 35 +- .../Governance/Models/Result6.cs | 35 +- .../Governance/Models/Result7.cs | 35 +- .../Governance/Models/RewardMode.cs | 35 +- .../ICRC1Ledger/Models/ApproveError.cs | 104 +- .../ICRC1Ledger/Models/ApproveResult.cs | 35 +- .../ICRC1Ledger/Models/ChangeFeeCollector.cs | 27 +- .../ICRC1Ledger/Models/LedgerArg.cs | 35 +- .../ICRC1Ledger/Models/MetadataValue.cs | 61 +- .../ICRC1Ledger/Models/TransferError.cs | 93 +- .../ICRC1Ledger/Models/TransferFromError.cs | 104 +- .../ICRC1Ledger/Models/TransferFromResult.cs | 35 +- .../ICRC1Ledger/Models/TransferResult.cs | 35 +- .../Sample.Shared/ICRC1Ledger/Models/Value.cs | 94 +- src/ClientGenerator/API.md | 57 +- src/ClientGenerator/API.xml | 30 +- src/ClientGenerator/ClientCodeGenerator.cs | 18 +- .../ClientGenerationOptions.cs | 30 +- src/ClientGenerator/README.md | 9 +- src/ClientGenerator/RoslynTypeResolver.cs | 5 +- src/ClientGenerator/SourceCodeType.cs | 4 +- src/ClientGenerator/TomlConfigParser.cs | 19 +- .../Generators/ClientGeneratorTests.cs | 30 +- ...se_False_VariantsUseProperties_False.snap} | 0 ...ase_False_VariantsUseProperties_True.snap} | 0 ...ase_True_VariantsUseProperties_False.snap} | 0 ...Case_True_VariantsUseProperties_True.snap} | 0 ...se_False_VariantsUseProperties_False.snap} | 0 ...ase_False_VariantsUseProperties_True.snap} | 0 ...ase_True_VariantsUseProperties_False.snap} | 0 ...Case_True_VariantsUseProperties_True.snap} | 0 ...ase_False_VariantsUseProperties_False.snap | 41 + ...Case_False_VariantsUseProperties_True.snap | 41 + ...Case_True_VariantsUseProperties_False.snap | 41 + ...dCase_True_VariantsUseProperties_True.snap | 41 + ...ase_False_VariantsUseProperties_False.snap | 41 + ...Case_False_VariantsUseProperties_True.snap | 41 + ...Case_True_VariantsUseProperties_False.snap | 41 + ...dCase_True_VariantsUseProperties_True.snap | 41 + ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 405 +++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 394 +++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 405 +++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 394 +++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 405 +++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 394 +++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 405 +++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 394 +++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 59 + ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 55 + ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 59 + ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 55 + ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 59 + ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 55 + ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 59 + ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 55 + ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 2935 +++++++++++++++++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 2666 +++++++++++++++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 2935 +++++++++++++++++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 2666 +++++++++++++++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 2935 +++++++++++++++++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 2666 +++++++++++++++ ...se_False_VariantsUseProperties_False.snap} | 0 ...Case_False_VariantsUseProperties_True.snap | 2935 +++++++++++++++++ ...ase_True_VariantsUseProperties_False.snap} | 0 ...dCase_True_VariantsUseProperties_True.snap | 2666 +++++++++++++++ 106 files changed, 28198 insertions(+), 334 deletions(-) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False.snap => AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False.snap => AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap => AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap => AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False.snap => AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False.snap => AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap => AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) rename test/Candid.Tests/Generators/__snapshots__/{AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap => AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap create mode 100644 test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap => Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap => Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap => Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap => Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap => Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap => Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap => Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap => Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False.snap => DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True.snap => DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False.snap => DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True.snap => DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False.snap => DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True.snap => DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False.snap => DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True.snap => DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap => Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap => Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap => Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap => Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap => Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap => Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap => Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap rename test/Candid.Tests/Generators/__snapshots__/{Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap => Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap} (100%) create mode 100644 test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap diff --git a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs index 76579c2f..816cf2c0 100644 --- a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; +using System; using OrderId = System.UInt32; namespace Sample.Shared.Dex.Models @@ -13,10 +14,6 @@ public class CancelOrderReceipt [VariantValueProperty()] public object? Value { get; set; } - public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - - public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } - public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) protected CancelOrderReceipt() { } + + public static CancelOrderReceipt Err(CancelOrderErr info) + { + return new CancelOrderReceipt(CancelOrderReceiptTag.Err, info); + } + + public static CancelOrderReceipt Ok(OrderId info) + { + return new CancelOrderReceipt(CancelOrderReceiptTag.Ok, info); + } + + public CancelOrderErr AsErr() + { + this.ValidateTag(CancelOrderReceiptTag.Err); + return (CancelOrderErr)this.Value!; + } + + public OrderId AsOk() + { + this.ValidateTag(CancelOrderReceiptTag.Ok); + return (OrderId)this.Value!; + } + + private void ValidateTag(CancelOrderReceiptTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum CancelOrderReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs index b9857b86..a0aea27f 100644 --- a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs @@ -1,6 +1,7 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; +using System; namespace Sample.Shared.Dex.Models { @@ -13,10 +14,6 @@ public class DepositReceipt [VariantValueProperty()] public object? Value { get; set; } - public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - - public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } - public DepositReceipt(DepositReceiptTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public DepositReceipt(DepositReceiptTag tag, object? value) protected DepositReceipt() { } + + public static DepositReceipt Err(DepositErr info) + { + return new DepositReceipt(DepositReceiptTag.Err, info); + } + + public static DepositReceipt Ok(UnboundedUInt info) + { + return new DepositReceipt(DepositReceiptTag.Ok, info); + } + + public DepositErr AsErr() + { + this.ValidateTag(DepositReceiptTag.Err); + return (DepositErr)this.Value!; + } + + public UnboundedUInt AsOk() + { + this.ValidateTag(DepositReceiptTag.Ok); + return (UnboundedUInt)this.Value!; + } + + private void ValidateTag(DepositReceiptTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum DepositReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs index 67d197bb..bba0c9ac 100644 --- a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs @@ -1,6 +1,7 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; +using System; namespace Sample.Shared.Dex.Models { @@ -13,10 +14,6 @@ public class OrderPlacementReceipt [VariantValueProperty()] public object? Value { get; set; } - public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - - public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } - public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) protected OrderPlacementReceipt() { } + + public static OrderPlacementReceipt Err(OrderPlacementErr info) + { + return new OrderPlacementReceipt(OrderPlacementReceiptTag.Err, info); + } + + public static OrderPlacementReceipt Ok(OptionalValue info) + { + return new OrderPlacementReceipt(OrderPlacementReceiptTag.Ok, info); + } + + public OrderPlacementErr AsErr() + { + this.ValidateTag(OrderPlacementReceiptTag.Err); + return (OrderPlacementErr)this.Value!; + } + + public OptionalValue AsOk() + { + this.ValidateTag(OrderPlacementReceiptTag.Ok); + return (OptionalValue)this.Value!; + } + + private void ValidateTag(OrderPlacementReceiptTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum OrderPlacementReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs index 43d01546..775d4e78 100644 --- a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs @@ -1,6 +1,7 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; +using System; namespace Sample.Shared.Dex.Models { @@ -13,10 +14,6 @@ public class WithdrawReceipt [VariantValueProperty()] public object? Value { get; set; } - public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - - public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } - public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public WithdrawReceipt(WithdrawReceiptTag tag, object? value) protected WithdrawReceipt() { } + + public static WithdrawReceipt Err(WithdrawErr info) + { + return new WithdrawReceipt(WithdrawReceiptTag.Err, info); + } + + public static WithdrawReceipt Ok(UnboundedUInt info) + { + return new WithdrawReceipt(WithdrawReceiptTag.Ok, info); + } + + public WithdrawErr AsErr() + { + this.ValidateTag(WithdrawReceiptTag.Err); + return (WithdrawErr)this.Value!; + } + + public UnboundedUInt AsOk() + { + this.ValidateTag(WithdrawReceiptTag.Ok); + return (UnboundedUInt)this.Value!; + } + + private void ValidateTag(WithdrawReceiptTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum WithdrawReceiptTag diff --git a/samples/Sample.Shared/Governance/Models/Action.cs b/samples/Sample.Shared/Governance/Models/Action.cs index ca7bc017..f6c1d09c 100644 --- a/samples/Sample.Shared/Governance/Models/Action.cs +++ b/samples/Sample.Shared/Governance/Models/Action.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,40 +13,165 @@ public class Action [VariantValueProperty()] public object? Value { get; set; } - public KnownNeuron? RegisterNeuron { get => this.Tag == ActionTag.RegisterNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterNeuron, value); } + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + protected Action() + { + } - public CreateServiceNervousSystem? CreateServiceNervousSystem { get => this.Tag == ActionTag.CreateServiceNervousSystem ? (CreateServiceNervousSystem)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.CreateServiceNervousSystem, value); } + public static Action RegisterNeuron(KnownNeuron info) + { + return new Action(ActionTag.RegisterNeuron, info); + } - public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public static Action ManageNeuron(ManageNeuron info) + { + return new Action(ActionTag.ManageNeuron, info); + } - public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public static Action CreateServiceNervousSystem(CreateServiceNervousSystem info) + { + return new Action(ActionTag.CreateServiceNervousSystem, info); + } - public OpenSnsTokenSwap? OpenSnsTokenSwap { get => this.Tag == ActionTag.OpenSnsTokenSwap ? (OpenSnsTokenSwap)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.OpenSnsTokenSwap, value); } + public static Action ExecuteNnsFunction(ExecuteNnsFunction info) + { + return new Action(ActionTag.ExecuteNnsFunction, info); + } + + public static Action RewardNodeProvider(RewardNodeProvider info) + { + return new Action(ActionTag.RewardNodeProvider, info); + } - public SetSnsTokenSwapOpenTimeWindow? SetSnsTokenSwapOpenTimeWindow { get => this.Tag == ActionTag.SetSnsTokenSwapOpenTimeWindow ? (SetSnsTokenSwapOpenTimeWindow)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetSnsTokenSwapOpenTimeWindow, value); } + public static Action OpenSnsTokenSwap(OpenSnsTokenSwap info) + { + return new Action(ActionTag.OpenSnsTokenSwap, info); + } - public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public static Action SetSnsTokenSwapOpenTimeWindow(SetSnsTokenSwapOpenTimeWindow info) + { + return new Action(ActionTag.SetSnsTokenSwapOpenTimeWindow, info); + } - public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public static Action SetDefaultFollowees(SetDefaultFollowees info) + { + return new Action(ActionTag.SetDefaultFollowees, info); + } - public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public static Action RewardNodeProviders(RewardNodeProviders info) + { + return new Action(ActionTag.RewardNodeProviders, info); + } - public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public static Action ManageNetworkEconomics(NetworkEconomics info) + { + return new Action(ActionTag.ManageNetworkEconomics, info); + } - public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public static Action ApproveGenesisKyc(ApproveGenesisKyc info) + { + return new Action(ActionTag.ApproveGenesisKyc, info); + } - public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public static Action AddOrRemoveNodeProvider(AddOrRemoveNodeProvider info) + { + return new Action(ActionTag.AddOrRemoveNodeProvider, info); + } - public Action(ActionTag tag, object? value) + public static Action Motion(Motion info) { - this.Tag = tag; - this.Value = value; + return new Action(ActionTag.Motion, info); } - protected Action() + public KnownNeuron AsRegisterNeuron() + { + this.ValidateTag(ActionTag.RegisterNeuron); + return (KnownNeuron)this.Value!; + } + + public ManageNeuron AsManageNeuron() + { + this.ValidateTag(ActionTag.ManageNeuron); + return (ManageNeuron)this.Value!; + } + + public CreateServiceNervousSystem AsCreateServiceNervousSystem() + { + this.ValidateTag(ActionTag.CreateServiceNervousSystem); + return (CreateServiceNervousSystem)this.Value!; + } + + public ExecuteNnsFunction AsExecuteNnsFunction() + { + this.ValidateTag(ActionTag.ExecuteNnsFunction); + return (ExecuteNnsFunction)this.Value!; + } + + public RewardNodeProvider AsRewardNodeProvider() + { + this.ValidateTag(ActionTag.RewardNodeProvider); + return (RewardNodeProvider)this.Value!; + } + + public OpenSnsTokenSwap AsOpenSnsTokenSwap() + { + this.ValidateTag(ActionTag.OpenSnsTokenSwap); + return (OpenSnsTokenSwap)this.Value!; + } + + public SetSnsTokenSwapOpenTimeWindow AsSetSnsTokenSwapOpenTimeWindow() + { + this.ValidateTag(ActionTag.SetSnsTokenSwapOpenTimeWindow); + return (SetSnsTokenSwapOpenTimeWindow)this.Value!; + } + + public SetDefaultFollowees AsSetDefaultFollowees() + { + this.ValidateTag(ActionTag.SetDefaultFollowees); + return (SetDefaultFollowees)this.Value!; + } + + public RewardNodeProviders AsRewardNodeProviders() + { + this.ValidateTag(ActionTag.RewardNodeProviders); + return (RewardNodeProviders)this.Value!; + } + + public NetworkEconomics AsManageNetworkEconomics() + { + this.ValidateTag(ActionTag.ManageNetworkEconomics); + return (NetworkEconomics)this.Value!; + } + + public ApproveGenesisKyc AsApproveGenesisKyc() + { + this.ValidateTag(ActionTag.ApproveGenesisKyc); + return (ApproveGenesisKyc)this.Value!; + } + + public AddOrRemoveNodeProvider AsAddOrRemoveNodeProvider() + { + this.ValidateTag(ActionTag.AddOrRemoveNodeProvider); + return (AddOrRemoveNodeProvider)this.Value!; + } + + public Motion AsMotion() + { + this.ValidateTag(ActionTag.Motion); + return (Motion)this.Value!; + } + + private void ValidateTag(ActionTag tag) { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } } diff --git a/samples/Sample.Shared/Governance/Models/By.cs b/samples/Sample.Shared/Governance/Models/By.cs index 76cca6d5..07345192 100644 --- a/samples/Sample.Shared/Governance/Models/By.cs +++ b/samples/Sample.Shared/Governance/Models/By.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,12 +13,6 @@ public class By [VariantValueProperty()] public object? Value { get; set; } - public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - - public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - - public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } - public By(ByTag tag, object? value) { this.Tag = tag; @@ -28,6 +23,47 @@ protected By() { } + public static By NeuronIdOrSubaccount(By.NeuronIdOrSubaccountInfo info) + { + return new By(ByTag.NeuronIdOrSubaccount, info); + } + + public static By MemoAndController(ClaimOrRefreshNeuronFromAccount info) + { + return new By(ByTag.MemoAndController, info); + } + + public static By Memo(ulong info) + { + return new By(ByTag.Memo, info); + } + + public By.NeuronIdOrSubaccountInfo AsNeuronIdOrSubaccount() + { + this.ValidateTag(ByTag.NeuronIdOrSubaccount); + return (By.NeuronIdOrSubaccountInfo)this.Value!; + } + + public ClaimOrRefreshNeuronFromAccount AsMemoAndController() + { + this.ValidateTag(ByTag.MemoAndController); + return (ClaimOrRefreshNeuronFromAccount)this.Value!; + } + + public ulong AsMemo() + { + this.ValidateTag(ByTag.Memo); + return (ulong)this.Value!; + } + + private void ValidateTag(ByTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + public class NeuronIdOrSubaccountInfo { public NeuronIdOrSubaccountInfo() diff --git a/samples/Sample.Shared/Governance/Models/Change.cs b/samples/Sample.Shared/Governance/Models/Change.cs index 649b8e6e..563b885d 100644 --- a/samples/Sample.Shared/Governance/Models/Change.cs +++ b/samples/Sample.Shared/Governance/Models/Change.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Change [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - - public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } - public Change(ChangeTag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Change(ChangeTag tag, object? value) protected Change() { } + + public static Change ToRemove(NodeProvider info) + { + return new Change(ChangeTag.ToRemove, info); + } + + public static Change ToAdd(NodeProvider info) + { + return new Change(ChangeTag.ToAdd, info); + } + + public NodeProvider AsToRemove() + { + this.ValidateTag(ChangeTag.ToRemove); + return (NodeProvider)this.Value!; + } + + public NodeProvider AsToAdd() + { + this.ValidateTag(ChangeTag.ToAdd); + return (NodeProvider)this.Value!; + } + + private void ValidateTag(ChangeTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum ChangeTag diff --git a/samples/Sample.Shared/Governance/Models/Command.cs b/samples/Sample.Shared/Governance/Models/Command.cs index cefb4f2d..6ecab138 100644 --- a/samples/Sample.Shared/Governance/Models/Command.cs +++ b/samples/Sample.Shared/Governance/Models/Command.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,38 +13,154 @@ public class Command [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } - public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public static Command Spawn(Spawn info) + { + return new Command(CommandTag.Spawn, info); + } - public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public static Command Split(Split info) + { + return new Command(CommandTag.Split, info); + } - public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public static Command Follow(Follow info) + { + return new Command(CommandTag.Follow, info); + } - public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public static Command ClaimOrRefresh(ClaimOrRefresh info) + { + return new Command(CommandTag.ClaimOrRefresh, info); + } - public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public static Command Configure(Configure info) + { + return new Command(CommandTag.Configure, info); + } - public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public static Command RegisterVote(RegisterVote info) + { + return new Command(CommandTag.RegisterVote, info); + } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public static Command Merge(Merge info) + { + return new Command(CommandTag.Merge, info); + } - public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public static Command DisburseToNeuron(DisburseToNeuron info) + { + return new Command(CommandTag.DisburseToNeuron, info); + } - public StakeMaturity? StakeMaturity { get => this.Tag == CommandTag.StakeMaturity ? (StakeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.StakeMaturity, value); } + public static Command MakeProposal(Proposal info) + { + return new Command(CommandTag.MakeProposal, info); + } - public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public static Command StakeMaturity(StakeMaturity info) + { + return new Command(CommandTag.StakeMaturity, info); + } - public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public static Command MergeMaturity(MergeMaturity info) + { + return new Command(CommandTag.MergeMaturity, info); + } - public Command(CommandTag tag, object? value) + public static Command Disburse(Disburse info) { - this.Tag = tag; - this.Value = value; + return new Command(CommandTag.Disburse, info); } - protected Command() + public Spawn AsSpawn() + { + this.ValidateTag(CommandTag.Spawn); + return (Spawn)this.Value!; + } + + public Split AsSplit() + { + this.ValidateTag(CommandTag.Split); + return (Split)this.Value!; + } + + public Follow AsFollow() + { + this.ValidateTag(CommandTag.Follow); + return (Follow)this.Value!; + } + + public ClaimOrRefresh AsClaimOrRefresh() + { + this.ValidateTag(CommandTag.ClaimOrRefresh); + return (ClaimOrRefresh)this.Value!; + } + + public Configure AsConfigure() + { + this.ValidateTag(CommandTag.Configure); + return (Configure)this.Value!; + } + + public RegisterVote AsRegisterVote() + { + this.ValidateTag(CommandTag.RegisterVote); + return (RegisterVote)this.Value!; + } + + public Merge AsMerge() + { + this.ValidateTag(CommandTag.Merge); + return (Merge)this.Value!; + } + + public DisburseToNeuron AsDisburseToNeuron() + { + this.ValidateTag(CommandTag.DisburseToNeuron); + return (DisburseToNeuron)this.Value!; + } + + public Proposal AsMakeProposal() + { + this.ValidateTag(CommandTag.MakeProposal); + return (Proposal)this.Value!; + } + + public StakeMaturity AsStakeMaturity() + { + this.ValidateTag(CommandTag.StakeMaturity); + return (StakeMaturity)this.Value!; + } + + public MergeMaturity AsMergeMaturity() + { + this.ValidateTag(CommandTag.MergeMaturity); + return (MergeMaturity)this.Value!; + } + + public Disburse AsDisburse() + { + this.ValidateTag(CommandTag.Disburse); + return (Disburse)this.Value!; + } + + private void ValidateTag(CommandTag tag) { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } } diff --git a/samples/Sample.Shared/Governance/Models/Command1.cs b/samples/Sample.Shared/Governance/Models/Command1.cs index cc6fc372..4b974821 100644 --- a/samples/Sample.Shared/Governance/Models/Command1.cs +++ b/samples/Sample.Shared/Governance/Models/Command1.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,40 +13,165 @@ public class Command1 [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + public Command1(Command1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + protected Command1() + { + } - public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + public static Command1 Error(GovernanceError info) + { + return new Command1(Command1Tag.Error, info); + } - public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + public static Command1 Spawn(SpawnResponse info) + { + return new Command1(Command1Tag.Spawn, info); + } - public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + public static Command1 Split(SpawnResponse info) + { + return new Command1(Command1Tag.Split, info); + } - public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + public static Command1 Follow(Command1.FollowInfo info) + { + return new Command1(Command1Tag.Follow, info); + } - public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + public static Command1 ClaimOrRefresh(ClaimOrRefreshResponse info) + { + return new Command1(Command1Tag.ClaimOrRefresh, info); + } - public MergeResponse? Merge { get => this.Tag == Command1Tag.Merge ? (MergeResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + public static Command1 Configure(Command1.ConfigureInfo info) + { + return new Command1(Command1Tag.Configure, info); + } - public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + public static Command1 RegisterVote(Command1.RegisterVoteInfo info) + { + return new Command1(Command1Tag.RegisterVote, info); + } - public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + public static Command1 Merge(MergeResponse info) + { + return new Command1(Command1Tag.Merge, info); + } - public StakeMaturityResponse? StakeMaturity { get => this.Tag == Command1Tag.StakeMaturity ? (StakeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.StakeMaturity, value); } + public static Command1 DisburseToNeuron(SpawnResponse info) + { + return new Command1(Command1Tag.DisburseToNeuron, info); + } - public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + public static Command1 MakeProposal(MakeProposalResponse info) + { + return new Command1(Command1Tag.MakeProposal, info); + } - public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + public static Command1 StakeMaturity(StakeMaturityResponse info) + { + return new Command1(Command1Tag.StakeMaturity, info); + } - public Command1(Command1Tag tag, object? value) + public static Command1 MergeMaturity(MergeMaturityResponse info) { - this.Tag = tag; - this.Value = value; + return new Command1(Command1Tag.MergeMaturity, info); } - protected Command1() + public static Command1 Disburse(DisburseResponse info) + { + return new Command1(Command1Tag.Disburse, info); + } + + public GovernanceError AsError() + { + this.ValidateTag(Command1Tag.Error); + return (GovernanceError)this.Value!; + } + + public SpawnResponse AsSpawn() + { + this.ValidateTag(Command1Tag.Spawn); + return (SpawnResponse)this.Value!; + } + + public SpawnResponse AsSplit() + { + this.ValidateTag(Command1Tag.Split); + return (SpawnResponse)this.Value!; + } + + public Command1.FollowInfo AsFollow() + { + this.ValidateTag(Command1Tag.Follow); + return (Command1.FollowInfo)this.Value!; + } + + public ClaimOrRefreshResponse AsClaimOrRefresh() { + this.ValidateTag(Command1Tag.ClaimOrRefresh); + return (ClaimOrRefreshResponse)this.Value!; + } + + public Command1.ConfigureInfo AsConfigure() + { + this.ValidateTag(Command1Tag.Configure); + return (Command1.ConfigureInfo)this.Value!; + } + + public Command1.RegisterVoteInfo AsRegisterVote() + { + this.ValidateTag(Command1Tag.RegisterVote); + return (Command1.RegisterVoteInfo)this.Value!; + } + + public MergeResponse AsMerge() + { + this.ValidateTag(Command1Tag.Merge); + return (MergeResponse)this.Value!; + } + + public SpawnResponse AsDisburseToNeuron() + { + this.ValidateTag(Command1Tag.DisburseToNeuron); + return (SpawnResponse)this.Value!; + } + + public MakeProposalResponse AsMakeProposal() + { + this.ValidateTag(Command1Tag.MakeProposal); + return (MakeProposalResponse)this.Value!; + } + + public StakeMaturityResponse AsStakeMaturity() + { + this.ValidateTag(Command1Tag.StakeMaturity); + return (StakeMaturityResponse)this.Value!; + } + + public MergeMaturityResponse AsMergeMaturity() + { + this.ValidateTag(Command1Tag.MergeMaturity); + return (MergeMaturityResponse)this.Value!; + } + + public DisburseResponse AsDisburse() + { + this.ValidateTag(Command1Tag.Disburse); + return (DisburseResponse)this.Value!; + } + + private void ValidateTag(Command1Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } public class FollowInfo diff --git a/samples/Sample.Shared/Governance/Models/Command2.cs b/samples/Sample.Shared/Governance/Models/Command2.cs index d33c44a0..43deeefd 100644 --- a/samples/Sample.Shared/Governance/Models/Command2.cs +++ b/samples/Sample.Shared/Governance/Models/Command2.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,32 +13,121 @@ public class Command2 [VariantValueProperty()] public object? Value { get; set; } - public NeuronId? Spawn { get => this.Tag == Command2Tag.Spawn ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + public Command2(Command2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + protected Command2() + { + } - public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + public static Command2 Spawn(NeuronId info) + { + return new Command2(Command2Tag.Spawn, info); + } - public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + public static Command2 Split(Split info) + { + return new Command2(Command2Tag.Split, info); + } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + public static Command2 Configure(Configure info) + { + return new Command2(Command2Tag.Configure, info); + } - public Command2.SyncCommandInfo? SyncCommand { get => this.Tag == Command2Tag.SyncCommand ? (Command2.SyncCommandInfo)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.SyncCommand, value); } + public static Command2 Merge(Merge info) + { + return new Command2(Command2Tag.Merge, info); + } - public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + public static Command2 DisburseToNeuron(DisburseToNeuron info) + { + return new Command2(Command2Tag.DisburseToNeuron, info); + } - public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + public static Command2 SyncCommand(Command2.SyncCommandInfo info) + { + return new Command2(Command2Tag.SyncCommand, info); + } + + public static Command2 ClaimOrRefreshNeuron(ClaimOrRefresh info) + { + return new Command2(Command2Tag.ClaimOrRefreshNeuron, info); + } - public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + public static Command2 MergeMaturity(MergeMaturity info) + { + return new Command2(Command2Tag.MergeMaturity, info); + } - public Command2(Command2Tag tag, object? value) + public static Command2 Disburse(Disburse info) { - this.Tag = tag; - this.Value = value; + return new Command2(Command2Tag.Disburse, info); } - protected Command2() + public NeuronId AsSpawn() { + this.ValidateTag(Command2Tag.Spawn); + return (NeuronId)this.Value!; + } + + public Split AsSplit() + { + this.ValidateTag(Command2Tag.Split); + return (Split)this.Value!; + } + + public Configure AsConfigure() + { + this.ValidateTag(Command2Tag.Configure); + return (Configure)this.Value!; + } + + public Merge AsMerge() + { + this.ValidateTag(Command2Tag.Merge); + return (Merge)this.Value!; + } + + public DisburseToNeuron AsDisburseToNeuron() + { + this.ValidateTag(Command2Tag.DisburseToNeuron); + return (DisburseToNeuron)this.Value!; + } + + public Command2.SyncCommandInfo AsSyncCommand() + { + this.ValidateTag(Command2Tag.SyncCommand); + return (Command2.SyncCommandInfo)this.Value!; + } + + public ClaimOrRefresh AsClaimOrRefreshNeuron() + { + this.ValidateTag(Command2Tag.ClaimOrRefreshNeuron); + return (ClaimOrRefresh)this.Value!; + } + + public MergeMaturity AsMergeMaturity() + { + this.ValidateTag(Command2Tag.MergeMaturity); + return (MergeMaturity)this.Value!; + } + + public Disburse AsDisburse() + { + this.ValidateTag(Command2Tag.Disburse); + return (Disburse)this.Value!; + } + + private void ValidateTag(Command2Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } public class SyncCommandInfo diff --git a/samples/Sample.Shared/Governance/Models/DissolveState.cs b/samples/Sample.Shared/Governance/Models/DissolveState.cs index d93a67ee..96dca45d 100644 --- a/samples/Sample.Shared/Governance/Models/DissolveState.cs +++ b/samples/Sample.Shared/Governance/Models/DissolveState.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class DissolveState [VariantValueProperty()] public object? Value { get; set; } - public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - - public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } - public DissolveState(DissolveStateTag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public DissolveState(DissolveStateTag tag, object? value) protected DissolveState() { } + + public static DissolveState DissolveDelaySeconds(ulong info) + { + return new DissolveState(DissolveStateTag.DissolveDelaySeconds, info); + } + + public static DissolveState WhenDissolvedTimestampSeconds(ulong info) + { + return new DissolveState(DissolveStateTag.WhenDissolvedTimestampSeconds, info); + } + + public ulong AsDissolveDelaySeconds() + { + this.ValidateTag(DissolveStateTag.DissolveDelaySeconds); + return (ulong)this.Value!; + } + + public ulong AsWhenDissolvedTimestampSeconds() + { + this.ValidateTag(DissolveStateTag.WhenDissolvedTimestampSeconds); + return (ulong)this.Value!; + } + + private void ValidateTag(DissolveStateTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum DissolveStateTag diff --git a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs index 2d81edf0..4822b6d1 100644 --- a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs +++ b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs @@ -1,6 +1,7 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; using System.Collections.Generic; +using System; namespace Sample.Shared.Governance.Models { @@ -13,10 +14,6 @@ public class NeuronIdOrSubaccount [VariantValueProperty()] public object? Value { get; set; } - public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - - public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } - public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) protected NeuronIdOrSubaccount() { } + + public static NeuronIdOrSubaccount Subaccount(List info) + { + return new NeuronIdOrSubaccount(NeuronIdOrSubaccountTag.Subaccount, info); + } + + public static NeuronIdOrSubaccount NeuronId(NeuronId info) + { + return new NeuronIdOrSubaccount(NeuronIdOrSubaccountTag.NeuronId, info); + } + + public List AsSubaccount() + { + this.ValidateTag(NeuronIdOrSubaccountTag.Subaccount); + return (List)this.Value!; + } + + public NeuronId AsNeuronId() + { + this.ValidateTag(NeuronIdOrSubaccountTag.NeuronId); + return (NeuronId)this.Value!; + } + + private void ValidateTag(NeuronIdOrSubaccountTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum NeuronIdOrSubaccountTag diff --git a/samples/Sample.Shared/Governance/Models/Operation.cs b/samples/Sample.Shared/Governance/Models/Operation.cs index 30bc5eaa..fc3612bd 100644 --- a/samples/Sample.Shared/Governance/Models/Operation.cs +++ b/samples/Sample.Shared/Governance/Models/Operation.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,32 +13,121 @@ public class Operation [VariantValueProperty()] public object? Value { get; set; } - public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + protected Operation() + { + } - public ChangeAutoStakeMaturity? ChangeAutoStakeMaturity { get => this.Tag == OperationTag.ChangeAutoStakeMaturity ? (ChangeAutoStakeMaturity)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.ChangeAutoStakeMaturity, value); } + public static Operation RemoveHotKey(RemoveHotKey info) + { + return new Operation(OperationTag.RemoveHotKey, info); + } - public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public static Operation AddHotKey(AddHotKey info) + { + return new Operation(OperationTag.AddHotKey, info); + } - public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public static Operation ChangeAutoStakeMaturity(ChangeAutoStakeMaturity info) + { + return new Operation(OperationTag.ChangeAutoStakeMaturity, info); + } - public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public static Operation StopDissolving(Operation.StopDissolvingInfo info) + { + return new Operation(OperationTag.StopDissolving, info); + } - public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public static Operation StartDissolving(Operation.StartDissolvingInfo info) + { + return new Operation(OperationTag.StartDissolving, info); + } - public Operation.LeaveCommunityFundInfo? LeaveCommunityFund { get => this.Tag == OperationTag.LeaveCommunityFund ? (Operation.LeaveCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.LeaveCommunityFund, value); } + public static Operation IncreaseDissolveDelay(IncreaseDissolveDelay info) + { + return new Operation(OperationTag.IncreaseDissolveDelay, info); + } + + public static Operation JoinCommunityFund(Operation.JoinCommunityFundInfo info) + { + return new Operation(OperationTag.JoinCommunityFund, info); + } - public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public static Operation LeaveCommunityFund(Operation.LeaveCommunityFundInfo info) + { + return new Operation(OperationTag.LeaveCommunityFund, info); + } - public Operation(OperationTag tag, object? value) + public static Operation SetDissolveTimestamp(SetDissolveTimestamp info) { - this.Tag = tag; - this.Value = value; + return new Operation(OperationTag.SetDissolveTimestamp, info); } - protected Operation() + public RemoveHotKey AsRemoveHotKey() { + this.ValidateTag(OperationTag.RemoveHotKey); + return (RemoveHotKey)this.Value!; + } + + public AddHotKey AsAddHotKey() + { + this.ValidateTag(OperationTag.AddHotKey); + return (AddHotKey)this.Value!; + } + + public ChangeAutoStakeMaturity AsChangeAutoStakeMaturity() + { + this.ValidateTag(OperationTag.ChangeAutoStakeMaturity); + return (ChangeAutoStakeMaturity)this.Value!; + } + + public Operation.StopDissolvingInfo AsStopDissolving() + { + this.ValidateTag(OperationTag.StopDissolving); + return (Operation.StopDissolvingInfo)this.Value!; + } + + public Operation.StartDissolvingInfo AsStartDissolving() + { + this.ValidateTag(OperationTag.StartDissolving); + return (Operation.StartDissolvingInfo)this.Value!; + } + + public IncreaseDissolveDelay AsIncreaseDissolveDelay() + { + this.ValidateTag(OperationTag.IncreaseDissolveDelay); + return (IncreaseDissolveDelay)this.Value!; + } + + public Operation.JoinCommunityFundInfo AsJoinCommunityFund() + { + this.ValidateTag(OperationTag.JoinCommunityFund); + return (Operation.JoinCommunityFundInfo)this.Value!; + } + + public Operation.LeaveCommunityFundInfo AsLeaveCommunityFund() + { + this.ValidateTag(OperationTag.LeaveCommunityFund); + return (Operation.LeaveCommunityFundInfo)this.Value!; + } + + public SetDissolveTimestamp AsSetDissolveTimestamp() + { + this.ValidateTag(OperationTag.SetDissolveTimestamp); + return (SetDissolveTimestamp)this.Value!; + } + + private void ValidateTag(OperationTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } public class StopDissolvingInfo diff --git a/samples/Sample.Shared/Governance/Models/Progress.cs b/samples/Sample.Shared/Governance/Models/Progress.cs index 0301433a..d94733f3 100644 --- a/samples/Sample.Shared/Governance/Models/Progress.cs +++ b/samples/Sample.Shared/Governance/Models/Progress.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,8 +13,6 @@ public class Progress [VariantValueProperty()] public object? Value { get; set; } - public NeuronId? LastNeuronId { get => this.Tag == ProgressTag.LastNeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (ProgressTag.LastNeuronId, value); } - public Progress(ProgressTag tag, object? value) { this.Tag = tag; @@ -23,6 +22,25 @@ public Progress(ProgressTag tag, object? value) protected Progress() { } + + public static Progress LastNeuronId(NeuronId info) + { + return new Progress(ProgressTag.LastNeuronId, info); + } + + public NeuronId AsLastNeuronId() + { + this.ValidateTag(ProgressTag.LastNeuronId); + return (NeuronId)this.Value!; + } + + private void ValidateTag(ProgressTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum ProgressTag diff --git a/samples/Sample.Shared/Governance/Models/Result.cs b/samples/Sample.Shared/Governance/Models/Result.cs index 0105448f..a28ad572 100644 --- a/samples/Sample.Shared/Governance/Models/Result.cs +++ b/samples/Sample.Shared/Governance/Models/Result.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,8 +13,6 @@ public class Result [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } - public Result(ResultTag tag, object? value) { this.Tag = tag; @@ -23,6 +22,30 @@ public Result(ResultTag tag, object? value) protected Result() { } + + public static Result Ok() + { + return new Result(ResultTag.Ok, null); + } + + public static Result Err(GovernanceError info) + { + return new Result(ResultTag.Err, info); + } + + public GovernanceError AsErr() + { + this.ValidateTag(ResultTag.Err); + return (GovernanceError)this.Value!; + } + + private void ValidateTag(ResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum ResultTag diff --git a/samples/Sample.Shared/Governance/Models/Result1.cs b/samples/Sample.Shared/Governance/Models/Result1.cs index beb4b916..fd43e2ba 100644 --- a/samples/Sample.Shared/Governance/Models/Result1.cs +++ b/samples/Sample.Shared/Governance/Models/Result1.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result1 [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } - - public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } - public Result1(Result1Tag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Result1(Result1Tag tag, object? value) protected Result1() { } + + public static Result1 Error(GovernanceError info) + { + return new Result1(Result1Tag.Error, info); + } + + public static Result1 NeuronId(NeuronId info) + { + return new Result1(Result1Tag.NeuronId, info); + } + + public GovernanceError AsError() + { + this.ValidateTag(Result1Tag.Error); + return (GovernanceError)this.Value!; + } + + public NeuronId AsNeuronId() + { + this.ValidateTag(Result1Tag.NeuronId); + return (NeuronId)this.Value!; + } + + private void ValidateTag(Result1Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum Result1Tag diff --git a/samples/Sample.Shared/Governance/Models/Result2.cs b/samples/Sample.Shared/Governance/Models/Result2.cs index dd5b0d7a..673f09fc 100644 --- a/samples/Sample.Shared/Governance/Models/Result2.cs +++ b/samples/Sample.Shared/Governance/Models/Result2.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result2 [VariantValueProperty()] public object? Value { get; set; } - public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } - - public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } - public Result2(Result2Tag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Result2(Result2Tag tag, object? value) protected Result2() { } + + public static Result2 Ok(Neuron info) + { + return new Result2(Result2Tag.Ok, info); + } + + public static Result2 Err(GovernanceError info) + { + return new Result2(Result2Tag.Err, info); + } + + public Neuron AsOk() + { + this.ValidateTag(Result2Tag.Ok); + return (Neuron)this.Value!; + } + + public GovernanceError AsErr() + { + this.ValidateTag(Result2Tag.Err); + return (GovernanceError)this.Value!; + } + + private void ValidateTag(Result2Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum Result2Tag diff --git a/samples/Sample.Shared/Governance/Models/Result3.cs b/samples/Sample.Shared/Governance/Models/Result3.cs index 902e764f..d1f83ee0 100644 --- a/samples/Sample.Shared/Governance/Models/Result3.cs +++ b/samples/Sample.Shared/Governance/Models/Result3.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result3 [VariantValueProperty()] public object? Value { get; set; } - public GovernanceCachedMetrics? Ok { get => this.Tag == Result3Tag.Ok ? (GovernanceCachedMetrics)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } - - public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } - public Result3(Result3Tag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Result3(Result3Tag tag, object? value) protected Result3() { } + + public static Result3 Ok(GovernanceCachedMetrics info) + { + return new Result3(Result3Tag.Ok, info); + } + + public static Result3 Err(GovernanceError info) + { + return new Result3(Result3Tag.Err, info); + } + + public GovernanceCachedMetrics AsOk() + { + this.ValidateTag(Result3Tag.Ok); + return (GovernanceCachedMetrics)this.Value!; + } + + public GovernanceError AsErr() + { + this.ValidateTag(Result3Tag.Err); + return (GovernanceError)this.Value!; + } + + private void ValidateTag(Result3Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum Result3Tag diff --git a/samples/Sample.Shared/Governance/Models/Result4.cs b/samples/Sample.Shared/Governance/Models/Result4.cs index 9fb942dd..039d7ac3 100644 --- a/samples/Sample.Shared/Governance/Models/Result4.cs +++ b/samples/Sample.Shared/Governance/Models/Result4.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result4 [VariantValueProperty()] public object? Value { get; set; } - public RewardNodeProviders? Ok { get => this.Tag == Result4Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } - - public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } - public Result4(Result4Tag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Result4(Result4Tag tag, object? value) protected Result4() { } + + public static Result4 Ok(RewardNodeProviders info) + { + return new Result4(Result4Tag.Ok, info); + } + + public static Result4 Err(GovernanceError info) + { + return new Result4(Result4Tag.Err, info); + } + + public RewardNodeProviders AsOk() + { + this.ValidateTag(Result4Tag.Ok); + return (RewardNodeProviders)this.Value!; + } + + public GovernanceError AsErr() + { + this.ValidateTag(Result4Tag.Err); + return (GovernanceError)this.Value!; + } + + private void ValidateTag(Result4Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum Result4Tag diff --git a/samples/Sample.Shared/Governance/Models/Result5.cs b/samples/Sample.Shared/Governance/Models/Result5.cs index a384e9b0..0a5758fa 100644 --- a/samples/Sample.Shared/Governance/Models/Result5.cs +++ b/samples/Sample.Shared/Governance/Models/Result5.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result5 [VariantValueProperty()] public object? Value { get; set; } - public NeuronInfo? Ok { get => this.Tag == Result5Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } - - public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } - public Result5(Result5Tag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Result5(Result5Tag tag, object? value) protected Result5() { } + + public static Result5 Ok(NeuronInfo info) + { + return new Result5(Result5Tag.Ok, info); + } + + public static Result5 Err(GovernanceError info) + { + return new Result5(Result5Tag.Err, info); + } + + public NeuronInfo AsOk() + { + this.ValidateTag(Result5Tag.Ok); + return (NeuronInfo)this.Value!; + } + + public GovernanceError AsErr() + { + this.ValidateTag(Result5Tag.Err); + return (GovernanceError)this.Value!; + } + + private void ValidateTag(Result5Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum Result5Tag diff --git a/samples/Sample.Shared/Governance/Models/Result6.cs b/samples/Sample.Shared/Governance/Models/Result6.cs index 0e47dab5..e4226631 100644 --- a/samples/Sample.Shared/Governance/Models/Result6.cs +++ b/samples/Sample.Shared/Governance/Models/Result6.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result6 [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? Ok { get => this.Tag == Result6Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result6Tag.Ok, value); } - - public GovernanceError? Err { get => this.Tag == Result6Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result6Tag.Err, value); } - public Result6(Result6Tag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public Result6(Result6Tag tag, object? value) protected Result6() { } + + public static Result6 Ok(NodeProvider info) + { + return new Result6(Result6Tag.Ok, info); + } + + public static Result6 Err(GovernanceError info) + { + return new Result6(Result6Tag.Err, info); + } + + public NodeProvider AsOk() + { + this.ValidateTag(Result6Tag.Ok); + return (NodeProvider)this.Value!; + } + + public GovernanceError AsErr() + { + this.ValidateTag(Result6Tag.Err); + return (GovernanceError)this.Value!; + } + + private void ValidateTag(Result6Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum Result6Tag diff --git a/samples/Sample.Shared/Governance/Models/Result7.cs b/samples/Sample.Shared/Governance/Models/Result7.cs index f506ba8c..ac88252a 100644 --- a/samples/Sample.Shared/Governance/Models/Result7.cs +++ b/samples/Sample.Shared/Governance/Models/Result7.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class Result7 [VariantValueProperty()] public object? Value { get; set; } - public Committed? Committed { get => this.Tag == Result7Tag.Committed ? (Committed)this.Value : default; set => (this.Tag, this.Value) = (Result7Tag.Committed, value); } - - public Result7.AbortedInfo? Aborted { get => this.Tag == Result7Tag.Aborted ? (Result7.AbortedInfo)this.Value : default; set => (this.Tag, this.Value) = (Result7Tag.Aborted, value); } - public Result7(Result7Tag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ protected Result7() { } + public static Result7 Committed(Committed info) + { + return new Result7(Result7Tag.Committed, info); + } + + public static Result7 Aborted(Result7.AbortedInfo info) + { + return new Result7(Result7Tag.Aborted, info); + } + + public Committed AsCommitted() + { + this.ValidateTag(Result7Tag.Committed); + return (Committed)this.Value!; + } + + public Result7.AbortedInfo AsAborted() + { + this.ValidateTag(Result7Tag.Aborted); + return (Result7.AbortedInfo)this.Value!; + } + + private void ValidateTag(Result7Tag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + public class AbortedInfo { public AbortedInfo() diff --git a/samples/Sample.Shared/Governance/Models/RewardMode.cs b/samples/Sample.Shared/Governance/Models/RewardMode.cs index 66b3306c..dd6a8b8a 100644 --- a/samples/Sample.Shared/Governance/Models/RewardMode.cs +++ b/samples/Sample.Shared/Governance/Models/RewardMode.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Governance.Models; +using System; namespace Sample.Shared.Governance.Models { @@ -12,10 +13,6 @@ public class RewardMode [VariantValueProperty()] public object? Value { get; set; } - public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - - public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } - public RewardMode(RewardModeTag tag, object? value) { this.Tag = tag; @@ -25,6 +22,36 @@ public RewardMode(RewardModeTag tag, object? value) protected RewardMode() { } + + public static RewardMode RewardToNeuron(RewardToNeuron info) + { + return new RewardMode(RewardModeTag.RewardToNeuron, info); + } + + public static RewardMode RewardToAccount(RewardToAccount info) + { + return new RewardMode(RewardModeTag.RewardToAccount, info); + } + + public RewardToNeuron AsRewardToNeuron() + { + this.ValidateTag(RewardModeTag.RewardToNeuron); + return (RewardToNeuron)this.Value!; + } + + public RewardToAccount AsRewardToAccount() + { + this.ValidateTag(RewardModeTag.RewardToAccount); + return (RewardToAccount)this.Value!; + } + + private void ValidateTag(RewardModeTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum RewardModeTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs index 61822f94..c7a67d1b 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; using Timestamp = System.UInt64; @@ -15,28 +16,109 @@ public class ApproveError [VariantValueProperty()] public object? Value { get; set; } - public ApproveError.GenericErrorInfo? GenericError { get => this.Tag == ApproveErrorTag.GenericError ? (ApproveError.GenericErrorInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.GenericError, value); } + public ApproveError(ApproveErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public ApproveError.DuplicateInfo? Duplicate { get => this.Tag == ApproveErrorTag.Duplicate ? (ApproveError.DuplicateInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.Duplicate, value); } + protected ApproveError() + { + } - public ApproveError.BadFeeInfo? BadFee { get => this.Tag == ApproveErrorTag.BadFee ? (ApproveError.BadFeeInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.BadFee, value); } + public static ApproveError GenericError(ApproveError.GenericErrorInfo info) + { + return new ApproveError(ApproveErrorTag.GenericError, info); + } - public ApproveError.AllowanceChangedInfo? AllowanceChanged { get => this.Tag == ApproveErrorTag.AllowanceChanged ? (ApproveError.AllowanceChangedInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.AllowanceChanged, value); } + public static ApproveError TemporarilyUnavailable() + { + return new ApproveError(ApproveErrorTag.TemporarilyUnavailable, null); + } - public ApproveError.CreatedInFutureInfo? CreatedInFuture { get => this.Tag == ApproveErrorTag.CreatedInFuture ? (ApproveError.CreatedInFutureInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.CreatedInFuture, value); } + public static ApproveError Duplicate(ApproveError.DuplicateInfo info) + { + return new ApproveError(ApproveErrorTag.Duplicate, info); + } - public ApproveError.ExpiredInfo? Expired { get => this.Tag == ApproveErrorTag.Expired ? (ApproveError.ExpiredInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.Expired, value); } + public static ApproveError BadFee(ApproveError.BadFeeInfo info) + { + return new ApproveError(ApproveErrorTag.BadFee, info); + } - public ApproveError.InsufficientFundsInfo? InsufficientFunds { get => this.Tag == ApproveErrorTag.InsufficientFunds ? (ApproveError.InsufficientFundsInfo)this.Value : default; set => (this.Tag, this.Value) = (ApproveErrorTag.InsufficientFunds, value); } + public static ApproveError AllowanceChanged(ApproveError.AllowanceChangedInfo info) + { + return new ApproveError(ApproveErrorTag.AllowanceChanged, info); + } - public ApproveError(ApproveErrorTag tag, object? value) + public static ApproveError CreatedInFuture(ApproveError.CreatedInFutureInfo info) { - this.Tag = tag; - this.Value = value; + return new ApproveError(ApproveErrorTag.CreatedInFuture, info); } - protected ApproveError() + public static ApproveError TooOld() + { + return new ApproveError(ApproveErrorTag.TooOld, null); + } + + public static ApproveError Expired(ApproveError.ExpiredInfo info) + { + return new ApproveError(ApproveErrorTag.Expired, info); + } + + public static ApproveError InsufficientFunds(ApproveError.InsufficientFundsInfo info) + { + return new ApproveError(ApproveErrorTag.InsufficientFunds, info); + } + + public ApproveError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(ApproveErrorTag.GenericError); + return (ApproveError.GenericErrorInfo)this.Value!; + } + + public ApproveError.DuplicateInfo AsDuplicate() { + this.ValidateTag(ApproveErrorTag.Duplicate); + return (ApproveError.DuplicateInfo)this.Value!; + } + + public ApproveError.BadFeeInfo AsBadFee() + { + this.ValidateTag(ApproveErrorTag.BadFee); + return (ApproveError.BadFeeInfo)this.Value!; + } + + public ApproveError.AllowanceChangedInfo AsAllowanceChanged() + { + this.ValidateTag(ApproveErrorTag.AllowanceChanged); + return (ApproveError.AllowanceChangedInfo)this.Value!; + } + + public ApproveError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(ApproveErrorTag.CreatedInFuture); + return (ApproveError.CreatedInFutureInfo)this.Value!; + } + + public ApproveError.ExpiredInfo AsExpired() + { + this.ValidateTag(ApproveErrorTag.Expired); + return (ApproveError.ExpiredInfo)this.Value!; + } + + public ApproveError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(ApproveErrorTag.InsufficientFunds); + return (ApproveError.InsufficientFundsInfo)this.Value!; + } + + private void ValidateTag(ApproveErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } public class GenericErrorInfo diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs index e825b1fa..5fd7c701 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models @@ -13,10 +14,6 @@ public class ApproveResult [VariantValueProperty()] public object? Value { get; set; } - public BlockIndex? Ok { get => this.Tag == ApproveResultTag.Ok ? (BlockIndex)this.Value : default; set => (this.Tag, this.Value) = (ApproveResultTag.Ok, value); } - - public ApproveError? Err { get => this.Tag == ApproveResultTag.Err ? (ApproveError)this.Value : default; set => (this.Tag, this.Value) = (ApproveResultTag.Err, value); } - public ApproveResult(ApproveResultTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public ApproveResult(ApproveResultTag tag, object? value) protected ApproveResult() { } + + public static ApproveResult Ok(BlockIndex info) + { + return new ApproveResult(ApproveResultTag.Ok, info); + } + + public static ApproveResult Err(ApproveError info) + { + return new ApproveResult(ApproveResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(ApproveResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public ApproveError AsErr() + { + this.ValidateTag(ApproveResultTag.Err); + return (ApproveError)this.Value!; + } + + private void ValidateTag(ApproveResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum ApproveResultTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs index 53df9b99..deddac03 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; namespace Sample.Shared.ICRC1Ledger.Models { @@ -12,8 +13,6 @@ public class ChangeFeeCollector [VariantValueProperty()] public object? Value { get; set; } - public Account? SetTo { get => this.Tag == ChangeFeeCollectorTag.SetTo ? (Account)this.Value : default; set => (this.Tag, this.Value) = (ChangeFeeCollectorTag.SetTo, value); } - public ChangeFeeCollector(ChangeFeeCollectorTag tag, object? value) { this.Tag = tag; @@ -23,6 +22,30 @@ public ChangeFeeCollector(ChangeFeeCollectorTag tag, object? value) protected ChangeFeeCollector() { } + + public static ChangeFeeCollector Unset() + { + return new ChangeFeeCollector(ChangeFeeCollectorTag.Unset, null); + } + + public static ChangeFeeCollector SetTo(Account info) + { + return new ChangeFeeCollector(ChangeFeeCollectorTag.SetTo, info); + } + + public Account AsSetTo() + { + this.ValidateTag(ChangeFeeCollectorTag.SetTo); + return (Account)this.Value!; + } + + private void ValidateTag(ChangeFeeCollectorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum ChangeFeeCollectorTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs index e17c821d..9945c6d5 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs @@ -1,6 +1,7 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; using EdjCase.ICP.Candid.Models; +using System; namespace Sample.Shared.ICRC1Ledger.Models { @@ -13,10 +14,6 @@ public class LedgerArg [VariantValueProperty()] public object? Value { get; set; } - public InitArgs? Init { get => this.Tag == LedgerArgTag.Init ? (InitArgs)this.Value : default; set => (this.Tag, this.Value) = (LedgerArgTag.Init, value); } - - public OptionalValue? Upgrade { get => this.Tag == LedgerArgTag.Upgrade ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (LedgerArgTag.Upgrade, value); } - public LedgerArg(LedgerArgTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public LedgerArg(LedgerArgTag tag, object? value) protected LedgerArg() { } + + public static LedgerArg Init(InitArgs info) + { + return new LedgerArg(LedgerArgTag.Init, info); + } + + public static LedgerArg Upgrade(OptionalValue info) + { + return new LedgerArg(LedgerArgTag.Upgrade, info); + } + + public InitArgs AsInit() + { + this.ValidateTag(LedgerArgTag.Init); + return (InitArgs)this.Value!; + } + + public OptionalValue AsUpgrade() + { + this.ValidateTag(LedgerArgTag.Upgrade); + return (OptionalValue)this.Value!; + } + + private void ValidateTag(LedgerArgTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum LedgerArgTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs index e00f0a53..4aabcdd6 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs @@ -2,6 +2,7 @@ using Sample.Shared.ICRC1Ledger.Models; using EdjCase.ICP.Candid.Models; using System.Collections.Generic; +using System; namespace Sample.Shared.ICRC1Ledger.Models { @@ -14,14 +15,6 @@ public class MetadataValue [VariantValueProperty()] public object? Value { get; set; } - public UnboundedUInt? Nat { get => this.Tag == MetadataValueTag.Nat ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Nat, value); } - - public UnboundedInt? Int { get => this.Tag == MetadataValueTag.Int ? (UnboundedInt)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Int, value); } - - public string? Text { get => this.Tag == MetadataValueTag.Text ? (string)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Text, value); } - - public List? Blob { get => this.Tag == MetadataValueTag.Blob ? (List)this.Value : default; set => (this.Tag, this.Value) = (MetadataValueTag.Blob, value); } - public MetadataValue(MetadataValueTag tag, object? value) { this.Tag = tag; @@ -31,6 +24,58 @@ public MetadataValue(MetadataValueTag tag, object? value) protected MetadataValue() { } + + public static MetadataValue Nat(UnboundedUInt info) + { + return new MetadataValue(MetadataValueTag.Nat, info); + } + + public static MetadataValue Int(UnboundedInt info) + { + return new MetadataValue(MetadataValueTag.Int, info); + } + + public static MetadataValue Text(string info) + { + return new MetadataValue(MetadataValueTag.Text, info); + } + + public static MetadataValue Blob(List info) + { + return new MetadataValue(MetadataValueTag.Blob, info); + } + + public UnboundedUInt AsNat() + { + this.ValidateTag(MetadataValueTag.Nat); + return (UnboundedUInt)this.Value!; + } + + public UnboundedInt AsInt() + { + this.ValidateTag(MetadataValueTag.Int); + return (UnboundedInt)this.Value!; + } + + public string AsText() + { + this.ValidateTag(MetadataValueTag.Text); + return (string)this.Value!; + } + + public List AsBlob() + { + this.ValidateTag(MetadataValueTag.Blob); + return (List)this.Value!; + } + + private void ValidateTag(MetadataValueTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum MetadataValueTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs index 4ac2f391..2ed753c7 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; using Timestamp = System.UInt64; @@ -16,26 +17,98 @@ public class TransferError [VariantValueProperty()] public object? Value { get; set; } - public TransferError.BadFeeInfo? BadFee { get => this.Tag == TransferErrorTag.BadFee ? (TransferError.BadFeeInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.BadFee, value); } + public TransferError(TransferErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public TransferError.BadBurnInfo? BadBurn { get => this.Tag == TransferErrorTag.BadBurn ? (TransferError.BadBurnInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.BadBurn, value); } + protected TransferError() + { + } - public TransferError.InsufficientFundsInfo? InsufficientFunds { get => this.Tag == TransferErrorTag.InsufficientFunds ? (TransferError.InsufficientFundsInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.InsufficientFunds, value); } + public static TransferError BadFee(TransferError.BadFeeInfo info) + { + return new TransferError(TransferErrorTag.BadFee, info); + } - public TransferError.CreatedInFutureInfo? CreatedInFuture { get => this.Tag == TransferErrorTag.CreatedInFuture ? (TransferError.CreatedInFutureInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.CreatedInFuture, value); } + public static TransferError BadBurn(TransferError.BadBurnInfo info) + { + return new TransferError(TransferErrorTag.BadBurn, info); + } - public TransferError.DuplicateInfo? Duplicate { get => this.Tag == TransferErrorTag.Duplicate ? (TransferError.DuplicateInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.Duplicate, value); } + public static TransferError InsufficientFunds(TransferError.InsufficientFundsInfo info) + { + return new TransferError(TransferErrorTag.InsufficientFunds, info); + } - public TransferError.GenericErrorInfo? GenericError { get => this.Tag == TransferErrorTag.GenericError ? (TransferError.GenericErrorInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferErrorTag.GenericError, value); } + public static TransferError TooOld() + { + return new TransferError(TransferErrorTag.TooOld, null); + } - public TransferError(TransferErrorTag tag, object? value) + public static TransferError CreatedInFuture(TransferError.CreatedInFutureInfo info) { - this.Tag = tag; - this.Value = value; + return new TransferError(TransferErrorTag.CreatedInFuture, info); } - protected TransferError() + public static TransferError TemporarilyUnavailable() + { + return new TransferError(TransferErrorTag.TemporarilyUnavailable, null); + } + + public static TransferError Duplicate(TransferError.DuplicateInfo info) { + return new TransferError(TransferErrorTag.Duplicate, info); + } + + public static TransferError GenericError(TransferError.GenericErrorInfo info) + { + return new TransferError(TransferErrorTag.GenericError, info); + } + + public TransferError.BadFeeInfo AsBadFee() + { + this.ValidateTag(TransferErrorTag.BadFee); + return (TransferError.BadFeeInfo)this.Value!; + } + + public TransferError.BadBurnInfo AsBadBurn() + { + this.ValidateTag(TransferErrorTag.BadBurn); + return (TransferError.BadBurnInfo)this.Value!; + } + + public TransferError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(TransferErrorTag.InsufficientFunds); + return (TransferError.InsufficientFundsInfo)this.Value!; + } + + public TransferError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(TransferErrorTag.CreatedInFuture); + return (TransferError.CreatedInFutureInfo)this.Value!; + } + + public TransferError.DuplicateInfo AsDuplicate() + { + this.ValidateTag(TransferErrorTag.Duplicate); + return (TransferError.DuplicateInfo)this.Value!; + } + + public TransferError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(TransferErrorTag.GenericError); + return (TransferError.GenericErrorInfo)this.Value!; + } + + private void ValidateTag(TransferErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } public class BadFeeInfo diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs index 935df949..04f193d4 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; using Timestamp = System.UInt64; @@ -16,28 +17,109 @@ public class TransferFromError [VariantValueProperty()] public object? Value { get; set; } - public TransferFromError.BadFeeInfo? BadFee { get => this.Tag == TransferFromErrorTag.BadFee ? (TransferFromError.BadFeeInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.BadFee, value); } + public TransferFromError(TransferFromErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } - public TransferFromError.BadBurnInfo? BadBurn { get => this.Tag == TransferFromErrorTag.BadBurn ? (TransferFromError.BadBurnInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.BadBurn, value); } + protected TransferFromError() + { + } - public TransferFromError.InsufficientFundsInfo? InsufficientFunds { get => this.Tag == TransferFromErrorTag.InsufficientFunds ? (TransferFromError.InsufficientFundsInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.InsufficientFunds, value); } + public static TransferFromError BadFee(TransferFromError.BadFeeInfo info) + { + return new TransferFromError(TransferFromErrorTag.BadFee, info); + } - public TransferFromError.InsufficientAllowanceInfo? InsufficientAllowance { get => this.Tag == TransferFromErrorTag.InsufficientAllowance ? (TransferFromError.InsufficientAllowanceInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.InsufficientAllowance, value); } + public static TransferFromError BadBurn(TransferFromError.BadBurnInfo info) + { + return new TransferFromError(TransferFromErrorTag.BadBurn, info); + } - public TransferFromError.CreatedInFutureInfo? CreatedInFuture { get => this.Tag == TransferFromErrorTag.CreatedInFuture ? (TransferFromError.CreatedInFutureInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.CreatedInFuture, value); } + public static TransferFromError InsufficientFunds(TransferFromError.InsufficientFundsInfo info) + { + return new TransferFromError(TransferFromErrorTag.InsufficientFunds, info); + } - public TransferFromError.DuplicateInfo? Duplicate { get => this.Tag == TransferFromErrorTag.Duplicate ? (TransferFromError.DuplicateInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.Duplicate, value); } + public static TransferFromError InsufficientAllowance(TransferFromError.InsufficientAllowanceInfo info) + { + return new TransferFromError(TransferFromErrorTag.InsufficientAllowance, info); + } - public TransferFromError.GenericErrorInfo? GenericError { get => this.Tag == TransferFromErrorTag.GenericError ? (TransferFromError.GenericErrorInfo)this.Value : default; set => (this.Tag, this.Value) = (TransferFromErrorTag.GenericError, value); } + public static TransferFromError TooOld() + { + return new TransferFromError(TransferFromErrorTag.TooOld, null); + } - public TransferFromError(TransferFromErrorTag tag, object? value) + public static TransferFromError CreatedInFuture(TransferFromError.CreatedInFutureInfo info) { - this.Tag = tag; - this.Value = value; + return new TransferFromError(TransferFromErrorTag.CreatedInFuture, info); } - protected TransferFromError() + public static TransferFromError Duplicate(TransferFromError.DuplicateInfo info) + { + return new TransferFromError(TransferFromErrorTag.Duplicate, info); + } + + public static TransferFromError TemporarilyUnavailable() + { + return new TransferFromError(TransferFromErrorTag.TemporarilyUnavailable, null); + } + + public static TransferFromError GenericError(TransferFromError.GenericErrorInfo info) + { + return new TransferFromError(TransferFromErrorTag.GenericError, info); + } + + public TransferFromError.BadFeeInfo AsBadFee() + { + this.ValidateTag(TransferFromErrorTag.BadFee); + return (TransferFromError.BadFeeInfo)this.Value!; + } + + public TransferFromError.BadBurnInfo AsBadBurn() { + this.ValidateTag(TransferFromErrorTag.BadBurn); + return (TransferFromError.BadBurnInfo)this.Value!; + } + + public TransferFromError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(TransferFromErrorTag.InsufficientFunds); + return (TransferFromError.InsufficientFundsInfo)this.Value!; + } + + public TransferFromError.InsufficientAllowanceInfo AsInsufficientAllowance() + { + this.ValidateTag(TransferFromErrorTag.InsufficientAllowance); + return (TransferFromError.InsufficientAllowanceInfo)this.Value!; + } + + public TransferFromError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(TransferFromErrorTag.CreatedInFuture); + return (TransferFromError.CreatedInFutureInfo)this.Value!; + } + + public TransferFromError.DuplicateInfo AsDuplicate() + { + this.ValidateTag(TransferFromErrorTag.Duplicate); + return (TransferFromError.DuplicateInfo)this.Value!; + } + + public TransferFromError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(TransferFromErrorTag.GenericError); + return (TransferFromError.GenericErrorInfo)this.Value!; + } + + private void ValidateTag(TransferFromErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } public class BadFeeInfo diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs index 7ec88404..2fab0fc0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models @@ -13,10 +14,6 @@ public class TransferFromResult [VariantValueProperty()] public object? Value { get; set; } - public BlockIndex? Ok { get => this.Tag == TransferFromResultTag.Ok ? (BlockIndex)this.Value : default; set => (this.Tag, this.Value) = (TransferFromResultTag.Ok, value); } - - public TransferFromError? Err { get => this.Tag == TransferFromResultTag.Err ? (TransferFromError)this.Value : default; set => (this.Tag, this.Value) = (TransferFromResultTag.Err, value); } - public TransferFromResult(TransferFromResultTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public TransferFromResult(TransferFromResultTag tag, object? value) protected TransferFromResult() { } + + public static TransferFromResult Ok(BlockIndex info) + { + return new TransferFromResult(TransferFromResultTag.Ok, info); + } + + public static TransferFromResult Err(TransferFromError info) + { + return new TransferFromResult(TransferFromResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(TransferFromResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public TransferFromError AsErr() + { + this.ValidateTag(TransferFromResultTag.Err); + return (TransferFromError)this.Value!; + } + + private void ValidateTag(TransferFromResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum TransferFromResultTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs index 3c9e4613..dd528fc0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.ICRC1Ledger.Models; +using System; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models @@ -13,10 +14,6 @@ public class TransferResult [VariantValueProperty()] public object? Value { get; set; } - public BlockIndex? Ok { get => this.Tag == TransferResultTag.Ok ? (BlockIndex)this.Value : default; set => (this.Tag, this.Value) = (TransferResultTag.Ok, value); } - - public TransferError? Err { get => this.Tag == TransferResultTag.Err ? (TransferError)this.Value : default; set => (this.Tag, this.Value) = (TransferResultTag.Err, value); } - public TransferResult(TransferResultTag tag, object? value) { this.Tag = tag; @@ -26,6 +23,36 @@ public TransferResult(TransferResultTag tag, object? value) protected TransferResult() { } + + public static TransferResult Ok(BlockIndex info) + { + return new TransferResult(TransferResultTag.Ok, info); + } + + public static TransferResult Err(TransferError info) + { + return new TransferResult(TransferResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(TransferResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public TransferError AsErr() + { + this.ValidateTag(TransferResultTag.Err); + return (TransferError)this.Value!; + } + + private void ValidateTag(TransferResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } } public enum TransferResultTag diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs index bd5c3f53..8aca17d0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs @@ -2,6 +2,7 @@ using Sample.Shared.ICRC1Ledger.Models; using System.Collections.Generic; using EdjCase.ICP.Candid.Models; +using System; using Map = System.Collections.Generic.Dictionary; namespace Sample.Shared.ICRC1Ledger.Models @@ -15,28 +16,99 @@ public class Value [VariantValueProperty()] public object? Value_ { get; set; } - public List? Blob { get => this.Tag == ValueTag.Blob ? (List)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Blob, value); } + public Value(ValueTag tag, object? value) + { + this.Tag = tag; + this.Value_ = value; + } - public string? Text { get => this.Tag == ValueTag.Text ? (string)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Text, value); } + protected Value() + { + } - public UnboundedUInt? Nat { get => this.Tag == ValueTag.Nat ? (UnboundedUInt)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Nat, value); } + public static Value Blob(List info) + { + return new Value(ValueTag.Blob, info); + } - public ulong? Nat64 { get => this.Tag == ValueTag.Nat64 ? (ulong)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Nat64, value); } + public static Value Text(string info) + { + return new Value(ValueTag.Text, info); + } - public UnboundedInt? Int { get => this.Tag == ValueTag.Int ? (UnboundedInt)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Int, value); } + public static Value Nat(UnboundedUInt info) + { + return new Value(ValueTag.Nat, info); + } - public List? Array { get => this.Tag == ValueTag.Array ? (List)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Array, value); } + public static Value Nat64(ulong info) + { + return new Value(ValueTag.Nat64, info); + } - public Map? Map { get => this.Tag == ValueTag.Map ? (Map)this.Value_ : default; set => (this.Tag, this.Value_) = (ValueTag.Map, value); } + public static Value Int(UnboundedInt info) + { + return new Value(ValueTag.Int, info); + } - public Value(ValueTag tag, object? value) + public static Value Array(List info) { - this.Tag = tag; - this.Value_ = value; + return new Value(ValueTag.Array, info); } - protected Value() + public static Value Map(Map info) + { + return new Value(ValueTag.Map, info); + } + + public List AsBlob() + { + this.ValidateTag(ValueTag.Blob); + return (List)this.Value_!; + } + + public string AsText() + { + this.ValidateTag(ValueTag.Text); + return (string)this.Value_!; + } + + public UnboundedUInt AsNat() + { + this.ValidateTag(ValueTag.Nat); + return (UnboundedUInt)this.Value_!; + } + + public ulong AsNat64() + { + this.ValidateTag(ValueTag.Nat64); + return (ulong)this.Value_!; + } + + public UnboundedInt AsInt() + { + this.ValidateTag(ValueTag.Int); + return (UnboundedInt)this.Value_!; + } + + public List AsArray() + { + this.ValidateTag(ValueTag.Array); + return (List)this.Value_!; + } + + public Map AsMap() + { + this.ValidateTag(ValueTag.Map); + return (Map)this.Value_!; + } + + private void ValidateTag(ValueTag tag) { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } } } diff --git a/src/ClientGenerator/API.md b/src/ClientGenerator/API.md index 3484007a..6af28af9 100644 --- a/src/ClientGenerator/API.md +++ b/src/ClientGenerator/API.md @@ -8,7 +8,7 @@ - [GenerateClientFromCanisterAsync(canisterId,options)](#M-EdjCase-ICP-ClientGenerator-ClientCodeGenerator-GenerateClientFromCanisterAsync-EdjCase-ICP-Candid-Models-Principal,EdjCase-ICP-ClientGenerator-ClientGenerationOptions- 'EdjCase.ICP.ClientGenerator.ClientCodeGenerator.GenerateClientFromCanisterAsync(EdjCase.ICP.Candid.Models.Principal,EdjCase.ICP.ClientGenerator.ClientGenerationOptions)') - [GenerateClientFromFile(fileText,options)](#M-EdjCase-ICP-ClientGenerator-ClientCodeGenerator-GenerateClientFromFile-System-String,EdjCase-ICP-ClientGenerator-ClientGenerationOptions- 'EdjCase.ICP.ClientGenerator.ClientCodeGenerator.GenerateClientFromFile(System.String,EdjCase.ICP.ClientGenerator.ClientGenerationOptions)') - [ClientGenerationOptions](#T-EdjCase-ICP-ClientGenerator-ClientGenerationOptions 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions') - - [#ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,keepCandidCase,boundryNodeUrl,types)](#M-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-#ctor-System-String,System-String,System-Boolean,System-String,System-String,System-Boolean,System-Boolean,System-Boolean,System-Boolean,System-Uri,System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.#ctor(System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Uri,System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') + - [#ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,variantsUseProperties,keepCandidCase,boundryNodeUrl,types)](#M-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-#ctor-System-String,System-String,System-Boolean,System-String,System-String,System-Boolean,System-Boolean,System-Boolean,System-Boolean,System-Boolean,System-Uri,System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.#ctor(System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Uri,System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') - [BoundryNodeUrl](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-BoundryNodeUrl 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.BoundryNodeUrl') - [FeatureNullable](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-FeatureNullable 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.FeatureNullable') - [FilePathOrCanisterId](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-FilePathOrCanisterId 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.FilePathOrCanisterId') @@ -20,6 +20,7 @@ - [OutputDirectory](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-OutputDirectory 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.OutputDirectory') - [PurgeOutputDirectory](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-PurgeOutputDirectory 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.PurgeOutputDirectory') - [Types](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-Types 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.Types') + - [VariantsUseProperties](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-VariantsUseProperties 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.VariantsUseProperties') - [ClientSyntax](#T-EdjCase-ICP-ClientGenerator-ClientSyntax 'EdjCase.ICP.ClientGenerator.ClientSyntax') - [#ctor(name,clientFile,typeFiles)](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-#ctor-System-String,Microsoft-CodeAnalysis-CSharp-Syntax-CompilationUnitSyntax,System-Collections-Generic-List{System-ValueTuple{System-String,Microsoft-CodeAnalysis-CSharp-Syntax-CompilationUnitSyntax}}- 'EdjCase.ICP.ClientGenerator.ClientSyntax.#ctor(System.String,Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax,System.Collections.Generic.List{System.ValueTuple{System.String,Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax}})') - [ClientFile](#P-EdjCase-ICP-ClientGenerator-ClientSyntax-ClientFile 'EdjCase.ICP.ClientGenerator.ClientSyntax.ClientFile') @@ -33,14 +34,10 @@ - [NameOverride](#P-EdjCase-ICP-ClientGenerator-NamedTypeOptions-NameOverride 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.NameOverride') - [TypeOptions](#P-EdjCase-ICP-ClientGenerator-NamedTypeOptions-TypeOptions 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.TypeOptions') - [TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') - - [#ctor(fields,innerType,representation)](#M-EdjCase-ICP-ClientGenerator-TypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions},EdjCase-ICP-ClientGenerator-TypeOptions,System-Nullable{EdjCase-ICP-ClientGenerator-TypeRepresentation}- 'EdjCase.ICP.ClientGenerator.TypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions},EdjCase.ICP.ClientGenerator.TypeOptions,System.Nullable{EdjCase.ICP.ClientGenerator.TypeRepresentation})') + - [#ctor(fields,innerType,representation)](#M-EdjCase-ICP-ClientGenerator-TypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions},EdjCase-ICP-ClientGenerator-TypeOptions,System-String- 'EdjCase.ICP.ClientGenerator.TypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions},EdjCase.ICP.ClientGenerator.TypeOptions,System.String)') - [Fields](#P-EdjCase-ICP-ClientGenerator-TypeOptions-Fields 'EdjCase.ICP.ClientGenerator.TypeOptions.Fields') - [InnerType](#P-EdjCase-ICP-ClientGenerator-TypeOptions-InnerType 'EdjCase.ICP.ClientGenerator.TypeOptions.InnerType') - [Representation](#P-EdjCase-ICP-ClientGenerator-TypeOptions-Representation 'EdjCase.ICP.ClientGenerator.TypeOptions.Representation') -- [TypeRepresentation](#T-EdjCase-ICP-ClientGenerator-TypeRepresentation 'EdjCase.ICP.ClientGenerator.TypeRepresentation') - - [Array](#F-EdjCase-ICP-ClientGenerator-TypeRepresentation-Array 'EdjCase.ICP.ClientGenerator.TypeRepresentation.Array') - - [Dictionary](#F-EdjCase-ICP-ClientGenerator-TypeRepresentation-Dictionary 'EdjCase.ICP.ClientGenerator.TypeRepresentation.Dictionary') - - [List](#F-EdjCase-ICP-ClientGenerator-TypeRepresentation-List 'EdjCase.ICP.ClientGenerator.TypeRepresentation.List') ## ClientCodeGenerator `type` @@ -108,8 +105,8 @@ EdjCase.ICP.ClientGenerator Options for generating a client - -### #ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,keepCandidCase,boundryNodeUrl,types) `constructor` + +### #ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,variantsUseProperties,keepCandidCase,boundryNodeUrl,types) `constructor` ##### Parameters @@ -123,6 +120,7 @@ Options for generating a client | purgeOutputDirectory | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, removes all files in the output directory before regeneration. Defaults to true | | noFolders | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, there will be no folders, all files will be in the same directory | | featureNullable | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, the nullable C# feature will be used | +| variantsUseProperties | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, variant classes will be generated with properties instead of methods | | keepCandidCase | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier | | boundryNodeUrl | [System.Uri](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Uri 'System.Uri') | Optional. The url of the boundry node for the internet computer. Defaults to ic0.app | | types | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. Specifies options for each candid type in the definition | @@ -206,6 +204,13 @@ If true, removes all files in the output directory before regeneration, otherwis Optional. Specifies options for each candid type in the definition. Only supports named types, no anonymous types + +### VariantsUseProperties `property` + +##### Summary + +If true, variant classes will be generated with properties instead of methods + ## ClientSyntax `type` @@ -344,7 +349,7 @@ EdjCase.ICP.ClientGenerator Interface to specify generation options for specific types in the candid - + ### #ctor(fields,innerType,representation) `constructor` ##### Parameters @@ -353,7 +358,7 @@ Interface to specify generation options for specific types in the candid | ---- | ---- | ----------- | | fields | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the records fields or variant options | | innerType | [EdjCase.ICP.ClientGenerator.TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') | Optional. The type options for the sub type of a vec or opt | -| representation | [System.Nullable{EdjCase.ICP.ClientGenerator.TypeRepresentation}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{EdjCase.ICP.ClientGenerator.TypeRepresentation}') | Optional. How the type should be represented in C# | +| representation | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | Optional. How the type should be represented in C# | ##### Exceptions @@ -381,35 +386,3 @@ Optional. The type options for the sub type of a vec or opt ##### Summary Optional. How the type should be represented in C# - - -## TypeRepresentation `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator - -##### Summary - -C# type representations for the vec type - - -### Array `constants` - -##### Summary - -Array - - -### Dictionary `constants` - -##### Summary - -Dictionary - - -### List `constants` - -##### Summary - -List diff --git a/src/ClientGenerator/API.xml b/src/ClientGenerator/API.xml index 20c9194a..7346d100 100644 --- a/src/ClientGenerator/API.xml +++ b/src/ClientGenerator/API.xml @@ -77,6 +77,11 @@ If true, the nullable C# feature will be used + + + If true, variant classes will be generated with properties instead of methods + + If true, the names of properties and methods will keep the raw candid name. @@ -94,7 +99,7 @@ Only supports named types, no anonymous types - + The name of the client class and file to use The base namespace to use in the generated files If true, will treat as a canister id and get the definition from the canister. Otherwise will treat it as a file path and get the definition from the file @@ -103,6 +108,7 @@ If true, removes all files in the output directory before regeneration. Defaults to true If true, there will be no folders, all files will be in the same directory If true, the nullable C# feature will be used + If true, variant classes will be generated with properties instead of methods If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier Optional. The url of the boundry node for the internet computer. Defaults to ic0.app Optional. Specifies options for each candid type in the definition @@ -146,32 +152,12 @@ Optional. How the type should be represented in C# - + Optional. The type options for each of the records fields or variant options Optional. The type options for the sub type of a vec or opt Optional. How the type should be represented in C# - - - C# type representations for the vec type - - - - - List - - - - - Array - - - - - Dictionary - - A model containing the client code to be rendered diff --git a/src/ClientGenerator/ClientCodeGenerator.cs b/src/ClientGenerator/ClientCodeGenerator.cs index e8cb848d..274a56c5 100644 --- a/src/ClientGenerator/ClientCodeGenerator.cs +++ b/src/ClientGenerator/ClientCodeGenerator.cs @@ -5,6 +5,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Org.BouncyCastle.Crypto.Agreement; +using Org.BouncyCastle.Ocsp; using System; using System.Collections.Generic; using System.Linq; @@ -101,6 +102,7 @@ ClientGenerationOptions options modelNamespace, aliases, options.FeatureNullable, + options.VariantsUseProperties, nameHelper, declaredTypes ); @@ -196,17 +198,17 @@ private static SourceCodeType ResolveSourceCodeType( innerTypeOptions ); bool isDictionaryCompatible = innerType is TupleSourceCodeType t && t.Fields.Count == 2; - TypeRepresentation defaultRepresentation = isDictionaryCompatible - ? TypeRepresentation.Dictionary - : TypeRepresentation.List; - TypeRepresentation rep = typeOptions?.Representation ?? defaultRepresentation; - switch (rep) + string defaultRepresentation = isDictionaryCompatible + ? "dictionary" + : "list"; + string rep = typeOptions?.Representation ?? defaultRepresentation; + switch (rep.ToLower()) { - case TypeRepresentation.Array: + case "array": return new ArraySourceCodeType(innerType); - case TypeRepresentation.List: + case "list": return new ListSourceCodeType(innerType); - case TypeRepresentation.Dictionary: + case "dictionary": if (!isDictionaryCompatible) { throw new Exception("List to dictionary conversion is only compatible with `vec record { a; b }` candid types"); diff --git a/src/ClientGenerator/ClientGenerationOptions.cs b/src/ClientGenerator/ClientGenerationOptions.cs index 761b1144..acc1f5ca 100644 --- a/src/ClientGenerator/ClientGenerationOptions.cs +++ b/src/ClientGenerator/ClientGenerationOptions.cs @@ -48,6 +48,10 @@ public class ClientGenerationOptions /// public bool FeatureNullable { get; } /// + /// If true, variant classes will be generated with properties instead of methods + /// + public bool VariantsUseProperties { get; } + /// /// If true, the names of properties and methods will keep the raw candid name. /// Otherwise they will be converted to something prettier /// @@ -72,6 +76,7 @@ public class ClientGenerationOptions /// If true, removes all files in the output directory before regeneration. Defaults to true /// If true, there will be no folders, all files will be in the same directory /// If true, the nullable C# feature will be used + /// If true, variant classes will be generated with properties instead of methods /// If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier /// Optional. The url of the boundry node for the internet computer. Defaults to ic0.app /// Optional. Specifies options for each candid type in the definition @@ -84,6 +89,7 @@ public ClientGenerationOptions( bool purgeOutputDirectory = true, bool noFolders = false, bool featureNullable = false, + bool variantsUseProperties = false, bool keepCandidCase = false, Uri? boundryNodeUrl = null, Dictionary? types = null @@ -102,6 +108,7 @@ public ClientGenerationOptions( this.PurgeOutputDirectory = purgeOutputDirectory; this.NoFolders = noFolders; this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; this.KeepCandidCase = keepCandidCase; this.BoundryNodeUrl = boundryNodeUrl; this.Types = types ?? new Dictionary(); @@ -151,7 +158,7 @@ public class TypeOptions /// /// Optional. How the type should be represented in C# /// - public TypeRepresentation? Representation { get; } + public string? Representation { get; } /// Optional. The type options for each of the records fields or variant options /// Optional. The type options for the sub type of a vec or opt @@ -160,7 +167,7 @@ public class TypeOptions public TypeOptions( Dictionary? fields, TypeOptions? innerType, - TypeRepresentation? representation + string? representation ) { this.Fields = fields ?? new Dictionary(); @@ -168,23 +175,4 @@ public TypeOptions( this.Representation = representation; } } - - /// - /// C# type representations for the vec type - /// - public enum TypeRepresentation - { - /// - /// List - /// - List, - /// - /// Array - /// - Array, - /// - /// Dictionary - /// - Dictionary - } } diff --git a/src/ClientGenerator/README.md b/src/ClientGenerator/README.md index b442d7b3..16dbd0fb 100644 --- a/src/ClientGenerator/README.md +++ b/src/ClientGenerator/README.md @@ -100,6 +100,11 @@ candid-client-generator gen ./ ##### Variant Types Options +- `representation` - Optional (Text) Sets what C# type should be generated. (Defaults to Dictionary if possible, otherwise a List) + + - `ClassWithMethods` - (Default) Uses a C# class with method accessors + - `ClassWithProperties` - Uses a C# class with property accessors + - `[clients.types.{CandidTypeId}.fields.{CandidOptionId}]` `{CandidOptionId}` is a variant option in the variant type `{CandidTypeId}` @@ -113,8 +118,8 @@ candid-client-generator gen ./ - `representation` - Optional (Text) Sets what C# type should be generated. (Defaults to Dictionary if possible, otherwise a List) - `Array` - Uses a C# array - - `List` - Uses a C# `List` - - `Dictionary` - Uses a C# `Dictionary`. Only works if the `vec` contains a `record` with 2 unamed fields (tuple). The first will be the key, the second will be the value + - `Dictionary` - (Default if applicable) Uses a C# `Dictionary`. Only works if the `vec` contains a `record` with 2 unamed fields (tuple). The first will be the key, the second will be the value + - `List` - (Default if not Dictionary) Uses a C# `List` - `[clients.types.{CandidTypeId}.innerType]` diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index 8ec286ab..c00c4f1f 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -26,6 +26,7 @@ internal class RoslynTypeResolver public string ModelNamespace { get; } public HashSet Aliases { get; } public bool FeatureNullable { get; } + public bool VariantsUseProperties { get; } public NameHelper NameHelper { get; } public Dictionary DeclaredTypes { get; } @@ -33,6 +34,7 @@ public RoslynTypeResolver( string modelNamespace, HashSet aliases, bool featureNullable, + bool variantsUseProperties, NameHelper nameHelper, Dictionary declaredTypes ) @@ -40,6 +42,7 @@ public RoslynTypeResolver( this.ModelNamespace = modelNamespace; this.Aliases = aliases; this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; this.NameHelper = nameHelper; this.DeclaredTypes = declaredTypes; } @@ -300,7 +303,7 @@ public ClassDeclarationSyntax GenerateClient( }; List methods; List? customProperties; - if (false) // TODO + if (!this.VariantsUseProperties) { methods = this.GenerateVariantMethods( variantTypeName, diff --git a/src/ClientGenerator/SourceCodeType.cs b/src/ClientGenerator/SourceCodeType.cs index e1fe9b30..26b18ffe 100644 --- a/src/ClientGenerator/SourceCodeType.cs +++ b/src/ClientGenerator/SourceCodeType.cs @@ -115,7 +115,9 @@ internal class VariantSourceCodeType : SourceCodeType public List<(ResolvedName Tag, SourceCodeType? Type)> Options { get; } public override bool IsPredefinedType { get; } = false; - public VariantSourceCodeType(List<(ResolvedName Tag, SourceCodeType? Type)> options) + public VariantSourceCodeType( + List<(ResolvedName Tag, SourceCodeType? Type)> options + ) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); } diff --git a/src/ClientGenerator/TomlConfigParser.cs b/src/ClientGenerator/TomlConfigParser.cs index 210d53ae..a3e99de7 100644 --- a/src/ClientGenerator/TomlConfigParser.cs +++ b/src/ClientGenerator/TomlConfigParser.cs @@ -63,6 +63,7 @@ public static List Parse(string filePath) purgeOutputDirectory: clientOptions.PurgeDirectory ?? true, noFolders: clientOptions.NoFolders ?? false, featureNullable: clientOptions.FeatureNullable ?? true, + variantsUseProperties: clientOptions.VariantsUseProperties ?? false, keepCandidCase: clientOptions.KeepCandidCase ?? false, boundryNodeUrl: clientOptions.BaseUrl, types: clientOptions.Types @@ -81,6 +82,7 @@ private static CommonOptions ParseCommonOptions(TomlTable config, (CommonOptions bool? noFolders = GetOptional(config, "no-folders") ?? parent?.Options.NoFolders; string? outputDirectory = GetOptional(config, "output-directory") ?? (parent == null ? null : Path.Combine(parent.Value.Options.OutputDirectory ?? "./", parent.Value.ClientName)); bool? featureNullable = GetOptional(config, "feature-nullable") ?? parent?.Options.FeatureNullable; + bool? variantsUseProperties = GetOptional(config, "variants-use-properties") ?? parent?.Options.VariantsUseProperties; bool? keepCandidCase = GetOptional(config, "keep-candid-case") ?? parent?.Options.KeepCandidCase; TomlTable? typeTable = GetOptional(config, "types"); Dictionary types = BuildTypes(typeTable); @@ -106,6 +108,7 @@ private static CommonOptions ParseCommonOptions(TomlTable config, (CommonOptions noFolders, outputDirectory, featureNullable, + variantsUseProperties, keepCandidCase, types ); @@ -140,7 +143,7 @@ private static Dictionary BuildTypes(TomlTable? typeTa private static TypeOptions BuildTypeOptions(TomlTable t) { - TypeRepresentation? representation = GetEnumOptional(t, "representation"); + string? representation = GetOptional(t, "representation"); TomlTable? optionTypeTable = GetOptional(t, "fields"); Dictionary options = BuildTypes(optionTypeTable); @@ -173,17 +176,6 @@ private static T GetRequired(TomlTable table, string key, string? prefix = nu return default; } - private static TEnum? GetEnumOptional(TomlTable table, string key) - where TEnum : struct - { - string? stringValue = GetOptional(table, key); - if (stringValue == null) - { - return null; - } - return (TEnum)Enum.Parse(typeof(TEnum), stringValue); - } - } internal class CommonOptions @@ -194,6 +186,7 @@ internal class CommonOptions public bool? NoFolders { get; } public string? OutputDirectory { get; } public bool? FeatureNullable { get; } + public bool? VariantsUseProperties { get; } public bool? KeepCandidCase { get; } public Dictionary Types { get; } @@ -204,6 +197,7 @@ public CommonOptions( bool? noFolders, string? outputDirectory, bool? featureNullable, + bool? variantsUseProperties, bool? keepCandidCase, Dictionary? types ) @@ -214,6 +208,7 @@ public CommonOptions( this.NoFolders = noFolders; this.OutputDirectory = outputDirectory; this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; this.KeepCandidCase = keepCandidCase; this.Types = types ?? new Dictionary(); } diff --git a/test/Candid.Tests/Generators/ClientGeneratorTests.cs b/test/Candid.Tests/Generators/ClientGeneratorTests.cs index 84e517b7..6f7dab1f 100644 --- a/test/Candid.Tests/Generators/ClientGeneratorTests.cs +++ b/test/Candid.Tests/Generators/ClientGeneratorTests.cs @@ -28,14 +28,22 @@ public void GenerateClients(string serviceName) string fileText = GetFileText(serviceName + ".did"); string baseNamespace = "Test"; CandidServiceDescription serviceFile = CandidServiceDescription.Parse(fileText); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, false); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, false); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, false); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, false, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, false, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, false, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, false, true); } private void GenerateClientInternal( @@ -44,7 +52,8 @@ private void GenerateClientInternal( string serviceName, bool noFolders, bool featureNullable, - bool keepCandidCase + bool keepCandidCase, + bool variantsUseProperties ) { ClientGenerationOptions options = new( @@ -56,6 +65,7 @@ bool keepCandidCase purgeOutputDirectory: true, noFolders: noFolders, featureNullable: featureNullable, + variantsUseProperties: variantsUseProperties, keepCandidCase: keepCandidCase, boundryNodeUrl: null, types: null @@ -81,7 +91,7 @@ bool keepCandidCase //trees.Add(SyntaxFactory.SyntaxTree(f.Syntax)); } - Snapshot.Match(clientCode, $"{serviceName}_NoFolders_{noFolders}_Nullable_{featureNullable}_KeepCandidCase_{keepCandidCase}"); + Snapshot.Match(clientCode, $"{serviceName}_NoFolders_{noFolders}_Nullable_{featureNullable}_KeepCandidCase_{keepCandidCase}_VariantsUseProperties_{variantsUseProperties}"); //TODO //CSharpCompilation compilation = CSharpCompilation diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap new file mode 100644 index 00000000..9b9e2d89 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> B() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..9b9e2d89 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> B() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap new file mode 100644 index 00000000..c214dad0 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> b() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..c214dad0 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> b() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap new file mode 100644 index 00000000..d331df95 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> B() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..d331df95 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> B() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap new file mode 100644 index 00000000..2fd21dd7 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> b() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..2fd21dd7 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>>(this.Converter); + } + + public async Task> b() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..657a2a50 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..f8ef3fe0 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> getBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..d38390ce --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..92684ad6 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> getBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..fb433cfb --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..8a6ae328 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> getBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..31531501 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..009e1f4f --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> getBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6ada7655 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..1312f3a3 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test.Models +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6015c723 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..0b6a4542 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test.Models +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..8feb8a4e --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..4492d533 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6f5995fd --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..be72442a --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..19e3578c --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetNetworkEconomicsParameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetNeuronIds() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetPendingProposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task ListKnownNeurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNodeProviders() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..8c144f6e --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_build_metadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_network_economics_parameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_neuron_ids() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_pending_proposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task list_known_neurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_node_providers() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test.Models +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test.Models +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test.Models +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test.Models +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test.Models +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test.Models +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test.Models +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test.Models +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test.Models +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test.Models +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test.Models +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test.Models +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test.Models +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..dacce7a3 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetNetworkEconomicsParameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetNeuronIds() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetPendingProposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task ListKnownNeurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNodeProviders() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..67dda3a7 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_build_metadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_network_economics_parameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_neuron_ids() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_pending_proposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task list_known_neurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_node_providers() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test.Models +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test.Models +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test.Models +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test.Models +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test.Models +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test.Models +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test.Models +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test.Models +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test.Models +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test.Models +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test.Models +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test.Models +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test.Models +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..7f33d3ef --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetNetworkEconomicsParameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetNeuronIds() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetPendingProposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task ListKnownNeurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNodeProviders() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..7b9450ff --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_build_metadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_network_economics_parameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_neuron_ids() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_pending_proposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task list_known_neurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_node_providers() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..d7f7e5d0 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetNetworkEconomicsParameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetNeuronIds() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> GetPendingProposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task ListKnownNeurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNodeProviders() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6e693da1 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid; +using System.Threading.Tasks; +using Test; +using System.Collections.Generic; +using EdjCase.ICP.Agent.Responses; + +namespace Test +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_build_metadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + public async Task _get_network_economics_parameters() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_neuron_ids() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task> _get_pending_proposals() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task list_known_neurons() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_node_providers() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} From 6401995aba15c98d563c4820b26cf65c8c4a0fa2 Mon Sep 17 00:00:00 2001 From: Ethan Celletti Date: Mon, 25 Sep 2023 14:14:32 -0700 Subject: [PATCH 9/9] Adding ! --- .../Dex/Models/CancelOrderReceipt.cs | 35 +---- .../Dex/Models/DepositReceipt.cs | 35 +---- .../Dex/Models/OrderPlacementReceipt.cs | 35 +---- .../Dex/Models/WithdrawReceipt.cs | 35 +---- samples/Sample.Shared/candid-client.toml | 1 + src/ClientGenerator/RoslynTypeResolver.cs | 14 +- ...Case_False_VariantsUseProperties_True.snap | 16 +- ...dCase_True_VariantsUseProperties_True.snap | 16 +- ...Case_False_VariantsUseProperties_True.snap | 16 +- ...dCase_True_VariantsUseProperties_True.snap | 16 +- ...Case_False_VariantsUseProperties_True.snap | 16 +- ...dCase_True_VariantsUseProperties_True.snap | 16 +- ...Case_False_VariantsUseProperties_True.snap | 16 +- ...dCase_True_VariantsUseProperties_True.snap | 16 +- ...Case_False_VariantsUseProperties_True.snap | 140 +++++++++--------- ...dCase_True_VariantsUseProperties_True.snap | 140 +++++++++--------- ...Case_False_VariantsUseProperties_True.snap | 140 +++++++++--------- ...dCase_True_VariantsUseProperties_True.snap | 140 +++++++++--------- ...Case_False_VariantsUseProperties_True.snap | 140 +++++++++--------- ...dCase_True_VariantsUseProperties_True.snap | 140 +++++++++--------- ...Case_False_VariantsUseProperties_True.snap | 140 +++++++++--------- ...dCase_True_VariantsUseProperties_True.snap | 140 +++++++++--------- 22 files changed, 650 insertions(+), 753 deletions(-) diff --git a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs index 816cf2c0..70e869c6 100644 --- a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs @@ -1,6 +1,5 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; -using System; using OrderId = System.UInt32; namespace Sample.Shared.Dex.Models @@ -14,6 +13,10 @@ public class CancelOrderReceipt [VariantValueProperty()] public object? Value { get; set; } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) protected CancelOrderReceipt() { } - - public static CancelOrderReceipt Err(CancelOrderErr info) - { - return new CancelOrderReceipt(CancelOrderReceiptTag.Err, info); - } - - public static CancelOrderReceipt Ok(OrderId info) - { - return new CancelOrderReceipt(CancelOrderReceiptTag.Ok, info); - } - - public CancelOrderErr AsErr() - { - this.ValidateTag(CancelOrderReceiptTag.Err); - return (CancelOrderErr)this.Value!; - } - - public OrderId AsOk() - { - this.ValidateTag(CancelOrderReceiptTag.Ok); - return (OrderId)this.Value!; - } - - private void ValidateTag(CancelOrderReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum CancelOrderReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs index a0aea27f..90d93e3e 100644 --- a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { @@ -14,6 +13,10 @@ public class DepositReceipt [VariantValueProperty()] public object? Value { get; set; } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public DepositReceipt(DepositReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public DepositReceipt(DepositReceiptTag tag, object? value) protected DepositReceipt() { } - - public static DepositReceipt Err(DepositErr info) - { - return new DepositReceipt(DepositReceiptTag.Err, info); - } - - public static DepositReceipt Ok(UnboundedUInt info) - { - return new DepositReceipt(DepositReceiptTag.Ok, info); - } - - public DepositErr AsErr() - { - this.ValidateTag(DepositReceiptTag.Err); - return (DepositErr)this.Value!; - } - - public UnboundedUInt AsOk() - { - this.ValidateTag(DepositReceiptTag.Ok); - return (UnboundedUInt)this.Value!; - } - - private void ValidateTag(DepositReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum DepositReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs index bba0c9ac..ac20a8d2 100644 --- a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { @@ -14,6 +13,10 @@ public class OrderPlacementReceipt [VariantValueProperty()] public object? Value { get; set; } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) protected OrderPlacementReceipt() { } - - public static OrderPlacementReceipt Err(OrderPlacementErr info) - { - return new OrderPlacementReceipt(OrderPlacementReceiptTag.Err, info); - } - - public static OrderPlacementReceipt Ok(OptionalValue info) - { - return new OrderPlacementReceipt(OrderPlacementReceiptTag.Ok, info); - } - - public OrderPlacementErr AsErr() - { - this.ValidateTag(OrderPlacementReceiptTag.Err); - return (OrderPlacementErr)this.Value!; - } - - public OptionalValue AsOk() - { - this.ValidateTag(OrderPlacementReceiptTag.Ok); - return (OptionalValue)this.Value!; - } - - private void ValidateTag(OrderPlacementReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum OrderPlacementReceiptTag diff --git a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs index 775d4e78..10b6abc8 100644 --- a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs @@ -1,7 +1,6 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { @@ -14,6 +13,10 @@ public class WithdrawReceipt [VariantValueProperty()] public object? Value { get; set; } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { this.Tag = tag; @@ -23,36 +26,6 @@ public WithdrawReceipt(WithdrawReceiptTag tag, object? value) protected WithdrawReceipt() { } - - public static WithdrawReceipt Err(WithdrawErr info) - { - return new WithdrawReceipt(WithdrawReceiptTag.Err, info); - } - - public static WithdrawReceipt Ok(UnboundedUInt info) - { - return new WithdrawReceipt(WithdrawReceiptTag.Ok, info); - } - - public WithdrawErr AsErr() - { - this.ValidateTag(WithdrawReceiptTag.Err); - return (WithdrawErr)this.Value!; - } - - public UnboundedUInt AsOk() - { - this.ValidateTag(WithdrawReceiptTag.Ok); - return (UnboundedUInt)this.Value!; - } - - private void ValidateTag(WithdrawReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum WithdrawReceiptTag diff --git a/samples/Sample.Shared/candid-client.toml b/samples/Sample.Shared/candid-client.toml index 442df9ce..314dbd1c 100644 --- a/samples/Sample.Shared/candid-client.toml +++ b/samples/Sample.Shared/candid-client.toml @@ -7,6 +7,7 @@ feature-nullable = true name = "Dex" type = "file" file-path = "ServiceDefinitions/Dex.did" +variants-use-properties = true [[clients]] name = "ICRC1Ledger" diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index c00c4f1f..250afaac 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -387,14 +387,18 @@ private List GenerateVariantProperties( SyntaxFactory.IdentifierName(o.Name.Name) ) ), - // ({OptionType}) this.Value + // ({OptionType}) this.Value! SyntaxFactory.CastExpression( o.Type!.Name.ToTypeSyntax(), - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(valueName) + SyntaxFactory.PostfixUnaryExpression( + SyntaxKind.SuppressNullableWarningExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(valueName) + ) ) + ), // default SyntaxFactory.LiteralExpression( diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap index 657a2a50..0616c1e1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object value) { @@ -194,9 +194,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) { @@ -289,9 +289,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object value) { @@ -339,9 +339,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap index f8ef3fe0..3fa1a5ed 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object value) { @@ -194,9 +194,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) { @@ -282,9 +282,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object value) { @@ -332,9 +332,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap index d38390ce..8185a087 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { @@ -194,9 +194,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { @@ -289,9 +289,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object? value) { @@ -339,9 +339,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap index 92684ad6..08b2cac1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { @@ -194,9 +194,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { @@ -282,9 +282,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object? value) { @@ -332,9 +332,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap index fb433cfb..92d7d8cc 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object value) { @@ -194,9 +194,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) { @@ -289,9 +289,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object value) { @@ -339,9 +339,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap index 8a6ae328..b801ae51 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object value) { @@ -194,9 +194,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) { @@ -282,9 +282,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object value) { @@ -332,9 +332,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap index 31531501..fb4e3898 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { @@ -194,9 +194,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { @@ -289,9 +289,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object? value) { @@ -339,9 +339,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap index 009e1f4f..795aea1b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -144,9 +144,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { @@ -194,9 +194,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } - public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { @@ -282,9 +282,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } - public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } public DepositReceipt(DepositReceiptTag tag, object? value) { @@ -332,9 +332,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } - public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap index 19e3578c..81b5c48d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -218,25 +218,25 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object value) { @@ -427,11 +427,11 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object value) { @@ -475,9 +475,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object value) { @@ -612,27 +612,27 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object value) { @@ -677,29 +677,29 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } - public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } - public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } - public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } - public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } - public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } - public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } - public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } - public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } - public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } - public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } - public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } public Command1(Command1Tag tag, object value) { @@ -773,21 +773,21 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } - public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } - public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } - public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } public Command2(Command2Tag tag, object value) { @@ -942,9 +942,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object value) { @@ -1818,9 +1818,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) { @@ -2021,19 +2021,19 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object value) { @@ -2340,7 +2340,7 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object value) { @@ -2376,9 +2376,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } - public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } public Result1(Result1Tag tag, object value) { @@ -2414,9 +2414,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } public Result2(Result2Tag tag, object value) { @@ -2452,9 +2452,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } public Result3(Result3Tag tag, object value) { @@ -2490,9 +2490,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } public Result4(Result4Tag tag, object value) { @@ -2528,9 +2528,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } public Result5(Result5Tag tag, object value) { @@ -2602,9 +2602,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap index 8c144f6e..6dca60d5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -216,25 +216,25 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object value) { @@ -409,11 +409,11 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object value) { @@ -457,9 +457,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object value) { @@ -585,27 +585,27 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object value) { @@ -650,29 +650,29 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } - public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } - public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } - public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } - public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } - public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } - public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } - public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } - public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } - public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } - public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } - public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } public Command_1(Command_1Tag tag, object value) { @@ -746,21 +746,21 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } - public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } - public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } - public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } public Command_2(Command_2Tag tag, object value) { @@ -901,9 +901,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object value) { @@ -1657,9 +1657,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) { @@ -1835,19 +1835,19 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object value) { @@ -2113,7 +2113,7 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object value) { @@ -2149,9 +2149,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } - public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } public Result_1(Result_1Tag tag, object value) { @@ -2187,9 +2187,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } public Result_2(Result_2Tag tag, object value) { @@ -2225,9 +2225,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } public Result_3(Result_3Tag tag, object value) { @@ -2263,9 +2263,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } public Result_4(Result_4Tag tag, object value) { @@ -2301,9 +2301,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } public Result_5(Result_5Tag tag, object value) { @@ -2370,9 +2370,9 @@ namespace Test.Models [VariantValueProperty()] public object Value { get; set; } - public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap index dacce7a3..db4d8c4b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -218,25 +218,25 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object? value) { @@ -427,11 +427,11 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object? value) { @@ -475,9 +475,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object? value) { @@ -612,27 +612,27 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object? value) { @@ -677,29 +677,29 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } - public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } - public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } - public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } - public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } - public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } - public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } - public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } - public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } - public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } - public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } - public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } public Command1(Command1Tag tag, object? value) { @@ -773,21 +773,21 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } - public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } - public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } - public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } public Command2(Command2Tag tag, object? value) { @@ -942,9 +942,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object? value) { @@ -1818,9 +1818,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) { @@ -2021,19 +2021,19 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object? value) { @@ -2340,7 +2340,7 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object? value) { @@ -2376,9 +2376,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } - public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } public Result1(Result1Tag tag, object? value) { @@ -2414,9 +2414,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } public Result2(Result2Tag tag, object? value) { @@ -2452,9 +2452,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } public Result3(Result3Tag tag, object? value) { @@ -2490,9 +2490,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } public Result4(Result4Tag tag, object? value) { @@ -2528,9 +2528,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } public Result5(Result5Tag tag, object? value) { @@ -2602,9 +2602,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap index 67dda3a7..7b4218b2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -216,25 +216,25 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object? value) { @@ -409,11 +409,11 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object? value) { @@ -457,9 +457,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object? value) { @@ -585,27 +585,27 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object? value) { @@ -650,29 +650,29 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } - public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } - public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } - public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } - public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } - public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } - public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } - public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } - public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } - public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } - public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } - public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } public Command_1(Command_1Tag tag, object? value) { @@ -746,21 +746,21 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } - public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } - public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } - public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } public Command_2(Command_2Tag tag, object? value) { @@ -901,9 +901,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object? value) { @@ -1657,9 +1657,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) { @@ -1835,19 +1835,19 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object? value) { @@ -2113,7 +2113,7 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object? value) { @@ -2149,9 +2149,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } - public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } public Result_1(Result_1Tag tag, object? value) { @@ -2187,9 +2187,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } public Result_2(Result_2Tag tag, object? value) { @@ -2225,9 +2225,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } public Result_3(Result_3Tag tag, object? value) { @@ -2263,9 +2263,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } public Result_4(Result_4Tag tag, object? value) { @@ -2301,9 +2301,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } public Result_5(Result_5Tag tag, object? value) { @@ -2370,9 +2370,9 @@ namespace Test.Models [VariantValueProperty()] public object? Value { get; set; } - public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap index 7f33d3ef..0b8e999f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -218,25 +218,25 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object value) { @@ -427,11 +427,11 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object value) { @@ -475,9 +475,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object value) { @@ -612,27 +612,27 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object value) { @@ -677,29 +677,29 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } - public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } - public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } - public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } - public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } - public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } - public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } - public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } - public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } - public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } - public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } - public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } public Command1(Command1Tag tag, object value) { @@ -773,21 +773,21 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } - public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } - public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } - public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } public Command2(Command2Tag tag, object value) { @@ -942,9 +942,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object value) { @@ -1818,9 +1818,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) { @@ -2021,19 +2021,19 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object value) { @@ -2340,7 +2340,7 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object value) { @@ -2376,9 +2376,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } - public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } public Result1(Result1Tag tag, object value) { @@ -2414,9 +2414,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } public Result2(Result2Tag tag, object value) { @@ -2452,9 +2452,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } public Result3(Result3Tag tag, object value) { @@ -2490,9 +2490,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } public Result4(Result4Tag tag, object value) { @@ -2528,9 +2528,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } public Result5(Result5Tag tag, object value) { @@ -2602,9 +2602,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap index 7b9450ff..965926cb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -216,25 +216,25 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object value) { @@ -409,11 +409,11 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object value) { @@ -457,9 +457,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object value) { @@ -585,27 +585,27 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object value) { @@ -650,29 +650,29 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } - public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } - public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } - public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } - public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } - public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } - public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } - public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } - public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } - public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } - public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } - public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } public Command_1(Command_1Tag tag, object value) { @@ -746,21 +746,21 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } - public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } - public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } - public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } - public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } - public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } public Command_2(Command_2Tag tag, object value) { @@ -901,9 +901,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object value) { @@ -1657,9 +1657,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) { @@ -1835,19 +1835,19 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object value) { @@ -2113,7 +2113,7 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object value) { @@ -2149,9 +2149,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } - public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } public Result_1(Result_1Tag tag, object value) { @@ -2187,9 +2187,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } public Result_2(Result_2Tag tag, object value) { @@ -2225,9 +2225,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } public Result_3(Result_3Tag tag, object value) { @@ -2263,9 +2263,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } public Result_4(Result_4Tag tag, object value) { @@ -2301,9 +2301,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } - public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } public Result_5(Result_5Tag tag, object value) { @@ -2370,9 +2370,9 @@ namespace Test [VariantValueProperty()] public object Value { get; set; } - public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap index d7f7e5d0..abdcb15e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -218,25 +218,25 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object? value) { @@ -427,11 +427,11 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object? value) { @@ -475,9 +475,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object? value) { @@ -612,27 +612,27 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object? value) { @@ -677,29 +677,29 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } - public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } - public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } - public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } - public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } - public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } - public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } - public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } - public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } - public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } - public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } - public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } public Command1(Command1Tag tag, object? value) { @@ -773,21 +773,21 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } - public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } - public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } - public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } public Command2(Command2Tag tag, object? value) { @@ -942,9 +942,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object? value) { @@ -1818,9 +1818,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) { @@ -2021,19 +2021,19 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object? value) { @@ -2340,7 +2340,7 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object? value) { @@ -2376,9 +2376,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } - public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } public Result1(Result1Tag tag, object? value) { @@ -2414,9 +2414,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } public Result2(Result2Tag tag, object? value) { @@ -2452,9 +2452,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } public Result3(Result3Tag tag, object? value) { @@ -2490,9 +2490,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } public Result4(Result4Tag tag, object? value) { @@ -2528,9 +2528,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } public Result5(Result5Tag tag, object? value) { @@ -2602,9 +2602,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object? value) { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap index 6e693da1..d68b2e18 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -216,25 +216,25 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } - public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } - public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } - public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } - public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } - public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } - public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } - public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } - public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } - public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } public Action(ActionTag tag, object? value) { @@ -409,11 +409,11 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } - public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } - public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } public By(ByTag tag, object? value) { @@ -457,9 +457,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } - public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } public Change(ChangeTag tag, object? value) { @@ -585,27 +585,27 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } - public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } - public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } - public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } - public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } - public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } - public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } - public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } public Command(CommandTag tag, object? value) { @@ -650,29 +650,29 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } - public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } - public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } - public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } - public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } - public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } - public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } - public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } - public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } - public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } - public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } - public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } public Command_1(Command_1Tag tag, object? value) { @@ -746,21 +746,21 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } - public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } - public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } - public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } - public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } - public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } - public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } - public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } public Command_2(Command_2Tag tag, object? value) { @@ -901,9 +901,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } - public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } public DissolveState(DissolveStateTag tag, object? value) { @@ -1657,9 +1657,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } - public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) { @@ -1835,19 +1835,19 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } - public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } - public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } - public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } - public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } - public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } - public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } public Operation(OperationTag tag, object? value) { @@ -2113,7 +2113,7 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } public Result(ResultTag tag, object? value) { @@ -2149,9 +2149,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } - public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } public Result_1(Result_1Tag tag, object? value) { @@ -2187,9 +2187,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } public Result_2(Result_2Tag tag, object? value) { @@ -2225,9 +2225,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } public Result_3(Result_3Tag tag, object? value) { @@ -2263,9 +2263,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } public Result_4(Result_4Tag tag, object? value) { @@ -2301,9 +2301,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } - public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } public Result_5(Result_5Tag tag, object? value) { @@ -2370,9 +2370,9 @@ namespace Test [VariantValueProperty()] public object? Value { get; set; } - public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } - public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } public RewardMode(RewardModeTag tag, object? value) {