Beispiel #1
0
        public override async Task ExecuteAsync(string[] args)
        {
            var cmdLine = CommandLine.Parse(args);

            if (cmdLine.ShowUsage)
            {
                return;
            }

            var address = cmdLine.EmailAddress;

            try
            {
                var request = new UpdateMaskedEmailRequest
                {
                    Name        = cmdLine.Name,
                    Description = cmdLine.Description,
                };
                await Client.UpdateAddress(address, request);
            }
            catch (ApiException e)
            {
                if (e.StatusCode == HttpStatusCode.NotFound)
                {
                    Console.Error.WriteLine("ERR: no such masked email address.");
                    return;
                }

                throw;
            }

            Console.Out.WriteLine($"The masked email {address} has been successfully updated.");
        }
Beispiel #2
0
        public async Task <ActionResult> UpdateMaskedEmail(string email, [FromBody] UpdateMaskedEmailRequest request)
        {
            if (!GetAuthenticatedUserId(out var identifier))
            {
                return(BadRequest());
            }

            await service_
            .UpdateMaskedEmail(identifier, email, request.Name, request.Description)
            ;

            return(Ok());
        }
 public Task UpdateAddress(string address, [Body] UpdateMaskedEmailRequest request)
 {
     return(client_.UpdateAddress(address, request));
 }