public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktUserCustomListItemsPostShow obj, CancellationToken cancellationToken = default) { if (jsonWriter == null) { throw new ArgumentNullException(nameof(jsonWriter)); } await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_SHOW_PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (obj.Seasons != null) { var customListItemsPostShowSeasonArrayJsonWriter = new ArrayJsonWriter <ITraktUserCustomListItemsPostShowSeason>(); await jsonWriter.WritePropertyNameAsync(JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_SHOW_PROPERTY_NAME_SEASONS, cancellationToken).ConfigureAwait(false); await customListItemsPostShowSeasonArrayJsonWriter.WriteArrayAsync(jsonWriter, obj.Seasons, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktSyncRatingsPostResponseNotFoundShow obj, CancellationToken cancellationToken = default) { if (jsonWriter == null) { throw new ArgumentNullException(nameof(jsonWriter)); } await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (obj.Rating.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_RESPONSE_NOT_FOUND_SHOW_PROPERTY_NAME_RATING, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Rating, cancellationToken).ConfigureAwait(false); } if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_RESPONSE_NOT_FOUND_SHOW_PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktSyncRatingsPostShow obj, CancellationToken cancellationToken = default) { if (jsonWriter == null) { throw new ArgumentNullException(nameof(jsonWriter)); } await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (obj.RatedAt.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_SHOW_PROPERTY_NAME_RATED_AT, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.RatedAt.Value.ToTraktLongDateTimeString(), cancellationToken).ConfigureAwait(false); } if (obj.Rating.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_SHOW_PROPERTY_NAME_RATING, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Rating, cancellationToken).ConfigureAwait(false); } if (!string.IsNullOrEmpty(obj.Title)) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_SHOW_PROPERTY_NAME_TITLE, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Title, cancellationToken).ConfigureAwait(false); } if (obj.Year.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_SHOW_PROPERTY_NAME_YEAR, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Year, cancellationToken).ConfigureAwait(false); } if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_SHOW_PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (obj.Seasons != null) { var syncRatingsPostShowSeasonArrayJsonWriter = new ArrayJsonWriter <ITraktSyncRatingsPostShowSeason>(); await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_RATINGS_POST_SHOW_PROPERTY_NAME_SEASONS, cancellationToken).ConfigureAwait(false); await syncRatingsPostShowSeasonArrayJsonWriter.WriteArrayAsync(jsonWriter, obj.Seasons, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktPostResponseNotFoundShow obj, CancellationToken cancellationToken = default) { CheckJsonTextWriter(jsonWriter); await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktSyncHistoryPostShow obj, CancellationToken cancellationToken = default) { CheckJsonTextWriter(jsonWriter); await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (obj.WatchedAt.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_WATCHED_AT, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.WatchedAt.Value.ToTraktLongDateTimeString(), cancellationToken).ConfigureAwait(false); } if (!string.IsNullOrEmpty(obj.Title)) { await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_TITLE, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Title, cancellationToken).ConfigureAwait(false); } if (obj.Year.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_YEAR, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Year, cancellationToken).ConfigureAwait(false); } if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (obj.Seasons != null) { var syncHistoryPostShowSeasonArrayJsonWriter = new ArrayJsonWriter <ITraktSyncHistoryPostShowSeason>(); await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_SEASONS, cancellationToken).ConfigureAwait(false); await syncHistoryPostShowSeasonArrayJsonWriter.WriteArrayAsync(jsonWriter, obj.Seasons, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktUserHiddenItemsPostShow obj, CancellationToken cancellationToken = default) { if (jsonWriter == null) { throw new ArgumentNullException(nameof(jsonWriter)); } await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(obj.Title)) { await jsonWriter.WritePropertyNameAsync(JsonProperties.USER_HIDDEN_ITEMS_POST_SHOW_PROPERTY_NAME_TITLE, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Title, cancellationToken).ConfigureAwait(false); } if (obj.Year.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.USER_HIDDEN_ITEMS_POST_SHOW_PROPERTY_NAME_YEAR, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Year, cancellationToken).ConfigureAwait(false); } if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.USER_HIDDEN_ITEMS_POST_SHOW_PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (obj.Seasons != null) { var hiddenItemsPostShowSeasonArrayJsonWriter = new ArrayJsonWriter <ITraktUserHiddenItemsPostShowSeason>(); await jsonWriter.WritePropertyNameAsync(JsonProperties.USER_HIDDEN_ITEMS_POST_SHOW_PROPERTY_NAME_SEASONS, cancellationToken).ConfigureAwait(false); await hiddenItemsPostShowSeasonArrayJsonWriter.WriteArrayAsync(jsonWriter, obj.Seasons, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
protected override async Task WriteMetadataObjectAsync(JsonTextWriter jsonWriter, ITraktSyncCollectionPostShow obj, CancellationToken cancellationToken = default) { if (obj.CollectedAt.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_COLLECTION_POST_SHOW_PROPERTY_NAME_COLLECTED_AT, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.CollectedAt.Value.ToTraktLongDateTimeString(), cancellationToken).ConfigureAwait(false); } if (!string.IsNullOrEmpty(obj.Title)) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_COLLECTION_POST_SHOW_PROPERTY_NAME_TITLE, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Title, cancellationToken).ConfigureAwait(false); } if (obj.Year.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_COLLECTION_POST_SHOW_PROPERTY_NAME_YEAR, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Year, cancellationToken).ConfigureAwait(false); } if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_COLLECTION_POST_SHOW_PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (obj.Seasons != null) { var syncCollectionPostShowSeasonArrayJsonWriter = new ArrayJsonWriter <ITraktSyncCollectionPostShowSeason>(); await jsonWriter.WritePropertyNameAsync(JsonProperties.SYNC_COLLECTION_POST_SHOW_PROPERTY_NAME_SEASONS, cancellationToken).ConfigureAwait(false); await syncCollectionPostShowSeasonArrayJsonWriter.WriteArrayAsync(jsonWriter, obj.Seasons, cancellationToken).ConfigureAwait(false); } await base.WriteMetadataObjectAsync(jsonWriter, obj, cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktUserCustomListItemsPostShow obj, CancellationToken cancellationToken = default) { CheckJsonTextWriter(jsonWriter); await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (obj.Seasons != null) { var customListItemsPostShowSeasonArrayJsonWriter = new ArrayJsonWriter <ITraktUserCustomListItemsPostShowSeason>(); await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_SEASONS, cancellationToken).ConfigureAwait(false); await customListItemsPostShowSeasonArrayJsonWriter.WriteArrayAsync(jsonWriter, obj.Seasons, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }
public override async Task WriteObjectAsync(JsonTextWriter jsonWriter, ITraktSyncRecommendationsPostShow obj, CancellationToken cancellationToken = default) { CheckJsonTextWriter(jsonWriter); await jsonWriter.WriteStartObjectAsync(cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(obj.Title)) { await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_TITLE, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Title, cancellationToken).ConfigureAwait(false); } if (obj.Year.HasValue) { await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_YEAR, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Year, cancellationToken).ConfigureAwait(false); } if (obj.Ids != null) { var showIdsObjectJsonWriter = new ShowIdsObjectJsonWriter(); await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_IDS, cancellationToken).ConfigureAwait(false); await showIdsObjectJsonWriter.WriteObjectAsync(jsonWriter, obj.Ids, cancellationToken).ConfigureAwait(false); } if (!string.IsNullOrEmpty(obj.Notes)) { await jsonWriter.WritePropertyNameAsync(JsonProperties.PROPERTY_NAME_NOTES, cancellationToken).ConfigureAwait(false); await jsonWriter.WriteValueAsync(obj.Notes, cancellationToken).ConfigureAwait(false); } await jsonWriter.WriteEndObjectAsync(cancellationToken).ConfigureAwait(false); }