Skip to content

Commit

Permalink
Merge pull request #532 from henrikfroehling/issue/release-1.4.0/GH-522
Browse files Browse the repository at this point in the history
Resolves GH-522
  • Loading branch information
henrikfroehling authored Jul 4, 2023
2 parents fc54913 + cb368c5 commit f40ee81
Show file tree
Hide file tree
Showing 23 changed files with 643 additions and 643 deletions.
14 changes: 7 additions & 7 deletions Postman/v1.4.0/Trakt_API_Requests.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -7893,10 +7893,10 @@
]
},
{
"name": "Recommended",
"name": "Favorited",
"item": [
{
"name": "Get the most recommended movies",
"name": "Get the most favorited movies",
"request": {
"method": "GET",
"header": [
Expand All @@ -7917,13 +7917,13 @@
}
],
"url": {
"raw": "{{API_URL}}/movies/recommended",
"raw": "{{API_URL}}/movies/favorited",
"host": [
"{{API_URL}}"
],
"path": [
"movies",
"recommended"
"favorited"
],
"query": [
{
Expand Down Expand Up @@ -8046,7 +8046,7 @@
"response": []
},
{
"name": "Get the most recommended movies (period)",
"name": "Get the most favorited movies (period)",
"request": {
"method": "GET",
"header": [
Expand All @@ -8067,13 +8067,13 @@
}
],
"url": {
"raw": "{{API_URL}}/movies/recommended/:period",
"raw": "{{API_URL}}/movies/favorited/:period",
"host": [
"{{API_URL}}"
],
"path": [
"movies",
"recommended",
"favorited",
":period"
],
"query": [
Expand Down
22 changes: 11 additions & 11 deletions Source/Lib/Trakt.NET/Modules/TraktMoviesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,17 +753,17 @@ public Task<TraktPagedResponse<ITraktMostAnticipatedMovie>> GetMostAnticipatedMo
}

/// <summary>
/// Gets the most recommended movies.
/// Gets the most favorited movies.
/// <para>OAuth authorization not required.</para>
/// <para>
/// See <a href="https://trakt.docs.apiary.io/#reference/movies/recommended/get-the-most-recommended-movies">"Trakt API Doc - Movies: Recommended"</a> for more information.
/// See <a href="https://trakt.docs.apiary.io/#reference/movies/favorited/get-the-most-favorited-movies">"Trakt API Doc - Movies: Favorited"</a> for more information.
/// </para>
/// <para>
/// Use the <see cref="ITraktMovieFilterBuilder" /> to create an instance of the optional <see cref="ITraktMovieFilter" />.
/// See also <seealso cref="TraktFilter.NewMovieFilter()" />.
/// </para>
/// </summary>
/// <param name="period">The time period, for which the most recommended movies should be queried. See also <seealso cref="TraktTimePeriod" />.</param>
/// <param name="period">The time period, for which the most favorited movies should be queried. See also <seealso cref="TraktTimePeriod" />.</param>
/// <param name="extendedInfo">
/// The extended info, which determines how much data about the movies should be queried.
/// See also <seealso cref="TraktExtendedInfo" />.
Expand All @@ -775,20 +775,20 @@ public Task<TraktPagedResponse<ITraktMostAnticipatedMovie>> GetMostAnticipatedMo
/// If provided, the exception <see cref="OperationCanceledException" /> should be catched.
/// </param>
/// <returns>
/// An <see cref="TraktPagedResponse{ITraktMostRecommendedMovie}"/> instance containing the queried most recommended movies and which also
/// An <see cref="TraktPagedResponse{ITraktMostFavoritedMovie}"/> instance containing the queried most favorited movies and which also
/// contains the queried page number, the page's item count, maximum page count and maximum item count.
/// <para>
/// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktMostRecommendedMovie" />.
/// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktMostFavoritedMovie" />.
/// </para>
/// </returns>
/// <exception cref="TraktException">Thrown, if the request fails.</exception>
public Task<TraktPagedResponse<ITraktMostRecommendedMovie>> GetMostRecommendedMoviesAsync(TraktTimePeriod period = null,
TraktExtendedInfo extendedInfo = null,
ITraktMovieFilter filter = null,
TraktPagedParameters pagedParameters = null,
CancellationToken cancellationToken = default)
public Task<TraktPagedResponse<ITraktMostFavoritedMovie>> GetMostFavoritedMoviesAsync(TraktTimePeriod period = null,
TraktExtendedInfo extendedInfo = null,
ITraktMovieFilter filter = null,
TraktPagedParameters pagedParameters = null,
CancellationToken cancellationToken = default)
{
var request = new MoviesMostRecommendedRequest
var request = new MoviesMostFavoritedRequest
{
Period = period,
ExtendedInfo = extendedInfo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace TraktNet.Objects.Get.Movies
{
/// <summary>A recommended Trakt movie.</summary>
public interface ITraktMostRecommendedMovie : ITraktMovie
/// <summary>A favorited Trakt movie.</summary>
public interface ITraktMostFavoritedMovie : ITraktMovie
{
/// <summary>Gets or sets the user count for the <see cref="Movie" />.</summary>
int? UserCount { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace TraktNet.Objects.Get.Movies
using System;
using System.Collections.Generic;

/// <summary>A recommended Trakt movie.</summary>
public class TraktMostRecommendedMovie : ITraktMostRecommendedMovie
/// <summary>A favorited Trakt movie.</summary>
public class TraktMostFavoritedMovie : ITraktMostFavoritedMovie
{
/// <summary>Gets or sets the user count for the <see cref="Movie" />.</summary>
public int? UserCount { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace TraktNet.Objects.Get.Movies.Json.Factories
{
using Get.Movies.Json.Reader;
using Get.Movies.Json.Writer;
using Objects.Json;

internal class MostFavoritedMovieJsonIOFactory : IJsonIOFactory<ITraktMostFavoritedMovie>
{
public IObjectJsonReader<ITraktMostFavoritedMovie> CreateObjectReader() => new MostFavoritedMovieObjectJsonReader();

public IObjectJsonWriter<ITraktMostFavoritedMovie> CreateObjectWriter() => new MostFavoritedMovieObjectJsonWriter();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ namespace TraktNet.Objects.Get.Movies.Json.Reader
using System.Threading;
using System.Threading.Tasks;

internal class MostRecommendedMovieObjectJsonReader : AObjectJsonReader<ITraktMostRecommendedMovie>
internal class MostFavoritedMovieObjectJsonReader : AObjectJsonReader<ITraktMostFavoritedMovie>
{
public override async Task<ITraktMostRecommendedMovie> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
public override async Task<ITraktMostFavoritedMovie> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
{
CheckJsonTextReader(jsonReader);

if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
{
var movieObjectReader = new MovieObjectJsonReader();
ITraktMostRecommendedMovie traktMostRecommendedMovie = new TraktMostRecommendedMovie();
ITraktMostFavoritedMovie traktMostFavoritedMovie = new TraktMostFavoritedMovie();

while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
{
Expand All @@ -23,21 +23,21 @@ public override async Task<ITraktMostRecommendedMovie> ReadObjectAsync(JsonTextR
switch (propertyName)
{
case JsonProperties.PROPERTY_NAME_USER_COUNT:
traktMostRecommendedMovie.UserCount = await jsonReader.ReadAsInt32Async(cancellationToken);
traktMostFavoritedMovie.UserCount = await jsonReader.ReadAsInt32Async(cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_MOVIE:
traktMostRecommendedMovie.Movie = await movieObjectReader.ReadObjectAsync(jsonReader, cancellationToken);
traktMostFavoritedMovie.Movie = await movieObjectReader.ReadObjectAsync(jsonReader, cancellationToken);
break;
default:
await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);
break;
}
}

return traktMostRecommendedMovie;
return traktMostFavoritedMovie;
}

return await Task.FromResult(default(ITraktMostRecommendedMovie));
return await Task.FromResult(default(ITraktMostFavoritedMovie));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace TraktNet.Objects.Get.Movies.Json.Writer
using System.Threading;
using System.Threading.Tasks;

internal class MostRecommendedMovieObjectJsonWriter : AObjectJsonWriter<ITraktMostRecommendedMovie>
internal class MostFavoritedMovieObjectJsonWriter : AObjectJsonWriter<ITraktMostFavoritedMovie>
{
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktMostRecommendedMovie obj, CancellationToken cancellationToken = default)
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktMostFavoritedMovie obj, CancellationToken cancellationToken = default)
{
CheckJsonTextWriter(jsonWriter);
await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Trakt.NET/Objects/Json/JsonFactoryContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static JsonFactoryContainer()
s_jsonIOFactories.Add(typeof(ITraktBoxOfficeMovie), new BoxOfficeMovieJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMostAnticipatedMovie), new MostAnticipatedMovieJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMostPWCMovie), new MostPWCMovieJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMostRecommendedMovie), new MostRecommendedMovieJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMostFavoritedMovie), new MostFavoritedMovieJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMovie), new MovieJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMovieAlias), new MovieAliasJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktMovieIds), new MovieIdsJsonIOFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace TraktNet.Requests.Base
using Parameters;
using System.Collections.Generic;

internal abstract class AMostRecommendedRequest<TResponseContentType> : AGetRequest<TResponseContentType>, ISupportsExtendedInfo, ISupportsFilter, ISupportsPagination
internal abstract class AMostFavoritedRequest<TResponseContentType> : AGetRequest<TResponseContentType>, ISupportsExtendedInfo, ISupportsFilter, ISupportsPagination
{
internal TraktTimePeriod Period { get; set; }

Expand Down
12 changes: 12 additions & 0 deletions Source/Lib/Trakt.NET/Requests/Movies/MoviesMostFavoritedRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace TraktNet.Requests.Movies
{
using Base;
using Objects.Get.Movies;

internal sealed class MoviesMostFavoritedRequest : AMostFavoritedRequest<ITraktMostFavoritedMovie>
{
public override string UriTemplate => "movies/favorited{/period}{?extended,page,limit,query,years,genres,languages,countries,runtimes,ratings,certifications}";

public override void Validate() { }
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace TraktNet.Requests.Shows
using Base;
using Objects.Get.Shows;

internal sealed class ShowsMostRecommendedRequest : AMostRecommendedRequest<ITraktMostRecommendedShow>
internal sealed class ShowsMostRecommendedRequest : AMostFavoritedRequest<ITraktMostRecommendedShow>
{
public override string UriTemplate => "shows/recommended{/period}{?extended,page,limit,query,years,genres,languages,countries,runtimes,ratings,certifications,networks,status}";

Expand Down
Loading

0 comments on commit f40ee81

Please sign in to comment.