agentTypes.jsonl
Schema
_key
(required): integer
Range: 1 .. 13name
(required): enum
Enum values:NonAgent
,BasicAgent
,TutorialAgent
,ResearchAgent
,CONCORDAgent
,GenericStorylineMissionAgent
,StorylineMissionAgent
,EventMissionAgent
,FactionalWarfareAgent
,EpicArcAgent
,AuraAgent
,CareerAgent
,HeraldryAgent
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var agentType = AgentType.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class AgentType
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("name")]
public Name Name { get; set; }
}
public enum Name { AuraAgent, BasicAgent, CareerAgent, ConcordAgent, EpicArcAgent, EventMissionAgent, FactionalWarfareAgent, GenericStorylineMissionAgent, HeraldryAgent, NonAgent, ResearchAgent, StorylineMissionAgent, TutorialAgent };
public partial class AgentType
{
public static AgentType FromJson(string json) => JsonConvert.DeserializeObject<AgentType>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this AgentType 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 =
{
NameConverter.Singleton,
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
internal class NameConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(Name) || t == typeof(Name?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<string>(reader);
switch (value)
{
case "AuraAgent":
return Name.AuraAgent;
case "BasicAgent":
return Name.BasicAgent;
case "CONCORDAgent":
return Name.ConcordAgent;
case "CareerAgent":
return Name.CareerAgent;
case "EpicArcAgent":
return Name.EpicArcAgent;
case "EventMissionAgent":
return Name.EventMissionAgent;
case "FactionalWarfareAgent":
return Name.FactionalWarfareAgent;
case "GenericStorylineMissionAgent":
return Name.GenericStorylineMissionAgent;
case "HeraldryAgent":
return Name.HeraldryAgent;
case "NonAgent":
return Name.NonAgent;
case "ResearchAgent":
return Name.ResearchAgent;
case "StorylineMissionAgent":
return Name.StorylineMissionAgent;
case "TutorialAgent":
return Name.TutorialAgent;
}
throw new Exception("Cannot unmarshal type Name");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (Name)untypedValue;
switch (value)
{
case Name.AuraAgent:
serializer.Serialize(writer, "AuraAgent");
return;
case Name.BasicAgent:
serializer.Serialize(writer, "BasicAgent");
return;
case Name.ConcordAgent:
serializer.Serialize(writer, "CONCORDAgent");
return;
case Name.CareerAgent:
serializer.Serialize(writer, "CareerAgent");
return;
case Name.EpicArcAgent:
serializer.Serialize(writer, "EpicArcAgent");
return;
case Name.EventMissionAgent:
serializer.Serialize(writer, "EventMissionAgent");
return;
case Name.FactionalWarfareAgent:
serializer.Serialize(writer, "FactionalWarfareAgent");
return;
case Name.GenericStorylineMissionAgent:
serializer.Serialize(writer, "GenericStorylineMissionAgent");
return;
case Name.HeraldryAgent:
serializer.Serialize(writer, "HeraldryAgent");
return;
case Name.NonAgent:
serializer.Serialize(writer, "NonAgent");
return;
case Name.ResearchAgent:
serializer.Serialize(writer, "ResearchAgent");
return;
case Name.StorylineMissionAgent:
serializer.Serialize(writer, "StorylineMissionAgent");
return;
case Name.TutorialAgent:
serializer.Serialize(writer, "TutorialAgent");
return;
}
throw new Exception("Cannot marshal type Name");
}
public static readonly NameConverter Singleton = new NameConverter();
}
}
// 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:
//
// agentType, err := UnmarshalAgentType(bytes)
// bytes, err = agentType.Marshal()
package model
import "encoding/json"
func UnmarshalAgentType(data []byte) (AgentType, error) {
var r AgentType
err := json.Unmarshal(data, &r)
return r, err
}
func (r *AgentType) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type AgentType struct {
Key int64 `json:"_key"`
Name Name `json:"name"`
}
type Name string
const (
AuraAgent Name = "AuraAgent"
BasicAgent Name = "BasicAgent"
CONCORDAgent Name = "CONCORDAgent"
CareerAgent Name = "CareerAgent"
EpicArcAgent Name = "EpicArcAgent"
EventMissionAgent Name = "EventMissionAgent"
FactionalWarfareAgent Name = "FactionalWarfareAgent"
GenericStorylineMissionAgent Name = "GenericStorylineMissionAgent"
HeraldryAgent Name = "HeraldryAgent"
NonAgent Name = "NonAgent"
ResearchAgent Name = "ResearchAgent"
StorylineMissionAgent Name = "StorylineMissionAgent"
TutorialAgent Name = "TutorialAgent"
)
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 1,
"maximum": 13
},
"name": {
"type": "string",
"enum": [
"NonAgent",
"BasicAgent",
"TutorialAgent",
"ResearchAgent",
"CONCORDAgent",
"GenericStorylineMissionAgent",
"StorylineMissionAgent",
"EventMissionAgent",
"FactionalWarfareAgent",
"EpicArcAgent",
"AuraAgent",
"CareerAgent",
"HeraldryAgent"
]
}
},
"required": [
"_key",
"name"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val agentType = json.parse(AgentType.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class AgentType (
@SerialName("_key")
val key: Long,
val name: Name
)
@Serializable
enum class Name(val value: String) {
@SerialName("AuraAgent") AuraAgent("AuraAgent"),
@SerialName("BasicAgent") BasicAgent("BasicAgent"),
@SerialName("CONCORDAgent") CONCORDAgent("CONCORDAgent"),
@SerialName("CareerAgent") CareerAgent("CareerAgent"),
@SerialName("EpicArcAgent") EpicArcAgent("EpicArcAgent"),
@SerialName("EventMissionAgent") EventMissionAgent("EventMissionAgent"),
@SerialName("FactionalWarfareAgent") FactionalWarfareAgent("FactionalWarfareAgent"),
@SerialName("GenericStorylineMissionAgent") GenericStorylineMissionAgent("GenericStorylineMissionAgent"),
@SerialName("HeraldryAgent") HeraldryAgent("HeraldryAgent"),
@SerialName("NonAgent") NonAgent("NonAgent"),
@SerialName("ResearchAgent") ResearchAgent("ResearchAgent"),
@SerialName("StorylineMissionAgent") StorylineMissionAgent("StorylineMissionAgent"),
@SerialName("TutorialAgent") TutorialAgent("TutorialAgent");
}
<?php
// This is a autogenerated file:AgentType
class AgentType {
private int $key; // json:_key Required
private Name $name; // json:name Required
/**
* @param int $key
* @param Name $name
*/
public function __construct(int $key, Name $name) {
$this->key = $key;
$this->name = $name;
}
/**
* @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 (AgentType::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this AgentType::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:AgentType::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (AgentType::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey AgentType::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param string $value
* @throws Exception
* @return Name
*/
public static function fromName(string $value): Name {
return Name::from($value); /*enum*/
}
/**
* @throws Exception
* @return string
*/
public function toName(): string {
if (AgentType::validateName($this->name)) {
return Name::to($this->name); /*enum*/
}
throw new Exception('never get to this AgentType::name');
}
/**
* @param Name
* @return bool
* @throws Exception
*/
public static function validateName(Name $value): bool {
Name::to($value);
return true;
}
/**
* @throws Exception
* @return Name
*/
public function getName(): Name {
if (AgentType::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName AgentType::name');
}
/**
* @return Name
*/
public static function sampleName(): Name {
return Name::sample(); /*enum*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return AgentType::validateKey($this->key)
|| AgentType::validateName($this->name);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'name'} = $this->toName();
return $out;
}
/**
* @param stdClass $obj
* @return AgentType
* @throws Exception
*/
public static function from(stdClass $obj): AgentType {
return new AgentType(
AgentType::fromKey($obj->{'_key'})
,AgentType::fromName($obj->{'name'})
);
}
/**
* @return AgentType
*/
public static function sample(): AgentType {
return new AgentType(
AgentType::sampleKey()
,AgentType::sampleName()
);
}
}
// This is a autogenerated file:Name
class Name {
public static Name $AURA_AGENT;
public static Name $BASIC_AGENT;
public static Name $CAREER_AGENT;
public static Name $CONCORD_AGENT;
public static Name $EPIC_ARC_AGENT;
public static Name $EVENT_MISSION_AGENT;
public static Name $FACTIONAL_WARFARE_AGENT;
public static Name $GENERIC_STORYLINE_MISSION_AGENT;
public static Name $HERALDRY_AGENT;
public static Name $NON_AGENT;
public static Name $RESEARCH_AGENT;
public static Name $STORYLINE_MISSION_AGENT;
public static Name $TUTORIAL_AGENT;
public static function init() {
Name::$AURA_AGENT = new Name('AuraAgent');
Name::$BASIC_AGENT = new Name('BasicAgent');
Name::$CAREER_AGENT = new Name('CareerAgent');
Name::$CONCORD_AGENT = new Name('CONCORDAgent');
Name::$EPIC_ARC_AGENT = new Name('EpicArcAgent');
Name::$EVENT_MISSION_AGENT = new Name('EventMissionAgent');
Name::$FACTIONAL_WARFARE_AGENT = new Name('FactionalWarfareAgent');
Name::$GENERIC_STORYLINE_MISSION_AGENT = new Name('GenericStorylineMissionAgent');
Name::$HERALDRY_AGENT = new Name('HeraldryAgent');
Name::$NON_AGENT = new Name('NonAgent');
Name::$RESEARCH_AGENT = new Name('ResearchAgent');
Name::$STORYLINE_MISSION_AGENT = new Name('StorylineMissionAgent');
Name::$TUTORIAL_AGENT = new Name('TutorialAgent');
}
private string $enum;
public function __construct(string $enum) {
$this->enum = $enum;
}
/**
* @param Name
* @return string
* @throws Exception
*/
public static function to(Name $obj): string {
switch ($obj->enum) {
case Name::$AURA_AGENT->enum: return 'AuraAgent';
case Name::$BASIC_AGENT->enum: return 'BasicAgent';
case Name::$CAREER_AGENT->enum: return 'CareerAgent';
case Name::$CONCORD_AGENT->enum: return 'CONCORDAgent';
case Name::$EPIC_ARC_AGENT->enum: return 'EpicArcAgent';
case Name::$EVENT_MISSION_AGENT->enum: return 'EventMissionAgent';
case Name::$FACTIONAL_WARFARE_AGENT->enum: return 'FactionalWarfareAgent';
case Name::$GENERIC_STORYLINE_MISSION_AGENT->enum: return 'GenericStorylineMissionAgent';
case Name::$HERALDRY_AGENT->enum: return 'HeraldryAgent';
case Name::$NON_AGENT->enum: return 'NonAgent';
case Name::$RESEARCH_AGENT->enum: return 'ResearchAgent';
case Name::$STORYLINE_MISSION_AGENT->enum: return 'StorylineMissionAgent';
case Name::$TUTORIAL_AGENT->enum: return 'TutorialAgent';
}
throw new Exception('the give value is not an enum-value.');
}
/**
* @param mixed
* @return Name
* @throws Exception
*/
public static function from($obj): Name {
switch ($obj) {
case 'AuraAgent': return Name::$AURA_AGENT;
case 'BasicAgent': return Name::$BASIC_AGENT;
case 'CareerAgent': return Name::$CAREER_AGENT;
case 'CONCORDAgent': return Name::$CONCORD_AGENT;
case 'EpicArcAgent': return Name::$EPIC_ARC_AGENT;
case 'EventMissionAgent': return Name::$EVENT_MISSION_AGENT;
case 'FactionalWarfareAgent': return Name::$FACTIONAL_WARFARE_AGENT;
case 'GenericStorylineMissionAgent': return Name::$GENERIC_STORYLINE_MISSION_AGENT;
case 'HeraldryAgent': return Name::$HERALDRY_AGENT;
case 'NonAgent': return Name::$NON_AGENT;
case 'ResearchAgent': return Name::$RESEARCH_AGENT;
case 'StorylineMissionAgent': return Name::$STORYLINE_MISSION_AGENT;
case 'TutorialAgent': return Name::$TUTORIAL_AGENT;
}
throw new Exception("Cannot deserialize Name");
}
/**
* @return Name
*/
public static function sample(): Name {
return Name::$AURA_AGENT;
}
}
Name::init();
from enum import Enum
from typing import Any, TypeVar, Type, cast
T = TypeVar("T")
EnumT = TypeVar("EnumT", bound=Enum)
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def to_enum(c: Type[EnumT], x: Any) -> EnumT:
assert isinstance(x, c)
return x.value
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Name(Enum):
AURA_AGENT = "AuraAgent"
BASIC_AGENT = "BasicAgent"
CAREER_AGENT = "CareerAgent"
CONCORD_AGENT = "CONCORDAgent"
EPIC_ARC_AGENT = "EpicArcAgent"
EVENT_MISSION_AGENT = "EventMissionAgent"
FACTIONAL_WARFARE_AGENT = "FactionalWarfareAgent"
GENERIC_STORYLINE_MISSION_AGENT = "GenericStorylineMissionAgent"
HERALDRY_AGENT = "HeraldryAgent"
NON_AGENT = "NonAgent"
RESEARCH_AGENT = "ResearchAgent"
STORYLINE_MISSION_AGENT = "StorylineMissionAgent"
TUTORIAL_AGENT = "TutorialAgent"
class AgentType:
key: int
name: Name
def __init__(self, key: int, name: Name) -> None:
self.key = key
self.name = name
@staticmethod
def from_dict(obj: Any) -> 'AgentType':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
name = Name(obj.get("name"))
return AgentType(key, name)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["name"] = to_enum(Name, self.name)
return result
def agent_type_from_dict(s: Any) -> AgentType:
return AgentType.from_dict(s)
def agent_type_to_dict(x: AgentType) -> Any:
return to_class(AgentType, x)
// To parse this data:
//
// import { Convert, AgentType } from "./file";
//
// const agentType = Convert.toAgentType(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface AgentType {
_key: number;
name: Name;
[property: string]: any;
}
export enum Name {
AuraAgent = "AuraAgent",
BasicAgent = "BasicAgent",
CareerAgent = "CareerAgent",
ConcordAgent = "CONCORDAgent",
EpicArcAgent = "EpicArcAgent",
EventMissionAgent = "EventMissionAgent",
FactionalWarfareAgent = "FactionalWarfareAgent",
GenericStorylineMissionAgent = "GenericStorylineMissionAgent",
HeraldryAgent = "HeraldryAgent",
NonAgent = "NonAgent",
ResearchAgent = "ResearchAgent",
StorylineMissionAgent = "StorylineMissionAgent",
TutorialAgent = "TutorialAgent",
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toAgentType(json: string): AgentType {
return cast(JSON.parse(json), r("AgentType"));
}
public static agentTypeToJson(value: AgentType): string {
return JSON.stringify(uncast(value, r("AgentType")), 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 = {
"AgentType": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "name", js: "name", typ: r("Name") },
], "any"),
"Name": [
"AuraAgent",
"BasicAgent",
"CareerAgent",
"CONCORDAgent",
"EpicArcAgent",
"EventMissionAgent",
"FactionalWarfareAgent",
"GenericStorylineMissionAgent",
"HeraldryAgent",
"NonAgent",
"ResearchAgent",
"StorylineMissionAgent",
"TutorialAgent",
],
};