groups.jsonl
Schema
_key
(required): integer
Range: 0 .. 368726anchorable
(required): booleananchored
(required): booleancategoryID
(required): integer
Range: 0 .. 350001fittableNonSingleton
(required): booleaniconID
: integer
Range: 0 .. 26457-
name
(required): objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
published
(required): boolean useBasePrice
(required): boolean
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var group = Group.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class Group
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("anchorable")]
public bool Anchorable { get; set; }
[JsonProperty("anchored")]
public bool Anchored { get; set; }
[JsonProperty("categoryID")]
public long CategoryId { get; set; }
[JsonProperty("fittableNonSingleton")]
public bool FittableNonSingleton { get; set; }
[JsonProperty("iconID", NullValueHandling = NullValueHandling.Ignore)]
public long? IconId { get; set; }
[JsonProperty("name")]
public Name Name { get; set; }
[JsonProperty("published")]
public bool Published { get; set; }
[JsonProperty("useBasePrice")]
public bool UseBasePrice { get; set; }
}
public partial class Name
{
[JsonProperty("de")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class Group
{
public static Group FromJson(string json) => JsonConvert.DeserializeObject<Group>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this Group self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
internal class PurpleMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 93)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 93)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly PurpleMinMaxLengthCheckConverter Singleton = new PurpleMinMaxLengthCheckConverter();
}
internal class FluffyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 73)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 73)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FluffyMinMaxLengthCheckConverter Singleton = new FluffyMinMaxLengthCheckConverter();
}
internal class TentacledMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 110)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 110)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly TentacledMinMaxLengthCheckConverter Singleton = new TentacledMinMaxLengthCheckConverter();
}
internal class StickyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 126)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 126)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly StickyMinMaxLengthCheckConverter Singleton = new StickyMinMaxLengthCheckConverter();
}
internal class IndigoMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 1 && value.Length <= 48)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 1 && value.Length <= 48)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
internal class IndecentMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 1 && value.Length <= 36)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 1 && value.Length <= 36)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
internal class HilariousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 119)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 119)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly HilariousMinMaxLengthCheckConverter Singleton = new HilariousMinMaxLengthCheckConverter();
}
internal class AmbitiousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 1 && value.Length <= 26)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 1 && value.Length <= 26)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly AmbitiousMinMaxLengthCheckConverter Singleton = new AmbitiousMinMaxLengthCheckConverter();
}
}
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
// group, err := UnmarshalGroup(bytes)
// bytes, err = group.Marshal()
package model
import "encoding/json"
func UnmarshalGroup(data []byte) (Group, error) {
var r Group
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Group) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type Group struct {
Key int64 `json:"_key"`
Anchorable bool `json:"anchorable"`
Anchored bool `json:"anchored"`
CategoryID int64 `json:"categoryID"`
FittableNonSingleton bool `json:"fittableNonSingleton"`
IconID *int64 `json:"iconID,omitempty"`
Name Name `json:"name"`
Published bool `json:"published"`
UseBasePrice bool `json:"useBasePrice"`
}
type Name struct {
De string `json:"de"`
En string `json:"en"`
Es string `json:"es"`
Fr string `json:"fr"`
Ja string `json:"ja"`
Ko string `json:"ko"`
Ru string `json:"ru"`
Zh string `json:"zh"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 0,
"maximum": 368726
},
"anchorable": {
"type": "boolean"
},
"anchored": {
"type": "boolean"
},
"categoryID": {
"type": "integer",
"minimum": 0,
"maximum": 350001
},
"fittableNonSingleton": {
"type": "boolean"
},
"iconID": {
"type": "integer",
"minimum": 0,
"maximum": 26457
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 3,
"maxLength": 93
},
"en": {
"type": "string",
"minLength": 3,
"maxLength": 73
},
"es": {
"type": "string",
"minLength": 3,
"maxLength": 110
},
"fr": {
"type": "string",
"minLength": 3,
"maxLength": 126
},
"ja": {
"type": "string",
"minLength": 1,
"maxLength": 48
},
"ko": {
"type": "string",
"minLength": 1,
"maxLength": 36
},
"ru": {
"type": "string",
"minLength": 3,
"maxLength": 119
},
"zh": {
"type": "string",
"minLength": 1,
"maxLength": 26
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"published": {
"type": "boolean"
},
"useBasePrice": {
"type": "boolean"
}
},
"required": [
"_key",
"anchorable",
"anchored",
"categoryID",
"fittableNonSingleton",
"name",
"published",
"useBasePrice"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val group = json.parse(Group.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class Group (
@SerialName("_key")
val key: Long,
val anchorable: Boolean,
val anchored: Boolean,
@SerialName("categoryID")
val categoryId: Long,
val fittableNonSingleton: Boolean,
@SerialName("iconID")
val iconId: Long? = null,
val name: Name,
val published: Boolean,
val useBasePrice: Boolean
)
@Serializable
data class Name (
val de: String,
val en: String,
val es: String,
val fr: String,
val ja: String,
val ko: String,
val ru: String,
val zh: String
)
<?php
// This is a autogenerated file:Group
class Group {
private int $key; // json:_key Required
private bool $anchorable; // json:anchorable Required
private bool $anchored; // json:anchored Required
private int $categoryId; // json:categoryID Required
private bool $fittableNonSingleton; // json:fittableNonSingleton Required
private ?int $iconId; // json:iconID Optional
private Name $name; // json:name Required
private bool $published; // json:published Required
private bool $useBasePrice; // json:useBasePrice Required
/**
* @param int $key
* @param bool $anchorable
* @param bool $anchored
* @param int $categoryId
* @param bool $fittableNonSingleton
* @param int|null $iconId
* @param Name $name
* @param bool $published
* @param bool $useBasePrice
*/
public function __construct(int $key, bool $anchorable, bool $anchored, int $categoryId, bool $fittableNonSingleton, ?int $iconId, Name $name, bool $published, bool $useBasePrice) {
$this->key = $key;
$this->anchorable = $anchorable;
$this->anchored = $anchored;
$this->categoryId = $categoryId;
$this->fittableNonSingleton = $fittableNonSingleton;
$this->iconId = $iconId;
$this->name = $name;
$this->published = $published;
$this->useBasePrice = $useBasePrice;
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromKey(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toKey(): int {
if (Group::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this Group::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Group::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (Group::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey Group::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromAnchorable(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toAnchorable(): bool {
if (Group::validateAnchorable($this->anchorable)) {
return $this->anchorable; /*bool*/
}
throw new Exception('never get to this Group::anchorable');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateAnchorable(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Group::anchorable");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getAnchorable(): bool {
if (Group::validateAnchorable($this->anchorable)) {
return $this->anchorable;
}
throw new Exception('never get to getAnchorable Group::anchorable');
}
/**
* @return bool
*/
public static function sampleAnchorable(): bool {
return true; /*32:anchorable*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromAnchored(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toAnchored(): bool {
if (Group::validateAnchored($this->anchored)) {
return $this->anchored; /*bool*/
}
throw new Exception('never get to this Group::anchored');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateAnchored(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Group::anchored");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getAnchored(): bool {
if (Group::validateAnchored($this->anchored)) {
return $this->anchored;
}
throw new Exception('never get to getAnchored Group::anchored');
}
/**
* @return bool
*/
public static function sampleAnchored(): bool {
return true; /*33:anchored*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromCategoryId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toCategoryId(): int {
if (Group::validateCategoryId($this->categoryId)) {
return $this->categoryId; /*int*/
}
throw new Exception('never get to this Group::categoryId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateCategoryId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Group::categoryId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getCategoryId(): int {
if (Group::validateCategoryId($this->categoryId)) {
return $this->categoryId;
}
throw new Exception('never get to getCategoryId Group::categoryId');
}
/**
* @return int
*/
public static function sampleCategoryId(): int {
return 34; /*34:categoryId*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromFittableNonSingleton(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toFittableNonSingleton(): bool {
if (Group::validateFittableNonSingleton($this->fittableNonSingleton)) {
return $this->fittableNonSingleton; /*bool*/
}
throw new Exception('never get to this Group::fittableNonSingleton');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateFittableNonSingleton(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Group::fittableNonSingleton");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getFittableNonSingleton(): bool {
if (Group::validateFittableNonSingleton($this->fittableNonSingleton)) {
return $this->fittableNonSingleton;
}
throw new Exception('never get to getFittableNonSingleton Group::fittableNonSingleton');
}
/**
* @return bool
*/
public static function sampleFittableNonSingleton(): bool {
return true; /*35:fittableNonSingleton*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromIconId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toIconId(): ?int {
if (Group::validateIconId($this->iconId)) {
if (!is_null($this->iconId)) {
return $this->iconId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Group::iconId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateIconId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Group::iconId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getIconId(): ?int {
if (Group::validateIconId($this->iconId)) {
return $this->iconId;
}
throw new Exception('never get to getIconId Group::iconId');
}
/**
* @return ?int
*/
public static function sampleIconId(): ?int {
return 36; /*36:iconId*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Name
*/
public static function fromName(stdClass $value): Name {
return Name::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toName(): stdClass {
if (Group::validateName($this->name)) {
return $this->name->to(); /*class*/
}
throw new Exception('never get to this Group::name');
}
/**
* @param Name
* @return bool
* @throws Exception
*/
public static function validateName(Name $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Name
*/
public function getName(): Name {
if (Group::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName Group::name');
}
/**
* @return Name
*/
public static function sampleName(): Name {
return Name::sample(); /*37:name*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromPublished(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toPublished(): bool {
if (Group::validatePublished($this->published)) {
return $this->published; /*bool*/
}
throw new Exception('never get to this Group::published');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validatePublished(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Group::published");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getPublished(): bool {
if (Group::validatePublished($this->published)) {
return $this->published;
}
throw new Exception('never get to getPublished Group::published');
}
/**
* @return bool
*/
public static function samplePublished(): bool {
return true; /*38:published*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromUseBasePrice(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toUseBasePrice(): bool {
if (Group::validateUseBasePrice($this->useBasePrice)) {
return $this->useBasePrice; /*bool*/
}
throw new Exception('never get to this Group::useBasePrice');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateUseBasePrice(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Group::useBasePrice");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getUseBasePrice(): bool {
if (Group::validateUseBasePrice($this->useBasePrice)) {
return $this->useBasePrice;
}
throw new Exception('never get to getUseBasePrice Group::useBasePrice');
}
/**
* @return bool
*/
public static function sampleUseBasePrice(): bool {
return true; /*39:useBasePrice*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Group::validateKey($this->key)
|| Group::validateAnchorable($this->anchorable)
|| Group::validateAnchored($this->anchored)
|| Group::validateCategoryId($this->categoryId)
|| Group::validateFittableNonSingleton($this->fittableNonSingleton)
|| Group::validateIconId($this->iconId)
|| Group::validateName($this->name)
|| Group::validatePublished($this->published)
|| Group::validateUseBasePrice($this->useBasePrice);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'anchorable'} = $this->toAnchorable();
$out->{'anchored'} = $this->toAnchored();
$out->{'categoryID'} = $this->toCategoryId();
$out->{'fittableNonSingleton'} = $this->toFittableNonSingleton();
$out->{'iconID'} = $this->toIconId();
$out->{'name'} = $this->toName();
$out->{'published'} = $this->toPublished();
$out->{'useBasePrice'} = $this->toUseBasePrice();
return $out;
}
/**
* @param stdClass $obj
* @return Group
* @throws Exception
*/
public static function from(stdClass $obj): Group {
return new Group(
Group::fromKey($obj->{'_key'})
,Group::fromAnchorable($obj->{'anchorable'})
,Group::fromAnchored($obj->{'anchored'})
,Group::fromCategoryId($obj->{'categoryID'})
,Group::fromFittableNonSingleton($obj->{'fittableNonSingleton'})
,Group::fromIconId($obj->{'iconID'})
,Group::fromName($obj->{'name'})
,Group::fromPublished($obj->{'published'})
,Group::fromUseBasePrice($obj->{'useBasePrice'})
);
}
/**
* @return Group
*/
public static function sample(): Group {
return new Group(
Group::sampleKey()
,Group::sampleAnchorable()
,Group::sampleAnchored()
,Group::sampleCategoryId()
,Group::sampleFittableNonSingleton()
,Group::sampleIconId()
,Group::sampleName()
,Group::samplePublished()
,Group::sampleUseBasePrice()
);
}
}
// This is a autogenerated file:Name
class Name {
private string $de; // json:de Required
private string $en; // json:en Required
private string $es; // json:es Required
private string $fr; // json:fr Required
private string $ja; // json:ja Required
private string $ko; // json:ko Required
private string $ru; // json:ru Required
private string $zh; // json:zh Required
/**
* @param string $de
* @param string $en
* @param string $es
* @param string $fr
* @param string $ja
* @param string $ko
* @param string $ru
* @param string $zh
*/
public function __construct(string $de, string $en, string $es, string $fr, string $ja, string $ko, string $ru, string $zh) {
$this->de = $de;
$this->en = $en;
$this->es = $es;
$this->fr = $fr;
$this->ja = $ja;
$this->ko = $ko;
$this->ru = $ru;
$this->zh = $zh;
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromDe(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toDe(): string {
if (Name::validateDe($this->de)) {
return $this->de; /*string*/
}
throw new Exception('never get to this Name::de');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateDe(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::de");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getDe(): string {
if (Name::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe Name::de');
}
/**
* @return string
*/
public static function sampleDe(): string {
return 'Name::de::31'; /*31:de*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEn(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEn(): string {
if (Name::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this Name::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (Name::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn Name::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'Name::en::32'; /*32:en*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEs(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEs(): string {
if (Name::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this Name::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (Name::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs Name::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'Name::es::33'; /*33:es*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromFr(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toFr(): string {
if (Name::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this Name::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (Name::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr Name::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'Name::fr::34'; /*34:fr*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromJa(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toJa(): string {
if (Name::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this Name::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (Name::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa Name::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'Name::ja::35'; /*35:ja*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromKo(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toKo(): string {
if (Name::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this Name::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (Name::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo Name::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'Name::ko::36'; /*36:ko*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromRu(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toRu(): string {
if (Name::validateRu($this->ru)) {
return $this->ru; /*string*/
}
throw new Exception('never get to this Name::ru');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateRu(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ru");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getRu(): string {
if (Name::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu Name::ru');
}
/**
* @return string
*/
public static function sampleRu(): string {
return 'Name::ru::37'; /*37:ru*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromZh(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toZh(): string {
if (Name::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this Name::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (Name::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh Name::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'Name::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Name::validateDe($this->de)
|| Name::validateEn($this->en)
|| Name::validateEs($this->es)
|| Name::validateFr($this->fr)
|| Name::validateJa($this->ja)
|| Name::validateKo($this->ko)
|| Name::validateRu($this->ru)
|| Name::validateZh($this->zh);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'de'} = $this->toDe();
$out->{'en'} = $this->toEn();
$out->{'es'} = $this->toEs();
$out->{'fr'} = $this->toFr();
$out->{'ja'} = $this->toJa();
$out->{'ko'} = $this->toKo();
$out->{'ru'} = $this->toRu();
$out->{'zh'} = $this->toZh();
return $out;
}
/**
* @param stdClass $obj
* @return Name
* @throws Exception
*/
public static function from(stdClass $obj): Name {
return new Name(
Name::fromDe($obj->{'de'})
,Name::fromEn($obj->{'en'})
,Name::fromEs($obj->{'es'})
,Name::fromFr($obj->{'fr'})
,Name::fromJa($obj->{'ja'})
,Name::fromKo($obj->{'ko'})
,Name::fromRu($obj->{'ru'})
,Name::fromZh($obj->{'zh'})
);
}
/**
* @return Name
*/
public static function sample(): Name {
return new Name(
Name::sampleDe()
,Name::sampleEn()
,Name::sampleEs()
,Name::sampleFr()
,Name::sampleJa()
,Name::sampleKo()
,Name::sampleRu()
,Name::sampleZh()
);
}
}
from typing import Any, Optional, TypeVar, Type, cast
T = TypeVar("T")
def from_str(x: Any) -> str:
assert isinstance(x, str)
return x
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_bool(x: Any) -> bool:
assert isinstance(x, bool)
return x
def from_none(x: Any) -> Any:
assert x is None
return x
def from_union(fs, x):
for f in fs:
try:
return f(x)
except:
pass
assert False
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Name:
de: str
en: str
es: str
fr: str
ja: str
ko: str
ru: str
zh: str
def __init__(self, de: str, en: str, es: str, fr: str, ja: str, ko: str, ru: str, zh: str) -> None:
self.de = de
self.en = en
self.es = es
self.fr = fr
self.ja = ja
self.ko = ko
self.ru = ru
self.zh = zh
@staticmethod
def from_dict(obj: Any) -> 'Name':
assert isinstance(obj, dict)
de = from_str(obj.get("de"))
en = from_str(obj.get("en"))
es = from_str(obj.get("es"))
fr = from_str(obj.get("fr"))
ja = from_str(obj.get("ja"))
ko = from_str(obj.get("ko"))
ru = from_str(obj.get("ru"))
zh = from_str(obj.get("zh"))
return Name(de, en, es, fr, ja, ko, ru, zh)
def to_dict(self) -> dict:
result: dict = {}
result["de"] = from_str(self.de)
result["en"] = from_str(self.en)
result["es"] = from_str(self.es)
result["fr"] = from_str(self.fr)
result["ja"] = from_str(self.ja)
result["ko"] = from_str(self.ko)
result["ru"] = from_str(self.ru)
result["zh"] = from_str(self.zh)
return result
class Group:
key: int
anchorable: bool
anchored: bool
category_id: int
fittable_non_singleton: bool
icon_id: Optional[int]
name: Name
published: bool
use_base_price: bool
def __init__(self, key: int, anchorable: bool, anchored: bool, category_id: int, fittable_non_singleton: bool, icon_id: Optional[int], name: Name, published: bool, use_base_price: bool) -> None:
self.key = key
self.anchorable = anchorable
self.anchored = anchored
self.category_id = category_id
self.fittable_non_singleton = fittable_non_singleton
self.icon_id = icon_id
self.name = name
self.published = published
self.use_base_price = use_base_price
@staticmethod
def from_dict(obj: Any) -> 'Group':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
anchorable = from_bool(obj.get("anchorable"))
anchored = from_bool(obj.get("anchored"))
category_id = from_int(obj.get("categoryID"))
fittable_non_singleton = from_bool(obj.get("fittableNonSingleton"))
icon_id = from_union([from_int, from_none], obj.get("iconID"))
name = Name.from_dict(obj.get("name"))
published = from_bool(obj.get("published"))
use_base_price = from_bool(obj.get("useBasePrice"))
return Group(key, anchorable, anchored, category_id, fittable_non_singleton, icon_id, name, published, use_base_price)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["anchorable"] = from_bool(self.anchorable)
result["anchored"] = from_bool(self.anchored)
result["categoryID"] = from_int(self.category_id)
result["fittableNonSingleton"] = from_bool(self.fittable_non_singleton)
if self.icon_id is not None:
result["iconID"] = from_union([from_int, from_none], self.icon_id)
result["name"] = to_class(Name, self.name)
result["published"] = from_bool(self.published)
result["useBasePrice"] = from_bool(self.use_base_price)
return result
def group_from_dict(s: Any) -> Group:
return Group.from_dict(s)
def group_to_dict(x: Group) -> Any:
return to_class(Group, x)
// To parse this data:
//
// import { Convert, Group } from "./file";
//
// const group = Convert.toGroup(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface Group {
_key: number;
anchorable: boolean;
anchored: boolean;
categoryID: number;
fittableNonSingleton: boolean;
iconID?: number;
name: Name;
published: boolean;
useBasePrice: boolean;
[property: string]: any;
}
export interface Name {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: any;
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toGroup(json: string): Group {
return cast(JSON.parse(json), r("Group"));
}
public static groupToJson(value: Group): string {
return JSON.stringify(uncast(value, r("Group")), null, 2);
}
}
function invalidValue(typ: any, val: any, key: any, parent: any = ''): never {
const prettyTyp = prettyTypeName(typ);
const parentText = parent ? ` on ${parent}` : '';
const keyText = key ? ` for key "${key}"` : '';
throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
}
function prettyTypeName(typ: any): string {
if (Array.isArray(typ)) {
if (typ.length === 2 && typ[0] === undefined) {
return `an optional ${prettyTypeName(typ[1])}`;
} else {
return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
}
} else if (typeof typ === "object" && typ.literal !== undefined) {
return typ.literal;
} else {
return typeof typ;
}
}
function jsonToJSProps(typ: any): any {
if (typ.jsonToJS === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
typ.jsonToJS = map;
}
return typ.jsonToJS;
}
function jsToJSONProps(typ: any): any {
if (typ.jsToJSON === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
typ.jsToJSON = map;
}
return typ.jsToJSON;
}
function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
function transformPrimitive(typ: string, val: any): any {
if (typeof typ === typeof val) return val;
return invalidValue(typ, val, key, parent);
}
function transformUnion(typs: any[], val: any): any {
// val must validate against one typ in typs
const l = typs.length;
for (let i = 0; i < l; i++) {
const typ = typs[i];
try {
return transform(val, typ, getProps);
} catch (_) {}
}
return invalidValue(typs, val, key, parent);
}
function transformEnum(cases: string[], val: any): any {
if (cases.indexOf(val) !== -1) return val;
return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
}
function transformArray(typ: any, val: any): any {
// val must be an array with no invalid elements
if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
return val.map(el => transform(el, typ, getProps));
}
function transformDate(val: any): any {
if (val === null) {
return null;
}
const d = new Date(val);
if (isNaN(d.valueOf())) {
return invalidValue(l("Date"), val, key, parent);
}
return d;
}
function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
if (val === null || typeof val !== "object" || Array.isArray(val)) {
return invalidValue(l(ref || "object"), val, key, parent);
}
const result: any = {};
Object.getOwnPropertyNames(props).forEach(key => {
const prop = props[key];
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
result[prop.key] = transform(v, prop.typ, getProps, key, ref);
});
Object.getOwnPropertyNames(val).forEach(key => {
if (!Object.prototype.hasOwnProperty.call(props, key)) {
result[key] = transform(val[key], additional, getProps, key, ref);
}
});
return result;
}
if (typ === "any") return val;
if (typ === null) {
if (val === null) return val;
return invalidValue(typ, val, key, parent);
}
if (typ === false) return invalidValue(typ, val, key, parent);
let ref: any = undefined;
while (typeof typ === "object" && typ.ref !== undefined) {
ref = typ.ref;
typ = typeMap[typ.ref];
}
if (Array.isArray(typ)) return transformEnum(typ, val);
if (typeof typ === "object") {
return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
: typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val)
: typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val)
: invalidValue(typ, val, key, parent);
}
// Numbers can be parsed by Date but shouldn't be.
if (typ === Date && typeof val !== "number") return transformDate(val);
return transformPrimitive(typ, val);
}
function cast<T>(val: any, typ: any): T {
return transform(val, typ, jsonToJSProps);
}
function uncast<T>(val: T, typ: any): any {
return transform(val, typ, jsToJSONProps);
}
function l(typ: any) {
return { literal: typ };
}
function a(typ: any) {
return { arrayItems: typ };
}
function u(...typs: any[]) {
return { unionMembers: typs };
}
function o(props: any[], additional: any) {
return { props, additional };
}
function m(additional: any) {
return { props: [], additional };
}
function r(name: string) {
return { ref: name };
}
const typeMap: any = {
"Group": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "anchorable", js: "anchorable", typ: true },
{ json: "anchored", js: "anchored", typ: true },
{ json: "categoryID", js: "categoryID", typ: 0 },
{ json: "fittableNonSingleton", js: "fittableNonSingleton", typ: true },
{ json: "iconID", js: "iconID", typ: u(undefined, 0) },
{ json: "name", js: "name", typ: r("Name") },
{ json: "published", js: "published", typ: true },
{ json: "useBasePrice", js: "useBasePrice", typ: true },
], "any"),
"Name": o([
{ json: "de", js: "de", typ: "" },
{ json: "en", js: "en", typ: "" },
{ json: "es", js: "es", typ: "" },
{ json: "fr", js: "fr", typ: "" },
{ json: "ja", js: "ja", typ: "" },
{ json: "ko", js: "ko", typ: "" },
{ json: "ru", js: "ru", typ: "" },
{ json: "zh", js: "zh", typ: "" },
], "any"),
};