Esempio n. 1
0
        /// <summary>
        /// Removes movies from users collection
        /// </summary>
        /// <param name="syncData">list of shows</param>
        public static TraktSyncResponse RemoveMoviesFromCollection(TraktMovieSync syncData)
        {
            if (syncData == null)
            {
                return(null);
            }

            var response = TraktWeb.PostToTrakt(TraktURIs.SyncCollectionRemove, syncData.ToJSON());

            return(response.FromJSON <TraktSyncResponse>());
        }
Esempio n. 2
0
        /// <summary>
        /// Removes movies from users watched history
        /// </summary>
        /// <param name="syncData">list of shows</param>
        public static TraktSyncResponse RemoveMoviesFromWatchedHistory(TraktMovieSync syncData)
        {
            if (syncData == null)
            {
                return(null);
            }

            var response = TraktWeb.PostToTrakt(TraktURIs.SyncWatchedRemove, syncData.ToJSON());

            return(response.FromJSON <TraktSyncResponse>());
        }
Esempio n. 3
0
        /// <summary>
        /// Sends movie sync data to Trakt Watchlist
        /// </summary>
        /// <param name="syncData">The sync data to send</param>
        /// <returns>The response from trakt</returns>
        public static TraktSyncResponse AddMoviesToWatchlist(TraktMovieSync syncData)
        {
            // check that we have everything we need
            if (syncData == null || syncData.Movies == null || syncData.Movies.Count == 0)
            {
                return(null);
            }

            // serialize data to JSON and send to server
            string response = TraktWeb.PostToTrakt(TraktURIs.SyncWatchlist, syncData.ToJSON());

            // return success or failure
            return(response.FromJSON <TraktSyncResponse>());
        }
Esempio n. 4
0
        /// <summary>
        /// Removes all movies from watchlist from trakt
        /// </summary>
        /// <param name="syncData">list of movies</param>
        public static TraktSyncResponse RemoveMoviesFromWatchlist(TraktMovieSync syncData)
        {
            if (syncData == null)
                return null;

            var response = TraktWeb.PostToTrakt(TraktURIs.SyncWatchlistRemove, syncData.ToJSON());
            return response.FromJSON<TraktSyncResponse>();
        }
Esempio n. 5
0
        /// <summary>
        /// Sends movie sync data to Trakt Watchlist
        /// </summary>
        /// <param name="syncData">The sync data to send</param>
        /// <returns>The response from trakt</returns>
        public static TraktSyncResponse AddMoviesToWatchlist(TraktMovieSync syncData)
        {
            // check that we have everything we need
            if (syncData == null || syncData.Movies == null || syncData.Movies.Count == 0)
                return null;

            // serialize data to JSON and send to server
            string response = TraktWeb.PostToTrakt(TraktURIs.SyncWatchlist, syncData.ToJSON());

            // return success or failure
            return response.FromJSON<TraktSyncResponse>();
        }
Esempio n. 6
0
        /// <summary>
        /// Sends movie sync data to Trakt
        /// </summary>
        /// <param name="syncData">The sync data to send</param>
        /// <param name="mode">The sync mode to use</param>
        /// <returns>The response from trakt</returns>
        public static TraktMovieSyncResponse SyncMovieLibrary(TraktMovieSync syncData, TraktSyncModes mode)
        {
            // check that we have everything we need
            if (syncData == null || syncData.MovieList.Count == 0)
            {
                return(null);
            }

            // serialize data to JSON and send to server
            string response = TraktWeb.Transmit(string.Format(TraktURIs.SyncMovieLibrary, mode.ToString()), syncData.ToJSON());

            // return success or failure
            return(response.FromJSON <TraktMovieSyncResponse>());
        }
Esempio n. 7
0
    /// <summary>
    /// Sends movie sync data to Trakt
    /// </summary>
    /// <param name="syncData">The sync data to send</param>
    /// <param name="mode">The sync mode to use</param>
    /// <returns>The response from trakt</returns>
    public static TraktSyncResponse SyncMovieLibrary(TraktMovieSync syncData, TraktSyncModes mode)
    {
      // check that we have everything we need
      // server can accept title/year if imdb id is not supplied
      if (syncData == null || syncData.MovieList.Count == 0)
      {
        TraktSyncResponse error = new TraktSyncResponse
        {
          Error = "Not enough information to send to server",
          Status = "failure"
        };
        return error;
      }

      // serialize Scrobble object to JSON and send to server
      string response = Transmit(string.Format(TraktURIs.SyncMovieLibrary, mode), syncData.ToJSON());

      // return success or failure
      return response.FromJSON<TraktSyncResponse>();
    }