diff --git a/Tzkt.Api/Controllers/AccountsController.cs b/Tzkt.Api/Controllers/AccountsController.cs index 93ca68b5f..2133e9949 100644 --- a/Tzkt.Api/Controllers/AccountsController.cs +++ b/Tzkt.Api/Controllers/AccountsController.cs @@ -147,7 +147,7 @@ public Task GetCount( /// Include or not account metadata /// [HttpGet("{address}")] - public Task GetByAddress([Address] string address, bool metadata = false) + public Task GetByAddress([Required][Address] string address, bool metadata = false) { return Accounts.Get(address, metadata); } @@ -165,7 +165,7 @@ public Task GetByAddress([Address] string address, bool metadata = fals /// [HttpGet("{address}/contracts")] public async Task>> GetContracts( - [Address] string address, + [Required][Address] string address, SortParameter sort, OffsetParameter offset, [Range(0, 10000)] int limit = 100) @@ -194,7 +194,7 @@ public async Task>> GetContracts( /// [HttpGet("{address}/delegators")] public async Task>> GetDelegators( - [Address] string address, + [Required][Address] string address, AccountTypeParameter type, Int64Parameter balance, Int32Parameter delegationLevel, @@ -251,7 +251,7 @@ public async Task>> GetDelegators( /// [HttpGet("{address}/operations")] public async Task>> GetOperations( - [Address] string address, + [Required][Address] string address, string type, AccountParameter initiator, AccountParameter sender, @@ -410,7 +410,7 @@ public async Task>> GetOperations( /// Account address (starting with tz or KT) /// [HttpGet("{address}/metadata")] - public Task GetMetadata([Address] string address) + public Task GetMetadata([Required][Address] string address) { return Accounts.GetMetadata(address); } @@ -431,7 +431,7 @@ public Task GetMetadata([Address] string address) /// [HttpGet("{address}/report")] public async Task GetBalanceReport( - [Address] string address, + [Required][Address] string address, DateTimeOffset? from, DateTimeOffset? to, string currency, @@ -525,7 +525,7 @@ public async Task GetBalanceReport( /// [HttpGet("{address}/balance_history")] public async Task>> GetBalanceHistory( - [Address] string address, + [Required][Address] string address, [Min(1)] int? step, SelectParameter select, SortParameter sort, @@ -573,7 +573,7 @@ public async Task>> GetBalanceHistor /// Block height at which you want to know account balance /// [HttpGet("{address}/balance_history/{level:int}")] - public Task GetBalanceAtLevel([Address] string address, int level) + public Task GetBalanceAtLevel([Required][Address] string address, [Min(0)] int level) { return History.Get(address, level); } @@ -588,7 +588,7 @@ public Task GetBalanceAtLevel([Address] string address, int level) /// Datetime at which you want to know account balance (e.g. `2020-01-01`, or `2019-12-30T23:42:59Z`) /// [HttpGet("{address}/balance_history/{datetime:DateTime}")] - public Task GetBalanceAtDate([Address] string address, DateTimeOffset datetime) + public Task GetBalanceAtDate([Required][Address] string address, DateTimeOffset datetime) { return History.Get(address, datetime.DateTime); } diff --git a/Tzkt.Api/Controllers/BigMapsController.cs b/Tzkt.Api/Controllers/BigMapsController.cs index 04fadb55d..eee26830d 100644 --- a/Tzkt.Api/Controllers/BigMapsController.cs +++ b/Tzkt.Api/Controllers/BigMapsController.cs @@ -246,7 +246,7 @@ public async Task>> GetKeys( [HttpGet("{id:int}/keys/{key}")] public async Task> GetKey( [Min(0)] int id, - string key, + [Required] string key, MichelineFormat micheline = MichelineFormat.Json) { try @@ -284,7 +284,7 @@ public async Task> GetKey( [HttpGet("{id:int}/keys/{key}/updates")] public async Task>> GetKeyUpdates( [Min(0)] int id, - string key, + [Required] string key, SortParameter sort, OffsetParameter offset, [Range(0, 10000)] int limit = 100, @@ -391,7 +391,7 @@ public async Task>> GetHistoricalK public async Task> GetKey( [Min(0)] int id, [Min(0)] int level, - string key, + [Required] string key, MichelineFormat micheline = MichelineFormat.Json) { try diff --git a/Tzkt.Api/Controllers/BlocksController.cs b/Tzkt.Api/Controllers/BlocksController.cs index 590176291..e87169f84 100644 --- a/Tzkt.Api/Controllers/BlocksController.cs +++ b/Tzkt.Api/Controllers/BlocksController.cs @@ -121,7 +121,7 @@ public async Task>> Get( /// [HttpGet("{hash}")] public Task GetByHash( - [BlockHash] string hash, + [Required][BlockHash] string hash, bool operations = false, MichelineFormat micheline = MichelineFormat.Json, Symbols quote = Symbols.None) diff --git a/Tzkt.Api/Controllers/CommitmentsController.cs b/Tzkt.Api/Controllers/CommitmentsController.cs index bc54028ba..657ec9989 100644 --- a/Tzkt.Api/Controllers/CommitmentsController.cs +++ b/Tzkt.Api/Controllers/CommitmentsController.cs @@ -31,7 +31,7 @@ public CommitmentsController(CommitmentRepository commitments, StateCache state) /// Blinded address (starting with btz) /// [HttpGet("{address}")] - public Task Get([BlindedAddress] string address) + public Task Get([Required][BlindedAddress] string address) { return Commitments.Get(address); } diff --git a/Tzkt.Api/Controllers/ContractsController.cs b/Tzkt.Api/Controllers/ContractsController.cs index 63e3ee2de..8d4b6a844 100644 --- a/Tzkt.Api/Controllers/ContractsController.cs +++ b/Tzkt.Api/Controllers/ContractsController.cs @@ -149,7 +149,7 @@ public Task GetCount(ContractKindParameter kind) /// Contract address (starting with KT) /// [HttpGet("{address}")] - public Task GetByAddress([Address] string address) + public Task GetByAddress([Required][Address] string address) { return Accounts.GetContract(address); } @@ -170,7 +170,7 @@ public Task GetByAddress([Address] string address) /// [HttpGet("{address}/same")] public async Task>> GetSame( - [Address] string address, + [Required][Address] string address, SelectParameter select, SortParameter sort, OffsetParameter offset, @@ -229,7 +229,7 @@ public async Task>> GetSame( /// [HttpGet("{address}/similar")] public async Task>> GetSimilar( - [Address] string address, + [Required][Address] string address, SelectParameter select, SortParameter sort, OffsetParameter offset, @@ -282,7 +282,7 @@ public async Task>> GetSimilar( /// Code format (`0` - micheline, `1` - michelson, `2` - bytes (base64)) /// [HttpGet("{address}/code")] - public async Task GetCode([Address] string address, [Range(0, 2)] int format = 0) + public async Task GetCode([Required][Address] string address, [Range(0, 2)] int format = 0) { if (format == 0) return await Accounts.GetMichelineCode(address); @@ -300,7 +300,7 @@ public async Task GetCode([Address] string address, [Range(0, 2)] int fo /// Contract address /// [HttpGet("{address}/interface")] - public Task GetInterface([Address] string address) + public Task GetInterface([Required][Address] string address) { return Accounts.GetContractInterface(address); } @@ -321,7 +321,7 @@ public Task GetInterface([Address] string address) /// Include parameters schema in michelson format /// [HttpGet("{address}/entrypoints")] - public Task> GetEntrypoints([Address] string address, bool all = false, bool json = true, bool micheline = false, bool michelson = false) + public Task> GetEntrypoints([Required][Address] string address, bool all = false, bool json = true, bool micheline = false, bool michelson = false) { return Accounts.GetEntrypoints(address, all, json, micheline, michelson); } @@ -339,7 +339,7 @@ public Task> GetEntrypoints([Address] string address, bo /// Include parameters schema in michelson format /// [HttpGet("{address}/entrypoints/{name}")] - public Task GetEntrypointByName([Address] string address, string name, bool json = true, bool micheline = false, bool michelson = false) + public Task GetEntrypointByName([Required][Address] string address, [Required] string name, bool json = true, bool micheline = false, bool michelson = false) { return Accounts.GetEntrypoint(address, name, json, micheline, michelson); } @@ -355,7 +355,7 @@ public Task GetEntrypointByName([Address] string address, string nam /// Json parameters /// [HttpGet("{address}/entrypoints/{name}/build")] - public async Task BuildEntrypointParameters([Address] string address, string name, string value) + public async Task BuildEntrypointParameters([Required][Address] string address, [Required] string name, string value) { try { @@ -379,7 +379,7 @@ public async Task BuildEntrypointParameters([Address] string addre /// Json parameters /// [HttpPost("{address}/entrypoints/{name}/build")] - public async Task BuildEntrypointParameters([Address] string address, string name, [FromBody] object value) + public async Task BuildEntrypointParameters([Required][Address] string address, [Required] string name, [FromBody] object value) { try { @@ -402,7 +402,7 @@ public async Task BuildEntrypointParameters([Address] string addre /// Path in the JSON value (point-separated list of field names, e.g. `path=settings.refund_time` to return /// [HttpGet("{address}/storage")] - public async Task GetStorage([Address] string address, [Min(0)] int level = 0, string path = null) + public async Task GetStorage([Required][Address] string address, [Min(0)] int level = 0, string path = null) { #region safe path JsonPath[] jsonPath = null; @@ -433,7 +433,7 @@ public async Task GetStorage([Address] string address, [Min(0)] in /// Level at which storage schema should be taken. If `0` or not specified, the current schema will be returned. /// [HttpGet("{address}/storage/schema")] - public async Task GetStorageSchema([Address] string address, [Min(0)] int level = 0) + public async Task GetStorageSchema([Required][Address] string address, [Min(0)] int level = 0) { if (level == 0) return this.Json(await Accounts.GetStorageSchema(address)); @@ -451,7 +451,7 @@ public async Task GetStorageSchema([Address] string address, [Min( /// Maximum number of items to return /// [HttpGet("{address}/storage/history")] - public Task> GetStorageHistory([Address] string address, [Min(0)] int lastId = 0, [Range(0, 1000)] int limit = 10) + public Task> GetStorageHistory([Required][Address] string address, [Min(0)] int lastId = 0, [Range(0, 1000)] int limit = 10) { return Accounts.GetStorageHistory(address, lastId, limit); } @@ -466,7 +466,7 @@ public Task> GetStorageHistory([Address] string addre /// Level at which storage value should be taken. If `0` or not specified, the current value will be returned. /// [HttpGet("{address}/storage/raw")] - public Task GetRawStorage([Address] string address, [Min(0)] int level = 0) + public Task GetRawStorage([Required][Address] string address, [Min(0)] int level = 0) { if (level == 0) return Accounts.GetRawStorageValue(address); @@ -483,7 +483,7 @@ public Task GetRawStorage([Address] string address, [Min(0)] int lev /// Level at which storage schema should be taken. If `0` or not specified, the current schema will be returned. /// [HttpGet("{address}/storage/raw/schema")] - public Task GetRawStorageSchema([Address] string address, [Min(0)] int level = 0) + public Task GetRawStorageSchema([Required][Address] string address, [Min(0)] int level = 0) { if (level == 0) return Accounts.GetRawStorageSchema(address); @@ -501,7 +501,7 @@ public Task GetRawStorageSchema([Address] string address, [Min(0)] i /// Maximum number of items to return /// [HttpGet("{address}/storage/raw/history")] - public Task> GetRawStorageHistory([Address] string address, [Min(0)] int lastId = 0, [Range(0, 1000)] int limit = 10) + public Task> GetRawStorageHistory([Required][Address] string address, [Min(0)] int lastId = 0, [Range(0, 1000)] int limit = 10) { return Accounts.GetRawStorageHistory(address, lastId, limit); } @@ -523,7 +523,7 @@ public Task> GetRawStorageHistory([Address] string ad /// [HttpGet("{address}/bigmaps")] public async Task>> GetBigMaps( - [Address] string address, + [Required][Address] string address, BigMapTagsParameter tags, SelectParameter select, SortParameter sort, @@ -581,8 +581,8 @@ public async Task>> GetBigMaps( /// [HttpGet("{address}/bigmaps/{name}")] public async Task> GetBigMapByName( - [Address] string address, - string name, + [Required][Address] string address, + [Required] string name, MichelineFormat micheline = MichelineFormat.Json) { var acc = await Accounts.GetRawAsync(address); @@ -616,8 +616,8 @@ public async Task> GetBigMapByName( /// [HttpGet("{address}/bigmaps/{name}/keys")] public async Task>> GetBigMapByNameKeys( - [Address] string address, - string name, + [Required][Address] string address, + [Required] string name, bool? active, JsonParameter key, JsonParameter value, @@ -682,9 +682,9 @@ public async Task>> GetBigMapByNameKeys( /// [HttpGet("{address}/bigmaps/{name}/keys/{key}")] public async Task> GetKey( - [Address] string address, - string name, - string key, + [Required][Address] string address, + [Required] string name, + [Required] string key, MichelineFormat micheline = MichelineFormat.Json) { var acc = await Accounts.GetRawAsync(address); @@ -732,9 +732,9 @@ public async Task> GetKey( /// [HttpGet("{address}/bigmaps/{name}/keys/{key}/updates")] public async Task>> GetKeyUpdates( - [Address] string address, - string name, - string key, + [Required][Address] string address, + [Required] string name, + [Required] string key, SortParameter sort, OffsetParameter offset, [Range(0, 10000)] int limit = 100, @@ -795,8 +795,8 @@ public async Task>> GetKeyUpdates( /// [HttpGet("{address}/bigmaps/{name}/historical_keys/{level:int}")] public async Task>> GetHistoricalKeys( - [Address] string address, - string name, + [Required][Address] string address, + [Required] string name, [Min(0)] int level, bool? active, JsonParameter key, @@ -862,10 +862,10 @@ public async Task>> GetHistoricalK /// [HttpGet("{address}/bigmaps/{name}/historical_keys/{level:int}/{key}")] public async Task> GetKey( - [Address] string address, - string name, + [Required][Address] string address, + [Required] string name, [Min(0)] int level, - string key, + [Required] string key, MichelineFormat micheline = MichelineFormat.Json) { var acc = await Accounts.GetRawAsync(address); diff --git a/Tzkt.Api/Controllers/CyclesController.cs b/Tzkt.Api/Controllers/CyclesController.cs index 070a03d64..8c3051f27 100644 --- a/Tzkt.Api/Controllers/CyclesController.cs +++ b/Tzkt.Api/Controllers/CyclesController.cs @@ -99,7 +99,7 @@ public async Task>> Get( /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("{index:int}")] - public Task GetByIndex(int index, Symbols quote = Symbols.None) + public Task GetByIndex([Min(0)] int index, Symbols quote = Symbols.None) { return Cycles.Get(index, quote); } diff --git a/Tzkt.Api/Controllers/DelegatesController.cs b/Tzkt.Api/Controllers/DelegatesController.cs index 5daa7ec8c..82d91205c 100644 --- a/Tzkt.Api/Controllers/DelegatesController.cs +++ b/Tzkt.Api/Controllers/DelegatesController.cs @@ -95,7 +95,7 @@ public Task GetCount(BoolParameter active) /// Delegate address (starting with tz) /// [HttpGet("{address}")] - public Task GetByAddress([Address] string address) + public Task GetByAddress([Required][Address] string address) { return Accounts.GetDelegate(address); } diff --git a/Tzkt.Api/Controllers/OperationsController.cs b/Tzkt.Api/Controllers/OperationsController.cs index d01303046..eff197ee6 100644 --- a/Tzkt.Api/Controllers/OperationsController.cs +++ b/Tzkt.Api/Controllers/OperationsController.cs @@ -37,7 +37,7 @@ public OperationsController(OperationRepository operations, StateCache state) /// [HttpGet("{hash}")] public Task> GetByHash( - [OpHash] string hash, + [Required][OpHash] string hash, MichelineFormat micheline = MichelineFormat.Json, Symbols quote = Symbols.None) { @@ -57,7 +57,7 @@ public Task> GetByHash( /// [HttpGet("{hash}/{counter}")] public Task> GetByHashCounter( - [OpHash] string hash, + [Required][OpHash] string hash, [Min(0)] int counter, MichelineFormat micheline = MichelineFormat.Json, Symbols quote = Symbols.None) @@ -79,7 +79,7 @@ public Task> GetByHashCounter( /// [HttpGet("{hash}/{counter}/{nonce}")] public Task> GetByHashCounterNonce( - [OpHash] string hash, + [Required][OpHash] string hash, [Min(0)] int counter, [Min(0)] int nonce, MichelineFormat micheline = MichelineFormat.Json, @@ -168,7 +168,7 @@ public async Task>> GetEndorsemen /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("endorsements/{hash}")] - public Task> GetEndorsementByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetEndorsementByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetEndorsements(hash, quote); } @@ -279,7 +279,7 @@ public async Task>> GetBallots( /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("ballots/{hash}")] - public Task> GetBallotByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetBallotByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetBallots(hash, quote); } @@ -392,7 +392,7 @@ public async Task>> GetProposals( /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("proposals/{hash}")] - public Task> GetProposalByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetProposalByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetProposals(hash, quote); } @@ -497,7 +497,7 @@ public async Task>> GetActivations /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("activations/{hash}")] - public Task> GetActivationByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetActivationByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetActivations(hash, quote); } @@ -627,7 +627,7 @@ public async Task>> GetDoubleBak /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("double_baking/{hash}")] - public Task> GetDoubleBakingByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetDoubleBakingByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetDoubleBakings(hash, quote); } @@ -757,7 +757,7 @@ public async Task>> GetDouble /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("double_endorsing/{hash}")] - public Task> GetDoubleEndorsingByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetDoubleEndorsingByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetDoubleEndorsings(hash, quote); } @@ -887,7 +887,7 @@ public async Task>> GetNonceR /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("nonce_revelations/{hash}")] - public Task> GetNonceRevelationByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetNonceRevelationByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetNonceRevelations(hash, quote); } @@ -1047,7 +1047,7 @@ public async Task>> GetDelegations /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("delegations/{hash}")] - public Task> GetDelegationByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetDelegationByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetDelegations(hash, quote); } @@ -1229,7 +1229,7 @@ public async Task>> GetOriginatio /// [HttpGet("originations/{hash}")] public Task> GetOriginationByHash( - [OpHash] string hash, + [Required][OpHash] string hash, MichelineFormat micheline, Symbols quote = Symbols.None) { @@ -1392,7 +1392,7 @@ public async Task>> GetTransactio /// [HttpGet("transactions/{hash}")] public Task> GetTransactionByHash( - [OpHash] string hash, + [Required][OpHash] string hash, MichelineFormat micheline = MichelineFormat.Json, Symbols quote = Symbols.None) { @@ -1412,7 +1412,7 @@ public Task> GetTransactionByHash( /// [HttpGet("transactions/{hash}/{counter}")] public Task> GetTransactionByHashCounter( - [OpHash] string hash, + [Required][OpHash] string hash, [Min(0)] int counter, MichelineFormat micheline = MichelineFormat.Json, Symbols quote = Symbols.None) @@ -1434,7 +1434,7 @@ public Task> GetTransactionByHashCounter( /// [HttpGet("transactions/{hash}/{counter}/{nonce}")] public Task> GetTransactionByHashCounterNonce( - [OpHash] string hash, + [Required][OpHash] string hash, [Min(0)] int counter, [Min(0)] int nonce, MichelineFormat micheline = MichelineFormat.Json, @@ -1547,7 +1547,7 @@ public async Task>> GetReveals( /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("reveals/{hash}")] - public Task> GetRevealByHash([OpHash] string hash, Symbols quote = Symbols.None) + public Task> GetRevealByHash([Required][OpHash] string hash, Symbols quote = Symbols.None) { return Operations.GetReveals(hash, quote); } diff --git a/Tzkt.Api/Controllers/ProtocolsController.cs b/Tzkt.Api/Controllers/ProtocolsController.cs index 3f1b0c527..c9062e1f1 100644 --- a/Tzkt.Api/Controllers/ProtocolsController.cs +++ b/Tzkt.Api/Controllers/ProtocolsController.cs @@ -96,7 +96,7 @@ public Task GetByCode([Min(0)] int code) /// Protocol hash /// [HttpGet("{hash}")] - public Task GetByHash([ProtocolHash] string hash) + public Task GetByHash([Required][ProtocolHash] string hash) { return Protocols.Get(hash); } diff --git a/Tzkt.Api/Controllers/RewardsController.cs b/Tzkt.Api/Controllers/RewardsController.cs index af15592d0..1c7d829ed 100644 --- a/Tzkt.Api/Controllers/RewardsController.cs +++ b/Tzkt.Api/Controllers/RewardsController.cs @@ -30,7 +30,7 @@ public RewardsController(RewardsRepository rewards) /// Baker address /// [HttpGet("bakers/{address}/count")] - public Task GetBakerRewardsCount([Address] string address) + public Task GetBakerRewardsCount([Required][Address] string address) { return Rewards.GetBakerRewardsCount(address); } @@ -51,7 +51,7 @@ public Task GetBakerRewardsCount([Address] string address) /// [HttpGet("bakers/{address}")] public async Task>> GetBakerRewards( - [Address] string address, + [Required][Address] string address, Int32Parameter cycle, SelectParameter select, SortParameter sort, @@ -100,7 +100,7 @@ public async Task>> GetBakerRewards( /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("bakers/{address}/{cycle:int}")] - public Task GetBakerRewardsByCycle([Address] string address, int cycle, Symbols quote = Symbols.None) + public Task GetBakerRewardsByCycle([Required][Address] string address, [Min(0)] int cycle, Symbols quote = Symbols.None) { return Rewards.GetBakerRewards(address, cycle, quote); } @@ -114,7 +114,7 @@ public Task GetBakerRewardsByCycle([Address] string address, int c /// Delegator address /// [HttpGet("delegators/{address}/count")] - public Task GetDelegatorRewardsCount([Address] string address) + public Task GetDelegatorRewardsCount([Required][Address] string address) { return Rewards.GetDelegatorRewardsCount(address); } @@ -135,7 +135,7 @@ public Task GetDelegatorRewardsCount([Address] string address) /// [HttpGet("delegators/{address}")] public async Task>> GetDelegatorRewards( - [Address] string address, + [Required][Address] string address, Int32Parameter cycle, SelectParameter select, SortParameter sort, @@ -184,7 +184,7 @@ public async Task>> GetDelegatorRewar /// Comma-separated list of ticker symbols to inject historical prices into response /// [HttpGet("delegators/{address}/{cycle:int}")] - public Task GetDelegatorRewardsByCycle([Address] string address, int cycle, Symbols quote = Symbols.None) + public Task GetDelegatorRewardsByCycle([Required][Address] string address, [Min(0)] int cycle, Symbols quote = Symbols.None) { return Rewards.GetDelegatorRewards(address, cycle, quote); } @@ -201,7 +201,7 @@ public Task GetDelegatorRewardsByCycle([Address] string addres /// Maximum number of delegators to return /// [HttpGet("split/{address}/{cycle:int}")] - public Task GetRewardSplit([Address] string address, int cycle, int offset = 0, [Range(0, 10000)] int limit = 100) + public Task GetRewardSplit([Required][Address] string address, [Min(0)] int cycle, int offset = 0, [Range(0, 10000)] int limit = 100) { return Rewards.GetRewardSplit(address, cycle, offset, limit); } @@ -217,7 +217,7 @@ public Task GetRewardSplit([Address] string address, int cycle, int /// Delegator address /// [HttpGet("split/{baker}/{cycle:int}/{delegator}")] - public Task GetRewardSplitDelegator([Address] string baker, int cycle, [Address] string delegator) + public Task GetRewardSplitDelegator([Required][Address] string baker, [Min(0)] int cycle, [Required][Address] string delegator) { return Rewards.GetRewardSplitDelegator(baker, cycle, delegator); } diff --git a/Tzkt.Api/Controllers/RightsController.cs b/Tzkt.Api/Controllers/RightsController.cs index dc20ace93..559a9d063 100644 --- a/Tzkt.Api/Controllers/RightsController.cs +++ b/Tzkt.Api/Controllers/RightsController.cs @@ -113,7 +113,7 @@ public async Task>> Get( [OpenApiIgnore] [HttpGet("schedule")] public async Task>> GetSchedule( - [Address] [Required] string baker, + [Required][Address] string baker, [Required] DateTimeOffset from, [Required] DateTimeOffset to, [Min(0)] int maxPriority = 0) diff --git a/Tzkt.Api/Controllers/VotingController.cs b/Tzkt.Api/Controllers/VotingController.cs index 6a2d28b39..dbfab6caa 100644 --- a/Tzkt.Api/Controllers/VotingController.cs +++ b/Tzkt.Api/Controllers/VotingController.cs @@ -97,7 +97,7 @@ public async Task>> GetProposals( /// Proposal hash /// [HttpGet("proposals/{hash}")] - public Task GetProposalByHash([ProtocolHash] string hash) + public Task GetProposalByHash([Required][ProtocolHash] string hash) { return Voting.GetProposal(hash); } @@ -217,7 +217,7 @@ public async Task>> GetPeriodVoters( /// Voter address /// [HttpGet("periods/{index:int}/voters/{address}")] - public Task GetPeriodVoter([Min(0)] int index, [Address] string address) + public Task GetPeriodVoter([Min(0)] int index, [Required][Address] string address) { return Voting.GetVoter(index, address); } @@ -257,7 +257,7 @@ public async Task>> GetPeriodVoters( /// Voter address /// [HttpGet("periods/current/voters/{address}")] - public Task GetPeriodVoter([Address] string address) + public Task GetPeriodVoter([Required][Address] string address) { return Voting.GetVoter(State.Current.VotingPeriod, address); }