예제 #1
0
        public async Task Update(int[] epId, EpStatus status)
        {
            if (epId == null)
            {
                throw new ArgumentNullException(nameof(epId));
            }
            if (epId.Length <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(status));
            }
            if (!Enum.IsDefined(typeof(EpStatus), status))
            {
                throw new ArgumentOutOfRangeException(nameof(status));
            }

            var url = $"/ep/{epId.Last()}/status/{status.ToString().ToLowerInvariant()}";

            using (var client = new BangumiClient(_oauthProvider))
            {
                using (var postContent = new FormUrlEncodedContent(Enumerable.Empty <KeyValuePair <string, string> >()))
                {
                    await client.PostAsync(url, postContent);
                }
            }
        }
예제 #2
0
        public static string GetValue(this EpStatus status)
        {
            switch (status)
            {
            case EpStatus.Watched:
                return("watched");

            case EpStatus.Queue:
                return("queue");

            case EpStatus.Drop:
                return("drop");

            case EpStatus.Remove:
                return("remove");

            default:
                return(status.ToString());
            }
        }