Skip to content

Commit

Permalink
GH-349: Rename TraktUserCustomListPost to TraktUserPersonalListPost
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikfroehling committed Nov 1, 2022
1 parent d8fb045 commit 57a843f
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions Source/Lib/Trakt.NET/Modules/TraktUsersModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ public Task<TraktResponse<ITraktList>> CreatePersonalListAsync(string usernameOr
if (listName.Length == 0)
throw new ArgumentException("list name must not be empty", nameof(listName));

var requestBody = new TraktUserCustomListPost
var requestBody = new TraktUserPersonalListPost
{
Name = listName,
Description = listDescription,
Expand Down Expand Up @@ -698,7 +698,7 @@ public Task<TraktResponse<ITraktList>> UpdatePersonalListAsync(string usernameOr
if (isListNameNotValid && isDescriptionNotSet && isPrivacyNotSetOrValid && isDisplayNumbersNotSet && isAllowCommentsNotSet)
throw new ArgumentException("no list specific values set");

var requestBody = new TraktUserCustomListPost
var requestBody = new TraktUserPersonalListPost
{
Name = listName,
Description = listDescription,
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 @@ -433,7 +433,7 @@ static JsonFactoryContainer()
s_jsonIOFactories.Add(typeof(ITraktListLike), new ListLikeJsonIOFactory());

// user post objects
s_jsonIOFactories.Add(typeof(ITraktUserPersonalListPost), new UserCustomListPostJsonIOFactory());
s_jsonIOFactories.Add(typeof(ITraktUserPersonalListPost), new UserPersonalListPostJsonIOFactory());

// user response post objects
s_jsonIOFactories.Add(typeof(ITraktUserFollowUserPostResponse), new UserFollowUserPostResponseJsonIOFactory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Threading.Tasks;

/// <summary>An episode custom list post.</summary>
public class TraktUserCustomListPost : ITraktUserPersonalListPost
public class TraktUserPersonalListPost : ITraktUserPersonalListPost
{
/// <summary>Gets or sets the required name of the custom list.</summary>
public string Name { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using Reader;
using Writer;

internal class UserCustomListPostJsonIOFactory : IJsonIOFactory<ITraktUserPersonalListPost>
internal class UserPersonalListPostJsonIOFactory : IJsonIOFactory<ITraktUserPersonalListPost>
{
public IObjectJsonReader<ITraktUserPersonalListPost> CreateObjectReader() => new UserCustomListPostObjectJsonReader();
public IObjectJsonReader<ITraktUserPersonalListPost> CreateObjectReader() => new UserPersonalListPostObjectJsonReader();

public IObjectJsonWriter<ITraktUserPersonalListPost> CreateObjectWriter() => new UserCustomListPostObjectJsonWriter();
public IObjectJsonWriter<ITraktUserPersonalListPost> CreateObjectWriter() => new UserPersonalListPostObjectJsonWriter();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
using System.Threading;
using System.Threading.Tasks;

internal class UserCustomListPostObjectJsonReader : AObjectJsonReader<ITraktUserPersonalListPost>
internal class UserPersonalListPostObjectJsonReader : AObjectJsonReader<ITraktUserPersonalListPost>
{
public override async Task<ITraktUserPersonalListPost> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
{
CheckJsonTextReader(jsonReader);

if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
{
ITraktUserPersonalListPost userCustomListPost = new TraktUserCustomListPost();
ITraktUserPersonalListPost userPersonalListPost = new TraktUserPersonalListPost();

while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
{
Expand All @@ -23,33 +23,33 @@ public override async Task<ITraktUserPersonalListPost> ReadObjectAsync(JsonTextR
switch (propertyName)
{
case JsonProperties.PROPERTY_NAME_NAME:
userCustomListPost.Name = await jsonReader.ReadAsStringAsync(cancellationToken);
userPersonalListPost.Name = await jsonReader.ReadAsStringAsync(cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_DESCRIPTION:
userCustomListPost.Description = await jsonReader.ReadAsStringAsync(cancellationToken);
userPersonalListPost.Description = await jsonReader.ReadAsStringAsync(cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_PRIVACY:
userCustomListPost.Privacy = await JsonReaderHelper.ReadEnumerationValueAsync<TraktAccessScope>(jsonReader, cancellationToken);
userPersonalListPost.Privacy = await JsonReaderHelper.ReadEnumerationValueAsync<TraktAccessScope>(jsonReader, cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_DISPLAY_NUMBERS:
userCustomListPost.DisplayNumbers = await jsonReader.ReadAsBooleanAsync(cancellationToken);
userPersonalListPost.DisplayNumbers = await jsonReader.ReadAsBooleanAsync(cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_ALLOW_COMMENTS:
userCustomListPost.AllowComments = await jsonReader.ReadAsBooleanAsync(cancellationToken);
userPersonalListPost.AllowComments = await jsonReader.ReadAsBooleanAsync(cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_SORT_BY:
userCustomListPost.SortBy = await jsonReader.ReadAsStringAsync(cancellationToken);
userPersonalListPost.SortBy = await jsonReader.ReadAsStringAsync(cancellationToken);
break;
case JsonProperties.PROPERTY_NAME_SORT_HOW:
userCustomListPost.SortHow = await jsonReader.ReadAsStringAsync(cancellationToken);
userPersonalListPost.SortHow = await jsonReader.ReadAsStringAsync(cancellationToken);
break;
default:
await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);
break;
}
}

return userCustomListPost;
return userPersonalListPost;
}

return await Task.FromResult(default(ITraktUserPersonalListPost));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading;
using System.Threading.Tasks;

internal class UserCustomListPostObjectJsonWriter : AObjectJsonWriter<ITraktUserPersonalListPost>
internal class UserPersonalListPostObjectJsonWriter : AObjectJsonWriter<ITraktUserPersonalListPost>
{
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktUserPersonalListPost obj, CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class TraktUsersModule_Tests
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME
};
Expand Down Expand Up @@ -60,7 +60,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList()
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Description()
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_Privacy()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -145,7 +145,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_Privacy_And_DisplayNumbers()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -189,7 +189,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_Privacy_And_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -234,7 +234,7 @@ await client.Users.CreatePersonalListAsync(USERNAME, LIST_NAME, DESCRIPTION, PRI
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_DisplayNumbers()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -277,7 +277,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -321,7 +321,7 @@ await client.Users.CreatePersonalListAsync(USERNAME, LIST_NAME, DESCRIPTION, nul
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Description_And_DisplayNumbers_And_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -366,7 +366,7 @@ await client.Users.CreatePersonalListAsync(USERNAME, LIST_NAME, DESCRIPTION, nul
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Privacy = PRIVACY
Expand Down Expand Up @@ -408,7 +408,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy()
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy_And_DisplayNumbers()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Privacy = PRIVACY,
Expand Down Expand Up @@ -451,7 +451,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy_And_Disp
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy_And_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Privacy = PRIVACY,
Expand Down Expand Up @@ -494,7 +494,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy_And_Allo
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_Privacy_And_DisplayNumbers_And_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Privacy = PRIVACY,
Expand Down Expand Up @@ -539,7 +539,7 @@ await client.Users.CreatePersonalListAsync(USERNAME, LIST_NAME, null, PRIVACY,
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_DisplayNumbers()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
DisplayNumbers = DISPLAY_NUMBERS
Expand Down Expand Up @@ -581,7 +581,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_DisplayNumbers()
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
AllowComments = ALLOW_COMMENTS
Expand Down Expand Up @@ -623,7 +623,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_With_AllowComments()
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_With_DisplayNumbers_And_AllowComments()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
DisplayNumbers = DISPLAY_NUMBERS,
Expand Down Expand Up @@ -667,7 +667,7 @@ await client.Users.CreatePersonalListAsync(USERNAME, LIST_NAME, null, null,
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_Complete()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME,
Description = DESCRIPTION,
Expand Down Expand Up @@ -745,7 +745,7 @@ public async Task Test_TraktUsersModule_CreatePersonalList_Throws_API_Exception(
[Fact]
public async Task Test_TraktUsersModule_CreatePersonalList_Exceptions()
{
ITraktUserPersonalListPost createListPost = new TraktUserCustomListPost
ITraktUserPersonalListPost createListPost = new TraktUserPersonalListPost
{
Name = LIST_NAME
};
Expand Down
Loading

0 comments on commit 57a843f

Please sign in to comment.