Beispiel #1
0
 public async Task UpdateOrCreateSessionAsync(SessionData sessionData)
 {
     await GrpcCallerService.CallService(_urls.Session, async channel =>
     {
         var client   = new SessionClient(channel);
         var request  = MapToSessionRequest(sessionData);
         var response = await client.UpdateSessionAsync(request);
     });
 }
Beispiel #2
0
 public async Task <ReceiverResponse> HandleReceiverRequestAsync(Models.ActionRequest actionRequest)
 {
     return(await GrpcCallerService.CallService(_urls.Receivers(actionRequest.SessionData.Language), async channel =>
     {
         var client = new ReceiverClient(channel);
         var request = MapToGrpcActionRequest(actionRequest);
         var response = await client.HandleReceiverRequestAsync(request);
         return MapToReceiverResponse(response);
     }));
 }
Beispiel #3
0
 public async Task <ReceiverResponse> HandleAfterActionRequestAsync(SessionData session)
 {
     return(await GrpcCallerService.CallService(_urls.Receiver, async channel =>
     {
         var client = new ReceiverClient(channel);
         var request = MapToChatRequest(session);
         var response = await client.HandleAfterActionAsync(request);
         return MapToReceiverResponse(response);
     }));
 }
Beispiel #4
0
 public async Task <SessionData> GetSessionDataAsync(Models.AuthType authType, long chatId)
 {
     return(await GrpcCallerService.CallService(_urls.Session, async channel =>
     {
         var client = new SessionClient(channel);
         var request = new GetSessionRequest
         {
             AuthType = GrpcSession.AuthType.Telegram,
             ChatId = chatId
         };
         var response = await client.GetSessionByIdAsync(request);
         return MapToSessionData(response);
     }));
 }