//public StatusData<GeneralKvPair<string, string>> SignOut(SystemSession sessionObject, SignOut request)
        //{
        //    var result = new StatusData<GeneralKvPair<string, string>>
        //    {
        //        Status = SystemDbStatus.Deleted,
        //        Data = new GeneralKvPair<string, string>()
        //    };
        //    var session = new Session { SessionToken = request.Token, DeviceId = request.DeviceId, UserId = request.UserName, Replay = true };
        //    //var user = new User { Session = new Session { UserId = request.UserId.ToString(), SessionToken = request.LoginToken, DeviceId = request.DeviceId, Replay = true }, UsernameEmail = request.UserName };
        //    //var aa = _client.Service.Kill(user);
        //    _client.SessionService.killSession(session);
        //    result.Data.Id = request.DeviceId;
        //    result.Data.Value = request.Token;

        //    return result;
        //}

        public async Task<StatusData<bool>> SignOut(SystemSession sessionObject, SignOut request)
        {
            var result = new StatusData<bool>
            {
                Status = SystemDbStatus.Deleted
            };
            var session = new Session { SessionToken = request.Token, DeviceId = request.DeviceId, UserId = request.UserName, Replay = true };
            result.Data = await Task.Factory.StartNew(() => Client.SessionService.killSession(session)).ConfigureAwait(false);
            return result;
        }
 public IAsyncResult Begin_gearUpVer2(AsyncCallback callback, object state, GearUp gearUp, Session session)
 {
   return send_gearUpVer2(callback, state, gearUp, session);
 }
 public void send_getRules(int userId, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("getRules", TMessageType.Call, seqid_));
   getRules_args args = new getRules_args();
   args.UserId = userId;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
      public List<InboxRule> getRules(int userId, Session session)
      {
        #if !SILVERLIGHT
        send_getRules(userId, session);
        return recv_getRules();

        #else
        var asyncResult = Begin_getRules(null, null, userId, session);
        return End_getRules(asyncResult);

        #endif
      }
 public void send_deleteInboxRules(Inbox inbox, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("deleteInboxRules", TMessageType.Call, seqid_));
   deleteInboxRules_args args = new deleteInboxRules_args();
   args.Inbox = inbox;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
      /// <summary>
      /// Method to delete existing inbox rules with following parameters:
      /// @param Inbox messageFolder
      /// 1. int userId
      /// 2. int folderId
      /// @param InboxRule messageRule
      /// 1. int messageRuleId
      /// @param Session sessionObj
      /// @return int code
      /// @throws InboxException
      /// @throws SessionException
      /// </summary>
      /// <param name="inbox"></param>
      /// <param name="session"></param>
      public DbStatus deleteInboxRules(Inbox inbox, Session session)
      {
        #if !SILVERLIGHT
        send_deleteInboxRules(inbox, session);
        return recv_deleteInboxRules();

        #else
        var asyncResult = Begin_deleteInboxRules(null, null, inbox, session);
        return End_deleteInboxRules(asyncResult);

        #endif
      }
      /// <summary>
      /// Method to create Inbox Rules that takes following paramaters with their respective field set:
      /// @param Inbox messageFolder
      /// 1. int userId
      /// 2. int folderId
      /// @param InboxRule messageRule
      /// 1. int ruleUserSelection,
      /// 2. int ruleTypeUser,
      /// 3. int ruleTypeSubject,
      /// 4. String subject,
      /// 5. String[] contactList,
      /// 6. String[] groupList
      /// @param Session sessionObj
      /// @return int code
      /// @throws InboxException
      /// @throws SessionException
      /// </summary>
      /// <param name="inbox"></param>
      /// <param name="session"></param>
      public Inbox createInboxRules(Inbox inbox, Session session)
      {
        #if !SILVERLIGHT
        send_createInboxRules(inbox, session);
        return recv_createInboxRules();

        #else
        var asyncResult = Begin_createInboxRules(null, null, inbox, session);
        return End_createInboxRules(asyncResult);

        #endif
      }
 public IAsyncResult send_sync(AsyncCallback callback, object state, string snapshot, Session session)
 public IAsyncResult Begin_tinyInstancePush(AsyncCallback callback, object state, ChatInstancePullInfo instance, Session session)
 {
   return send_tinyInstancePush(callback, state, instance, session);
 }
 public IAsyncResult send_tinyMsgPush(AsyncCallback callback, object state, ChatMessagePull msg, Session session)
      public string tinyMsgPush(ChatMessagePull msg, Session session)
      {
        #if !SILVERLIGHT
        send_tinyMsgPush(msg, session);
        return recv_tinyMsgPush();

        #else
        var asyncResult = Begin_tinyMsgPush(null, null, msg, session);
        return End_tinyMsgPush(asyncResult);

        #endif
      }
 public IAsyncResult Begin_tinyMsgPush(AsyncCallback callback, object state, ChatMessagePull msg, Session session)
 {
   return send_tinyMsgPush(callback, state, msg, session);
 }
 public void send_gearUpVer2(GearUp gearUp, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("gearUpVer2", TMessageType.Call, seqid_));
   gearUpVer2_args args = new gearUpVer2_args();
   args.GearUp = gearUp;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
 public IAsyncResult send_gearUpVer2(AsyncCallback callback, object state, GearUp gearUp, Session session)
      public string gearUpVer2(GearUp gearUp, Session session)
      {
        #if !SILVERLIGHT
        send_gearUpVer2(gearUp, session);
        return recv_gearUpVer2();

        #else
        var asyncResult = Begin_gearUpVer2(null, null, gearUp, session);
        return End_gearUpVer2(asyncResult);

        #endif
      }
 public IAsyncResult Begin_sync(AsyncCallback callback, object state, string snapshot, Session session)
 {
   return send_sync(callback, state, snapshot, session);
 }
      public string sync(string snapshot, Session session)
      {
        #if !SILVERLIGHT
        send_sync(snapshot, session);
        return recv_sync();

        #else
        var asyncResult = Begin_sync(null, null, snapshot, session);
        return End_sync(asyncResult);

        #endif
      }
      public string tinyInstancePush(ChatInstancePullInfo instance, Session session)
      {
        #if !SILVERLIGHT
        send_tinyInstancePush(instance, session);
        return recv_tinyInstancePush();

        #else
        var asyncResult = Begin_tinyInstancePush(null, null, instance, session);
        return End_tinyInstancePush(asyncResult);

        #endif
      }
 public void send_sync(string snapshot, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("sync", TMessageType.Call, seqid_));
   sync_args args = new sync_args();
   args.Snapshot = snapshot;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
 public IAsyncResult send_tinyInstancePush(AsyncCallback callback, object state, ChatInstancePullInfo instance, Session session)
 public IAsyncResult Begin_deleteInboxRules(AsyncCallback callback, object state, Inbox inbox, Session session)
 {
   return send_deleteInboxRules(callback, state, inbox, session);
 }
 public void send_tinyInstancePush(ChatInstancePullInfo instance, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("tinyInstancePush", TMessageType.Call, seqid_));
   tinyInstancePush_args args = new tinyInstancePush_args();
   args.Instance = instance;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
 public IAsyncResult send_deleteInboxRules(AsyncCallback callback, object state, Inbox inbox, Session session)
 public IAsyncResult Begin_tinyGroupPush(AsyncCallback callback, object state, GroupPull groupPull, Session session)
 {
   return send_tinyGroupPush(callback, state, groupPull, session);
 }
 public IAsyncResult Begin_getRules(AsyncCallback callback, object state, int userId, Session session)
 {
   return send_getRules(callback, state, userId, session);
 }
      public string tinyGroupPush(GroupPull groupPull, Session session)
      {
        #if !SILVERLIGHT
        send_tinyGroupPush(groupPull, session);
        return recv_tinyGroupPush();

        #else
        var asyncResult = Begin_tinyGroupPush(null, null, groupPull, session);
        return End_tinyGroupPush(asyncResult);

        #endif
      }
 public IAsyncResult send_getRules(AsyncCallback callback, object state, int userId, Session session)
 public IAsyncResult send_tinyGroupPush(AsyncCallback callback, object state, GroupPull groupPull, Session session)
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Struct) {
           Inbox = new Inbox();
           Inbox.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Session = new Session();
           Session.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
 public void send_tinyGroupPush(GroupPull groupPull, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("tinyGroupPush", TMessageType.Call, seqid_));
   tinyGroupPush_args args = new tinyGroupPush_args();
   args.GroupPull = groupPull;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }