agents.jsonl
Schema
_key
(required): integer
Range: 3008416 .. 3020051agentTypeID
(required): integer
Range: 2 .. 13corporationID
(required): integer
Range: 1000002 .. 1000419divisionID
(required): integer
Range: 18 .. 37isLocator
(required): booleanlevel
(required): integer
Range: 1 .. 5locationID
(required): integer
Range: 60000004 .. 60015179
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var agent = Agent.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class Agent
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("agentTypeID")]
public long AgentTypeId { get; set; }
[JsonProperty("corporationID")]
public long CorporationId { get; set; }
[JsonProperty("divisionID")]
public long DivisionId { get; set; }
[JsonProperty("isLocator")]
public bool IsLocator { get; set; }
[JsonProperty("level")]
public long Level { get; set; }
[JsonProperty("locationID")]
public long LocationId { get; set; }
}
public partial class Agent
{
public static Agent FromJson(string json) => JsonConvert.DeserializeObject<Agent>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this Agent 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:
//
// agent, err := UnmarshalAgent(bytes)
// bytes, err = agent.Marshal()
package model
import "encoding/json"
func UnmarshalAgent(data []byte) (Agent, error) {
var r Agent
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Agent) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type Agent struct {
Key int64 `json:"_key"`
AgentTypeID int64 `json:"agentTypeID"`
CorporationID int64 `json:"corporationID"`
DivisionID int64 `json:"divisionID"`
IsLocator bool `json:"isLocator"`
Level int64 `json:"level"`
LocationID int64 `json:"locationID"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 3008416,
"maximum": 3020051
},
"agentTypeID": {
"type": "integer",
"minimum": 2,
"maximum": 13
},
"corporationID": {
"type": "integer",
"minimum": 1000002,
"maximum": 1000419
},
"divisionID": {
"type": "integer",
"minimum": 18,
"maximum": 37
},
"isLocator": {
"type": "boolean"
},
"level": {
"type": "integer",
"minimum": 1,
"maximum": 5
},
"locationID": {
"type": "integer",
"minimum": 60000004,
"maximum": 60015179
}
},
"required": [
"_key",
"agentTypeID",
"corporationID",
"divisionID",
"isLocator",
"level",
"locationID"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val agent = json.parse(Agent.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class Agent (
@SerialName("_key")
val key: Long,
@SerialName("agentTypeID")
val agentTypeId: Long,
@SerialName("corporationID")
val corporationId: Long,
@SerialName("divisionID")
val divisionId: Long,
val isLocator: Boolean,
val level: Long,
@SerialName("locationID")
val locationId: Long
)
<?php
// This is a autogenerated file:Agent
class Agent {
private int $key; // json:_key Required
private int $agentTypeId; // json:agentTypeID Required
private int $corporationId; // json:corporationID Required
private int $divisionId; // json:divisionID Required
private bool $isLocator; // json:isLocator Required
private int $level; // json:level Required
private int $locationId; // json:locationID Required
/**
* @param int $key
* @param int $agentTypeId
* @param int $corporationId
* @param int $divisionId
* @param bool $isLocator
* @param int $level
* @param int $locationId
*/
public function __construct(int $key, int $agentTypeId, int $corporationId, int $divisionId, bool $isLocator, int $level, int $locationId) {
$this->key = $key;
$this->agentTypeId = $agentTypeId;
$this->corporationId = $corporationId;
$this->divisionId = $divisionId;
$this->isLocator = $isLocator;
$this->level = $level;
$this->locationId = $locationId;
}
/**
* @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 (Agent::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this Agent::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Agent::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (Agent::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey Agent::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromAgentTypeId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toAgentTypeId(): int {
if (Agent::validateAgentTypeId($this->agentTypeId)) {
return $this->agentTypeId; /*int*/
}
throw new Exception('never get to this Agent::agentTypeId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateAgentTypeId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Agent::agentTypeId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getAgentTypeId(): int {
if (Agent::validateAgentTypeId($this->agentTypeId)) {
return $this->agentTypeId;
}
throw new Exception('never get to getAgentTypeId Agent::agentTypeId');
}
/**
* @return int
*/
public static function sampleAgentTypeId(): int {
return 32; /*32:agentTypeId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromCorporationId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toCorporationId(): int {
if (Agent::validateCorporationId($this->corporationId)) {
return $this->corporationId; /*int*/
}
throw new Exception('never get to this Agent::corporationId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateCorporationId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Agent::corporationId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getCorporationId(): int {
if (Agent::validateCorporationId($this->corporationId)) {
return $this->corporationId;
}
throw new Exception('never get to getCorporationId Agent::corporationId');
}
/**
* @return int
*/
public static function sampleCorporationId(): int {
return 33; /*33:corporationId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromDivisionId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toDivisionId(): int {
if (Agent::validateDivisionId($this->divisionId)) {
return $this->divisionId; /*int*/
}
throw new Exception('never get to this Agent::divisionId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateDivisionId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Agent::divisionId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getDivisionId(): int {
if (Agent::validateDivisionId($this->divisionId)) {
return $this->divisionId;
}
throw new Exception('never get to getDivisionId Agent::divisionId');
}
/**
* @return int
*/
public static function sampleDivisionId(): int {
return 34; /*34:divisionId*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromIsLocator(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toIsLocator(): bool {
if (Agent::validateIsLocator($this->isLocator)) {
return $this->isLocator; /*bool*/
}
throw new Exception('never get to this Agent::isLocator');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateIsLocator(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Agent::isLocator");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getIsLocator(): bool {
if (Agent::validateIsLocator($this->isLocator)) {
return $this->isLocator;
}
throw new Exception('never get to getIsLocator Agent::isLocator');
}
/**
* @return bool
*/
public static function sampleIsLocator(): bool {
return true; /*35:isLocator*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromLevel(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toLevel(): int {
if (Agent::validateLevel($this->level)) {
return $this->level; /*int*/
}
throw new Exception('never get to this Agent::level');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateLevel(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Agent::level");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getLevel(): int {
if (Agent::validateLevel($this->level)) {
return $this->level;
}
throw new Exception('never get to getLevel Agent::level');
}
/**
* @return int
*/
public static function sampleLevel(): int {
return 36; /*36:level*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromLocationId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toLocationId(): int {
if (Agent::validateLocationId($this->locationId)) {
return $this->locationId; /*int*/
}
throw new Exception('never get to this Agent::locationId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateLocationId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Agent::locationId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getLocationId(): int {
if (Agent::validateLocationId($this->locationId)) {
return $this->locationId;
}
throw new Exception('never get to getLocationId Agent::locationId');
}
/**
* @return int
*/
public static function sampleLocationId(): int {
return 37; /*37:locationId*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Agent::validateKey($this->key)
|| Agent::validateAgentTypeId($this->agentTypeId)
|| Agent::validateCorporationId($this->corporationId)
|| Agent::validateDivisionId($this->divisionId)
|| Agent::validateIsLocator($this->isLocator)
|| Agent::validateLevel($this->level)
|| Agent::validateLocationId($this->locationId);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'agentTypeID'} = $this->toAgentTypeId();
$out->{'corporationID'} = $this->toCorporationId();
$out->{'divisionID'} = $this->toDivisionId();
$out->{'isLocator'} = $this->toIsLocator();
$out->{'level'} = $this->toLevel();
$out->{'locationID'} = $this->toLocationId();
return $out;
}
/**
* @param stdClass $obj
* @return Agent
* @throws Exception
*/
public static function from(stdClass $obj): Agent {
return new Agent(
Agent::fromKey($obj->{'_key'})
,Agent::fromAgentTypeId($obj->{'agentTypeID'})
,Agent::fromCorporationId($obj->{'corporationID'})
,Agent::fromDivisionId($obj->{'divisionID'})
,Agent::fromIsLocator($obj->{'isLocator'})
,Agent::fromLevel($obj->{'level'})
,Agent::fromLocationId($obj->{'locationID'})
);
}
/**
* @return Agent
*/
public static function sample(): Agent {
return new Agent(
Agent::sampleKey()
,Agent::sampleAgentTypeId()
,Agent::sampleCorporationId()
,Agent::sampleDivisionId()
,Agent::sampleIsLocator()
,Agent::sampleLevel()
,Agent::sampleLocationId()
);
}
}
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 from_bool(x: Any) -> bool:
assert 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 Agent:
key: int
agent_type_id: int
corporation_id: int
division_id: int
is_locator: bool
level: int
location_id: int
def __init__(self, key: int, agent_type_id: int, corporation_id: int, division_id: int, is_locator: bool, level: int, location_id: int) -> None:
self.key = key
self.agent_type_id = agent_type_id
self.corporation_id = corporation_id
self.division_id = division_id
self.is_locator = is_locator
self.level = level
self.location_id = location_id
@staticmethod
def from_dict(obj: Any) -> 'Agent':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
agent_type_id = from_int(obj.get("agentTypeID"))
corporation_id = from_int(obj.get("corporationID"))
division_id = from_int(obj.get("divisionID"))
is_locator = from_bool(obj.get("isLocator"))
level = from_int(obj.get("level"))
location_id = from_int(obj.get("locationID"))
return Agent(key, agent_type_id, corporation_id, division_id, is_locator, level, location_id)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["agentTypeID"] = from_int(self.agent_type_id)
result["corporationID"] = from_int(self.corporation_id)
result["divisionID"] = from_int(self.division_id)
result["isLocator"] = from_bool(self.is_locator)
result["level"] = from_int(self.level)
result["locationID"] = from_int(self.location_id)
return result
def agent_from_dict(s: Any) -> Agent:
return Agent.from_dict(s)
def agent_to_dict(x: Agent) -> Any:
return to_class(Agent, x)
// To parse this data:
//
// import { Convert, Agent } from "./file";
//
// const agent = Convert.toAgent(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface Agent {
_key: number;
agentTypeID: number;
corporationID: number;
divisionID: number;
isLocator: boolean;
level: number;
locationID: 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 toAgent(json: string): Agent {
return cast(JSON.parse(json), r("Agent"));
}
public static agentToJson(value: Agent): string {
return JSON.stringify(uncast(value, r("Agent")), 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 = {
"Agent": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "agentTypeID", js: "agentTypeID", typ: 0 },
{ json: "corporationID", js: "corporationID", typ: 0 },
{ json: "divisionID", js: "divisionID", typ: 0 },
{ json: "isLocator", js: "isLocator", typ: true },
{ json: "level", js: "level", typ: 0 },
{ json: "locationID", js: "locationID", typ: 0 },
], "any"),
};