types.jsonl
Schema
_key
(required): integer
Range: 0 .. 371027basePrice
: number
Range: 1 .. 700000000000capacity
: number
Range: 0.01 .. 999999999-
description
: objectde
: stringen
(required): stringes
: stringfr
: stringja
: stringko
: stringru
: stringzh
: string
-
factionID
: integer
Range: 500001 .. 1000419 graphicID
: integer
Range: 10 .. 28250groupID
(required): integer
Range: 0 .. 368726iconID
: integer
Range: 0 .. 27110marketGroupID
: integer
Range: 20 .. 3746mass
: number
Range: 0.001 .. 100000000000000000000000000000000000metaGroupID
: integer
Range: 1 .. 54-
name
(required): objectde
: stringen
(required): stringes
: stringfr
: stringja
: stringko
: stringru
: stringzh
: string
-
portionSize
(required): integer
Range: 1 .. 57344 published
(required): booleanraceID
: integer
Range: 1 .. 168radius
: number
Range: 2 .. 5000000000000soundID
: integer
Range: 9 .. 79428variationParentTypeID
: integer
Range: 178 .. 85230volume
: number
Range: 0.0002 .. 100000000000
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var purpleType = PurpleType.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class PurpleType
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("basePrice", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
public double? BasePrice { get; set; }
[JsonProperty("capacity", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double? Capacity { get; set; }
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public Description Description { get; set; }
[JsonProperty("factionID", NullValueHandling = NullValueHandling.Ignore)]
public long? FactionId { get; set; }
[JsonProperty("graphicID", NullValueHandling = NullValueHandling.Ignore)]
public long? GraphicId { get; set; }
[JsonProperty("groupID")]
public long GroupId { get; set; }
[JsonProperty("iconID", NullValueHandling = NullValueHandling.Ignore)]
public long? IconId { get; set; }
[JsonProperty("marketGroupID", NullValueHandling = NullValueHandling.Ignore)]
public long? MarketGroupId { get; set; }
[JsonProperty("mass", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double? Mass { get; set; }
[JsonProperty("metaGroupID", NullValueHandling = NullValueHandling.Ignore)]
public long? MetaGroupId { get; set; }
[JsonProperty("name")]
public Name Name { get; set; }
[JsonProperty("portionSize")]
public long PortionSize { get; set; }
[JsonProperty("published")]
public bool Published { get; set; }
[JsonProperty("raceID", NullValueHandling = NullValueHandling.Ignore)]
public long? RaceId { get; set; }
[JsonProperty("radius", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double? Radius { get; set; }
[JsonProperty("soundID", NullValueHandling = NullValueHandling.Ignore)]
public long? SoundId { get; set; }
[JsonProperty("variationParentTypeID", NullValueHandling = NullValueHandling.Ignore)]
public long? VariationParentTypeId { get; set; }
[JsonProperty("volume", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double? Volume { get; set; }
}
public partial class Description
{
[JsonProperty("de", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class Name
{
[JsonProperty("de", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(CunningMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(CunningMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(MagentaMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(FriskyMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(MischievousMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(MischievousMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(CunningMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(MischievousMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class PurpleType
{
public static PurpleType FromJson(string json) => JsonConvert.DeserializeObject<PurpleType>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this PurpleType 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 PurpleMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 1 && value <= 700000000000)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 1 && value <= 700000000000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly PurpleMinMaxValueCheckConverter Singleton = new PurpleMinMaxValueCheckConverter();
}
internal class FluffyMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 0.01 && value <= 999999999)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 0.01 && value <= 999999999)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FluffyMinMaxValueCheckConverter Singleton = new FluffyMinMaxValueCheckConverter();
}
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 >= 2 && value.Length <= 7704)
{
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 >= 2 && value.Length <= 7704)
{
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 >= 2 && value.Length <= 6577)
{
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 >= 2 && value.Length <= 6577)
{
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 >= 2 && value.Length <= 7329)
{
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 >= 2 && value.Length <= 7329)
{
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 >= 2 && value.Length <= 7765)
{
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 >= 2 && value.Length <= 7765)
{
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 <= 3118)
{
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 <= 3118)
{
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 <= 2686)
{
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 <= 2686)
{
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 >= 0 && value.Length <= 7027)
{
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 >= 0 && value.Length <= 7027)
{
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 >= 2 && value.Length <= 4634)
{
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 >= 2 && value.Length <= 4634)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly AmbitiousMinMaxLengthCheckConverter Singleton = new AmbitiousMinMaxLengthCheckConverter();
}
internal class TentacledMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 0.001 && value <= 1e+35)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 0.001 && value <= 1e+35)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
}
internal class CunningMinMaxLengthCheckConverter : 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 <= 99)
{
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 <= 99)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly CunningMinMaxLengthCheckConverter Singleton = new CunningMinMaxLengthCheckConverter();
}
internal class MagentaMinMaxLengthCheckConverter : 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 <= 115)
{
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 <= 115)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MagentaMinMaxLengthCheckConverter Singleton = new MagentaMinMaxLengthCheckConverter();
}
internal class FriskyMinMaxLengthCheckConverter : 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 <= 123)
{
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 <= 123)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FriskyMinMaxLengthCheckConverter Singleton = new FriskyMinMaxLengthCheckConverter();
}
internal class MischievousMinMaxLengthCheckConverter : 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 <= 99)
{
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 <= 99)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MischievousMinMaxLengthCheckConverter Singleton = new MischievousMinMaxLengthCheckConverter();
}
internal class StickyMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 2 && value <= 5000000000000)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 2 && value <= 5000000000000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly StickyMinMaxValueCheckConverter Singleton = new StickyMinMaxValueCheckConverter();
}
internal class IndigoMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 0.0002 && value <= 100000000000)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 0.0002 && value <= 100000000000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
}
// 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:
//
// type, err := UnmarshalType(bytes)
// bytes, err = type.Marshal()
package model
import "encoding/json"
func UnmarshalType(data []byte) (Type, error) {
var r Type
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Type) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type Type struct {
Key int64 `json:"_key"`
BasePrice *float64 `json:"basePrice,omitempty"`
Capacity *float64 `json:"capacity,omitempty"`
Description *Description `json:"description,omitempty"`
FactionID *int64 `json:"factionID,omitempty"`
GraphicID *int64 `json:"graphicID,omitempty"`
GroupID int64 `json:"groupID"`
IconID *int64 `json:"iconID,omitempty"`
MarketGroupID *int64 `json:"marketGroupID,omitempty"`
Mass *float64 `json:"mass,omitempty"`
MetaGroupID *int64 `json:"metaGroupID,omitempty"`
Name Name `json:"name"`
PortionSize int64 `json:"portionSize"`
Published bool `json:"published"`
RaceID *int64 `json:"raceID,omitempty"`
Radius *float64 `json:"radius,omitempty"`
SoundID *int64 `json:"soundID,omitempty"`
VariationParentTypeID *int64 `json:"variationParentTypeID,omitempty"`
Volume *float64 `json:"volume,omitempty"`
}
type Description struct {
De *string `json:"de,omitempty"`
En string `json:"en"`
Es *string `json:"es,omitempty"`
Fr *string `json:"fr,omitempty"`
Ja *string `json:"ja,omitempty"`
Ko *string `json:"ko,omitempty"`
Ru *string `json:"ru,omitempty"`
Zh *string `json:"zh,omitempty"`
}
type Name struct {
De *string `json:"de,omitempty"`
En string `json:"en"`
Es *string `json:"es,omitempty"`
Fr *string `json:"fr,omitempty"`
Ja *string `json:"ja,omitempty"`
Ko *string `json:"ko,omitempty"`
Ru *string `json:"ru,omitempty"`
Zh *string `json:"zh,omitempty"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 0,
"maximum": 371027
},
"basePrice": {
"type": "number",
"minimum": 1.0,
"maximum": 7.0E11
},
"capacity": {
"type": "number",
"minimum": 0.01,
"maximum": 9.99999999E8
},
"description": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 2,
"maxLength": 7704
},
"en": {
"type": "string",
"minLength": 2,
"maxLength": 6577
},
"es": {
"type": "string",
"minLength": 2,
"maxLength": 7329
},
"fr": {
"type": "string",
"minLength": 2,
"maxLength": 7765
},
"ja": {
"type": "string",
"minLength": 1,
"maxLength": 3118
},
"ko": {
"type": "string",
"minLength": 1,
"maxLength": 2686
},
"ru": {
"type": "string",
"minLength": 0,
"maxLength": 7027
},
"zh": {
"type": "string",
"minLength": 2,
"maxLength": 4634
}
},
"required": [
"en"
]
},
"factionID": {
"type": "integer",
"minimum": 500001,
"maximum": 1000419
},
"graphicID": {
"type": "integer",
"minimum": 10,
"maximum": 28250
},
"groupID": {
"type": "integer",
"minimum": 0,
"maximum": 368726
},
"iconID": {
"type": "integer",
"minimum": 0,
"maximum": 27110
},
"marketGroupID": {
"type": "integer",
"minimum": 20,
"maximum": 3746
},
"mass": {
"type": "number",
"minimum": 0.001,
"maximum": 1.0E35
},
"metaGroupID": {
"type": "integer",
"minimum": 1,
"maximum": 54
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 3,
"maxLength": 99
},
"en": {
"type": "string",
"minLength": 3,
"maxLength": 99
},
"es": {
"type": "string",
"minLength": 3,
"maxLength": 115
},
"fr": {
"type": "string",
"minLength": 3,
"maxLength": 123
},
"ja": {
"type": "string",
"minLength": 1,
"maxLength": 99
},
"ko": {
"type": "string",
"minLength": 1,
"maxLength": 99
},
"ru": {
"type": "string",
"minLength": 3,
"maxLength": 99
},
"zh": {
"type": "string",
"minLength": 1,
"maxLength": 99
}
},
"required": [
"en"
]
},
"portionSize": {
"type": "integer",
"minimum": 1,
"maximum": 57344
},
"published": {
"type": "boolean"
},
"raceID": {
"type": "integer",
"minimum": 1,
"maximum": 168
},
"radius": {
"type": "number",
"minimum": 2.0,
"maximum": 5.0E12
},
"soundID": {
"type": "integer",
"minimum": 9,
"maximum": 79428
},
"variationParentTypeID": {
"type": "integer",
"minimum": 178,
"maximum": 85230
},
"volume": {
"type": "number",
"minimum": 2.0E-4,
"maximum": 1.0E11
}
},
"required": [
"_key",
"groupID",
"name",
"portionSize",
"published"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val type = json.parse(Type.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class Type (
@SerialName("_key")
val key: Long,
val basePrice: Double? = null,
val capacity: Double? = null,
val description: Description? = null,
@SerialName("factionID")
val factionId: Long? = null,
@SerialName("graphicID")
val graphicId: Long? = null,
@SerialName("groupID")
val groupId: Long,
@SerialName("iconID")
val iconId: Long? = null,
@SerialName("marketGroupID")
val marketGroupId: Long? = null,
val mass: Double? = null,
@SerialName("metaGroupID")
val metaGroupId: Long? = null,
val name: Name,
val portionSize: Long,
val published: Boolean,
@SerialName("raceID")
val raceId: Long? = null,
val radius: Double? = null,
@SerialName("soundID")
val soundId: Long? = null,
@SerialName("variationParentTypeID")
val variationParentTypeId: Long? = null,
val volume: Double? = null
)
@Serializable
data class Description (
val de: String? = null,
val en: String,
val es: String? = null,
val fr: String? = null,
val ja: String? = null,
val ko: String? = null,
val ru: String? = null,
val zh: String? = null
)
@Serializable
data class Name (
val de: String? = null,
val en: String,
val es: String? = null,
val fr: String? = null,
val ja: String? = null,
val ko: String? = null,
val ru: String? = null,
val zh: String? = null
)
<?php
// This is a autogenerated file:Type
class Type {
private int $key; // json:_key Required
private ?float $basePrice; // json:basePrice Optional
private ?float $capacity; // json:capacity Optional
private ?Description $description; // json:description Optional
private ?int $factionId; // json:factionID Optional
private ?int $graphicId; // json:graphicID Optional
private int $groupId; // json:groupID Required
private ?int $iconId; // json:iconID Optional
private ?int $marketGroupId; // json:marketGroupID Optional
private ?float $mass; // json:mass Optional
private ?int $metaGroupId; // json:metaGroupID Optional
private Name $name; // json:name Required
private int $portionSize; // json:portionSize Required
private bool $published; // json:published Required
private ?int $raceId; // json:raceID Optional
private ?float $radius; // json:radius Optional
private ?int $soundId; // json:soundID Optional
private ?int $variationParentTypeId; // json:variationParentTypeID Optional
private ?float $volume; // json:volume Optional
/**
* @param int $key
* @param float|null $basePrice
* @param float|null $capacity
* @param Description|null $description
* @param int|null $factionId
* @param int|null $graphicId
* @param int $groupId
* @param int|null $iconId
* @param int|null $marketGroupId
* @param float|null $mass
* @param int|null $metaGroupId
* @param Name $name
* @param int $portionSize
* @param bool $published
* @param int|null $raceId
* @param float|null $radius
* @param int|null $soundId
* @param int|null $variationParentTypeId
* @param float|null $volume
*/
public function __construct(int $key, ?float $basePrice, ?float $capacity, ?Description $description, ?int $factionId, ?int $graphicId, int $groupId, ?int $iconId, ?int $marketGroupId, ?float $mass, ?int $metaGroupId, Name $name, int $portionSize, bool $published, ?int $raceId, ?float $radius, ?int $soundId, ?int $variationParentTypeId, ?float $volume) {
$this->key = $key;
$this->basePrice = $basePrice;
$this->capacity = $capacity;
$this->description = $description;
$this->factionId = $factionId;
$this->graphicId = $graphicId;
$this->groupId = $groupId;
$this->iconId = $iconId;
$this->marketGroupId = $marketGroupId;
$this->mass = $mass;
$this->metaGroupId = $metaGroupId;
$this->name = $name;
$this->portionSize = $portionSize;
$this->published = $published;
$this->raceId = $raceId;
$this->radius = $radius;
$this->soundId = $soundId;
$this->variationParentTypeId = $variationParentTypeId;
$this->volume = $volume;
}
/**
* @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 (Type::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this Type::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (Type::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey Type::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromBasePrice(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toBasePrice(): ?float {
if (Type::validateBasePrice($this->basePrice)) {
if (!is_null($this->basePrice)) {
return $this->basePrice; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Type::basePrice');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateBasePrice(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Type::basePrice");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getBasePrice(): ?float {
if (Type::validateBasePrice($this->basePrice)) {
return $this->basePrice;
}
throw new Exception('never get to getBasePrice Type::basePrice');
}
/**
* @return ?float
*/
public static function sampleBasePrice(): ?float {
return 32.032; /*32:basePrice*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromCapacity(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toCapacity(): ?float {
if (Type::validateCapacity($this->capacity)) {
if (!is_null($this->capacity)) {
return $this->capacity; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Type::capacity');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateCapacity(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Type::capacity");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getCapacity(): ?float {
if (Type::validateCapacity($this->capacity)) {
return $this->capacity;
}
throw new Exception('never get to getCapacity Type::capacity');
}
/**
* @return ?float
*/
public static function sampleCapacity(): ?float {
return 33.033; /*33:capacity*/
}
/**
* @param ?stdClass $value
* @throws Exception
* @return ?Description
*/
public static function fromDescription(?stdClass $value): ?Description {
if (!is_null($value)) {
return Description::from($value); /*class*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?stdClass
*/
public function toDescription(): ?stdClass {
if (Type::validateDescription($this->description)) {
if (!is_null($this->description)) {
return $this->description->to(); /*class*/
} else {
return null;
}
}
throw new Exception('never get to this Type::description');
}
/**
* @param Description|null
* @return bool
* @throws Exception
*/
public static function validateDescription(?Description $value): bool {
if (!is_null($value)) {
$value->validate();
}
return true;
}
/**
* @throws Exception
* @return ?Description
*/
public function getDescription(): ?Description {
if (Type::validateDescription($this->description)) {
return $this->description;
}
throw new Exception('never get to getDescription Type::description');
}
/**
* @return ?Description
*/
public static function sampleDescription(): ?Description {
return Description::sample(); /*34:description*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromFactionId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toFactionId(): ?int {
if (Type::validateFactionId($this->factionId)) {
if (!is_null($this->factionId)) {
return $this->factionId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::factionId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateFactionId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::factionId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getFactionId(): ?int {
if (Type::validateFactionId($this->factionId)) {
return $this->factionId;
}
throw new Exception('never get to getFactionId Type::factionId');
}
/**
* @return ?int
*/
public static function sampleFactionId(): ?int {
return 35; /*35:factionId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromGraphicId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toGraphicId(): ?int {
if (Type::validateGraphicId($this->graphicId)) {
if (!is_null($this->graphicId)) {
return $this->graphicId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::graphicId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateGraphicId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::graphicId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getGraphicId(): ?int {
if (Type::validateGraphicId($this->graphicId)) {
return $this->graphicId;
}
throw new Exception('never get to getGraphicId Type::graphicId');
}
/**
* @return ?int
*/
public static function sampleGraphicId(): ?int {
return 36; /*36:graphicId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromGroupId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toGroupId(): int {
if (Type::validateGroupId($this->groupId)) {
return $this->groupId; /*int*/
}
throw new Exception('never get to this Type::groupId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateGroupId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::groupId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getGroupId(): int {
if (Type::validateGroupId($this->groupId)) {
return $this->groupId;
}
throw new Exception('never get to getGroupId Type::groupId');
}
/**
* @return int
*/
public static function sampleGroupId(): int {
return 37; /*37:groupId*/
}
/**
* @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 (Type::validateIconId($this->iconId)) {
if (!is_null($this->iconId)) {
return $this->iconId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::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:Type::iconId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getIconId(): ?int {
if (Type::validateIconId($this->iconId)) {
return $this->iconId;
}
throw new Exception('never get to getIconId Type::iconId');
}
/**
* @return ?int
*/
public static function sampleIconId(): ?int {
return 38; /*38:iconId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromMarketGroupId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toMarketGroupId(): ?int {
if (Type::validateMarketGroupId($this->marketGroupId)) {
if (!is_null($this->marketGroupId)) {
return $this->marketGroupId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::marketGroupId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateMarketGroupId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::marketGroupId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getMarketGroupId(): ?int {
if (Type::validateMarketGroupId($this->marketGroupId)) {
return $this->marketGroupId;
}
throw new Exception('never get to getMarketGroupId Type::marketGroupId');
}
/**
* @return ?int
*/
public static function sampleMarketGroupId(): ?int {
return 39; /*39:marketGroupId*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromMass(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toMass(): ?float {
if (Type::validateMass($this->mass)) {
if (!is_null($this->mass)) {
return $this->mass; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Type::mass');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateMass(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Type::mass");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getMass(): ?float {
if (Type::validateMass($this->mass)) {
return $this->mass;
}
throw new Exception('never get to getMass Type::mass');
}
/**
* @return ?float
*/
public static function sampleMass(): ?float {
return 40.04; /*40:mass*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromMetaGroupId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toMetaGroupId(): ?int {
if (Type::validateMetaGroupId($this->metaGroupId)) {
if (!is_null($this->metaGroupId)) {
return $this->metaGroupId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::metaGroupId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateMetaGroupId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::metaGroupId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getMetaGroupId(): ?int {
if (Type::validateMetaGroupId($this->metaGroupId)) {
return $this->metaGroupId;
}
throw new Exception('never get to getMetaGroupId Type::metaGroupId');
}
/**
* @return ?int
*/
public static function sampleMetaGroupId(): ?int {
return 41; /*41:metaGroupId*/
}
/**
* @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 (Type::validateName($this->name)) {
return $this->name->to(); /*class*/
}
throw new Exception('never get to this Type::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 (Type::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName Type::name');
}
/**
* @return Name
*/
public static function sampleName(): Name {
return Name::sample(); /*42:name*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromPortionSize(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toPortionSize(): int {
if (Type::validatePortionSize($this->portionSize)) {
return $this->portionSize; /*int*/
}
throw new Exception('never get to this Type::portionSize');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validatePortionSize(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::portionSize");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getPortionSize(): int {
if (Type::validatePortionSize($this->portionSize)) {
return $this->portionSize;
}
throw new Exception('never get to getPortionSize Type::portionSize');
}
/**
* @return int
*/
public static function samplePortionSize(): int {
return 43; /*43:portionSize*/
}
/**
* @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 (Type::validatePublished($this->published)) {
return $this->published; /*bool*/
}
throw new Exception('never get to this Type::published');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validatePublished(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Type::published");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getPublished(): bool {
if (Type::validatePublished($this->published)) {
return $this->published;
}
throw new Exception('never get to getPublished Type::published');
}
/**
* @return bool
*/
public static function samplePublished(): bool {
return true; /*44:published*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromRaceId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toRaceId(): ?int {
if (Type::validateRaceId($this->raceId)) {
if (!is_null($this->raceId)) {
return $this->raceId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::raceId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateRaceId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::raceId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getRaceId(): ?int {
if (Type::validateRaceId($this->raceId)) {
return $this->raceId;
}
throw new Exception('never get to getRaceId Type::raceId');
}
/**
* @return ?int
*/
public static function sampleRaceId(): ?int {
return 45; /*45:raceId*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromRadius(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toRadius(): ?float {
if (Type::validateRadius($this->radius)) {
if (!is_null($this->radius)) {
return $this->radius; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Type::radius');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateRadius(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Type::radius");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getRadius(): ?float {
if (Type::validateRadius($this->radius)) {
return $this->radius;
}
throw new Exception('never get to getRadius Type::radius');
}
/**
* @return ?float
*/
public static function sampleRadius(): ?float {
return 46.046; /*46:radius*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromSoundId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toSoundId(): ?int {
if (Type::validateSoundId($this->soundId)) {
if (!is_null($this->soundId)) {
return $this->soundId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::soundId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateSoundId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::soundId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getSoundId(): ?int {
if (Type::validateSoundId($this->soundId)) {
return $this->soundId;
}
throw new Exception('never get to getSoundId Type::soundId');
}
/**
* @return ?int
*/
public static function sampleSoundId(): ?int {
return 47; /*47:soundId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromVariationParentTypeId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toVariationParentTypeId(): ?int {
if (Type::validateVariationParentTypeId($this->variationParentTypeId)) {
if (!is_null($this->variationParentTypeId)) {
return $this->variationParentTypeId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this Type::variationParentTypeId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateVariationParentTypeId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Type::variationParentTypeId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getVariationParentTypeId(): ?int {
if (Type::validateVariationParentTypeId($this->variationParentTypeId)) {
return $this->variationParentTypeId;
}
throw new Exception('never get to getVariationParentTypeId Type::variationParentTypeId');
}
/**
* @return ?int
*/
public static function sampleVariationParentTypeId(): ?int {
return 48; /*48:variationParentTypeId*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromVolume(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toVolume(): ?float {
if (Type::validateVolume($this->volume)) {
if (!is_null($this->volume)) {
return $this->volume; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Type::volume');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateVolume(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Type::volume");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getVolume(): ?float {
if (Type::validateVolume($this->volume)) {
return $this->volume;
}
throw new Exception('never get to getVolume Type::volume');
}
/**
* @return ?float
*/
public static function sampleVolume(): ?float {
return 49.049; /*49:volume*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Type::validateKey($this->key)
|| Type::validateBasePrice($this->basePrice)
|| Type::validateCapacity($this->capacity)
|| Type::validateDescription($this->description)
|| Type::validateFactionId($this->factionId)
|| Type::validateGraphicId($this->graphicId)
|| Type::validateGroupId($this->groupId)
|| Type::validateIconId($this->iconId)
|| Type::validateMarketGroupId($this->marketGroupId)
|| Type::validateMass($this->mass)
|| Type::validateMetaGroupId($this->metaGroupId)
|| Type::validateName($this->name)
|| Type::validatePortionSize($this->portionSize)
|| Type::validatePublished($this->published)
|| Type::validateRaceId($this->raceId)
|| Type::validateRadius($this->radius)
|| Type::validateSoundId($this->soundId)
|| Type::validateVariationParentTypeId($this->variationParentTypeId)
|| Type::validateVolume($this->volume);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'basePrice'} = $this->toBasePrice();
$out->{'capacity'} = $this->toCapacity();
$out->{'description'} = $this->toDescription();
$out->{'factionID'} = $this->toFactionId();
$out->{'graphicID'} = $this->toGraphicId();
$out->{'groupID'} = $this->toGroupId();
$out->{'iconID'} = $this->toIconId();
$out->{'marketGroupID'} = $this->toMarketGroupId();
$out->{'mass'} = $this->toMass();
$out->{'metaGroupID'} = $this->toMetaGroupId();
$out->{'name'} = $this->toName();
$out->{'portionSize'} = $this->toPortionSize();
$out->{'published'} = $this->toPublished();
$out->{'raceID'} = $this->toRaceId();
$out->{'radius'} = $this->toRadius();
$out->{'soundID'} = $this->toSoundId();
$out->{'variationParentTypeID'} = $this->toVariationParentTypeId();
$out->{'volume'} = $this->toVolume();
return $out;
}
/**
* @param stdClass $obj
* @return Type
* @throws Exception
*/
public static function from(stdClass $obj): Type {
return new Type(
Type::fromKey($obj->{'_key'})
,Type::fromBasePrice($obj->{'basePrice'})
,Type::fromCapacity($obj->{'capacity'})
,Type::fromDescription($obj->{'description'})
,Type::fromFactionId($obj->{'factionID'})
,Type::fromGraphicId($obj->{'graphicID'})
,Type::fromGroupId($obj->{'groupID'})
,Type::fromIconId($obj->{'iconID'})
,Type::fromMarketGroupId($obj->{'marketGroupID'})
,Type::fromMass($obj->{'mass'})
,Type::fromMetaGroupId($obj->{'metaGroupID'})
,Type::fromName($obj->{'name'})
,Type::fromPortionSize($obj->{'portionSize'})
,Type::fromPublished($obj->{'published'})
,Type::fromRaceId($obj->{'raceID'})
,Type::fromRadius($obj->{'radius'})
,Type::fromSoundId($obj->{'soundID'})
,Type::fromVariationParentTypeId($obj->{'variationParentTypeID'})
,Type::fromVolume($obj->{'volume'})
);
}
/**
* @return Type
*/
public static function sample(): Type {
return new Type(
Type::sampleKey()
,Type::sampleBasePrice()
,Type::sampleCapacity()
,Type::sampleDescription()
,Type::sampleFactionId()
,Type::sampleGraphicId()
,Type::sampleGroupId()
,Type::sampleIconId()
,Type::sampleMarketGroupId()
,Type::sampleMass()
,Type::sampleMetaGroupId()
,Type::sampleName()
,Type::samplePortionSize()
,Type::samplePublished()
,Type::sampleRaceId()
,Type::sampleRadius()
,Type::sampleSoundId()
,Type::sampleVariationParentTypeId()
,Type::sampleVolume()
);
}
}
// This is a autogenerated file:Description
class Description {
private ?string $de; // json:de Optional
private string $en; // json:en Required
private ?string $es; // json:es Optional
private ?string $fr; // json:fr Optional
private ?string $ja; // json:ja Optional
private ?string $ko; // json:ko Optional
private ?string $ru; // json:ru Optional
private ?string $zh; // json:zh Optional
/**
* @param string|null $de
* @param string $en
* @param string|null $es
* @param string|null $fr
* @param string|null $ja
* @param string|null $ko
* @param string|null $ru
* @param string|null $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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toDe(): ?string {
if (Description::validateDe($this->de)) {
if (!is_null($this->de)) {
return $this->de; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::de');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateDe(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::de");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getDe(): ?string {
if (Description::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe Description::de');
}
/**
* @return ?string
*/
public static function sampleDe(): ?string {
return 'Description::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 (Description::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this Description::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (Description::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn Description::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'Description::en::32'; /*32:en*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromEs(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toEs(): ?string {
if (Description::validateEs($this->es)) {
if (!is_null($this->es)) {
return $this->es; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::es');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateEs(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::es");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getEs(): ?string {
if (Description::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs Description::es');
}
/**
* @return ?string
*/
public static function sampleEs(): ?string {
return 'Description::es::33'; /*33:es*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromFr(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toFr(): ?string {
if (Description::validateFr($this->fr)) {
if (!is_null($this->fr)) {
return $this->fr; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::fr');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateFr(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::fr");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getFr(): ?string {
if (Description::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr Description::fr');
}
/**
* @return ?string
*/
public static function sampleFr(): ?string {
return 'Description::fr::34'; /*34:fr*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromJa(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toJa(): ?string {
if (Description::validateJa($this->ja)) {
if (!is_null($this->ja)) {
return $this->ja; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::ja');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateJa(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ja");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getJa(): ?string {
if (Description::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa Description::ja');
}
/**
* @return ?string
*/
public static function sampleJa(): ?string {
return 'Description::ja::35'; /*35:ja*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromKo(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toKo(): ?string {
if (Description::validateKo($this->ko)) {
if (!is_null($this->ko)) {
return $this->ko; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::ko');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateKo(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ko");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getKo(): ?string {
if (Description::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo Description::ko');
}
/**
* @return ?string
*/
public static function sampleKo(): ?string {
return 'Description::ko::36'; /*36:ko*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromRu(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toRu(): ?string {
if (Description::validateRu($this->ru)) {
if (!is_null($this->ru)) {
return $this->ru; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::ru');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateRu(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ru");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getRu(): ?string {
if (Description::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu Description::ru');
}
/**
* @return ?string
*/
public static function sampleRu(): ?string {
return 'Description::ru::37'; /*37:ru*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromZh(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toZh(): ?string {
if (Description::validateZh($this->zh)) {
if (!is_null($this->zh)) {
return $this->zh; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::zh');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateZh(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::zh");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getZh(): ?string {
if (Description::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh Description::zh');
}
/**
* @return ?string
*/
public static function sampleZh(): ?string {
return 'Description::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Description::validateDe($this->de)
|| Description::validateEn($this->en)
|| Description::validateEs($this->es)
|| Description::validateFr($this->fr)
|| Description::validateJa($this->ja)
|| Description::validateKo($this->ko)
|| Description::validateRu($this->ru)
|| Description::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 Description
* @throws Exception
*/
public static function from(stdClass $obj): Description {
return new Description(
Description::fromDe($obj->{'de'})
,Description::fromEn($obj->{'en'})
,Description::fromEs($obj->{'es'})
,Description::fromFr($obj->{'fr'})
,Description::fromJa($obj->{'ja'})
,Description::fromKo($obj->{'ko'})
,Description::fromRu($obj->{'ru'})
,Description::fromZh($obj->{'zh'})
);
}
/**
* @return Description
*/
public static function sample(): Description {
return new Description(
Description::sampleDe()
,Description::sampleEn()
,Description::sampleEs()
,Description::sampleFr()
,Description::sampleJa()
,Description::sampleKo()
,Description::sampleRu()
,Description::sampleZh()
);
}
}
// This is a autogenerated file:Name
class Name {
private ?string $de; // json:de Optional
private string $en; // json:en Required
private ?string $es; // json:es Optional
private ?string $fr; // json:fr Optional
private ?string $ja; // json:ja Optional
private ?string $ko; // json:ko Optional
private ?string $ru; // json:ru Optional
private ?string $zh; // json:zh Optional
/**
* @param string|null $de
* @param string $en
* @param string|null $es
* @param string|null $fr
* @param string|null $ja
* @param string|null $ko
* @param string|null $ru
* @param string|null $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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toDe(): ?string {
if (Name::validateDe($this->de)) {
if (!is_null($this->de)) {
return $this->de; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::de');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateDe(?string $value): bool {
if (!is_null($value)) {
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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toEs(): ?string {
if (Name::validateEs($this->es)) {
if (!is_null($this->es)) {
return $this->es; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::es');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateEs(?string $value): bool {
if (!is_null($value)) {
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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toFr(): ?string {
if (Name::validateFr($this->fr)) {
if (!is_null($this->fr)) {
return $this->fr; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::fr');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateFr(?string $value): bool {
if (!is_null($value)) {
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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toJa(): ?string {
if (Name::validateJa($this->ja)) {
if (!is_null($this->ja)) {
return $this->ja; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::ja');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateJa(?string $value): bool {
if (!is_null($value)) {
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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toKo(): ?string {
if (Name::validateKo($this->ko)) {
if (!is_null($this->ko)) {
return $this->ko; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::ko');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateKo(?string $value): bool {
if (!is_null($value)) {
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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toRu(): ?string {
if (Name::validateRu($this->ru)) {
if (!is_null($this->ru)) {
return $this->ru; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::ru');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateRu(?string $value): bool {
if (!is_null($value)) {
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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toZh(): ?string {
if (Name::validateZh($this->zh)) {
if (!is_null($this->zh)) {
return $this->zh; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Name::zh');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateZh(?string $value): bool {
if (!is_null($value)) {
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 Optional, Any, TypeVar, Type, cast
T = TypeVar("T")
def from_str(x: Any) -> str:
assert isinstance(x, str)
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 from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_float(x: Any) -> float:
assert isinstance(x, (float, int)) and not isinstance(x, bool)
return float(x)
def from_bool(x: Any) -> bool:
assert isinstance(x, bool)
return x
def to_float(x: Any) -> float:
assert isinstance(x, (int, float))
return x
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Description:
de: Optional[str]
en: str
es: Optional[str]
fr: Optional[str]
ja: Optional[str]
ko: Optional[str]
ru: Optional[str]
zh: Optional[str]
def __init__(self, de: Optional[str], en: str, es: Optional[str], fr: Optional[str], ja: Optional[str], ko: Optional[str], ru: Optional[str], zh: Optional[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) -> 'Description':
assert isinstance(obj, dict)
de = from_union([from_str, from_none], obj.get("de"))
en = from_str(obj.get("en"))
es = from_union([from_str, from_none], obj.get("es"))
fr = from_union([from_str, from_none], obj.get("fr"))
ja = from_union([from_str, from_none], obj.get("ja"))
ko = from_union([from_str, from_none], obj.get("ko"))
ru = from_union([from_str, from_none], obj.get("ru"))
zh = from_union([from_str, from_none], obj.get("zh"))
return Description(de, en, es, fr, ja, ko, ru, zh)
def to_dict(self) -> dict:
result: dict = {}
if self.de is not None:
result["de"] = from_union([from_str, from_none], self.de)
result["en"] = from_str(self.en)
if self.es is not None:
result["es"] = from_union([from_str, from_none], self.es)
if self.fr is not None:
result["fr"] = from_union([from_str, from_none], self.fr)
if self.ja is not None:
result["ja"] = from_union([from_str, from_none], self.ja)
if self.ko is not None:
result["ko"] = from_union([from_str, from_none], self.ko)
if self.ru is not None:
result["ru"] = from_union([from_str, from_none], self.ru)
if self.zh is not None:
result["zh"] = from_union([from_str, from_none], self.zh)
return result
class Name:
de: Optional[str]
en: str
es: Optional[str]
fr: Optional[str]
ja: Optional[str]
ko: Optional[str]
ru: Optional[str]
zh: Optional[str]
def __init__(self, de: Optional[str], en: str, es: Optional[str], fr: Optional[str], ja: Optional[str], ko: Optional[str], ru: Optional[str], zh: Optional[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_union([from_str, from_none], obj.get("de"))
en = from_str(obj.get("en"))
es = from_union([from_str, from_none], obj.get("es"))
fr = from_union([from_str, from_none], obj.get("fr"))
ja = from_union([from_str, from_none], obj.get("ja"))
ko = from_union([from_str, from_none], obj.get("ko"))
ru = from_union([from_str, from_none], obj.get("ru"))
zh = from_union([from_str, from_none], obj.get("zh"))
return Name(de, en, es, fr, ja, ko, ru, zh)
def to_dict(self) -> dict:
result: dict = {}
if self.de is not None:
result["de"] = from_union([from_str, from_none], self.de)
result["en"] = from_str(self.en)
if self.es is not None:
result["es"] = from_union([from_str, from_none], self.es)
if self.fr is not None:
result["fr"] = from_union([from_str, from_none], self.fr)
if self.ja is not None:
result["ja"] = from_union([from_str, from_none], self.ja)
if self.ko is not None:
result["ko"] = from_union([from_str, from_none], self.ko)
if self.ru is not None:
result["ru"] = from_union([from_str, from_none], self.ru)
if self.zh is not None:
result["zh"] = from_union([from_str, from_none], self.zh)
return result
class PurpleType:
key: int
base_price: Optional[float]
capacity: Optional[float]
description: Optional[Description]
faction_id: Optional[int]
graphic_id: Optional[int]
group_id: int
icon_id: Optional[int]
market_group_id: Optional[int]
mass: Optional[float]
meta_group_id: Optional[int]
name: Name
portion_size: int
published: bool
race_id: Optional[int]
radius: Optional[float]
sound_id: Optional[int]
variation_parent_type_id: Optional[int]
volume: Optional[float]
def __init__(self, key: int, base_price: Optional[float], capacity: Optional[float], description: Optional[Description], faction_id: Optional[int], graphic_id: Optional[int], group_id: int, icon_id: Optional[int], market_group_id: Optional[int], mass: Optional[float], meta_group_id: Optional[int], name: Name, portion_size: int, published: bool, race_id: Optional[int], radius: Optional[float], sound_id: Optional[int], variation_parent_type_id: Optional[int], volume: Optional[float]) -> None:
self.key = key
self.base_price = base_price
self.capacity = capacity
self.description = description
self.faction_id = faction_id
self.graphic_id = graphic_id
self.group_id = group_id
self.icon_id = icon_id
self.market_group_id = market_group_id
self.mass = mass
self.meta_group_id = meta_group_id
self.name = name
self.portion_size = portion_size
self.published = published
self.race_id = race_id
self.radius = radius
self.sound_id = sound_id
self.variation_parent_type_id = variation_parent_type_id
self.volume = volume
@staticmethod
def from_dict(obj: Any) -> 'PurpleType':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
base_price = from_union([from_float, from_none], obj.get("basePrice"))
capacity = from_union([from_float, from_none], obj.get("capacity"))
description = from_union([Description.from_dict, from_none], obj.get("description"))
faction_id = from_union([from_int, from_none], obj.get("factionID"))
graphic_id = from_union([from_int, from_none], obj.get("graphicID"))
group_id = from_int(obj.get("groupID"))
icon_id = from_union([from_int, from_none], obj.get("iconID"))
market_group_id = from_union([from_int, from_none], obj.get("marketGroupID"))
mass = from_union([from_float, from_none], obj.get("mass"))
meta_group_id = from_union([from_int, from_none], obj.get("metaGroupID"))
name = Name.from_dict(obj.get("name"))
portion_size = from_int(obj.get("portionSize"))
published = from_bool(obj.get("published"))
race_id = from_union([from_int, from_none], obj.get("raceID"))
radius = from_union([from_float, from_none], obj.get("radius"))
sound_id = from_union([from_int, from_none], obj.get("soundID"))
variation_parent_type_id = from_union([from_int, from_none], obj.get("variationParentTypeID"))
volume = from_union([from_float, from_none], obj.get("volume"))
return PurpleType(key, base_price, capacity, description, faction_id, graphic_id, group_id, icon_id, market_group_id, mass, meta_group_id, name, portion_size, published, race_id, radius, sound_id, variation_parent_type_id, volume)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
if self.base_price is not None:
result["basePrice"] = from_union([to_float, from_none], self.base_price)
if self.capacity is not None:
result["capacity"] = from_union([to_float, from_none], self.capacity)
if self.description is not None:
result["description"] = from_union([lambda x: to_class(Description, x), from_none], self.description)
if self.faction_id is not None:
result["factionID"] = from_union([from_int, from_none], self.faction_id)
if self.graphic_id is not None:
result["graphicID"] = from_union([from_int, from_none], self.graphic_id)
result["groupID"] = from_int(self.group_id)
if self.icon_id is not None:
result["iconID"] = from_union([from_int, from_none], self.icon_id)
if self.market_group_id is not None:
result["marketGroupID"] = from_union([from_int, from_none], self.market_group_id)
if self.mass is not None:
result["mass"] = from_union([to_float, from_none], self.mass)
if self.meta_group_id is not None:
result["metaGroupID"] = from_union([from_int, from_none], self.meta_group_id)
result["name"] = to_class(Name, self.name)
result["portionSize"] = from_int(self.portion_size)
result["published"] = from_bool(self.published)
if self.race_id is not None:
result["raceID"] = from_union([from_int, from_none], self.race_id)
if self.radius is not None:
result["radius"] = from_union([to_float, from_none], self.radius)
if self.sound_id is not None:
result["soundID"] = from_union([from_int, from_none], self.sound_id)
if self.variation_parent_type_id is not None:
result["variationParentTypeID"] = from_union([from_int, from_none], self.variation_parent_type_id)
if self.volume is not None:
result["volume"] = from_union([to_float, from_none], self.volume)
return result
def purple_type_from_dict(s: Any) -> PurpleType:
return PurpleType.from_dict(s)
def purple_type_to_dict(x: PurpleType) -> Any:
return to_class(PurpleType, x)
// To parse this data:
//
// import { Convert, Type } from "./file";
//
// const type = Convert.toType(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface Type {
_key: number;
basePrice?: number;
capacity?: number;
description?: Description;
factionID?: number;
graphicID?: number;
groupID: number;
iconID?: number;
marketGroupID?: number;
mass?: number;
metaGroupID?: number;
name: Name;
portionSize: number;
published: boolean;
raceID?: number;
radius?: number;
soundID?: number;
variationParentTypeID?: number;
volume?: number;
[property: string]: any;
}
export interface Description {
de?: string;
en: string;
es?: string;
fr?: string;
ja?: string;
ko?: string;
ru?: string;
zh?: string;
[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 toType(json: string): Type {
return cast(JSON.parse(json), r("Type"));
}
public static typeToJson(value: Type): string {
return JSON.stringify(uncast(value, r("Type")), 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 = {
"Type": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "basePrice", js: "basePrice", typ: u(undefined, 3.14) },
{ json: "capacity", js: "capacity", typ: u(undefined, 3.14) },
{ json: "description", js: "description", typ: u(undefined, r("Description")) },
{ json: "factionID", js: "factionID", typ: u(undefined, 0) },
{ json: "graphicID", js: "graphicID", typ: u(undefined, 0) },
{ json: "groupID", js: "groupID", typ: 0 },
{ json: "iconID", js: "iconID", typ: u(undefined, 0) },
{ json: "marketGroupID", js: "marketGroupID", typ: u(undefined, 0) },
{ json: "mass", js: "mass", typ: u(undefined, 3.14) },
{ json: "metaGroupID", js: "metaGroupID", typ: u(undefined, 0) },
{ json: "name", js: "name", typ: r("Name") },
{ json: "portionSize", js: "portionSize", typ: 0 },
{ json: "published", js: "published", typ: true },
{ json: "raceID", js: "raceID", typ: u(undefined, 0) },
{ json: "radius", js: "radius", typ: u(undefined, 3.14) },
{ json: "soundID", js: "soundID", typ: u(undefined, 0) },
{ json: "variationParentTypeID", js: "variationParentTypeID", typ: u(undefined, 0) },
{ json: "volume", js: "volume", typ: u(undefined, 3.14) },
], "any"),
"Description": o([
{ json: "de", js: "de", typ: u(undefined, "") },
{ json: "en", js: "en", typ: "" },
{ json: "es", js: "es", typ: u(undefined, "") },
{ json: "fr", js: "fr", typ: u(undefined, "") },
{ json: "ja", js: "ja", typ: u(undefined, "") },
{ json: "ko", js: "ko", typ: u(undefined, "") },
{ json: "ru", js: "ru", typ: u(undefined, "") },
{ json: "zh", js: "zh", typ: u(undefined, "") },
], "any"),
"Name": o([
{ json: "de", js: "de", typ: u(undefined, "") },
{ json: "en", js: "en", typ: "" },
{ json: "es", js: "es", typ: u(undefined, "") },
{ json: "fr", js: "fr", typ: u(undefined, "") },
{ json: "ja", js: "ja", typ: u(undefined, "") },
{ json: "ko", js: "ko", typ: u(undefined, "") },
{ json: "ru", js: "ru", typ: u(undefined, "") },
{ json: "zh", js: "zh", typ: u(undefined, "") },
], "any"),
};