-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-33: Implement missing json readers for show objects
- Loading branch information
1 parent
bcb0bbf
commit 3a88dcc
Showing
8 changed files
with
140 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Source/Lib/Trakt.NET/Objects/Get/Shows/Json/Reader/ShowAirsArrayJsonReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace TraktNet.Objects.Get.Shows.Json.Reader | ||
{ | ||
using Newtonsoft.Json; | ||
using Objects.Json; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
internal class ShowAirsArrayJsonReader : AArrayJsonReader<ITraktShowAirs> | ||
{ | ||
public override async Task<IEnumerable<ITraktShowAirs>> ReadArrayAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) | ||
{ | ||
if (jsonReader == null) | ||
return await Task.FromResult(default(IEnumerable<ITraktShowAirs>)); | ||
|
||
if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartArray) | ||
{ | ||
var showAirsReader = new ShowAirsObjectJsonReader(); | ||
var showAirss = new List<ITraktShowAirs>(); | ||
ITraktShowAirs showAirs = await showAirsReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
|
||
while (showAirs != null) | ||
{ | ||
showAirss.Add(showAirs); | ||
showAirs = await showAirsReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
} | ||
|
||
return showAirss; | ||
} | ||
|
||
return await Task.FromResult(default(IEnumerable<ITraktShowAirs>)); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Source/Lib/Trakt.NET/Objects/Get/Shows/Json/Reader/ShowCollectionProgressArrayJsonReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace TraktNet.Objects.Get.Shows.Json.Reader | ||
{ | ||
using Newtonsoft.Json; | ||
using Objects.Json; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
internal class ShowCollectionProgressArrayJsonReader : AArrayJsonReader<ITraktShowCollectionProgress> | ||
{ | ||
public override async Task<IEnumerable<ITraktShowCollectionProgress>> ReadArrayAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) | ||
{ | ||
if (jsonReader == null) | ||
return await Task.FromResult(default(IEnumerable<ITraktShowCollectionProgress>)); | ||
|
||
if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartArray) | ||
{ | ||
var showCollectionProgressReader = new ShowCollectionProgressObjectJsonReader(); | ||
var showCollectionProgresses = new List<ITraktShowCollectionProgress>(); | ||
ITraktShowCollectionProgress showCollectionProgress = await showCollectionProgressReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
|
||
while (showCollectionProgress != null) | ||
{ | ||
showCollectionProgresses.Add(showCollectionProgress); | ||
showCollectionProgress = await showCollectionProgressReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
} | ||
|
||
return showCollectionProgresses; | ||
} | ||
|
||
return await Task.FromResult(default(IEnumerable<ITraktShowCollectionProgress>)); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Source/Lib/Trakt.NET/Objects/Get/Shows/Json/Reader/ShowIdsArrayJsonReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace TraktNet.Objects.Get.Shows.Json.Reader | ||
{ | ||
using Newtonsoft.Json; | ||
using Objects.Json; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
internal class ShowIdsArrayJsonReader : AArrayJsonReader<ITraktShowIds> | ||
{ | ||
public override async Task<IEnumerable<ITraktShowIds>> ReadArrayAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) | ||
{ | ||
if (jsonReader == null) | ||
return await Task.FromResult(default(IEnumerable<ITraktShowIds>)); | ||
|
||
if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartArray) | ||
{ | ||
var showIdsReader = new ShowIdsObjectJsonReader(); | ||
var showIdss = new List<ITraktShowIds>(); | ||
ITraktShowIds showIds = await showIdsReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
|
||
while (showIds != null) | ||
{ | ||
showIdss.Add(showIds); | ||
showIds = await showIdsReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
} | ||
|
||
return showIdss; | ||
} | ||
|
||
return await Task.FromResult(default(IEnumerable<ITraktShowIds>)); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Source/Lib/Trakt.NET/Objects/Get/Shows/Json/Reader/ShowWatchedProgressArrayJsonReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace TraktNet.Objects.Get.Shows.Json.Reader | ||
{ | ||
using Newtonsoft.Json; | ||
using Objects.Json; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
internal class ShowWatchedProgressArrayJsonReader : AArrayJsonReader<ITraktShowWatchedProgress> | ||
{ | ||
public override async Task<IEnumerable<ITraktShowWatchedProgress>> ReadArrayAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) | ||
{ | ||
if (jsonReader == null) | ||
return await Task.FromResult(default(IEnumerable<ITraktShowWatchedProgress>)); | ||
|
||
if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartArray) | ||
{ | ||
var showWatchedProgressReader = new ShowWatchedProgressObjectJsonReader(); | ||
var showWatchedProgresses = new List<ITraktShowWatchedProgress>(); | ||
ITraktShowWatchedProgress showWatchedProgress = await showWatchedProgressReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
|
||
while (showWatchedProgress != null) | ||
{ | ||
showWatchedProgresses.Add(showWatchedProgress); | ||
showWatchedProgress = await showWatchedProgressReader.ReadObjectAsync(jsonReader, cancellationToken); | ||
} | ||
|
||
return showWatchedProgresses; | ||
} | ||
|
||
return await Task.FromResult(default(IEnumerable<ITraktShowWatchedProgress>)); | ||
} | ||
} | ||
} |