mapAsteroidBelts.jsonl
Schema
_key
(required): integer
Range: 40000003 .. 40350399celestialIndex
(required): integer
Range: 1 .. 18-
name
: objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
orbitID
(required): integer
Range: 40000002 .. 40350367 orbitIndex
(required): integer
Range: 1 .. 43-
position
(required): objectx
(required): number
Range: -14632889180160 .. 18456749875200y
(required): number
Range: -2230733905920 .. 2398178304000z
(required): number
Range: -19210119290880 .. 19002364846080
-
radius
: number
Range: 19223.099609 .. 165233 solarSystemID
(required): integer
Range: 30000001 .. 30045354-
statistics
: objectdensity
(required): number
Range: 104.578003 .. 1336.810059eccentricity
(required): number
Range: 0 .. 0.298219escapeVelocity
(required): number
Range: 8.6733 .. 77.066498locked
(required): booleanmassDust
(required): number
Range: 19891000717606912 .. 3998179970605121500massGas
: number
Range: 0.000001 .. 7435390orbitPeriod
(required): number
Range: 24578.599609 .. 1274770048orbitRadius
(required): number
Range: 5160910 .. 305014013952rotationRate
(required): number
Range: 24578.599609 .. 1274770048spectralClass
(required): stringsurfaceGravity
(required): number
Range: 0.001047 .. 0.033083temperature
(required): number
Range: 13.0181 .. 681.690979
-
typeID
(required): integer
Range: 15 .. 15
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var mapAsteroidBelt = MapAsteroidBelt.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class MapAsteroidBelt
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("celestialIndex")]
public long CelestialIndex { get; set; }
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public Name Name { get; set; }
[JsonProperty("orbitID")]
public long OrbitId { get; set; }
[JsonProperty("orbitIndex")]
public long OrbitIndex { get; set; }
[JsonProperty("position")]
public Position Position { get; set; }
[JsonProperty("radius", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double? Radius { get; set; }
[JsonProperty("solarSystemID")]
public long SolarSystemId { get; set; }
[JsonProperty("statistics", NullValueHandling = NullValueHandling.Ignore)]
public Statistics Statistics { get; set; }
[JsonProperty("typeID")]
public long TypeId { get; set; }
}
public partial class Name
{
[JsonProperty("de")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class Position
{
[JsonProperty("x")]
[JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
public double X { get; set; }
[JsonProperty("y")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double Y { get; set; }
[JsonProperty("z")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double Z { get; set; }
}
public partial class Statistics
{
[JsonProperty("density")]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double Density { get; set; }
[JsonProperty("eccentricity")]
[JsonConverter(typeof(IndecentMinMaxValueCheckConverter))]
public double Eccentricity { get; set; }
[JsonProperty("escapeVelocity")]
[JsonConverter(typeof(HilariousMinMaxValueCheckConverter))]
public double EscapeVelocity { get; set; }
[JsonProperty("locked")]
public bool Locked { get; set; }
[JsonProperty("massDust")]
[JsonConverter(typeof(AmbitiousMinMaxValueCheckConverter))]
public double MassDust { get; set; }
[JsonProperty("massGas", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(CunningMinMaxValueCheckConverter))]
public double? MassGas { get; set; }
[JsonProperty("orbitPeriod")]
[JsonConverter(typeof(MagentaMinMaxValueCheckConverter))]
public double OrbitPeriod { get; set; }
[JsonProperty("orbitRadius")]
[JsonConverter(typeof(FriskyMinMaxValueCheckConverter))]
public double OrbitRadius { get; set; }
[JsonProperty("rotationRate")]
[JsonConverter(typeof(MagentaMinMaxValueCheckConverter))]
public double RotationRate { get; set; }
[JsonProperty("spectralClass")]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string SpectralClass { get; set; }
[JsonProperty("surfaceGravity")]
[JsonConverter(typeof(MischievousMinMaxValueCheckConverter))]
public double SurfaceGravity { get; set; }
[JsonProperty("temperature")]
[JsonConverter(typeof(BraggadociousMinMaxValueCheckConverter))]
public double Temperature { get; set; }
}
public partial class MapAsteroidBelt
{
public static MapAsteroidBelt FromJson(string json) => JsonConvert.DeserializeObject<MapAsteroidBelt>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this MapAsteroidBelt 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 >= 29 && value.Length <= 47)
{
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 >= 29 && value.Length <= 47)
{
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 >= 38 && value.Length <= 56)
{
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 >= 38 && value.Length <= 56)
{
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 >= 37 && value.Length <= 55)
{
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 >= 37 && value.Length <= 55)
{
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 >= 18 && value.Length <= 29)
{
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 >= 18 && value.Length <= 29)
{
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 >= 13 && value.Length <= 25)
{
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 >= 13 && value.Length <= 25)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
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 >= -14632889180160 && value <= 18456749875200)
{
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 >= -14632889180160 && value <= 18456749875200)
{
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 >= -2230733905920 && value <= 2398178304000)
{
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 >= -2230733905920 && value <= 2398178304000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FluffyMinMaxValueCheckConverter Singleton = new FluffyMinMaxValueCheckConverter();
}
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 >= -19210119290880 && value <= 19002364846080)
{
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 >= -19210119290880 && value <= 19002364846080)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
}
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 >= 19223.099609 && value <= 165233)
{
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 >= 19223.099609 && value <= 165233)
{
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 >= 104.578003 && value <= 1336.810059)
{
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 >= 104.578003 && value <= 1336.810059)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
internal class IndecentMinMaxValueCheckConverter : 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 && value <= 0.298219)
{
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 && value <= 0.298219)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndecentMinMaxValueCheckConverter Singleton = new IndecentMinMaxValueCheckConverter();
}
internal class HilariousMinMaxValueCheckConverter : 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 >= 8.6733 && value <= 77.066498)
{
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 >= 8.6733 && value <= 77.066498)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly HilariousMinMaxValueCheckConverter Singleton = new HilariousMinMaxValueCheckConverter();
}
internal class AmbitiousMinMaxValueCheckConverter : 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 >= 19891000717606910 && value <= 3998179970605121500)
{
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 >= 19891000717606910 && value <= 3998179970605121500)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly AmbitiousMinMaxValueCheckConverter Singleton = new AmbitiousMinMaxValueCheckConverter();
}
internal class CunningMinMaxValueCheckConverter : 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.000001 && value <= 7435390)
{
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.000001 && value <= 7435390)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly CunningMinMaxValueCheckConverter Singleton = new CunningMinMaxValueCheckConverter();
}
internal class MagentaMinMaxValueCheckConverter : 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 >= 24578.599609 && value <= 1274770048)
{
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 >= 24578.599609 && value <= 1274770048)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly MagentaMinMaxValueCheckConverter Singleton = new MagentaMinMaxValueCheckConverter();
}
internal class FriskyMinMaxValueCheckConverter : 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 >= 5160910 && value <= 305014013952)
{
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 >= 5160910 && value <= 305014013952)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FriskyMinMaxValueCheckConverter Singleton = new FriskyMinMaxValueCheckConverter();
}
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 >= 3 && value.Length <= 3)
{
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 <= 3)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
internal class MischievousMinMaxValueCheckConverter : 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.001047 && value <= 0.033083)
{
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.001047 && value <= 0.033083)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly MischievousMinMaxValueCheckConverter Singleton = new MischievousMinMaxValueCheckConverter();
}
internal class BraggadociousMinMaxValueCheckConverter : 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 >= 13.0181 && value <= 681.690979)
{
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 >= 13.0181 && value <= 681.690979)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly BraggadociousMinMaxValueCheckConverter Singleton = new BraggadociousMinMaxValueCheckConverter();
}
}
// 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:
//
// mapAsteroidBelt, err := UnmarshalMapAsteroidBelt(bytes)
// bytes, err = mapAsteroidBelt.Marshal()
package model
import "encoding/json"
func UnmarshalMapAsteroidBelt(data []byte) (MapAsteroidBelt, error) {
var r MapAsteroidBelt
err := json.Unmarshal(data, &r)
return r, err
}
func (r *MapAsteroidBelt) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type MapAsteroidBelt struct {
Key int64 `json:"_key"`
CelestialIndex int64 `json:"celestialIndex"`
Name *Name `json:"name,omitempty"`
OrbitID int64 `json:"orbitID"`
OrbitIndex int64 `json:"orbitIndex"`
Position Position `json:"position"`
Radius *float64 `json:"radius,omitempty"`
SolarSystemID int64 `json:"solarSystemID"`
Statistics *Statistics `json:"statistics,omitempty"`
TypeID int64 `json:"typeID"`
}
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"`
}
type Position struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
}
type Statistics struct {
Density float64 `json:"density"`
Eccentricity float64 `json:"eccentricity"`
EscapeVelocity float64 `json:"escapeVelocity"`
Locked bool `json:"locked"`
MassDust float64 `json:"massDust"`
MassGas *float64 `json:"massGas,omitempty"`
OrbitPeriod float64 `json:"orbitPeriod"`
OrbitRadius float64 `json:"orbitRadius"`
RotationRate float64 `json:"rotationRate"`
SpectralClass string `json:"spectralClass"`
SurfaceGravity float64 `json:"surfaceGravity"`
Temperature float64 `json:"temperature"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 40000003,
"maximum": 40350399
},
"celestialIndex": {
"type": "integer",
"minimum": 1,
"maximum": 18
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 29,
"maxLength": 47
},
"en": {
"type": "string",
"minLength": 29,
"maxLength": 47
},
"es": {
"type": "string",
"minLength": 38,
"maxLength": 56
},
"fr": {
"type": "string",
"minLength": 37,
"maxLength": 55
},
"ja": {
"type": "string",
"minLength": 18,
"maxLength": 29
},
"ko": {
"type": "string",
"minLength": 18,
"maxLength": 29
},
"ru": {
"type": "string",
"minLength": 29,
"maxLength": 47
},
"zh": {
"type": "string",
"minLength": 13,
"maxLength": 25
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"orbitID": {
"type": "integer",
"minimum": 40000002,
"maximum": 40350367
},
"orbitIndex": {
"type": "integer",
"minimum": 1,
"maximum": 43
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1.463288918016E13,
"maximum": 1.84567498752E13
},
"y": {
"type": "number",
"minimum": -2.23073390592E12,
"maximum": 2.398178304E12
},
"z": {
"type": "number",
"minimum": -1.921011929088E13,
"maximum": 1.900236484608E13
}
},
"required": [
"x",
"y",
"z"
]
},
"radius": {
"type": "number",
"minimum": 19223.099609,
"maximum": 165233.0
},
"solarSystemID": {
"type": "integer",
"minimum": 30000001,
"maximum": 30045354
},
"statistics": {
"type": "object",
"properties": {
"density": {
"type": "number",
"minimum": 104.578003,
"maximum": 1336.810059
},
"eccentricity": {
"type": "number",
"minimum": 0.0,
"maximum": 0.298219
},
"escapeVelocity": {
"type": "number",
"minimum": 8.6733,
"maximum": 77.066498
},
"locked": {
"type": "boolean"
},
"massDust": {
"type": "number",
"minimum": 1.9891000717606912E16,
"maximum": 3.9981799706051215E18
},
"massGas": {
"type": "number",
"minimum": 1.0E-6,
"maximum": 7435390.0
},
"orbitPeriod": {
"type": "number",
"minimum": 24578.599609,
"maximum": 1.274770048E9
},
"orbitRadius": {
"type": "number",
"minimum": 5160910.0,
"maximum": 3.05014013952E11
},
"rotationRate": {
"type": "number",
"minimum": 24578.599609,
"maximum": 1.274770048E9
},
"spectralClass": {
"type": "string",
"minLength": 3,
"maxLength": 3
},
"surfaceGravity": {
"type": "number",
"minimum": 0.001047,
"maximum": 0.033083
},
"temperature": {
"type": "number",
"minimum": 13.0181,
"maximum": 681.690979
}
},
"required": [
"density",
"eccentricity",
"escapeVelocity",
"locked",
"massDust",
"orbitPeriod",
"orbitRadius",
"rotationRate",
"spectralClass",
"surfaceGravity",
"temperature"
]
},
"typeID": {
"type": "integer",
"minimum": 15,
"maximum": 15
}
},
"required": [
"_key",
"celestialIndex",
"orbitID",
"orbitIndex",
"position",
"solarSystemID",
"typeID"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val mapAsteroidBelt = json.parse(MapAsteroidBelt.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class MapAsteroidBelt (
@SerialName("_key")
val key: Long,
val celestialIndex: Long,
val name: Name? = null,
@SerialName("orbitID")
val orbitId: Long,
val orbitIndex: Long,
val position: Position,
val radius: Double? = null,
@SerialName("solarSystemID")
val solarSystemId: Long,
val statistics: Statistics? = null,
@SerialName("typeID")
val typeId: Long
)
@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
)
@Serializable
data class Position (
val x: Double,
val y: Double,
val z: Double
)
@Serializable
data class Statistics (
val density: Double,
val eccentricity: Double,
val escapeVelocity: Double,
val locked: Boolean,
val massDust: Double,
val massGas: Double? = null,
val orbitPeriod: Double,
val orbitRadius: Double,
val rotationRate: Double,
val spectralClass: String,
val surfaceGravity: Double,
val temperature: Double
)
<?php
// This is a autogenerated file:MapAsteroidBelt
class MapAsteroidBelt {
private int $key; // json:_key Required
private int $celestialIndex; // json:celestialIndex Required
private ?Name $name; // json:name Optional
private int $orbitId; // json:orbitID Required
private int $orbitIndex; // json:orbitIndex Required
private Position $position; // json:position Required
private ?float $radius; // json:radius Optional
private int $solarSystemId; // json:solarSystemID Required
private ?Statistics $statistics; // json:statistics Optional
private int $typeId; // json:typeID Required
/**
* @param int $key
* @param int $celestialIndex
* @param Name|null $name
* @param int $orbitId
* @param int $orbitIndex
* @param Position $position
* @param float|null $radius
* @param int $solarSystemId
* @param Statistics|null $statistics
* @param int $typeId
*/
public function __construct(int $key, int $celestialIndex, ?Name $name, int $orbitId, int $orbitIndex, Position $position, ?float $radius, int $solarSystemId, ?Statistics $statistics, int $typeId) {
$this->key = $key;
$this->celestialIndex = $celestialIndex;
$this->name = $name;
$this->orbitId = $orbitId;
$this->orbitIndex = $orbitIndex;
$this->position = $position;
$this->radius = $radius;
$this->solarSystemId = $solarSystemId;
$this->statistics = $statistics;
$this->typeId = $typeId;
}
/**
* @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 (MapAsteroidBelt::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this MapAsteroidBelt::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapAsteroidBelt::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (MapAsteroidBelt::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey MapAsteroidBelt::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromCelestialIndex(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toCelestialIndex(): int {
if (MapAsteroidBelt::validateCelestialIndex($this->celestialIndex)) {
return $this->celestialIndex; /*int*/
}
throw new Exception('never get to this MapAsteroidBelt::celestialIndex');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateCelestialIndex(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapAsteroidBelt::celestialIndex");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getCelestialIndex(): int {
if (MapAsteroidBelt::validateCelestialIndex($this->celestialIndex)) {
return $this->celestialIndex;
}
throw new Exception('never get to getCelestialIndex MapAsteroidBelt::celestialIndex');
}
/**
* @return int
*/
public static function sampleCelestialIndex(): int {
return 32; /*32:celestialIndex*/
}
/**
* @param ?stdClass $value
* @throws Exception
* @return ?Name
*/
public static function fromName(?stdClass $value): ?Name {
if (!is_null($value)) {
return Name::from($value); /*class*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?stdClass
*/
public function toName(): ?stdClass {
if (MapAsteroidBelt::validateName($this->name)) {
if (!is_null($this->name)) {
return $this->name->to(); /*class*/
} else {
return null;
}
}
throw new Exception('never get to this MapAsteroidBelt::name');
}
/**
* @param Name|null
* @return bool
* @throws Exception
*/
public static function validateName(?Name $value): bool {
if (!is_null($value)) {
$value->validate();
}
return true;
}
/**
* @throws Exception
* @return ?Name
*/
public function getName(): ?Name {
if (MapAsteroidBelt::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName MapAsteroidBelt::name');
}
/**
* @return ?Name
*/
public static function sampleName(): ?Name {
return Name::sample(); /*33:name*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromOrbitId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toOrbitId(): int {
if (MapAsteroidBelt::validateOrbitId($this->orbitId)) {
return $this->orbitId; /*int*/
}
throw new Exception('never get to this MapAsteroidBelt::orbitId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateOrbitId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapAsteroidBelt::orbitId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getOrbitId(): int {
if (MapAsteroidBelt::validateOrbitId($this->orbitId)) {
return $this->orbitId;
}
throw new Exception('never get to getOrbitId MapAsteroidBelt::orbitId');
}
/**
* @return int
*/
public static function sampleOrbitId(): int {
return 34; /*34:orbitId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromOrbitIndex(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toOrbitIndex(): int {
if (MapAsteroidBelt::validateOrbitIndex($this->orbitIndex)) {
return $this->orbitIndex; /*int*/
}
throw new Exception('never get to this MapAsteroidBelt::orbitIndex');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateOrbitIndex(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapAsteroidBelt::orbitIndex");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getOrbitIndex(): int {
if (MapAsteroidBelt::validateOrbitIndex($this->orbitIndex)) {
return $this->orbitIndex;
}
throw new Exception('never get to getOrbitIndex MapAsteroidBelt::orbitIndex');
}
/**
* @return int
*/
public static function sampleOrbitIndex(): int {
return 35; /*35:orbitIndex*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Position
*/
public static function fromPosition(stdClass $value): Position {
return Position::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toPosition(): stdClass {
if (MapAsteroidBelt::validatePosition($this->position)) {
return $this->position->to(); /*class*/
}
throw new Exception('never get to this MapAsteroidBelt::position');
}
/**
* @param Position
* @return bool
* @throws Exception
*/
public static function validatePosition(Position $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Position
*/
public function getPosition(): Position {
if (MapAsteroidBelt::validatePosition($this->position)) {
return $this->position;
}
throw new Exception('never get to getPosition MapAsteroidBelt::position');
}
/**
* @return Position
*/
public static function samplePosition(): Position {
return Position::sample(); /*36:position*/
}
/**
* @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 (MapAsteroidBelt::validateRadius($this->radius)) {
if (!is_null($this->radius)) {
return $this->radius; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this MapAsteroidBelt::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:MapAsteroidBelt::radius");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getRadius(): ?float {
if (MapAsteroidBelt::validateRadius($this->radius)) {
return $this->radius;
}
throw new Exception('never get to getRadius MapAsteroidBelt::radius');
}
/**
* @return ?float
*/
public static function sampleRadius(): ?float {
return 37.037; /*37:radius*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromSolarSystemId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toSolarSystemId(): int {
if (MapAsteroidBelt::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId; /*int*/
}
throw new Exception('never get to this MapAsteroidBelt::solarSystemId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateSolarSystemId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapAsteroidBelt::solarSystemId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getSolarSystemId(): int {
if (MapAsteroidBelt::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId;
}
throw new Exception('never get to getSolarSystemId MapAsteroidBelt::solarSystemId');
}
/**
* @return int
*/
public static function sampleSolarSystemId(): int {
return 38; /*38:solarSystemId*/
}
/**
* @param ?stdClass $value
* @throws Exception
* @return ?Statistics
*/
public static function fromStatistics(?stdClass $value): ?Statistics {
if (!is_null($value)) {
return Statistics::from($value); /*class*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?stdClass
*/
public function toStatistics(): ?stdClass {
if (MapAsteroidBelt::validateStatistics($this->statistics)) {
if (!is_null($this->statistics)) {
return $this->statistics->to(); /*class*/
} else {
return null;
}
}
throw new Exception('never get to this MapAsteroidBelt::statistics');
}
/**
* @param Statistics|null
* @return bool
* @throws Exception
*/
public static function validateStatistics(?Statistics $value): bool {
if (!is_null($value)) {
$value->validate();
}
return true;
}
/**
* @throws Exception
* @return ?Statistics
*/
public function getStatistics(): ?Statistics {
if (MapAsteroidBelt::validateStatistics($this->statistics)) {
return $this->statistics;
}
throw new Exception('never get to getStatistics MapAsteroidBelt::statistics');
}
/**
* @return ?Statistics
*/
public static function sampleStatistics(): ?Statistics {
return Statistics::sample(); /*39:statistics*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromTypeId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toTypeId(): int {
if (MapAsteroidBelt::validateTypeId($this->typeId)) {
return $this->typeId; /*int*/
}
throw new Exception('never get to this MapAsteroidBelt::typeId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateTypeId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapAsteroidBelt::typeId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getTypeId(): int {
if (MapAsteroidBelt::validateTypeId($this->typeId)) {
return $this->typeId;
}
throw new Exception('never get to getTypeId MapAsteroidBelt::typeId');
}
/**
* @return int
*/
public static function sampleTypeId(): int {
return 40; /*40:typeId*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return MapAsteroidBelt::validateKey($this->key)
|| MapAsteroidBelt::validateCelestialIndex($this->celestialIndex)
|| MapAsteroidBelt::validateName($this->name)
|| MapAsteroidBelt::validateOrbitId($this->orbitId)
|| MapAsteroidBelt::validateOrbitIndex($this->orbitIndex)
|| MapAsteroidBelt::validatePosition($this->position)
|| MapAsteroidBelt::validateRadius($this->radius)
|| MapAsteroidBelt::validateSolarSystemId($this->solarSystemId)
|| MapAsteroidBelt::validateStatistics($this->statistics)
|| MapAsteroidBelt::validateTypeId($this->typeId);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'celestialIndex'} = $this->toCelestialIndex();
$out->{'name'} = $this->toName();
$out->{'orbitID'} = $this->toOrbitId();
$out->{'orbitIndex'} = $this->toOrbitIndex();
$out->{'position'} = $this->toPosition();
$out->{'radius'} = $this->toRadius();
$out->{'solarSystemID'} = $this->toSolarSystemId();
$out->{'statistics'} = $this->toStatistics();
$out->{'typeID'} = $this->toTypeId();
return $out;
}
/**
* @param stdClass $obj
* @return MapAsteroidBelt
* @throws Exception
*/
public static function from(stdClass $obj): MapAsteroidBelt {
return new MapAsteroidBelt(
MapAsteroidBelt::fromKey($obj->{'_key'})
,MapAsteroidBelt::fromCelestialIndex($obj->{'celestialIndex'})
,MapAsteroidBelt::fromName($obj->{'name'})
,MapAsteroidBelt::fromOrbitId($obj->{'orbitID'})
,MapAsteroidBelt::fromOrbitIndex($obj->{'orbitIndex'})
,MapAsteroidBelt::fromPosition($obj->{'position'})
,MapAsteroidBelt::fromRadius($obj->{'radius'})
,MapAsteroidBelt::fromSolarSystemId($obj->{'solarSystemID'})
,MapAsteroidBelt::fromStatistics($obj->{'statistics'})
,MapAsteroidBelt::fromTypeId($obj->{'typeID'})
);
}
/**
* @return MapAsteroidBelt
*/
public static function sample(): MapAsteroidBelt {
return new MapAsteroidBelt(
MapAsteroidBelt::sampleKey()
,MapAsteroidBelt::sampleCelestialIndex()
,MapAsteroidBelt::sampleName()
,MapAsteroidBelt::sampleOrbitId()
,MapAsteroidBelt::sampleOrbitIndex()
,MapAsteroidBelt::samplePosition()
,MapAsteroidBelt::sampleRadius()
,MapAsteroidBelt::sampleSolarSystemId()
,MapAsteroidBelt::sampleStatistics()
,MapAsteroidBelt::sampleTypeId()
);
}
}
// 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()
);
}
}
// This is a autogenerated file:Position
class Position {
private float $x; // json:x Required
private float $y; // json:y Required
private float $z; // json:z Required
/**
* @param float $x
* @param float $y
* @param float $z
*/
public function __construct(float $x, float $y, float $z) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromX(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toX(): float {
if (Position::validateX($this->x)) {
return $this->x; /*float*/
}
throw new Exception('never get to this Position::x');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateX(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::x");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getX(): float {
if (Position::validateX($this->x)) {
return $this->x;
}
throw new Exception('never get to getX Position::x');
}
/**
* @return float
*/
public static function sampleX(): float {
return 31.031; /*31:x*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromY(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toY(): float {
if (Position::validateY($this->y)) {
return $this->y; /*float*/
}
throw new Exception('never get to this Position::y');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateY(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::y");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getY(): float {
if (Position::validateY($this->y)) {
return $this->y;
}
throw new Exception('never get to getY Position::y');
}
/**
* @return float
*/
public static function sampleY(): float {
return 32.032; /*32:y*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromZ(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toZ(): float {
if (Position::validateZ($this->z)) {
return $this->z; /*float*/
}
throw new Exception('never get to this Position::z');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateZ(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::z");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getZ(): float {
if (Position::validateZ($this->z)) {
return $this->z;
}
throw new Exception('never get to getZ Position::z');
}
/**
* @return float
*/
public static function sampleZ(): float {
return 33.033; /*33:z*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Position::validateX($this->x)
|| Position::validateY($this->y)
|| Position::validateZ($this->z);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'x'} = $this->toX();
$out->{'y'} = $this->toY();
$out->{'z'} = $this->toZ();
return $out;
}
/**
* @param stdClass $obj
* @return Position
* @throws Exception
*/
public static function from(stdClass $obj): Position {
return new Position(
Position::fromX($obj->{'x'})
,Position::fromY($obj->{'y'})
,Position::fromZ($obj->{'z'})
);
}
/**
* @return Position
*/
public static function sample(): Position {
return new Position(
Position::sampleX()
,Position::sampleY()
,Position::sampleZ()
);
}
}
// This is a autogenerated file:Statistics
class Statistics {
private float $density; // json:density Required
private float $eccentricity; // json:eccentricity Required
private float $escapeVelocity; // json:escapeVelocity Required
private bool $locked; // json:locked Required
private float $massDust; // json:massDust Required
private ?float $massGas; // json:massGas Optional
private float $orbitPeriod; // json:orbitPeriod Required
private float $orbitRadius; // json:orbitRadius Required
private float $rotationRate; // json:rotationRate Required
private string $spectralClass; // json:spectralClass Required
private float $surfaceGravity; // json:surfaceGravity Required
private float $temperature; // json:temperature Required
/**
* @param float $density
* @param float $eccentricity
* @param float $escapeVelocity
* @param bool $locked
* @param float $massDust
* @param float|null $massGas
* @param float $orbitPeriod
* @param float $orbitRadius
* @param float $rotationRate
* @param string $spectralClass
* @param float $surfaceGravity
* @param float $temperature
*/
public function __construct(float $density, float $eccentricity, float $escapeVelocity, bool $locked, float $massDust, ?float $massGas, float $orbitPeriod, float $orbitRadius, float $rotationRate, string $spectralClass, float $surfaceGravity, float $temperature) {
$this->density = $density;
$this->eccentricity = $eccentricity;
$this->escapeVelocity = $escapeVelocity;
$this->locked = $locked;
$this->massDust = $massDust;
$this->massGas = $massGas;
$this->orbitPeriod = $orbitPeriod;
$this->orbitRadius = $orbitRadius;
$this->rotationRate = $rotationRate;
$this->spectralClass = $spectralClass;
$this->surfaceGravity = $surfaceGravity;
$this->temperature = $temperature;
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromDensity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toDensity(): float {
if (Statistics::validateDensity($this->density)) {
return $this->density; /*float*/
}
throw new Exception('never get to this Statistics::density');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateDensity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::density");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getDensity(): float {
if (Statistics::validateDensity($this->density)) {
return $this->density;
}
throw new Exception('never get to getDensity Statistics::density');
}
/**
* @return float
*/
public static function sampleDensity(): float {
return 31.031; /*31:density*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromEccentricity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toEccentricity(): float {
if (Statistics::validateEccentricity($this->eccentricity)) {
return $this->eccentricity; /*float*/
}
throw new Exception('never get to this Statistics::eccentricity');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateEccentricity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::eccentricity");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getEccentricity(): float {
if (Statistics::validateEccentricity($this->eccentricity)) {
return $this->eccentricity;
}
throw new Exception('never get to getEccentricity Statistics::eccentricity');
}
/**
* @return float
*/
public static function sampleEccentricity(): float {
return 32.032; /*32:eccentricity*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromEscapeVelocity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toEscapeVelocity(): float {
if (Statistics::validateEscapeVelocity($this->escapeVelocity)) {
return $this->escapeVelocity; /*float*/
}
throw new Exception('never get to this Statistics::escapeVelocity');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateEscapeVelocity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::escapeVelocity");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getEscapeVelocity(): float {
if (Statistics::validateEscapeVelocity($this->escapeVelocity)) {
return $this->escapeVelocity;
}
throw new Exception('never get to getEscapeVelocity Statistics::escapeVelocity');
}
/**
* @return float
*/
public static function sampleEscapeVelocity(): float {
return 33.033; /*33:escapeVelocity*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromLocked(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toLocked(): bool {
if (Statistics::validateLocked($this->locked)) {
return $this->locked; /*bool*/
}
throw new Exception('never get to this Statistics::locked');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateLocked(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Statistics::locked");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getLocked(): bool {
if (Statistics::validateLocked($this->locked)) {
return $this->locked;
}
throw new Exception('never get to getLocked Statistics::locked');
}
/**
* @return bool
*/
public static function sampleLocked(): bool {
return true; /*34:locked*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromMassDust(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toMassDust(): float {
if (Statistics::validateMassDust($this->massDust)) {
return $this->massDust; /*float*/
}
throw new Exception('never get to this Statistics::massDust');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateMassDust(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::massDust");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getMassDust(): float {
if (Statistics::validateMassDust($this->massDust)) {
return $this->massDust;
}
throw new Exception('never get to getMassDust Statistics::massDust');
}
/**
* @return float
*/
public static function sampleMassDust(): float {
return 35.035; /*35:massDust*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromMassGas(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toMassGas(): ?float {
if (Statistics::validateMassGas($this->massGas)) {
if (!is_null($this->massGas)) {
return $this->massGas; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Statistics::massGas');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateMassGas(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::massGas");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getMassGas(): ?float {
if (Statistics::validateMassGas($this->massGas)) {
return $this->massGas;
}
throw new Exception('never get to getMassGas Statistics::massGas');
}
/**
* @return ?float
*/
public static function sampleMassGas(): ?float {
return 36.036; /*36:massGas*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromOrbitPeriod(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toOrbitPeriod(): float {
if (Statistics::validateOrbitPeriod($this->orbitPeriod)) {
return $this->orbitPeriod; /*float*/
}
throw new Exception('never get to this Statistics::orbitPeriod');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateOrbitPeriod(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::orbitPeriod");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getOrbitPeriod(): float {
if (Statistics::validateOrbitPeriod($this->orbitPeriod)) {
return $this->orbitPeriod;
}
throw new Exception('never get to getOrbitPeriod Statistics::orbitPeriod');
}
/**
* @return float
*/
public static function sampleOrbitPeriod(): float {
return 37.037; /*37:orbitPeriod*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromOrbitRadius(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toOrbitRadius(): float {
if (Statistics::validateOrbitRadius($this->orbitRadius)) {
return $this->orbitRadius; /*float*/
}
throw new Exception('never get to this Statistics::orbitRadius');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateOrbitRadius(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::orbitRadius");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getOrbitRadius(): float {
if (Statistics::validateOrbitRadius($this->orbitRadius)) {
return $this->orbitRadius;
}
throw new Exception('never get to getOrbitRadius Statistics::orbitRadius');
}
/**
* @return float
*/
public static function sampleOrbitRadius(): float {
return 38.038; /*38:orbitRadius*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromRotationRate(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toRotationRate(): float {
if (Statistics::validateRotationRate($this->rotationRate)) {
return $this->rotationRate; /*float*/
}
throw new Exception('never get to this Statistics::rotationRate');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateRotationRate(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::rotationRate");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getRotationRate(): float {
if (Statistics::validateRotationRate($this->rotationRate)) {
return $this->rotationRate;
}
throw new Exception('never get to getRotationRate Statistics::rotationRate');
}
/**
* @return float
*/
public static function sampleRotationRate(): float {
return 39.039; /*39:rotationRate*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromSpectralClass(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toSpectralClass(): string {
if (Statistics::validateSpectralClass($this->spectralClass)) {
return $this->spectralClass; /*string*/
}
throw new Exception('never get to this Statistics::spectralClass');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateSpectralClass(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Statistics::spectralClass");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getSpectralClass(): string {
if (Statistics::validateSpectralClass($this->spectralClass)) {
return $this->spectralClass;
}
throw new Exception('never get to getSpectralClass Statistics::spectralClass');
}
/**
* @return string
*/
public static function sampleSpectralClass(): string {
return 'Statistics::spectralClass::40'; /*40:spectralClass*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromSurfaceGravity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toSurfaceGravity(): float {
if (Statistics::validateSurfaceGravity($this->surfaceGravity)) {
return $this->surfaceGravity; /*float*/
}
throw new Exception('never get to this Statistics::surfaceGravity');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateSurfaceGravity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::surfaceGravity");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getSurfaceGravity(): float {
if (Statistics::validateSurfaceGravity($this->surfaceGravity)) {
return $this->surfaceGravity;
}
throw new Exception('never get to getSurfaceGravity Statistics::surfaceGravity');
}
/**
* @return float
*/
public static function sampleSurfaceGravity(): float {
return 41.041; /*41:surfaceGravity*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromTemperature(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toTemperature(): float {
if (Statistics::validateTemperature($this->temperature)) {
return $this->temperature; /*float*/
}
throw new Exception('never get to this Statistics::temperature');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateTemperature(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::temperature");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getTemperature(): float {
if (Statistics::validateTemperature($this->temperature)) {
return $this->temperature;
}
throw new Exception('never get to getTemperature Statistics::temperature');
}
/**
* @return float
*/
public static function sampleTemperature(): float {
return 42.042; /*42:temperature*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Statistics::validateDensity($this->density)
|| Statistics::validateEccentricity($this->eccentricity)
|| Statistics::validateEscapeVelocity($this->escapeVelocity)
|| Statistics::validateLocked($this->locked)
|| Statistics::validateMassDust($this->massDust)
|| Statistics::validateMassGas($this->massGas)
|| Statistics::validateOrbitPeriod($this->orbitPeriod)
|| Statistics::validateOrbitRadius($this->orbitRadius)
|| Statistics::validateRotationRate($this->rotationRate)
|| Statistics::validateSpectralClass($this->spectralClass)
|| Statistics::validateSurfaceGravity($this->surfaceGravity)
|| Statistics::validateTemperature($this->temperature);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'density'} = $this->toDensity();
$out->{'eccentricity'} = $this->toEccentricity();
$out->{'escapeVelocity'} = $this->toEscapeVelocity();
$out->{'locked'} = $this->toLocked();
$out->{'massDust'} = $this->toMassDust();
$out->{'massGas'} = $this->toMassGas();
$out->{'orbitPeriod'} = $this->toOrbitPeriod();
$out->{'orbitRadius'} = $this->toOrbitRadius();
$out->{'rotationRate'} = $this->toRotationRate();
$out->{'spectralClass'} = $this->toSpectralClass();
$out->{'surfaceGravity'} = $this->toSurfaceGravity();
$out->{'temperature'} = $this->toTemperature();
return $out;
}
/**
* @param stdClass $obj
* @return Statistics
* @throws Exception
*/
public static function from(stdClass $obj): Statistics {
return new Statistics(
Statistics::fromDensity($obj->{'density'})
,Statistics::fromEccentricity($obj->{'eccentricity'})
,Statistics::fromEscapeVelocity($obj->{'escapeVelocity'})
,Statistics::fromLocked($obj->{'locked'})
,Statistics::fromMassDust($obj->{'massDust'})
,Statistics::fromMassGas($obj->{'massGas'})
,Statistics::fromOrbitPeriod($obj->{'orbitPeriod'})
,Statistics::fromOrbitRadius($obj->{'orbitRadius'})
,Statistics::fromRotationRate($obj->{'rotationRate'})
,Statistics::fromSpectralClass($obj->{'spectralClass'})
,Statistics::fromSurfaceGravity($obj->{'surfaceGravity'})
,Statistics::fromTemperature($obj->{'temperature'})
);
}
/**
* @return Statistics
*/
public static function sample(): Statistics {
return new Statistics(
Statistics::sampleDensity()
,Statistics::sampleEccentricity()
,Statistics::sampleEscapeVelocity()
,Statistics::sampleLocked()
,Statistics::sampleMassDust()
,Statistics::sampleMassGas()
,Statistics::sampleOrbitPeriod()
,Statistics::sampleOrbitRadius()
,Statistics::sampleRotationRate()
,Statistics::sampleSpectralClass()
,Statistics::sampleSurfaceGravity()
,Statistics::sampleTemperature()
);
}
}
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_float(x: Any) -> float:
assert isinstance(x, (float, int)) and not isinstance(x, bool)
return float(x)
def to_float(x: Any) -> float:
assert isinstance(x, (int, float))
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 from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
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 Position:
x: float
y: float
z: float
def __init__(self, x: float, y: float, z: float) -> None:
self.x = x
self.y = y
self.z = z
@staticmethod
def from_dict(obj: Any) -> 'Position':
assert isinstance(obj, dict)
x = from_float(obj.get("x"))
y = from_float(obj.get("y"))
z = from_float(obj.get("z"))
return Position(x, y, z)
def to_dict(self) -> dict:
result: dict = {}
result["x"] = to_float(self.x)
result["y"] = to_float(self.y)
result["z"] = to_float(self.z)
return result
class Statistics:
density: float
eccentricity: float
escape_velocity: float
locked: bool
mass_dust: float
mass_gas: Optional[float]
orbit_period: float
orbit_radius: float
rotation_rate: float
spectral_class: str
surface_gravity: float
temperature: float
def __init__(self, density: float, eccentricity: float, escape_velocity: float, locked: bool, mass_dust: float, mass_gas: Optional[float], orbit_period: float, orbit_radius: float, rotation_rate: float, spectral_class: str, surface_gravity: float, temperature: float) -> None:
self.density = density
self.eccentricity = eccentricity
self.escape_velocity = escape_velocity
self.locked = locked
self.mass_dust = mass_dust
self.mass_gas = mass_gas
self.orbit_period = orbit_period
self.orbit_radius = orbit_radius
self.rotation_rate = rotation_rate
self.spectral_class = spectral_class
self.surface_gravity = surface_gravity
self.temperature = temperature
@staticmethod
def from_dict(obj: Any) -> 'Statistics':
assert isinstance(obj, dict)
density = from_float(obj.get("density"))
eccentricity = from_float(obj.get("eccentricity"))
escape_velocity = from_float(obj.get("escapeVelocity"))
locked = from_bool(obj.get("locked"))
mass_dust = from_float(obj.get("massDust"))
mass_gas = from_union([from_float, from_none], obj.get("massGas"))
orbit_period = from_float(obj.get("orbitPeriod"))
orbit_radius = from_float(obj.get("orbitRadius"))
rotation_rate = from_float(obj.get("rotationRate"))
spectral_class = from_str(obj.get("spectralClass"))
surface_gravity = from_float(obj.get("surfaceGravity"))
temperature = from_float(obj.get("temperature"))
return Statistics(density, eccentricity, escape_velocity, locked, mass_dust, mass_gas, orbit_period, orbit_radius, rotation_rate, spectral_class, surface_gravity, temperature)
def to_dict(self) -> dict:
result: dict = {}
result["density"] = to_float(self.density)
result["eccentricity"] = to_float(self.eccentricity)
result["escapeVelocity"] = to_float(self.escape_velocity)
result["locked"] = from_bool(self.locked)
result["massDust"] = to_float(self.mass_dust)
if self.mass_gas is not None:
result["massGas"] = from_union([to_float, from_none], self.mass_gas)
result["orbitPeriod"] = to_float(self.orbit_period)
result["orbitRadius"] = to_float(self.orbit_radius)
result["rotationRate"] = to_float(self.rotation_rate)
result["spectralClass"] = from_str(self.spectral_class)
result["surfaceGravity"] = to_float(self.surface_gravity)
result["temperature"] = to_float(self.temperature)
return result
class MapAsteroidBelt:
key: int
celestial_index: int
name: Optional[Name]
orbit_id: int
orbit_index: int
position: Position
radius: Optional[float]
solar_system_id: int
statistics: Optional[Statistics]
type_id: int
def __init__(self, key: int, celestial_index: int, name: Optional[Name], orbit_id: int, orbit_index: int, position: Position, radius: Optional[float], solar_system_id: int, statistics: Optional[Statistics], type_id: int) -> None:
self.key = key
self.celestial_index = celestial_index
self.name = name
self.orbit_id = orbit_id
self.orbit_index = orbit_index
self.position = position
self.radius = radius
self.solar_system_id = solar_system_id
self.statistics = statistics
self.type_id = type_id
@staticmethod
def from_dict(obj: Any) -> 'MapAsteroidBelt':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
celestial_index = from_int(obj.get("celestialIndex"))
name = from_union([Name.from_dict, from_none], obj.get("name"))
orbit_id = from_int(obj.get("orbitID"))
orbit_index = from_int(obj.get("orbitIndex"))
position = Position.from_dict(obj.get("position"))
radius = from_union([from_float, from_none], obj.get("radius"))
solar_system_id = from_int(obj.get("solarSystemID"))
statistics = from_union([Statistics.from_dict, from_none], obj.get("statistics"))
type_id = from_int(obj.get("typeID"))
return MapAsteroidBelt(key, celestial_index, name, orbit_id, orbit_index, position, radius, solar_system_id, statistics, type_id)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["celestialIndex"] = from_int(self.celestial_index)
if self.name is not None:
result["name"] = from_union([lambda x: to_class(Name, x), from_none], self.name)
result["orbitID"] = from_int(self.orbit_id)
result["orbitIndex"] = from_int(self.orbit_index)
result["position"] = to_class(Position, self.position)
if self.radius is not None:
result["radius"] = from_union([to_float, from_none], self.radius)
result["solarSystemID"] = from_int(self.solar_system_id)
if self.statistics is not None:
result["statistics"] = from_union([lambda x: to_class(Statistics, x), from_none], self.statistics)
result["typeID"] = from_int(self.type_id)
return result
def map_asteroid_belt_from_dict(s: Any) -> MapAsteroidBelt:
return MapAsteroidBelt.from_dict(s)
def map_asteroid_belt_to_dict(x: MapAsteroidBelt) -> Any:
return to_class(MapAsteroidBelt, x)
// To parse this data:
//
// import { Convert, MapAsteroidBelt } from "./file";
//
// const mapAsteroidBelt = Convert.toMapAsteroidBelt(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface MapAsteroidBelt {
_key: number;
celestialIndex: number;
name?: Name;
orbitID: number;
orbitIndex: number;
position: Position;
radius?: number;
solarSystemID: number;
statistics?: Statistics;
typeID: number;
[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;
}
export interface Position {
x: number;
y: number;
z: number;
[property: string]: any;
}
export interface Statistics {
density: number;
eccentricity: number;
escapeVelocity: number;
locked: boolean;
massDust: number;
massGas?: number;
orbitPeriod: number;
orbitRadius: number;
rotationRate: number;
spectralClass: string;
surfaceGravity: number;
temperature: number;
[property: string]: any;
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toMapAsteroidBelt(json: string): MapAsteroidBelt {
return cast(JSON.parse(json), r("MapAsteroidBelt"));
}
public static mapAsteroidBeltToJson(value: MapAsteroidBelt): string {
return JSON.stringify(uncast(value, r("MapAsteroidBelt")), 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 = {
"MapAsteroidBelt": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "celestialIndex", js: "celestialIndex", typ: 0 },
{ json: "name", js: "name", typ: u(undefined, r("Name")) },
{ json: "orbitID", js: "orbitID", typ: 0 },
{ json: "orbitIndex", js: "orbitIndex", typ: 0 },
{ json: "position", js: "position", typ: r("Position") },
{ json: "radius", js: "radius", typ: u(undefined, 3.14) },
{ json: "solarSystemID", js: "solarSystemID", typ: 0 },
{ json: "statistics", js: "statistics", typ: u(undefined, r("Statistics")) },
{ json: "typeID", js: "typeID", typ: 0 },
], "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"),
"Position": o([
{ json: "x", js: "x", typ: 3.14 },
{ json: "y", js: "y", typ: 3.14 },
{ json: "z", js: "z", typ: 3.14 },
], "any"),
"Statistics": o([
{ json: "density", js: "density", typ: 3.14 },
{ json: "eccentricity", js: "eccentricity", typ: 3.14 },
{ json: "escapeVelocity", js: "escapeVelocity", typ: 3.14 },
{ json: "locked", js: "locked", typ: true },
{ json: "massDust", js: "massDust", typ: 3.14 },
{ json: "massGas", js: "massGas", typ: u(undefined, 3.14) },
{ json: "orbitPeriod", js: "orbitPeriod", typ: 3.14 },
{ json: "orbitRadius", js: "orbitRadius", typ: 3.14 },
{ json: "rotationRate", js: "rotationRate", typ: 3.14 },
{ json: "spectralClass", js: "spectralClass", typ: "" },
{ json: "surfaceGravity", js: "surfaceGravity", typ: 3.14 },
{ json: "temperature", js: "temperature", typ: 3.14 },
], "any"),
};