268 lines
7.5 KiB
JavaScript
268 lines
7.5 KiB
JavaScript
// @ts-check
|
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
// This file is automatically generated. DO NOT EDIT
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore: Unused imports
|
|
import {Create as $Create} from "@wailsio/runtime";
|
|
|
|
export class Author {
|
|
/**
|
|
* Creates a new Author instance.
|
|
* @param {Partial<Author>} [$$source = {}] - The source object to create the Author.
|
|
*/
|
|
constructor($$source = {}) {
|
|
if (!("Id" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["Id"] = 0;
|
|
}
|
|
if (!("Name" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {string}
|
|
*/
|
|
this["Name"] = "";
|
|
}
|
|
if (!("Posts" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {Post[]}
|
|
*/
|
|
this["Posts"] = [];
|
|
}
|
|
if (!("Comments" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {Comment[]}
|
|
*/
|
|
this["Comments"] = [];
|
|
}
|
|
|
|
Object.assign(this, $$source);
|
|
}
|
|
|
|
/**
|
|
* Creates a new Author instance from a string or object.
|
|
* @param {any} [$$source = {}]
|
|
* @returns {Author}
|
|
*/
|
|
static createFrom($$source = {}) {
|
|
const $$createField2_0 = $$createType1;
|
|
const $$createField3_0 = $$createType3;
|
|
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
|
if ("Posts" in $$parsedSource) {
|
|
$$parsedSource["Posts"] = $$createField2_0($$parsedSource["Posts"]);
|
|
}
|
|
if ("Comments" in $$parsedSource) {
|
|
$$parsedSource["Comments"] = $$createField3_0($$parsedSource["Comments"]);
|
|
}
|
|
return new Author(/** @type {Partial<Author>} */($$parsedSource));
|
|
}
|
|
}
|
|
|
|
export class Comment {
|
|
/**
|
|
* Creates a new Comment instance.
|
|
* @param {Partial<Comment>} [$$source = {}] - The source object to create the Comment.
|
|
*/
|
|
constructor($$source = {}) {
|
|
if (!("Id" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["Id"] = 0;
|
|
}
|
|
if (!("Text" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {string}
|
|
*/
|
|
this["Text"] = "";
|
|
}
|
|
if (!("AuthorId" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["AuthorId"] = 0;
|
|
}
|
|
if (!("Author" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {Author}
|
|
*/
|
|
this["Author"] = (new Author());
|
|
}
|
|
if (!("Posts" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {Post[]}
|
|
*/
|
|
this["Posts"] = [];
|
|
}
|
|
|
|
Object.assign(this, $$source);
|
|
}
|
|
|
|
/**
|
|
* Creates a new Comment instance from a string or object.
|
|
* @param {any} [$$source = {}]
|
|
* @returns {Comment}
|
|
*/
|
|
static createFrom($$source = {}) {
|
|
const $$createField3_0 = $$createType4;
|
|
const $$createField4_0 = $$createType1;
|
|
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
|
if ("Author" in $$parsedSource) {
|
|
$$parsedSource["Author"] = $$createField3_0($$parsedSource["Author"]);
|
|
}
|
|
if ("Posts" in $$parsedSource) {
|
|
$$parsedSource["Posts"] = $$createField4_0($$parsedSource["Posts"]);
|
|
}
|
|
return new Comment(/** @type {Partial<Comment>} */($$parsedSource));
|
|
}
|
|
}
|
|
|
|
export class Post {
|
|
/**
|
|
* Creates a new Post instance.
|
|
* @param {Partial<Post>} [$$source = {}] - The source object to create the Post.
|
|
*/
|
|
constructor($$source = {}) {
|
|
if (!("Id" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["Id"] = 0;
|
|
}
|
|
if (!("Text" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {string}
|
|
*/
|
|
this["Text"] = "";
|
|
}
|
|
if (!("Deadline" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["Deadline"] = 0;
|
|
}
|
|
if (!("CreatedAt" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["CreatedAt"] = 0;
|
|
}
|
|
if (!("AuthorId" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["AuthorId"] = 0;
|
|
}
|
|
if (!("Author" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {Author}
|
|
*/
|
|
this["Author"] = (new Author());
|
|
}
|
|
if (!("PostTypeId" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["PostTypeId"] = 0;
|
|
}
|
|
if (!("PostType" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {PostType}
|
|
*/
|
|
this["PostType"] = (new PostType());
|
|
}
|
|
if (!("Comments" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {Comment[]}
|
|
*/
|
|
this["Comments"] = [];
|
|
}
|
|
|
|
Object.assign(this, $$source);
|
|
}
|
|
|
|
/**
|
|
* Creates a new Post instance from a string or object.
|
|
* @param {any} [$$source = {}]
|
|
* @returns {Post}
|
|
*/
|
|
static createFrom($$source = {}) {
|
|
const $$createField5_0 = $$createType4;
|
|
const $$createField7_0 = $$createType5;
|
|
const $$createField8_0 = $$createType3;
|
|
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
|
if ("Author" in $$parsedSource) {
|
|
$$parsedSource["Author"] = $$createField5_0($$parsedSource["Author"]);
|
|
}
|
|
if ("PostType" in $$parsedSource) {
|
|
$$parsedSource["PostType"] = $$createField7_0($$parsedSource["PostType"]);
|
|
}
|
|
if ("Comments" in $$parsedSource) {
|
|
$$parsedSource["Comments"] = $$createField8_0($$parsedSource["Comments"]);
|
|
}
|
|
return new Post(/** @type {Partial<Post>} */($$parsedSource));
|
|
}
|
|
}
|
|
|
|
export class PostType {
|
|
/**
|
|
* Creates a new PostType instance.
|
|
* @param {Partial<PostType>} [$$source = {}] - The source object to create the PostType.
|
|
*/
|
|
constructor($$source = {}) {
|
|
if (!("Id" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {number}
|
|
*/
|
|
this["Id"] = 0;
|
|
}
|
|
if (!("Name" in $$source)) {
|
|
/**
|
|
* @member
|
|
* @type {string}
|
|
*/
|
|
this["Name"] = "";
|
|
}
|
|
|
|
Object.assign(this, $$source);
|
|
}
|
|
|
|
/**
|
|
* Creates a new PostType instance from a string or object.
|
|
* @param {any} [$$source = {}]
|
|
* @returns {PostType}
|
|
*/
|
|
static createFrom($$source = {}) {
|
|
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
|
return new PostType(/** @type {Partial<PostType>} */($$parsedSource));
|
|
}
|
|
}
|
|
|
|
// Private type creation functions
|
|
const $$createType0 = Post.createFrom;
|
|
const $$createType1 = $Create.Array($$createType0);
|
|
const $$createType2 = Comment.createFrom;
|
|
const $$createType3 = $Create.Array($$createType2);
|
|
const $$createType4 = Author.createFrom;
|
|
const $$createType5 = PostType.createFrom;
|