Пример #1
0
        protected override void Action(ArgumentsValues args, OptionsValues options)
        {
            MangaRequestData data = MangaRequestData.DefaultAddRequest(args.Value<ReadingStatus>("status"));

            if (options.ContainsKey("score"))
                data.Score = options["score"].Value<int>("value");

            if (options.ContainsKey("priority"))
                data.Priority = options["priority"].Value<Priority>("value");

            MiniMALClient.AddRequestResult result = Client.AddManga(args.Value<int>("id"), data);

            switch (result)
            {
                case MiniMALClient.AddRequestResult.Created:
                    System.Console.WriteLine("Created");
                    break;
                case MiniMALClient.AddRequestResult.AlreadyInTheList:
                    System.Console.WriteLine("Already in your list.");
                    break;
            }
        }
Пример #2
0
        protected override void Action(ArgumentsValues args, OptionsValues options)
        {
            var data = new MangaRequestData();

            if (options.ContainsKey("score"))
                data.Score = options["score"].Value<int>("value");

            if (options.ContainsKey("status"))
                data.Status = options["status"].Value<ReadingStatus>("value");

            MiniMALClient.UpdateRequestResult result = Client.UpdateManga(args.Value<int>("id"), data);

            switch (result)
            {
                case MiniMALClient.UpdateRequestResult.Updated:
                    System.Console.WriteLine("Updated");
                    break;
                case MiniMALClient.UpdateRequestResult.NoParametersPassed:
                    System.Console.WriteLine("Empty request - use options");
                    break;
            }
        }