Beispiel #1
0
 public override async Task <GrpcAccount> GetAccountByMarketplaceId(GrpcGetByIdReq request, ServerCallContext context)
 {
     try
     {
         return(await MainController.GetAccountByMarketplaceId(request));
     }
     catch (Exception e)
     {
         throw HandleException(e);
     }
 }
Beispiel #2
0
 public static async Task <GrpcAccount> GetAccountByMarketplaceId(GrpcGetByIdReq request)
 {
     try
     {
         return(await Client.GetAccountByMarketplaceIdAsync(request));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
        public override async Task <GrpcVoid> RefreshAccountTokens(GrpcGetByIdReq request, ServerCallContext context)
        {
            try
            {
                await TokensUseCases.Refresh.Execute(request.Id);

                return(new GrpcVoid());
            }
            catch (Exception e)
            {
                throw HandleException(e);
            }
        }
Beispiel #4
0
        public static async Task <GrpcAccount> GetAccountByMarketplaceId(GrpcGetByIdReq grpcRequest)
        {
            try
            {
                var id       = GrpcGetByIdReqAdapter.Adapt(grpcRequest);
                var parsedId = Int64.Parse(id);
                var account  = await AccountUseCases.Get.ByMercadoLivreId(parsedId);

                return(AccountPresenter.Present(account));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <IActionResult> GetAccountByMarketplaceId(long id)
        {
            try
            {
                var grpcReq = new GrpcGetByIdReq()
                {
                    Id = id.ToString()
                };
                var grpcResp = await MercadoLivreClient.GetAccountByMarketplaceId(grpcReq);

                var json = JsonSerializer.Serialize(grpcResp);
                return(new ContentResult()
                {
                    ContentType = "application/json",
                    Content = json,
                    StatusCode = 200
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #6
0
 public static string Adapt(GrpcGetByIdReq req)
 {
     return(req.Id);
 }