Beispiel #1
0
        public static Task UseReservationAsync(NiconicoContext context, string vid, ReservationToken token)
        {
            if (vid.StartsWith("lv"))
            {
                vid = vid.Remove(0, 2);
            }

            if (!int.TryParse(vid, out var vidNumber))
            {
                throw new ArgumentException("vid can not accept NiconicoLiveContentId.");
            }

            var dict = new Dictionary <string, string>();

            dict.Add("accept", "true");
            dict.Add("mode", "use");
            dict.Add("vid", vid);
            dict.Add("token", token.Token);

            return(context.PostAsync($"http://live.nicovideo.jp/api/watchingreservation", dict, withToken: false));
        }
Beispiel #2
0
 /// <summary>
 /// タイムシフト予約の視聴権を使用して、指定されあた生放送のタイムシフト視聴を有効化します。
 /// </summary>
 /// <param name="liveId_wo_lv"></param>
 /// <param name="token"></param>
 /// <returns></returns>
 /// <remarks>視聴権は使用から放送時間+24時間の間のみ有効です。(視聴権に関わらず視聴期限内いつでも視聴可能な場合は除く)</remarks>
 public Task UseReservationAsync(string liveId_wo_lv, Reservation.ReservationToken token)
 {
     return(Reservation.ReservationClient.UseReservationAsync(_context, liveId_wo_lv, token));
 }
Beispiel #3
0
 /// <summary>
 /// タイムシフト予約を削除します。<br />
 /// </summary>
 /// <param name="liveId">生放送コンテンツID(内部的にはlv無し数字のみのコンテンツIDが必要ですが、lvがあってもトリミングするよう対応してます)</param>
 /// <param name="token">タイムシフト予約の削除用トークン。トークン取得は <see cref="GetReservationTokenAsync"/> を利用してください。 </param>
 /// <returns></returns>
 /// <remarks>Getメソッドによる削除操作を行っている都合上、削除の成功/失敗は別途タイムシフト予約一覧を再取得するなどアプリサイドでの確認が必要です。</remarks>
 public Task DeleteReservationAsync(string liveId, Reservation.ReservationToken token)
 {
     return(Reservation.ReservationClient.DeleteReservationAsync(_context, liveId, token));
 }
Beispiel #4
0
        public static Task DeleteReservationAsync(NiconicoContext context, string vid, ReservationToken reservationDeleteToken)
        {
            var dict = new Dictionary <string, string>();

            if (vid.StartsWith("lv"))
            {
                vid = vid.Remove(0, 2);
            }

            if (!int.TryParse(vid, out var vidNumber))
            {
                throw new ArgumentException("vid can not accept NiconicoLiveContentId.");
            }

            dict.Add("delete", "timeshift");
            dict.Add(nameof(vid), vid);
            dict.Add("confirm", reservationDeleteToken.Token);

            return(context.GetStringAsync("http://live.nicovideo.jp/my", dict));
        }