agentsInSpace.jsonl
Schema
_key
(required): integer
Range: 3018343 .. 3019501dungeonID
(required): integer
Range: 416 .. 5294solarSystemID
(required): integer
Range: 30000001 .. 30045323spawnPointID
(required): integer
Range: 4237 .. 5899typeID
(required): integer
Range: 2840 .. 32411
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var agentInSpace = AgentInSpace.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class AgentInSpace
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("dungeonID")]
public long DungeonId { get; set; }
[JsonProperty("solarSystemID")]
public long SolarSystemId { get; set; }
[JsonProperty("spawnPointID")]
public long SpawnPointId { get; set; }
[JsonProperty("typeID")]
public long TypeId { get; set; }
}
public partial class AgentInSpace
{
public static AgentInSpace FromJson(string json) => JsonConvert.DeserializeObject<AgentInSpace>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this AgentInSpace 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 }
},
};
}
}
// 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:
//
// agentInSpace, err := UnmarshalAgentInSpace(bytes)
// bytes, err = agentInSpace.Marshal()
package model
import "encoding/json"
func UnmarshalAgentInSpace(data []byte) (AgentInSpace, error) {
var r AgentInSpace
err := json.Unmarshal(data, &r)
return r, err
}
func (r *AgentInSpace) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type AgentInSpace struct {
Key int64 `json:"_key"`
DungeonID int64 `json:"dungeonID"`
SolarSystemID int64 `json:"solarSystemID"`
SpawnPointID int64 `json:"spawnPointID"`
TypeID int64 `json:"typeID"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 3018343,
"maximum": 3019501
},
"dungeonID": {
"type": "integer",
"minimum": 416,
"maximum": 5294
},
"solarSystemID": {
"type": "integer",
"minimum": 30000001,
"maximum": 30045323
},
"spawnPointID": {
"type": "integer",
"minimum": 4237,
"maximum": 5899
},
"typeID": {
"type": "integer",
"minimum": 2840,
"maximum": 32411
}
},
"required": [
"_key",
"dungeonID",
"solarSystemID",
"spawnPointID",
"typeID"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val agentInSpace = json.parse(AgentInSpace.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class AgentInSpace (
@SerialName("_key")
val key: Long,
@SerialName("dungeonID")
val dungeonId: Long,
@SerialName("solarSystemID")
val solarSystemId: Long,
@SerialName("spawnPointID")
val spawnPointId: Long,
@SerialName("typeID")
val typeId: Long
)
<?php
// This is a autogenerated file:AgentInSpace
class AgentInSpace {
private int $key; // json:_key Required
private int $dungeonId; // json:dungeonID Required
private int $solarSystemId; // json:solarSystemID Required
private int $spawnPointId; // json:spawnPointID Required
private int $typeId; // json:typeID Required
/**
* @param int $key
* @param int $dungeonId
* @param int $solarSystemId
* @param int $spawnPointId
* @param int $typeId
*/
public function __construct(int $key, int $dungeonId, int $solarSystemId, int $spawnPointId, int $typeId) {
$this->key = $key;
$this->dungeonId = $dungeonId;
$this->solarSystemId = $solarSystemId;
$this->spawnPointId = $spawnPointId;
$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 (AgentInSpace::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this AgentInSpace::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:AgentInSpace::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (AgentInSpace::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey AgentInSpace::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromDungeonId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toDungeonId(): int {
if (AgentInSpace::validateDungeonId($this->dungeonId)) {
return $this->dungeonId; /*int*/
}
throw new Exception('never get to this AgentInSpace::dungeonId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateDungeonId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:AgentInSpace::dungeonId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getDungeonId(): int {
if (AgentInSpace::validateDungeonId($this->dungeonId)) {
return $this->dungeonId;
}
throw new Exception('never get to getDungeonId AgentInSpace::dungeonId');
}
/**
* @return int
*/
public static function sampleDungeonId(): int {
return 32; /*32:dungeonId*/
}
/**
* @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 (AgentInSpace::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId; /*int*/
}
throw new Exception('never get to this AgentInSpace::solarSystemId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateSolarSystemId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:AgentInSpace::solarSystemId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getSolarSystemId(): int {
if (AgentInSpace::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId;
}
throw new Exception('never get to getSolarSystemId AgentInSpace::solarSystemId');
}
/**
* @return int
*/
public static function sampleSolarSystemId(): int {
return 33; /*33:solarSystemId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromSpawnPointId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toSpawnPointId(): int {
if (AgentInSpace::validateSpawnPointId($this->spawnPointId)) {
return $this->spawnPointId; /*int*/
}
throw new Exception('never get to this AgentInSpace::spawnPointId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateSpawnPointId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:AgentInSpace::spawnPointId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getSpawnPointId(): int {
if (AgentInSpace::validateSpawnPointId($this->spawnPointId)) {
return $this->spawnPointId;
}
throw new Exception('never get to getSpawnPointId AgentInSpace::spawnPointId');
}
/**
* @return int
*/
public static function sampleSpawnPointId(): int {
return 34; /*34:spawnPointId*/
}
/**
* @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 (AgentInSpace::validateTypeId($this->typeId)) {
return $this->typeId; /*int*/
}
throw new Exception('never get to this AgentInSpace::typeId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateTypeId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:AgentInSpace::typeId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getTypeId(): int {
if (AgentInSpace::validateTypeId($this->typeId)) {
return $this->typeId;
}
throw new Exception('never get to getTypeId AgentInSpace::typeId');
}
/**
* @return int
*/
public static function sampleTypeId(): int {
return 35; /*35:typeId*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return AgentInSpace::validateKey($this->key)
|| AgentInSpace::validateDungeonId($this->dungeonId)
|| AgentInSpace::validateSolarSystemId($this->solarSystemId)
|| AgentInSpace::validateSpawnPointId($this->spawnPointId)
|| AgentInSpace::validateTypeId($this->typeId);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'dungeonID'} = $this->toDungeonId();
$out->{'solarSystemID'} = $this->toSolarSystemId();
$out->{'spawnPointID'} = $this->toSpawnPointId();
$out->{'typeID'} = $this->toTypeId();
return $out;
}
/**
* @param stdClass $obj
* @return AgentInSpace
* @throws Exception
*/
public static function from(stdClass $obj): AgentInSpace {
return new AgentInSpace(
AgentInSpace::fromKey($obj->{'_key'})
,AgentInSpace::fromDungeonId($obj->{'dungeonID'})
,AgentInSpace::fromSolarSystemId($obj->{'solarSystemID'})
,AgentInSpace::fromSpawnPointId($obj->{'spawnPointID'})
,AgentInSpace::fromTypeId($obj->{'typeID'})
);
}
/**
* @return AgentInSpace
*/
public static function sample(): AgentInSpace {
return new AgentInSpace(
AgentInSpace::sampleKey()
,AgentInSpace::sampleDungeonId()
,AgentInSpace::sampleSolarSystemId()
,AgentInSpace::sampleSpawnPointId()
,AgentInSpace::sampleTypeId()
);
}
}
from typing import Any, TypeVar, Type, cast
T = TypeVar("T")
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 AgentInSpace:
key: int
dungeon_id: int
solar_system_id: int
spawn_point_id: int
type_id: int
def __init__(self, key: int, dungeon_id: int, solar_system_id: int, spawn_point_id: int, type_id: int) -> None:
self.key = key
self.dungeon_id = dungeon_id
self.solar_system_id = solar_system_id
self.spawn_point_id = spawn_point_id
self.type_id = type_id
@staticmethod
def from_dict(obj: Any) -> 'AgentInSpace':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
dungeon_id = from_int(obj.get("dungeonID"))
solar_system_id = from_int(obj.get("solarSystemID"))
spawn_point_id = from_int(obj.get("spawnPointID"))
type_id = from_int(obj.get("typeID"))
return AgentInSpace(key, dungeon_id, solar_system_id, spawn_point_id, type_id)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["dungeonID"] = from_int(self.dungeon_id)
result["solarSystemID"] = from_int(self.solar_system_id)
result["spawnPointID"] = from_int(self.spawn_point_id)
result["typeID"] = from_int(self.type_id)
return result
def agent_in_space_from_dict(s: Any) -> AgentInSpace:
return AgentInSpace.from_dict(s)
def agent_in_space_to_dict(x: AgentInSpace) -> Any:
return to_class(AgentInSpace, x)
// To parse this data:
//
// import { Convert, AgentInSpace } from "./file";
//
// const agentInSpace = Convert.toAgentInSpace(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface AgentInSpace {
_key: number;
dungeonID: number;
solarSystemID: number;
spawnPointID: number;
typeID: 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 toAgentInSpace(json: string): AgentInSpace {
return cast(JSON.parse(json), r("AgentInSpace"));
}
public static agentInSpaceToJson(value: AgentInSpace): string {
return JSON.stringify(uncast(value, r("AgentInSpace")), 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 = {
"AgentInSpace": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "dungeonID", js: "dungeonID", typ: 0 },
{ json: "solarSystemID", js: "solarSystemID", typ: 0 },
{ json: "spawnPointID", js: "spawnPointID", typ: 0 },
{ json: "typeID", js: "typeID", typ: 0 },
], "any"),
};