Skip to content

Instantly share code, notes, and snippets.

@garfbradaz
Created October 10, 2018 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garfbradaz/386cd3a37934b5ff90724c9d7026baac to your computer and use it in GitHub Desktop.
Save garfbradaz/386cd3a37934b5ff90724c9d7026baac to your computer and use it in GitHub Desktop.
Our Product object represented in JSON.
public partial class JsonProduct
{
[JsonProperty("record")]
public Record[] Record { get; set; }
}
public partial class Record
{
[JsonProperty("editionID")]
public double EditionId { get; set; }
[JsonProperty("coverTitle")]
public string CoverTitle { get; set; }
[JsonProperty("isbn13")]
public string Isbn13 { get; set; }
[JsonProperty("subTitle")]
public string SubTitle { get; set; }
[JsonProperty("coverAuthors")]
public string CoverAuthors { get; set; }
[JsonProperty("workReference")]
[JsonConverter(typeof(ParseStringConverter))]
public long WorkReference { get; set; }
[JsonProperty("binding")]
public Binding? Binding { get; set; }
[JsonProperty("division")]
public Division Division { get; set; }
[JsonProperty("formats")]
public Format[] Formats { get; set; }
[JsonProperty("sortTitle")]
public string SortTitle { get; set; }
[JsonProperty("workID")]
[JsonConverter(typeof(ParseStringConverter))]
public long WorkId { get; set; }
[JsonProperty("imprint")]
public Imprint Imprint { get; set; }
[JsonProperty("pubDate")]
public string PubDate { get; set; }
[JsonProperty("productType")]
public ProductType ProductType { get; set; }
[JsonProperty("seriesNumber")]
public long? SeriesNumber { get; set; }
[JsonProperty("seriesTitle")]
public string SeriesTitle { get; set; }
[JsonProperty("issuedNumber")]
public long IssuedNumber { get; set; }
[JsonProperty("minimumAge")]
public long? MinimumAge { get; set; }
[JsonProperty("maximumAge")]
public long? MaximumAge { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("keynote")]
public string Keynote { get; set; }
[JsonProperty("status")]
public Status Status { get; set; }
[JsonProperty("copyRightYear")]
public object CopyRightYear { get; set; }
[JsonProperty("pubPrice")]
public double PubPrice { get; set; }
[JsonProperty("keywords")]
public string[] Keywords { get; set; }
[JsonProperty("pageCount")]
public long? PageCount { get; set; }
[JsonProperty("editionTypes")]
public long[] EditionTypes { get; set; }
[JsonProperty("relatedProducts")]
public string[] RelatedProducts { get; set; }
[JsonProperty("people")]
public Person[] People { get; set; }
[JsonProperty("categories")]
public Category[] Categories { get; set; }
[JsonProperty("availability")]
public Availability Availability { get; set; }
[JsonProperty("timeStamp")]
public DateTimeOffset TimeStamp { get; set; }
[JsonProperty("reviews")]
public Review[] Reviews { get; set; }
[JsonProperty("images")]
public Image[] Images { get; set; }
[JsonProperty("awards")]
public object[] Awards { get; set; }
[JsonProperty("link")]
public object Link { get; set; }
[JsonProperty("isActive")]
public bool IsActive { get; set; }
}
public partial class Availability
{
[JsonProperty("code")]
[JsonConverter(typeof(ParseStringConverter))]
public long Code { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
}
public partial class Category
{
[JsonProperty("mainCode")]
public bool MainCode { get; set; }
[JsonProperty("version")]
public Version Version { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("categorytype")]
public CategoryCategorytype Categorytype { get; set; }
}
public partial class Format
{
[JsonProperty("mainCode")]
public object MainCode { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("description")]
public Binding Description { get; set; }
[JsonProperty("code")]
public FormatCode Code { get; set; }
[JsonProperty("categorytype")]
public FormatCategorytype Categorytype { get; set; }
}
public partial class Image
{
[JsonProperty("url")]
public Uri Url { get; set; }
[JsonProperty("type")]
public TypeEnum Type { get; set; }
}
public partial class Person
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("firstName")]
public string FirstName { get; set; }
[JsonProperty("lastName")]
public string LastName { get; set; }
[JsonProperty("role")]
public Role Role { get; set; }
[JsonProperty("code")]
public PersonCode Code { get; set; }
[JsonProperty("link")]
public object Link { get; set; }
}
public partial class Review
{
[JsonProperty("id")]
public double Id { get; set; }
[JsonProperty("editionId")]
public double EditionId { get; set; }
[JsonProperty("reviewText")]
public string ReviewText { get; set; }
[JsonProperty("reviewer")]
public string Reviewer { get; set; }
[JsonProperty("source")]
public string Source { get; set; }
}
public enum Binding { EBook, Hardback, Paperback };
public enum CategoryCategorytype { Bic, Bisac };
public enum Division { OrionPublishingGroup };
public enum FormatCategorytype { Onix };
public enum FormatCode { Bb, Bc, Dg, Ea };
public enum TypeEnum { Original, Thumbnail, Web };
public enum Imprint { WN };
public enum PersonCode { A01 };
public enum Role { Author };
public enum ProductType { Book, EBook };
public enum Status { Confirmed, OutOfPrint };
public partial struct Version
{
public long? Integer;
public string String;
public static implicit operator Version(long Integer) => new Version { Integer = Integer };
public static implicit operator Version(string String) => new Version { String = String };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment