public override async Task <ITraktUserCustomListItemsPostResponse> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { if (jsonReader == null) { return(await Task.FromResult(default(ITraktUserCustomListItemsPostResponse))); } if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var responseGroupReader = new UserCustomListItemsPostResponseGroupObjectJsonReader(); var responseNotFoundGroupReader = new UserCustomListItemsPostResponseNotFoundGroupObjectJsonReader(); ITraktUserCustomListItemsPostResponse customListItemsPostResponse = new TraktUserCustomListItemsPostResponse(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_PROPERTY_NAME_ADDED: customListItemsPostResponse.Added = await responseGroupReader.ReadObjectAsync(jsonReader, cancellationToken); break; case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_PROPERTY_NAME_EXISTING: customListItemsPostResponse.Existing = await responseGroupReader.ReadObjectAsync(jsonReader, cancellationToken); break; case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_PROPERTY_NAME_NOT_FOUND: customListItemsPostResponse.NotFound = await responseNotFoundGroupReader.ReadObjectAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(customListItemsPostResponse); } return(await Task.FromResult(default(ITraktUserCustomListItemsPostResponse))); }
public override async Task <ITraktUserCustomListItemsRemovePostResponse> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { CheckJsonTextReader(jsonReader); if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var responseGroupReader = new UserCustomListItemsPostResponseGroupObjectJsonReader(); var responseNotFoundGroupReader = new UserCustomListItemsPostResponseNotFoundGroupObjectJsonReader(); ITraktUserCustomListItemsRemovePostResponse customListItemsRemovePostResponse = new TraktUserCustomListItemsRemovePostResponse(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.PROPERTY_NAME_DELETED: customListItemsRemovePostResponse.Deleted = await responseGroupReader.ReadObjectAsync(jsonReader, cancellationToken); break; case JsonProperties.PROPERTY_NAME_NOT_FOUND: customListItemsRemovePostResponse.NotFound = await responseNotFoundGroupReader.ReadObjectAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(customListItemsRemovePostResponse); } return(await Task.FromResult(default(ITraktUserCustomListItemsRemovePostResponse))); }
public override async Task <IEnumerable <ITraktUserCustomListItemsPostResponseGroup> > ReadArrayAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { if (jsonReader == null) { return(await Task.FromResult(default(IEnumerable <ITraktUserCustomListItemsPostResponseGroup>))); } if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartArray) { var userCustomListItemsPostResponseGroupReader = new UserCustomListItemsPostResponseGroupObjectJsonReader(); var userCustomListItemsPostResponseGroups = new List <ITraktUserCustomListItemsPostResponseGroup>(); ITraktUserCustomListItemsPostResponseGroup userCustomListItemsPostResponseGroup = await userCustomListItemsPostResponseGroupReader.ReadObjectAsync(jsonReader, cancellationToken); while (userCustomListItemsPostResponseGroup != null) { userCustomListItemsPostResponseGroups.Add(userCustomListItemsPostResponseGroup); userCustomListItemsPostResponseGroup = await userCustomListItemsPostResponseGroupReader.ReadObjectAsync(jsonReader, cancellationToken); } return(userCustomListItemsPostResponseGroups); } return(await Task.FromResult(default(IEnumerable <ITraktUserCustomListItemsPostResponseGroup>))); }