public void Execute(Session session, CommandLine line)
 {
     if (session.IsAuthed())
     {
         var user = session.GetVariables().Inoreader.GetUserInfo();
         session.WriteLine(user.UserId);
     }
 }
 public void Execute(Session session, CommandLine line)
 {
     if (session.IsAuthed() && session.IsFeedsInitialized())
     {
         var inoreader = session.GetInoreader();
         var variables = session.GetVariables();
         inoreader.MarkAsRead(variables.FiltedItems.Select(z => z.Id).ToArray());
         variables.FiltedItems = null;
         session.WriteLine("done.");
     }
 }
示例#3
0
 public void Subscriptions(Session session, CommandLine line)
 {
     if (session.IsAuthed())
     {
         var inoreader = session.GetInoreader();
         var subscriptions = inoreader.GetSubscriptions();
         session.GetVariables().Subscriptions = subscriptions;
         for (var i = 0; i < subscriptions.Count; i++)
         {
             var item = subscriptions[i];
             session.WriteLine($"[{i}] {item.Title}");
         }
     }
 }
示例#4
0
        public void Feed(Session session, CommandLine line,
            [MethodParameter("id")][Alias("i")][Desciption("id of subscription")]
            int subscriptionId,
            [MethodParameter("count")][Alias("c")][Alias("n")][Desciption("count of feeds")]
            int? c = null,
            [MethodParameter("filter")][Alias("f")][Desciption("filter of feeds")]
            ItemsFilterEnum filter = ItemsFilterEnum.OnlyUnread)
        {
            if (session.IsAuthed())
            {
                var inoreader = session.GetInoreader();
                var variables = session.GetVariables();
                if (variables.Subscriptions == null)
                {
                    session.WriteLine("list sub before list feed.");
                    return;
                }
                if (subscriptionId < 0 || subscriptionId >= variables.Subscriptions.Count)
                {
                    session.WriteLine("invaild id.");
                    return;
                }
                var id = variables.Subscriptions[subscriptionId].Id;

                var count = c ?? 200;
                if (count < 1)
                {
                    session.WriteLine("count must > 0.");
                    return;
                }

                var items = inoreader.GetItems(id, filter: filter, count: count);
                variables.FiltedItems = items.Items;
                session.PrintItem();
            }
        }