certificates.jsonl
Schema
_key
(required): integer
Range: 50 .. 2267-
description
(required): objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
groupID
(required): integer
Range: 255 .. 1241 -
name
(required): objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
recommendedFor
: array of integer
Type:integer
Range: 582 .. 88001 skillTypes
(required): array of object_key
(required): integer
Range: 2403 .. 86264advanced
(required): integer
Range: 0 .. 5basic
(required): integer
Range: 0 .. 5elite
(required): integer
Range: 0 .. 5improved
(required): integer
Range: 0 .. 5standard
(required): integer
Range: 0 .. 5
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var certificate = Certificate.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class Certificate
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("description")]
public Description Description { get; set; }
[JsonProperty("groupID")]
public long GroupId { get; set; }
[JsonProperty("name")]
public Name Name { get; set; }
[JsonProperty("recommendedFor", NullValueHandling = NullValueHandling.Ignore)]
public long[] RecommendedFor { get; set; }
[JsonProperty("skillTypes")]
public SkillType[] SkillTypes { get; set; }
}
public partial class Description
{
[JsonProperty("de")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class Name
{
[JsonProperty("de")]
[JsonConverter(typeof(CunningMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(MagentaMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(FriskyMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(MischievousMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(BraggadociousMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(MinMaxLengthCheckConverter1))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(MinMaxLengthCheckConverter2))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(MinMaxLengthCheckConverter3))]
public string Zh { get; set; }
}
public partial class SkillType
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("advanced")]
public long Advanced { get; set; }
[JsonProperty("basic")]
public long Basic { get; set; }
[JsonProperty("elite")]
public long Elite { get; set; }
[JsonProperty("improved")]
public long Improved { get; set; }
[JsonProperty("standard")]
public long Standard { get; set; }
}
public partial class Certificate
{
public static Certificate FromJson(string json) => JsonConvert.DeserializeObject<Certificate>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this Certificate 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 >= 147 && value.Length <= 497)
{
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 >= 147 && value.Length <= 497)
{
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 >= 133 && value.Length <= 428)
{
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 >= 133 && value.Length <= 428)
{
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 >= 164 && value.Length <= 488)
{
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 >= 164 && value.Length <= 488)
{
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 >= 142 && value.Length <= 553)
{
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 >= 142 && value.Length <= 553)
{
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 >= 55 && value.Length <= 201)
{
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 >= 55 && value.Length <= 201)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
internal class IndecentMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 59 && value.Length <= 199)
{
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 >= 59 && value.Length <= 199)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
internal class HilariousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 133 && value.Length <= 616)
{
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 >= 133 && value.Length <= 616)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly HilariousMinMaxLengthCheckConverter Singleton = new HilariousMinMaxLengthCheckConverter();
}
internal class AmbitiousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 33 && value.Length <= 130)
{
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 >= 33 && value.Length <= 130)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly AmbitiousMinMaxLengthCheckConverter Singleton = new AmbitiousMinMaxLengthCheckConverter();
}
internal class CunningMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 5 && value.Length <= 51)
{
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 >= 5 && value.Length <= 51)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly CunningMinMaxLengthCheckConverter Singleton = new CunningMinMaxLengthCheckConverter();
}
internal class MagentaMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 5 && value.Length <= 49)
{
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 >= 5 && value.Length <= 49)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MagentaMinMaxLengthCheckConverter Singleton = new MagentaMinMaxLengthCheckConverter();
}
internal class FriskyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 5 && value.Length <= 66)
{
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 >= 5 && value.Length <= 66)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FriskyMinMaxLengthCheckConverter Singleton = new FriskyMinMaxLengthCheckConverter();
}
internal class MischievousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 4 && value.Length <= 57)
{
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 >= 4 && value.Length <= 57)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MischievousMinMaxLengthCheckConverter Singleton = new MischievousMinMaxLengthCheckConverter();
}
internal class BraggadociousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 2 && value.Length <= 21)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 2 && value.Length <= 21)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly BraggadociousMinMaxLengthCheckConverter Singleton = new BraggadociousMinMaxLengthCheckConverter();
}
internal class MinMaxLengthCheckConverter1 : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 2 && value.Length <= 16)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 2 && value.Length <= 16)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter1 Singleton = new MinMaxLengthCheckConverter1();
}
internal class MinMaxLengthCheckConverter2 : 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 >= 7 && value.Length <= 83)
{
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 >= 7 && value.Length <= 83)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter2 Singleton = new MinMaxLengthCheckConverter2();
}
internal class MinMaxLengthCheckConverter3 : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 2 && value.Length <= 10)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 2 && value.Length <= 10)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter3 Singleton = new MinMaxLengthCheckConverter3();
}
}
// 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:
//
// certificate, err := UnmarshalCertificate(bytes)
// bytes, err = certificate.Marshal()
package model
import "encoding/json"
func UnmarshalCertificate(data []byte) (Certificate, error) {
var r Certificate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Certificate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type Certificate struct {
Key int64 `json:"_key"`
Description Description `json:"description"`
GroupID int64 `json:"groupID"`
Name Name `json:"name"`
RecommendedFor []int64 `json:"recommendedFor,omitempty"`
SkillTypes []SkillType `json:"skillTypes"`
}
type Description 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 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 SkillType struct {
Key int64 `json:"_key"`
Advanced int64 `json:"advanced"`
Basic int64 `json:"basic"`
Elite int64 `json:"elite"`
Improved int64 `json:"improved"`
Standard int64 `json:"standard"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 50,
"maximum": 2267
},
"description": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 147,
"maxLength": 497
},
"en": {
"type": "string",
"minLength": 133,
"maxLength": 428
},
"es": {
"type": "string",
"minLength": 164,
"maxLength": 488
},
"fr": {
"type": "string",
"minLength": 142,
"maxLength": 553
},
"ja": {
"type": "string",
"minLength": 55,
"maxLength": 201
},
"ko": {
"type": "string",
"minLength": 59,
"maxLength": 199
},
"ru": {
"type": "string",
"minLength": 133,
"maxLength": 616
},
"zh": {
"type": "string",
"minLength": 33,
"maxLength": 130
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"groupID": {
"type": "integer",
"minimum": 255,
"maximum": 1241
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 5,
"maxLength": 51
},
"en": {
"type": "string",
"minLength": 5,
"maxLength": 49
},
"es": {
"type": "string",
"minLength": 5,
"maxLength": 66
},
"fr": {
"type": "string",
"minLength": 4,
"maxLength": 57
},
"ja": {
"type": "string",
"minLength": 2,
"maxLength": 21
},
"ko": {
"type": "string",
"minLength": 2,
"maxLength": 16
},
"ru": {
"type": "string",
"minLength": 7,
"maxLength": 83
},
"zh": {
"type": "string",
"minLength": 2,
"maxLength": 10
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"recommendedFor": {
"type": "array",
"items": {
"type": "integer",
"minimum": 582,
"maximum": 88001
},
"minItems": 1,
"maxItems": 436
},
"skillTypes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 2403,
"maximum": 86264
},
"advanced": {
"type": "integer",
"minimum": 0,
"maximum": 5
},
"basic": {
"type": "integer",
"minimum": 0,
"maximum": 5
},
"elite": {
"type": "integer",
"minimum": 0,
"maximum": 5
},
"improved": {
"type": "integer",
"minimum": 0,
"maximum": 5
},
"standard": {
"type": "integer",
"minimum": 0,
"maximum": 5
}
},
"required": [
"_key",
"advanced",
"basic",
"elite",
"improved",
"standard"
]
},
"minItems": 1,
"maxItems": 25
}
},
"required": [
"_key",
"description",
"groupID",
"name",
"skillTypes"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val certificate = json.parse(Certificate.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class Certificate (
@SerialName("_key")
val key: Long,
val description: Description,
@SerialName("groupID")
val groupId: Long,
val name: Name,
val recommendedFor: List<Long>? = null,
val skillTypes: List<SkillType>
)
@Serializable
data class Description (
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 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 SkillType (
@SerialName("_key")
val key: Long,
val advanced: Long,
val basic: Long,
val elite: Long,
val improved: Long,
val standard: Long
)
<?php
// This is a autogenerated file:Certificate
class Certificate {
private int $key; // json:_key Required
private Description $description; // json:description Required
private int $groupId; // json:groupID Required
private Name $name; // json:name Required
private ?array $recommendedFor; // json:recommendedFor Optional
private array $skillTypes; // json:skillTypes Required
/**
* @param int $key
* @param Description $description
* @param int $groupId
* @param Name $name
* @param array|null $recommendedFor
* @param array $skillTypes
*/
public function __construct(int $key, Description $description, int $groupId, Name $name, ?array $recommendedFor, array $skillTypes) {
$this->key = $key;
$this->description = $description;
$this->groupId = $groupId;
$this->name = $name;
$this->recommendedFor = $recommendedFor;
$this->skillTypes = $skillTypes;
}
/**
* @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 (Certificate::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this Certificate::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Certificate::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (Certificate::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey Certificate::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Description
*/
public static function fromDescription(stdClass $value): Description {
return Description::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toDescription(): stdClass {
if (Certificate::validateDescription($this->description)) {
return $this->description->to(); /*class*/
}
throw new Exception('never get to this Certificate::description');
}
/**
* @param Description
* @return bool
* @throws Exception
*/
public static function validateDescription(Description $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Description
*/
public function getDescription(): Description {
if (Certificate::validateDescription($this->description)) {
return $this->description;
}
throw new Exception('never get to getDescription Certificate::description');
}
/**
* @return Description
*/
public static function sampleDescription(): Description {
return Description::sample(); /*32:description*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromGroupId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toGroupId(): int {
if (Certificate::validateGroupId($this->groupId)) {
return $this->groupId; /*int*/
}
throw new Exception('never get to this Certificate::groupId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateGroupId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Certificate::groupId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getGroupId(): int {
if (Certificate::validateGroupId($this->groupId)) {
return $this->groupId;
}
throw new Exception('never get to getGroupId Certificate::groupId');
}
/**
* @return int
*/
public static function sampleGroupId(): int {
return 33; /*33:groupId*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Name
*/
public static function fromName(stdClass $value): Name {
return Name::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toName(): stdClass {
if (Certificate::validateName($this->name)) {
return $this->name->to(); /*class*/
}
throw new Exception('never get to this Certificate::name');
}
/**
* @param Name
* @return bool
* @throws Exception
*/
public static function validateName(Name $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Name
*/
public function getName(): Name {
if (Certificate::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName Certificate::name');
}
/**
* @return Name
*/
public static function sampleName(): Name {
return Name::sample(); /*34:name*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromRecommendedFor(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toRecommendedFor(): ?array {
if (Certificate::validateRecommendedFor($this->recommendedFor)) {
if (!is_null($this->recommendedFor)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->recommendedFor);
} else {
return null;
}
}
throw new Exception('never get to this Certificate::recommendedFor');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateRecommendedFor(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:Certificate::recommendedFor");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:Certificate::recommendedFor");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getRecommendedFor(): ?array {
if (Certificate::validateRecommendedFor($this->recommendedFor)) {
return $this->recommendedFor;
}
throw new Exception('never get to getRecommendedFor Certificate::recommendedFor');
}
/**
* @return ?array
*/
public static function sampleRecommendedFor(): ?array {
return array(
35 /*35:*/
); /* 35:recommendedFor*/
}
/**
* @param array $value
* @throws Exception
* @return array
*/
public static function fromSkillTypes(array $value): array {
return array_map(function ($value) {
return SkillType::from($value); /*class*/
}, $value);
}
/**
* @throws Exception
* @return array
*/
public function toSkillTypes(): array {
if (Certificate::validateSkillTypes($this->skillTypes)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->skillTypes);
}
throw new Exception('never get to this Certificate::skillTypes');
}
/**
* @param array
* @return bool
* @throws Exception
*/
public static function validateSkillTypes(array $value): bool {
if (!is_array($value)) {
throw new Exception("Attribute Error:Certificate::skillTypes");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
return true;
}
/**
* @throws Exception
* @return array
*/
public function getSkillTypes(): array {
if (Certificate::validateSkillTypes($this->skillTypes)) {
return $this->skillTypes;
}
throw new Exception('never get to getSkillTypes Certificate::skillTypes');
}
/**
* @return array
*/
public static function sampleSkillTypes(): array {
return array(
SkillType::sample() /*36:*/
); /* 36:skillTypes*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Certificate::validateKey($this->key)
|| Certificate::validateDescription($this->description)
|| Certificate::validateGroupId($this->groupId)
|| Certificate::validateName($this->name)
|| Certificate::validateRecommendedFor($this->recommendedFor)
|| Certificate::validateSkillTypes($this->skillTypes);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'description'} = $this->toDescription();
$out->{'groupID'} = $this->toGroupId();
$out->{'name'} = $this->toName();
$out->{'recommendedFor'} = $this->toRecommendedFor();
$out->{'skillTypes'} = $this->toSkillTypes();
return $out;
}
/**
* @param stdClass $obj
* @return Certificate
* @throws Exception
*/
public static function from(stdClass $obj): Certificate {
return new Certificate(
Certificate::fromKey($obj->{'_key'})
,Certificate::fromDescription($obj->{'description'})
,Certificate::fromGroupId($obj->{'groupID'})
,Certificate::fromName($obj->{'name'})
,Certificate::fromRecommendedFor($obj->{'recommendedFor'})
,Certificate::fromSkillTypes($obj->{'skillTypes'})
);
}
/**
* @return Certificate
*/
public static function sample(): Certificate {
return new Certificate(
Certificate::sampleKey()
,Certificate::sampleDescription()
,Certificate::sampleGroupId()
,Certificate::sampleName()
,Certificate::sampleRecommendedFor()
,Certificate::sampleSkillTypes()
);
}
}
// This is a autogenerated file:Description
class Description {
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 (Description::validateDe($this->de)) {
return $this->de; /*string*/
}
throw new Exception('never get to this Description::de');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateDe(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::de");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getDe(): string {
if (Description::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe Description::de');
}
/**
* @return string
*/
public static function sampleDe(): string {
return 'Description::de::31'; /*31:de*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEn(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEn(): string {
if (Description::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this Description::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (Description::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn Description::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'Description::en::32'; /*32:en*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEs(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEs(): string {
if (Description::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this Description::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (Description::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs Description::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'Description::es::33'; /*33:es*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromFr(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toFr(): string {
if (Description::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this Description::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (Description::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr Description::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'Description::fr::34'; /*34:fr*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromJa(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toJa(): string {
if (Description::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this Description::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (Description::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa Description::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'Description::ja::35'; /*35:ja*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromKo(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toKo(): string {
if (Description::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this Description::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (Description::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo Description::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'Description::ko::36'; /*36:ko*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromRu(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toRu(): string {
if (Description::validateRu($this->ru)) {
return $this->ru; /*string*/
}
throw new Exception('never get to this Description::ru');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateRu(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ru");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getRu(): string {
if (Description::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu Description::ru');
}
/**
* @return string
*/
public static function sampleRu(): string {
return 'Description::ru::37'; /*37:ru*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromZh(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toZh(): string {
if (Description::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this Description::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (Description::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh Description::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'Description::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Description::validateDe($this->de)
|| Description::validateEn($this->en)
|| Description::validateEs($this->es)
|| Description::validateFr($this->fr)
|| Description::validateJa($this->ja)
|| Description::validateKo($this->ko)
|| Description::validateRu($this->ru)
|| Description::validateZh($this->zh);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'de'} = $this->toDe();
$out->{'en'} = $this->toEn();
$out->{'es'} = $this->toEs();
$out->{'fr'} = $this->toFr();
$out->{'ja'} = $this->toJa();
$out->{'ko'} = $this->toKo();
$out->{'ru'} = $this->toRu();
$out->{'zh'} = $this->toZh();
return $out;
}
/**
* @param stdClass $obj
* @return Description
* @throws Exception
*/
public static function from(stdClass $obj): Description {
return new Description(
Description::fromDe($obj->{'de'})
,Description::fromEn($obj->{'en'})
,Description::fromEs($obj->{'es'})
,Description::fromFr($obj->{'fr'})
,Description::fromJa($obj->{'ja'})
,Description::fromKo($obj->{'ko'})
,Description::fromRu($obj->{'ru'})
,Description::fromZh($obj->{'zh'})
);
}
/**
* @return Description
*/
public static function sample(): Description {
return new Description(
Description::sampleDe()
,Description::sampleEn()
,Description::sampleEs()
,Description::sampleFr()
,Description::sampleJa()
,Description::sampleKo()
,Description::sampleRu()
,Description::sampleZh()
);
}
}
// This is a autogenerated file:Name
class Name {
private string $de; // json:de 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:SkillType
class SkillType {
private int $key; // json:_key Required
private int $advanced; // json:advanced Required
private int $basic; // json:basic Required
private int $elite; // json:elite Required
private int $improved; // json:improved Required
private int $standard; // json:standard Required
/**
* @param int $key
* @param int $advanced
* @param int $basic
* @param int $elite
* @param int $improved
* @param int $standard
*/
public function __construct(int $key, int $advanced, int $basic, int $elite, int $improved, int $standard) {
$this->key = $key;
$this->advanced = $advanced;
$this->basic = $basic;
$this->elite = $elite;
$this->improved = $improved;
$this->standard = $standard;
}
/**
* @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 (SkillType::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this SkillType::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:SkillType::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (SkillType::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey SkillType::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromAdvanced(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toAdvanced(): int {
if (SkillType::validateAdvanced($this->advanced)) {
return $this->advanced; /*int*/
}
throw new Exception('never get to this SkillType::advanced');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateAdvanced(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:SkillType::advanced");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getAdvanced(): int {
if (SkillType::validateAdvanced($this->advanced)) {
return $this->advanced;
}
throw new Exception('never get to getAdvanced SkillType::advanced');
}
/**
* @return int
*/
public static function sampleAdvanced(): int {
return 32; /*32:advanced*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromBasic(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toBasic(): int {
if (SkillType::validateBasic($this->basic)) {
return $this->basic; /*int*/
}
throw new Exception('never get to this SkillType::basic');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateBasic(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:SkillType::basic");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getBasic(): int {
if (SkillType::validateBasic($this->basic)) {
return $this->basic;
}
throw new Exception('never get to getBasic SkillType::basic');
}
/**
* @return int
*/
public static function sampleBasic(): int {
return 33; /*33:basic*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromElite(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toElite(): int {
if (SkillType::validateElite($this->elite)) {
return $this->elite; /*int*/
}
throw new Exception('never get to this SkillType::elite');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateElite(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:SkillType::elite");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getElite(): int {
if (SkillType::validateElite($this->elite)) {
return $this->elite;
}
throw new Exception('never get to getElite SkillType::elite');
}
/**
* @return int
*/
public static function sampleElite(): int {
return 34; /*34:elite*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromImproved(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toImproved(): int {
if (SkillType::validateImproved($this->improved)) {
return $this->improved; /*int*/
}
throw new Exception('never get to this SkillType::improved');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateImproved(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:SkillType::improved");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getImproved(): int {
if (SkillType::validateImproved($this->improved)) {
return $this->improved;
}
throw new Exception('never get to getImproved SkillType::improved');
}
/**
* @return int
*/
public static function sampleImproved(): int {
return 35; /*35:improved*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromStandard(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toStandard(): int {
if (SkillType::validateStandard($this->standard)) {
return $this->standard; /*int*/
}
throw new Exception('never get to this SkillType::standard');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateStandard(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:SkillType::standard");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getStandard(): int {
if (SkillType::validateStandard($this->standard)) {
return $this->standard;
}
throw new Exception('never get to getStandard SkillType::standard');
}
/**
* @return int
*/
public static function sampleStandard(): int {
return 36; /*36:standard*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return SkillType::validateKey($this->key)
|| SkillType::validateAdvanced($this->advanced)
|| SkillType::validateBasic($this->basic)
|| SkillType::validateElite($this->elite)
|| SkillType::validateImproved($this->improved)
|| SkillType::validateStandard($this->standard);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'advanced'} = $this->toAdvanced();
$out->{'basic'} = $this->toBasic();
$out->{'elite'} = $this->toElite();
$out->{'improved'} = $this->toImproved();
$out->{'standard'} = $this->toStandard();
return $out;
}
/**
* @param stdClass $obj
* @return SkillType
* @throws Exception
*/
public static function from(stdClass $obj): SkillType {
return new SkillType(
SkillType::fromKey($obj->{'_key'})
,SkillType::fromAdvanced($obj->{'advanced'})
,SkillType::fromBasic($obj->{'basic'})
,SkillType::fromElite($obj->{'elite'})
,SkillType::fromImproved($obj->{'improved'})
,SkillType::fromStandard($obj->{'standard'})
);
}
/**
* @return SkillType
*/
public static function sample(): SkillType {
return new SkillType(
SkillType::sampleKey()
,SkillType::sampleAdvanced()
,SkillType::sampleBasic()
,SkillType::sampleElite()
,SkillType::sampleImproved()
,SkillType::sampleStandard()
);
}
}
from typing import Any, List, Optional, TypeVar, Callable, Type, cast
T = TypeVar("T")
def from_str(x: Any) -> str:
assert isinstance(x, str)
return x
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
assert isinstance(x, list)
return [f(y) for y in 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 to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Description:
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) -> 'Description':
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 Description(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 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 SkillType:
key: int
advanced: int
basic: int
elite: int
improved: int
standard: int
def __init__(self, key: int, advanced: int, basic: int, elite: int, improved: int, standard: int) -> None:
self.key = key
self.advanced = advanced
self.basic = basic
self.elite = elite
self.improved = improved
self.standard = standard
@staticmethod
def from_dict(obj: Any) -> 'SkillType':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
advanced = from_int(obj.get("advanced"))
basic = from_int(obj.get("basic"))
elite = from_int(obj.get("elite"))
improved = from_int(obj.get("improved"))
standard = from_int(obj.get("standard"))
return SkillType(key, advanced, basic, elite, improved, standard)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["advanced"] = from_int(self.advanced)
result["basic"] = from_int(self.basic)
result["elite"] = from_int(self.elite)
result["improved"] = from_int(self.improved)
result["standard"] = from_int(self.standard)
return result
class Certificate:
key: int
description: Description
group_id: int
name: Name
recommended_for: Optional[List[int]]
skill_types: List[SkillType]
def __init__(self, key: int, description: Description, group_id: int, name: Name, recommended_for: Optional[List[int]], skill_types: List[SkillType]) -> None:
self.key = key
self.description = description
self.group_id = group_id
self.name = name
self.recommended_for = recommended_for
self.skill_types = skill_types
@staticmethod
def from_dict(obj: Any) -> 'Certificate':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
description = Description.from_dict(obj.get("description"))
group_id = from_int(obj.get("groupID"))
name = Name.from_dict(obj.get("name"))
recommended_for = from_union([lambda x: from_list(from_int, x), from_none], obj.get("recommendedFor"))
skill_types = from_list(SkillType.from_dict, obj.get("skillTypes"))
return Certificate(key, description, group_id, name, recommended_for, skill_types)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["description"] = to_class(Description, self.description)
result["groupID"] = from_int(self.group_id)
result["name"] = to_class(Name, self.name)
if self.recommended_for is not None:
result["recommendedFor"] = from_union([lambda x: from_list(from_int, x), from_none], self.recommended_for)
result["skillTypes"] = from_list(lambda x: to_class(SkillType, x), self.skill_types)
return result
def certificate_from_dict(s: Any) -> Certificate:
return Certificate.from_dict(s)
def certificate_to_dict(x: Certificate) -> Any:
return to_class(Certificate, x)
// To parse this data:
//
// import { Convert, Certificate } from "./file";
//
// const certificate = Convert.toCertificate(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface Certificate {
_key: number;
description: Description;
groupID: number;
name: Name;
recommendedFor?: number[];
skillTypes: SkillType[];
[property: string]: any;
}
export interface Description {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: any;
}
export interface Name {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: any;
}
export interface SkillType {
_key: number;
advanced: number;
basic: number;
elite: number;
improved: number;
standard: 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 toCertificate(json: string): Certificate {
return cast(JSON.parse(json), r("Certificate"));
}
public static certificateToJson(value: Certificate): string {
return JSON.stringify(uncast(value, r("Certificate")), 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 = {
"Certificate": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "description", js: "description", typ: r("Description") },
{ json: "groupID", js: "groupID", typ: 0 },
{ json: "name", js: "name", typ: r("Name") },
{ json: "recommendedFor", js: "recommendedFor", typ: u(undefined, a(0)) },
{ json: "skillTypes", js: "skillTypes", typ: a(r("SkillType")) },
], "any"),
"Description": 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"),
"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"),
"SkillType": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "advanced", js: "advanced", typ: 0 },
{ json: "basic", js: "basic", typ: 0 },
{ json: "elite", js: "elite", typ: 0 },
{ json: "improved", js: "improved", typ: 0 },
{ json: "standard", js: "standard", typ: 0 },
], "any"),
};