public async Task <IActionResult> CreateKey([FromBody] CreateApiKeyRequest request)
        {
            if (request == null)
            {
                return(BadRequest());
            }

            var client = await _clientAccountService.GetClientByIdAsync(request.ClientId);

            if (client == null)
            {
                ModelState.AddModelError("ClientId", request.ClientId);
                return(BadRequest(ModelState));
            }

            var apiKey = await _walletService.CreateWallet(request.ClientId, request.Apiv2Only, request.Name, request.Description);

            return(Ok(_mapper.Map <ApiKeyDto>(apiKey)));
        }
Beispiel #2
0
        private async Task <bool> ValidateClientId(string clientId)
        {
            var client = await _clientAccountService.GetClientByIdAsync(clientId);

            return(client != null);
        }