diff --git a/canopeum_backend/canopeum_backend/migrations/0002_remove_post_share_count.py b/canopeum_backend/canopeum_backend/migrations/0002_remove_post_share_count.py new file mode 100644 index 000000000..4fa060d3b --- /dev/null +++ b/canopeum_backend/canopeum_backend/migrations/0002_remove_post_share_count.py @@ -0,0 +1,17 @@ +# Generated by Django 5.1 on 2024-11-26 18:33 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("canopeum_backend", "0001_initial"), + ] + + operations = [ + migrations.RemoveField( + model_name="post", + name="share_count", + ), + ] diff --git a/canopeum_backend/test.py b/canopeum_backend/test.py index ff81fdd16..cc4b9ff0e 100644 --- a/canopeum_backend/test.py +++ b/canopeum_backend/test.py @@ -18,4 +18,8 @@ def test_no_pending_migrations(self): stderr=StringIO(), ) except SystemExit: - raise AssertionError("Pending migrations:\n" + out.getvalue()) from None + raise AssertionError( + "Pending migrations:\n" + + out.getvalue() + + "\nPlease run `uv run manage.py makemigrations`" + ) from None diff --git a/canopeum_frontend/.eslintrc.cjs b/canopeum_frontend/.eslintrc.cjs index fde6f4f1c..ae81c6e53 100644 --- a/canopeum_frontend/.eslintrc.cjs +++ b/canopeum_frontend/.eslintrc.cjs @@ -10,7 +10,7 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { projectService: { - allowDefaultProject: ['*/*/*.js', '.eslintrc.cjs'], + allowDefaultProject: ['*/*/*.js', '.eslintrc.cjs', 'apiSchemaGenerator.js'], }, // Still needed for plugins that haven't updated to typescript-eslint@8 yet // Namely: eslint-plugin-sonarjs diff --git a/canopeum_frontend/apiSchemaGenerator.js b/canopeum_frontend/apiSchemaGenerator.js index 65db48098..7dd7e9455 100644 --- a/canopeum_frontend/apiSchemaGenerator.js +++ b/canopeum_frontend/apiSchemaGenerator.js @@ -6,7 +6,7 @@ import * as url from 'node:url' const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) const schemaUrl = 'http://127.0.0.1:8000/api/schema/' const outputPath = path.join(__dirname, 'openapi.yaml') -const nswagPath = path.join(__dirname, '../../..', 'docs/canopeum.nswag') +const nswagPath = path.join(__dirname, '..', 'docs', 'canopeum.nswag') const response = await fetch(schemaUrl) if (!response.ok) { diff --git a/canopeum_frontend/package-lock.json b/canopeum_frontend/package-lock.json index 377f9dc84..b62c91612 100644 --- a/canopeum_frontend/package-lock.json +++ b/canopeum_frontend/package-lock.json @@ -38,7 +38,7 @@ "@types/react-transition-group": "^4.4.10", "@vitejs/plugin-react": "^4.2.1", "dprint": "^0.47.2", - "eslint-config-beslogic": "^3.1.1", + "eslint-config-beslogic": "^3.1.2", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", @@ -7214,9 +7214,9 @@ } }, "node_modules/eslint-config-beslogic": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/eslint-config-beslogic/-/eslint-config-beslogic-3.1.1.tgz", - "integrity": "sha512-/U6bDRLRI+hN6ZDfqeVBQ0zsjHhlaqdCNeZU45owZjoFBwab2VPno0IkBXUz6/LPrpMrI815XvUSLyFiD4OOBA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eslint-config-beslogic/-/eslint-config-beslogic-3.1.2.tgz", + "integrity": "sha512-+gZO5wShxJIxfKKeMp5i5nGphF9DhWlqmKYF+KlPdp788RryK6m5iur1nNM7x0wnT6cHKKkJE/2kAiqdxltmAQ==", "dev": true, "hasInstallScript": true, "license": "MIT", diff --git a/canopeum_frontend/package.json b/canopeum_frontend/package.json index d5b0632fd..1c306149c 100644 --- a/canopeum_frontend/package.json +++ b/canopeum_frontend/package.json @@ -47,7 +47,7 @@ "@types/react-transition-group": "^4.4.10", "@vitejs/plugin-react": "^4.2.1", "dprint": "^0.47.2", - "eslint-config-beslogic": "^3.1.1", + "eslint-config-beslogic": "^3.1.2", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", diff --git a/canopeum_frontend/src/components/social/SharePostDialog.tsx b/canopeum_frontend/src/components/social/SharePostDialog.tsx index 492356231..23583d764 100644 --- a/canopeum_frontend/src/components/social/SharePostDialog.tsx +++ b/canopeum_frontend/src/components/social/SharePostDialog.tsx @@ -19,8 +19,7 @@ const SharePostDialog = ({ onClose, open, post }: Props) => { const [shareUrl, setShareUrl] = useState('') useEffect( - () => - setShareUrl(`${globalThis.location.host}${appRoutes.postDetail(post.id)}`), + () => setShareUrl(`${globalThis.location.host}${appRoutes.postDetail(post.id)}`), [post], ) diff --git a/canopeum_frontend/src/services/api.ts b/canopeum_frontend/src/services/api.ts index a1326f44d..892663ecd 100644 --- a/canopeum_frontend/src/services/api.ts +++ b/canopeum_frontend/src/services/api.ts @@ -1,6908 +1,6904 @@ -// ---------------------- -// -// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) -// -// ---------------------- - -/* tslint:disable */ -/* eslint-disable */ -// ReSharper disable InconsistentNaming - -export class AdminUserSitesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - all(): Promise { - let url_ = this.baseUrl + '/admin-user-sites/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(AdminUserSites.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class BatchClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - all(): Promise { - let url_ = this.baseUrl + '/analytics/batches/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(BatchDetail.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - create( - site?: number | undefined, - name?: string | null | undefined, - sponsorName?: string | null | undefined, - sponsorWebsiteUrl?: string | null | undefined, - sponsorLogo?: FileParameter | null | undefined, - size?: number | null | undefined, - soilCondition?: string | null | undefined, - survivedCount?: number | null | undefined, - replaceCount?: number | null | undefined, - totalPropagation?: number | null | undefined, - image?: FileParameter | null | undefined, - fertilizerIds?: number[] | undefined, - mulchLayerIds?: number[] | undefined, - seeds?: Seeds[] | undefined, - species?: Species[] | undefined, - supportedSpecieIds?: number[] | undefined, - ): Promise { - let url_ = this.baseUrl + '/analytics/batches/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = new FormData() - if (site === null || site === undefined) { - throw new Error("The parameter 'site' cannot be null.") - } else { - content_.append('site', site.toString()) - } - if (name !== null && name !== undefined) { - content_.append('name', name.toString()) - } - if (sponsorName !== null && sponsorName !== undefined) { - content_.append('sponsorName', sponsorName.toString()) - } - if (sponsorWebsiteUrl !== null && sponsorWebsiteUrl !== undefined) { - content_.append('sponsorWebsiteUrl', sponsorWebsiteUrl.toString()) - } - if (sponsorLogo !== null && sponsorLogo !== undefined) { - content_.append( - 'sponsorLogo', - sponsorLogo.data, - sponsorLogo.fileName ? sponsorLogo.fileName : 'sponsorLogo', - ) - } - if (size !== null && size !== undefined) { - content_.append('size', size.toString()) - } - if (soilCondition !== null && soilCondition !== undefined) { - content_.append('soilCondition', soilCondition.toString()) - } - if (survivedCount !== null && survivedCount !== undefined) { - content_.append('survivedCount', survivedCount.toString()) - } - if (replaceCount !== null && replaceCount !== undefined) { - content_.append('replaceCount', replaceCount.toString()) - } - if (totalPropagation !== null && totalPropagation !== undefined) { - content_.append('totalPropagation', totalPropagation.toString()) - } - if (image !== null && image !== undefined) { - content_.append('image', image.data, image.fileName ? image.fileName : 'image') - } - if (fertilizerIds === null || fertilizerIds === undefined) { - throw new Error("The parameter 'fertilizerIds' cannot be null.") - } else { - fertilizerIds.forEach(item_ => content_.append('fertilizerIds', item_.toString())) - } - if (mulchLayerIds === null || mulchLayerIds === undefined) { - throw new Error("The parameter 'mulchLayerIds' cannot be null.") - } else { - mulchLayerIds.forEach(item_ => content_.append('mulchLayerIds', item_.toString())) - } - if (seeds === null || seeds === undefined) { - throw new Error("The parameter 'seeds' cannot be null.") - } else { - seeds.forEach(item_ => content_.append('seeds', item_.toString())) - } - if (species === null || species === undefined) { - throw new Error("The parameter 'species' cannot be null.") - } else { - species.forEach(item_ => content_.append('species', item_.toString())) - } - if (supportedSpecieIds === null || supportedSpecieIds === undefined) { - throw new Error("The parameter 'supportedSpecieIds' cannot be null.") - } else { - supportedSpecieIds.forEach(item_ => content_.append('supportedSpecieIds', item_.toString())) - } - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = BatchDetail.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - update( - batchId: number, - name?: string | null | undefined, - sponsorName?: string | null | undefined, - sponsorWebsiteUrl?: string | null | undefined, - sponsorLogo?: FileParameter | null | undefined, - size?: number | null | undefined, - soilCondition?: string | null | undefined, - survivedCount?: number | null | undefined, - replaceCount?: number | null | undefined, - totalPropagation?: number | null | undefined, - fertilizerIds?: number[] | undefined, - mulchLayerIds?: number[] | undefined, - seeds?: Seeds2[] | undefined, - species?: Species2[] | undefined, - supportedSpecieIds?: number[] | undefined, - ): Promise { - let url_ = this.baseUrl + '/analytics/batches/{batchId}/' - if (batchId === undefined || batchId === null) { - throw new Error("The parameter 'batchId' must be defined.") - } - url_ = url_.replace('{batchId}', encodeURIComponent('' + batchId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = new FormData() - if (name !== null && name !== undefined) { - content_.append('name', name.toString()) - } - if (sponsorName !== null && sponsorName !== undefined) { - content_.append('sponsorName', sponsorName.toString()) - } - if (sponsorWebsiteUrl !== null && sponsorWebsiteUrl !== undefined) { - content_.append('sponsorWebsiteUrl', sponsorWebsiteUrl.toString()) - } - if (sponsorLogo !== null && sponsorLogo !== undefined) { - content_.append( - 'sponsorLogo', - sponsorLogo.data, - sponsorLogo.fileName ? sponsorLogo.fileName : 'sponsorLogo', - ) - } - if (size !== null && size !== undefined) { - content_.append('size', size.toString()) - } - if (soilCondition !== null && soilCondition !== undefined) { - content_.append('soilCondition', soilCondition.toString()) - } - if (survivedCount !== null && survivedCount !== undefined) { - content_.append('survivedCount', survivedCount.toString()) - } - if (replaceCount !== null && replaceCount !== undefined) { - content_.append('replaceCount', replaceCount.toString()) - } - if (totalPropagation !== null && totalPropagation !== undefined) { - content_.append('totalPropagation', totalPropagation.toString()) - } - if (fertilizerIds === null || fertilizerIds === undefined) { - throw new Error("The parameter 'fertilizerIds' cannot be null.") - } else { - fertilizerIds.forEach(item_ => content_.append('fertilizerIds', item_.toString())) - } - if (mulchLayerIds === null || mulchLayerIds === undefined) { - throw new Error("The parameter 'mulchLayerIds' cannot be null.") - } else { - mulchLayerIds.forEach(item_ => content_.append('mulchLayerIds', item_.toString())) - } - if (seeds === null || seeds === undefined) { - throw new Error("The parameter 'seeds' cannot be null.") - } else { - seeds.forEach(item_ => content_.append('seeds', item_.toString())) - } - if (species === null || species === undefined) { - throw new Error("The parameter 'species' cannot be null.") - } else { - species.forEach(item_ => content_.append('species', item_.toString())) - } - if (supportedSpecieIds === null || supportedSpecieIds === undefined) { - throw new Error("The parameter 'supportedSpecieIds' cannot be null.") - } else { - supportedSpecieIds.forEach(item_ => content_.append('supportedSpecieIds', item_.toString())) - } - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdate(_response) - }) - } - - protected processUpdate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = BatchDetail.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - delete(batchId: number): Promise { - let url_ = this.baseUrl + '/analytics/batches/{batchId}/' - if (batchId === undefined || batchId === null) { - throw new Error("The parameter 'batchId' must be defined.") - } - url_ = url_.replace('{batchId}', encodeURIComponent('' + batchId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDelete(_response) - }) - } - - protected processDelete(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 204) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class FertilizerClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - allTypes(): Promise { - let url_ = this.baseUrl + '/analytics/fertilizers' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAllTypes(_response) - }) - } - - protected processAllTypes(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(FertilizerType.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class MulchLayerClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - allTypes(): Promise { - let url_ = this.baseUrl + '/analytics/mulch-layers' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAllTypes(_response) - }) - } - - protected processAllTypes(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(MulchLayerType.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class SiteClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - types(): Promise { - let url_ = this.baseUrl + '/analytics/site-types' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processTypes(_response) - }) - } - - protected processTypes(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(SiteType.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - all(): Promise { - let url_ = this.baseUrl + '/analytics/sites/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(Site.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - create( - name?: string | undefined, - siteType?: number | undefined, - image?: FileParameter | null | undefined, - latitude?: string | undefined, - longitude?: string | undefined, - description?: string | undefined, - size?: number | undefined, - species?: Species3[] | undefined, - researchPartnership?: boolean | undefined, - visibleMap?: boolean | undefined, - ): Promise { - let url_ = this.baseUrl + '/analytics/sites/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = new FormData() - if (name === null || name === undefined) { - throw new Error("The parameter 'name' cannot be null.") - } else { - content_.append('name', name.toString()) - } - if (siteType === null || siteType === undefined) { - throw new Error("The parameter 'siteType' cannot be null.") - } else { - content_.append('siteType', siteType.toString()) - } - if (image !== null && image !== undefined) { - content_.append('image', image.data, image.fileName ? image.fileName : 'image') - } - if (latitude === null || latitude === undefined) { - throw new Error("The parameter 'latitude' cannot be null.") - } else { - content_.append('latitude', latitude.toString()) - } - if (longitude === null || longitude === undefined) { - throw new Error("The parameter 'longitude' cannot be null.") - } else { - content_.append('longitude', longitude.toString()) - } - if (description === null || description === undefined) { - throw new Error("The parameter 'description' cannot be null.") - } else { - content_.append('description', description.toString()) - } - if (size === null || size === undefined) { - throw new Error("The parameter 'size' cannot be null.") - } else { - content_.append('size', size.toString()) - } - if (species === null || species === undefined) { - throw new Error("The parameter 'species' cannot be null.") - } else { - species.forEach(item_ => content_.append('species', item_.toString())) - } - if (researchPartnership === null || researchPartnership === undefined) { - throw new Error("The parameter 'researchPartnership' cannot be null.") - } else { - content_.append('researchPartnership', researchPartnership.toString()) - } - if (visibleMap === null || visibleMap === undefined) { - throw new Error("The parameter 'visibleMap' cannot be null.") - } else { - content_.append('visibleMap', visibleMap.toString()) - } - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = Site.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - detail(siteId: number): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDetail(_response) - }) - } - - protected processDetail(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = Site.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - update( - siteId: number, - name?: string | undefined, - siteType?: number | undefined, - image?: FileParameter | null | undefined, - latitude?: string | undefined, - longitude?: string | undefined, - description?: string | undefined, - size?: number | undefined, - species?: Species4[] | undefined, - researchPartnership?: boolean | undefined, - visibleMap?: boolean | undefined, - ): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = new FormData() - if (name === null || name === undefined) { - throw new Error("The parameter 'name' cannot be null.") - } else { - content_.append('name', name.toString()) - } - if (siteType === null || siteType === undefined) { - throw new Error("The parameter 'siteType' cannot be null.") - } else { - content_.append('siteType', siteType.toString()) - } - if (image !== null && image !== undefined) { - content_.append('image', image.data, image.fileName ? image.fileName : 'image') - } - if (latitude === null || latitude === undefined) { - throw new Error("The parameter 'latitude' cannot be null.") - } else { - content_.append('latitude', latitude.toString()) - } - if (longitude === null || longitude === undefined) { - throw new Error("The parameter 'longitude' cannot be null.") - } else { - content_.append('longitude', longitude.toString()) - } - if (description === null || description === undefined) { - throw new Error("The parameter 'description' cannot be null.") - } else { - content_.append('description', description.toString()) - } - if (size === null || size === undefined) { - throw new Error("The parameter 'size' cannot be null.") - } else { - content_.append('size', size.toString()) - } - if (species === null || species === undefined) { - throw new Error("The parameter 'species' cannot be null.") - } else { - species.forEach(item_ => content_.append('species', item_.toString())) - } - if (researchPartnership === null || researchPartnership === undefined) { - throw new Error("The parameter 'researchPartnership' cannot be null.") - } else { - content_.append('researchPartnership', researchPartnership.toString()) - } - if (visibleMap === null || visibleMap === undefined) { - throw new Error("The parameter 'visibleMap' cannot be null.") - } else { - content_.append('visibleMap', visibleMap.toString()) - } - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdate(_response) - }) - } - - protected processUpdate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = Site.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - delete(siteId: number): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDelete(_response) - }) - } - - protected processDelete(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 204) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - updateAdmins( - siteId: number, - body?: PatchedSiteAdminUpdateRequest | undefined, - ): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/admins' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdateAdmins(_response) - }) - } - - protected processUpdateAdmins(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(SiteAdmin.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - follow(siteId: number): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/followers/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'POST', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processFollow(_response) - }) - } - - protected processFollow(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - unfollow(siteId: number): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/followers/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUnfollow(_response) - }) - } - - protected processUnfollow(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 204) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - isFollowing(siteId: number): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/followers/current-user/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processIsFollowing(_response) - }) - } - - protected processIsFollowing(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = resultData200 !== undefined ? resultData200 : null - - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - summary(siteId: number): Promise { - let url_ = this.baseUrl + '/analytics/sites/{siteId}/summary' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSummary(_response) - }) - } - - protected processSummary(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = SiteSummaryDetail.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - map(): Promise { - let url_ = this.baseUrl + '/map/sites/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processMap(_response) - }) - } - - protected processMap(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(SiteMap.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - social(siteId: number): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSocial(_response) - }) - } - - protected processSocial(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = SiteSocial.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class SummaryClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - all(): Promise { - let url_ = this.baseUrl + '/analytics/sites/summary' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(SiteSummary.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class TreeClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - species(): Promise { - let url_ = this.baseUrl + '/analytics/tree-species' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSpecies(_response) - }) - } - - protected processSpecies(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(TreeType.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class SchemaClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - retrieve(format?: Format | undefined, lang?: Lang | undefined): Promise<{ [key: string]: any }> { - let url_ = this.baseUrl + '/api/schema/?' - if (format === null) { - throw new Error("The parameter 'format' cannot be null.") - } else if (format !== undefined) { - url_ += 'format=' + encodeURIComponent('' + format) + '&' - } - if (lang === null) { - throw new Error("The parameter 'lang' cannot be null.") - } else if (lang !== undefined) { - url_ += 'lang=' + encodeURIComponent('' + lang) + '&' - } - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/vnd.oai.openapi', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processRetrieve(_response) - }) - } - - protected processRetrieve(response: Response): Promise<{ [key: string]: any }> { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (resultData200) { - result200 = {} as any - for (let key in resultData200) { - if (resultData200.hasOwnProperty(key)) { - ;( result200)![key] = resultData200[key] !== undefined - ? resultData200[key] - : null - } - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve<{ [key: string]: any }>(null as any) - } -} - -export class AuthenticationClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - login(body: LoginUser): Promise { - let url_ = this.baseUrl + '/auth/login/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processLogin(_response) - }) - } - - protected processLogin(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = UserToken.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - register(body: RegisterUser): Promise { - let url_ = this.baseUrl + '/auth/register/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processRegister(_response) - }) - } - - protected processRegister(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = UserToken.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class TokenClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - create(body: TokenObtainPair): Promise { - let url_ = this.baseUrl + '/auth/token/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = TokenObtainPair.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class RefreshClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - create(body: TokenRefresh): Promise { - let url_ = this.baseUrl + '/auth/token/refresh/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = TokenRefresh.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class ContactClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - update(contactId: number, body?: PatchedContact | undefined): Promise { - let url_ = this.baseUrl + '/social/contacts/{contactId}/' - if (contactId === undefined || contactId === null) { - throw new Error("The parameter 'contactId' must be defined.") - } - url_ = url_.replace('{contactId}', encodeURIComponent('' + contactId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdate(_response) - }) - } - - protected processUpdate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = Contact.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class PostClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - all(page: number, size: number, siteId?: number[] | undefined): Promise { - let url_ = this.baseUrl + '/social/posts/?' - if (page === undefined || page === null) { - throw new Error("The parameter 'page' must be defined and cannot be null.") - } else { - url_ += 'page=' + encodeURIComponent('' + page) + '&' - } - if (size === undefined || size === null) { - throw new Error("The parameter 'size' must be defined and cannot be null.") - } else { - url_ += 'size=' + encodeURIComponent('' + size) + '&' - } - if (siteId === null) { - throw new Error("The parameter 'siteId' cannot be null.") - } else if (siteId !== undefined) { - siteId && siteId.forEach(item => { - url_ += 'siteId=' + encodeURIComponent('' + item) + '&' - }) - } - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = PostPagination.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - create( - site?: number | undefined, - body?: string | undefined, - media?: FileParameter[] | undefined, - ): Promise { - let url_ = this.baseUrl + '/social/posts/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = new FormData() - if (site === null || site === undefined) { - throw new Error("The parameter 'site' cannot be null.") - } else { - content_.append('site', site.toString()) - } - if (body === null || body === undefined) { - throw new Error("The parameter 'body' cannot be null.") - } else { - content_.append('body', body.toString()) - } - if (media === null || media === undefined) { - throw new Error("The parameter 'media' cannot be null.") - } else { - media.forEach(item_ => - content_.append('media', item_.data, item_.fileName ? item_.fileName : 'media') - ) - } - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = Post.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - detail(postId: number): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/' - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDetail(_response) - }) - } - - protected processDetail(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = Post.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - delete(postId: number): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/' - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDelete(_response) - }) - } - - protected processDelete(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 204) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class CommentClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - all(postId: number): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/comments/' - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(Comment.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - create(postId: number, body: CreateComment): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/comments/' - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = Comment.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - delete(commentId: number, postId: number): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/comments/{commentId}/' - if (commentId === undefined || commentId === null) { - throw new Error("The parameter 'commentId' must be defined.") - } - url_ = url_.replace('{commentId}', encodeURIComponent('' + commentId)) - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDelete(_response) - }) - } - - protected processDelete(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 204) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class LikeClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - likePost(postId: number, body?: { [key: string]: any } | undefined): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/likes/' - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processLikePost(_response) - }) - } - - protected processLikePost(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = Like.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - delete(postId: number): Promise { - let url_ = this.baseUrl + '/social/posts/{postId}/likes/' - if (postId === undefined || postId === null) { - throw new Error("The parameter 'postId' must be defined.") - } - url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDelete(_response) - }) - } - - protected processDelete(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = Like.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class AnnouncementClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - update(siteId: number, body?: PatchedAnnouncement | undefined): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/announcements/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdate(_response) - }) - } - - protected processUpdate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = Announcement.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class SocialClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - updatePublicStatus( - siteId: number, - body?: PatchedUpdateSitePublicStatus | undefined, - ): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/public-status' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdatePublicStatus(_response) - }) - } - - protected processUpdatePublicStatus(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = UpdateSitePublicStatus.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class WidgetClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - create(siteId: number, body?: Widget | undefined): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/widgets/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 201) { - return response.text().then(_responseText => { - let result201: any = null - let resultData201 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result201 = Widget.fromJS(resultData201) - return result201 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - update(siteId: number, widgetId: number, body?: PatchedWidget | undefined): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/widgets/{widgetId}/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - if (widgetId === undefined || widgetId === null) { - throw new Error("The parameter 'widgetId' must be defined.") - } - url_ = url_.replace('{widgetId}', encodeURIComponent('' + widgetId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdate(_response) - }) - } - - protected processUpdate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = Widget.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - /** - * @return No response body - */ - delete(siteId: number, widgetId: number): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/widgets/{widgetId}/' - if (siteId === undefined || siteId === null) { - throw new Error("The parameter 'siteId' must be defined.") - } - url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) - if (widgetId === undefined || widgetId === null) { - throw new Error("The parameter 'widgetId' must be defined.") - } - url_ = url_.replace('{widgetId}', encodeURIComponent('' + widgetId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'DELETE', - headers: {}, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDelete(_response) - }) - } - - protected processDelete(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 204) { - return response.text().then(_responseText => { - return - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class UserInvitationClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - create(body: CreateUserInvitation): Promise { - let url_ = this.baseUrl + '/user-invitations/' - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCreate(_response) - }) - } - - protected processCreate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = UserInvitation.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - detail(code: string): Promise { - let url_ = this.baseUrl + '/user-invitations/{code}' - if (code === undefined || code === null) { - throw new Error("The parameter 'code' must be defined.") - } - url_ = url_.replace('{code}', encodeURIComponent('' + code)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDetail(_response) - }) - } - - protected processDetail(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = UserInvitation.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class UserClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined - - constructor( - baseUrl?: string, - http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, - ) { - this.http = http ? http : window as any - this.baseUrl = baseUrl ?? '' - } - - all(): Promise { - let url_ = this.baseUrl + '/users/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAll(_response) - }) - } - - protected processAll(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(User.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - detail(userId: number): Promise { - let url_ = this.baseUrl + '/users/{userId}/' - if (userId === undefined || userId === null) { - throw new Error("The parameter 'userId' must be defined.") - } - url_ = url_.replace('{userId}', encodeURIComponent('' + userId)) - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processDetail(_response) - }) - } - - protected processDetail(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = User.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - update(userId: number, body?: PatchedUpdateUser | undefined): Promise { - let url_ = this.baseUrl + '/users/{userId}/' - if (userId === undefined || userId === null) { - throw new Error("The parameter 'userId' must be defined.") - } - url_ = url_.replace('{userId}', encodeURIComponent('' + userId)) - url_ = url_.replace(/[?&]$/, '') - - const content_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUpdate(_response) - }) - } - - protected processUpdate(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = User.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - current(): Promise { - let url_ = this.baseUrl + '/users/current_user/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processCurrent(_response) - }) - } - - protected processCurrent(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - result200 = User.fromJS(resultData200) - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } - - allForestStewards(): Promise { - let url_ = this.baseUrl + '/users/forest-stewards' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAllForestStewards(_response) - }) - } - - protected processAllForestStewards(response: Response): Promise { - const status = response.status - let _headers: any = {} - if (response.headers && response.headers.forEach) { - response.headers.forEach((v: any, k: any) => _headers[k] = v) - } - if (status === 200) { - return response.text().then(_responseText => { - let result200: any = null - let resultData200 = _responseText === '' - ? null - : JSON.parse(_responseText, this.jsonParseReviver) - if (Array.isArray(resultData200)) { - result200 = [] as any - for (let item of resultData200) { - result200!.push(User.fromJS(item)) - } - } else { - result200 = null - } - return result200 - }) - } else if (status !== 200 && status !== 204) { - return response.text().then(_responseText => { - return throwException( - 'An unexpected server error occurred.', - status, - _responseText, - _headers, - ) - }) - } - return Promise.resolve(null as any) - } -} - -export class AdminUserSites implements IAdminUserSites { - readonly id!: number - /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username!: string - email!: string - readonly sites!: SiteName[]; - - [key: string]: any - - constructor(data?: IAdminUserSites) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.sites = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.username = _data['username'] - this.email = _data['email'] - if (Array.isArray(_data['sites'])) { - ;( this).sites = [] as any - for (let item of _data['sites']) { - ;( this).sites!.push(SiteName.fromJS(item)) - } - } - } - } - - static fromJS(data: any): AdminUserSites { - data = typeof data === 'object' ? data : {} - let result = new AdminUserSites() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['username'] = this.username - data['email'] = this.email - if (Array.isArray(this.sites)) { - data['sites'] = [] - for (let item of this.sites) { - data['sites'].push(item.toJSON()) - } - } - return data - } -} - -export interface IAdminUserSites { - id: number - /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username: string - email: string - sites: SiteName[] - - [key: string]: any -} - -export class Announcement implements IAnnouncement { - readonly id!: number - body?: string | undefined - link?: string | undefined; - - [key: string]: any - - constructor(data?: IAnnouncement) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.body = _data['body'] - this.link = _data['link'] - } - } - - static fromJS(data: any): Announcement { - data = typeof data === 'object' ? data : {} - let result = new Announcement() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['body'] = this.body - data['link'] = this.link - return data - } -} - -export interface IAnnouncement { - id: number - body?: string | undefined - link?: string | undefined - - [key: string]: any -} - -export class Asset implements IAsset { - readonly id!: number - asset!: string; - - [key: string]: any - - constructor(data?: IAsset) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.asset = _data['asset'] - } - } - - static fromJS(data: any): Asset { - data = typeof data === 'object' ? data : {} - let result = new Asset() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['asset'] = this.asset - return data - } -} - -export interface IAsset { - id: number - asset: string - - [key: string]: any -} - -export class BatchDetail implements IBatchDetail { - readonly id!: number - readonly fertilizers!: FertilizerType[] - readonly mulchLayers!: MulchLayerType[] - readonly supportedSpecies!: TreeType[] - readonly seeds!: BatchSeed[] - readonly totalNumberSeeds!: number - readonly species!: BatchSpecies[] - readonly plantCount!: number - readonly sponsor!: BatchSponsor - image?: Asset - readonly createdAt!: Date | undefined - readonly updatedAt!: Date | undefined - name?: string | undefined - size?: number | undefined - soilCondition?: string | undefined - survivedCount?: number | undefined - replaceCount?: number | undefined - totalPropagation?: number | undefined - site!: number; - - [key: string]: any - - constructor(data?: IBatchDetail) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.fertilizers = [] - this.mulchLayers = [] - this.supportedSpecies = [] - this.seeds = [] - this.species = [] - this.sponsor = new BatchSponsor() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - if (Array.isArray(_data['fertilizers'])) { - ;( this).fertilizers = [] as any - for (let item of _data['fertilizers']) { - ;( this).fertilizers!.push(FertilizerType.fromJS(item)) - } - } - if (Array.isArray(_data['mulchLayers'])) { - ;( this).mulchLayers = [] as any - for (let item of _data['mulchLayers']) { - ;( this).mulchLayers!.push(MulchLayerType.fromJS(item)) - } - } - if (Array.isArray(_data['supportedSpecies'])) { - ;( this).supportedSpecies = [] as any - for (let item of _data['supportedSpecies']) { - ;( this).supportedSpecies!.push(TreeType.fromJS(item)) - } - } - if (Array.isArray(_data['seeds'])) { - ;( this).seeds = [] as any - for (let item of _data['seeds']) { - ;( this).seeds!.push(BatchSeed.fromJS(item)) - } - } - ;( this).totalNumberSeeds = _data['totalNumberSeeds'] - if (Array.isArray(_data['species'])) { - ;( this).species = [] as any - for (let item of _data['species']) { - ;( this).species!.push(BatchSpecies.fromJS(item)) - } - } - ;( this).plantCount = _data['plantCount'] - ;( this).sponsor = _data['sponsor'] - ? BatchSponsor.fromJS(_data['sponsor']) - : new BatchSponsor() - this.image = _data['image'] ? Asset.fromJS(_data['image']) : undefined - ;( this).createdAt = _data['createdAt'] - ? new Date(_data['createdAt'].toString()) - : undefined - ;( this).updatedAt = _data['updatedAt'] - ? new Date(_data['updatedAt'].toString()) - : undefined - this.name = _data['name'] - this.size = _data['size'] - this.soilCondition = _data['soilCondition'] - this.survivedCount = _data['survivedCount'] - this.replaceCount = _data['replaceCount'] - this.totalPropagation = _data['totalPropagation'] - this.site = _data['site'] - } - } - - static fromJS(data: any): BatchDetail { - data = typeof data === 'object' ? data : {} - let result = new BatchDetail() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - if (Array.isArray(this.fertilizers)) { - data['fertilizers'] = [] - for (let item of this.fertilizers) { - data['fertilizers'].push(item.toJSON()) - } - } - if (Array.isArray(this.mulchLayers)) { - data['mulchLayers'] = [] - for (let item of this.mulchLayers) { - data['mulchLayers'].push(item.toJSON()) - } - } - if (Array.isArray(this.supportedSpecies)) { - data['supportedSpecies'] = [] - for (let item of this.supportedSpecies) { - data['supportedSpecies'].push(item.toJSON()) - } - } - if (Array.isArray(this.seeds)) { - data['seeds'] = [] - for (let item of this.seeds) { - data['seeds'].push(item.toJSON()) - } - } - data['totalNumberSeeds'] = this.totalNumberSeeds - if (Array.isArray(this.species)) { - data['species'] = [] - for (let item of this.species) { - data['species'].push(item.toJSON()) - } - } - data['plantCount'] = this.plantCount - data['sponsor'] = this.sponsor ? this.sponsor.toJSON() : undefined - data['image'] = this.image ? this.image.toJSON() : undefined - data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined - data['updatedAt'] = this.updatedAt ? this.updatedAt.toISOString() : undefined - data['name'] = this.name - data['size'] = this.size - data['soilCondition'] = this.soilCondition - data['survivedCount'] = this.survivedCount - data['replaceCount'] = this.replaceCount - data['totalPropagation'] = this.totalPropagation - data['site'] = this.site - return data - } -} - -export interface IBatchDetail { - id: number - fertilizers: FertilizerType[] - mulchLayers: MulchLayerType[] - supportedSpecies: TreeType[] - seeds: BatchSeed[] - totalNumberSeeds: number - species: BatchSpecies[] - plantCount: number - sponsor: BatchSponsor - image?: Asset - createdAt: Date | undefined - updatedAt: Date | undefined - name?: string | undefined - size?: number | undefined - soilCondition?: string | undefined - survivedCount?: number | undefined - replaceCount?: number | undefined - totalPropagation?: number | undefined - site: number - - [key: string]: any -} - -export class BatchSeed implements IBatchSeed { - readonly id!: number - quantity!: number - readonly treeType!: TreeType; - - [key: string]: any - - constructor(data?: IBatchSeed) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.treeType = new TreeType() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.quantity = _data['quantity'] - ;( this).treeType = _data['treeType'] - ? TreeType.fromJS(_data['treeType']) - : new TreeType() - } - } - - static fromJS(data: any): BatchSeed { - data = typeof data === 'object' ? data : {} - let result = new BatchSeed() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - data['treeType'] = this.treeType ? this.treeType.toJSON() : undefined - return data - } -} - -export interface IBatchSeed { - id: number - quantity: number - treeType: TreeType - - [key: string]: any -} - -export class BatchSpecies implements IBatchSpecies { - readonly id!: number - quantity!: number - readonly treeType!: TreeType; - - [key: string]: any - - constructor(data?: IBatchSpecies) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.treeType = new TreeType() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.quantity = _data['quantity'] - ;( this).treeType = _data['treeType'] - ? TreeType.fromJS(_data['treeType']) - : new TreeType() - } - } - - static fromJS(data: any): BatchSpecies { - data = typeof data === 'object' ? data : {} - let result = new BatchSpecies() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - data['treeType'] = this.treeType ? this.treeType.toJSON() : undefined - return data - } -} - -export interface IBatchSpecies { - id: number - quantity: number - treeType: TreeType - - [key: string]: any -} - -export class BatchSponsor implements IBatchSponsor { - readonly id!: number - logo!: Asset - name!: string - url!: string; - - [key: string]: any - - constructor(data?: IBatchSponsor) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.logo = new Asset() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.logo = _data['logo'] ? Asset.fromJS(_data['logo']) : new Asset() - this.name = _data['name'] - this.url = _data['url'] - } - } - - static fromJS(data: any): BatchSponsor { - data = typeof data === 'object' ? data : {} - let result = new BatchSponsor() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['logo'] = this.logo ? this.logo.toJSON() : undefined - data['name'] = this.name - data['url'] = this.url - return data - } -} - -export interface IBatchSponsor { - id: number - logo: Asset - name: string - url: string - - [key: string]: any -} - -export class ChangePassword implements IChangePassword { - currentPassword!: string - newPassword!: string - newPasswordConfirmation!: string; - - [key: string]: any - - constructor(data?: IChangePassword) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.currentPassword = _data['currentPassword'] - this.newPassword = _data['newPassword'] - this.newPasswordConfirmation = _data['newPasswordConfirmation'] - } - } - - static fromJS(data: any): ChangePassword { - data = typeof data === 'object' ? data : {} - let result = new ChangePassword() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['currentPassword'] = this.currentPassword - data['newPassword'] = this.newPassword - data['newPasswordConfirmation'] = this.newPasswordConfirmation - return data - } -} - -export interface IChangePassword { - currentPassword: string - newPassword: string - newPasswordConfirmation: string - - [key: string]: any -} - -export class Comment implements IComment { - readonly id!: number - body!: string - readonly authorId!: number - readonly authorUsername!: string - readonly createdAt!: Date; - - [key: string]: any - - constructor(data?: IComment) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.body = _data['body'] - ;( this).authorId = _data['authorId'] - ;( this).authorUsername = _data['authorUsername'] - ;( this).createdAt = _data['createdAt'] - ? new Date(_data['createdAt'].toString()) - : undefined - } - } - - static fromJS(data: any): Comment { - data = typeof data === 'object' ? data : {} - let result = new Comment() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['body'] = this.body - data['authorId'] = this.authorId - data['authorUsername'] = this.authorUsername - data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined - return data - } -} - -export interface IComment { - id: number - body: string - authorId: number - authorUsername: string - createdAt: Date - - [key: string]: any -} - -export class Contact implements IContact { - readonly id!: number - address?: string | undefined - email?: string | undefined - phone?: string | undefined - facebookLink?: string | undefined - xLink?: string | undefined - instagramLink?: string | undefined - linkedinLink?: string | undefined; - - [key: string]: any - - constructor(data?: IContact) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.address = _data['address'] - this.email = _data['email'] - this.phone = _data['phone'] - this.facebookLink = _data['facebookLink'] - this.xLink = _data['xLink'] - this.instagramLink = _data['instagramLink'] - this.linkedinLink = _data['linkedinLink'] - } - } - - static fromJS(data: any): Contact { - data = typeof data === 'object' ? data : {} - let result = new Contact() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['address'] = this.address - data['email'] = this.email - data['phone'] = this.phone - data['facebookLink'] = this.facebookLink - data['xLink'] = this.xLink - data['instagramLink'] = this.instagramLink - data['linkedinLink'] = this.linkedinLink - return data - } -} - -export interface IContact { - id: number - address?: string | undefined - email?: string | undefined - phone?: string | undefined - facebookLink?: string | undefined - xLink?: string | undefined - instagramLink?: string | undefined - linkedinLink?: string | undefined - - [key: string]: any -} - -export class Coordinates implements ICoordinates { - readonly id!: number - dmsLatitude?: string | undefined - dmsLongitude?: string | undefined - ddLatitude?: string | undefined - ddLongitude?: string | undefined - address?: string | undefined; - - [key: string]: any - - constructor(data?: ICoordinates) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.dmsLatitude = _data['dmsLatitude'] - this.dmsLongitude = _data['dmsLongitude'] - this.ddLatitude = _data['ddLatitude'] - this.ddLongitude = _data['ddLongitude'] - this.address = _data['address'] - } - } - - static fromJS(data: any): Coordinates { - data = typeof data === 'object' ? data : {} - let result = new Coordinates() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['dmsLatitude'] = this.dmsLatitude - data['dmsLongitude'] = this.dmsLongitude - data['ddLatitude'] = this.ddLatitude - data['ddLongitude'] = this.ddLongitude - data['address'] = this.address - return data - } -} - -export interface ICoordinates { - id: number - dmsLatitude?: string | undefined - dmsLongitude?: string | undefined - ddLatitude?: string | undefined - ddLongitude?: string | undefined - address?: string | undefined - - [key: string]: any -} - -export class CoordinatesMap implements ICoordinatesMap { - readonly latitude!: number | undefined - readonly longitude!: number | undefined - address?: string | undefined; - - [key: string]: any - - constructor(data?: ICoordinatesMap) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).latitude = _data['latitude'] - ;( this).longitude = _data['longitude'] - this.address = _data['address'] - } - } - - static fromJS(data: any): CoordinatesMap { - data = typeof data === 'object' ? data : {} - let result = new CoordinatesMap() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['latitude'] = this.latitude - data['longitude'] = this.longitude - data['address'] = this.address - return data - } -} - -export interface ICoordinatesMap { - latitude: number | undefined - longitude: number | undefined - address?: string | undefined - - [key: string]: any -} - -export class CreateComment implements ICreateComment { - body!: string; - - [key: string]: any - - constructor(data?: ICreateComment) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.body = _data['body'] - } - } - - static fromJS(data: any): CreateComment { - data = typeof data === 'object' ? data : {} - let result = new CreateComment() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['body'] = this.body - return data - } -} - -export interface ICreateComment { - body: string - - [key: string]: any -} - -export class CreateUserInvitation implements ICreateUserInvitation { - siteIds!: number[] - email!: string; - - [key: string]: any - - constructor(data?: ICreateUserInvitation) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.siteIds = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - if (Array.isArray(_data['siteIds'])) { - this.siteIds = [] as any - for (let item of _data['siteIds']) { - this.siteIds!.push(item) - } - } - this.email = _data['email'] - } - } - - static fromJS(data: any): CreateUserInvitation { - data = typeof data === 'object' ? data : {} - let result = new CreateUserInvitation() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - if (Array.isArray(this.siteIds)) { - data['siteIds'] = [] - for (let item of this.siteIds) { - data['siteIds'].push(item) - } - } - data['email'] = this.email - return data - } -} - -export interface ICreateUserInvitation { - siteIds: number[] - email: string - - [key: string]: any -} - -export class FertilizerType implements IFertilizerType { - readonly id!: number - readonly en!: string - readonly fr!: string; - - [key: string]: any - - constructor(data?: IFertilizerType) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } - } - - static fromJS(data: any): FertilizerType { - data = typeof data === 'object' ? data : {} - let result = new FertilizerType() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['en'] = this.en - data['fr'] = this.fr - return data - } -} - -export interface IFertilizerType { - id: number - en: string - fr: string - - [key: string]: any -} - -export class Like implements ILike { - readonly id!: number - user!: number - post!: number; - - [key: string]: any - - constructor(data?: ILike) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.user = _data['user'] - this.post = _data['post'] - } - } - - static fromJS(data: any): Like { - data = typeof data === 'object' ? data : {} - let result = new Like() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['user'] = this.user - data['post'] = this.post - return data - } -} - -export interface ILike { - id: number - user: number - post: number - - [key: string]: any -} - -export class LoginUser implements ILoginUser { - email!: string - password!: string; - - [key: string]: any - - constructor(data?: ILoginUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.email = _data['email'] - this.password = _data['password'] - } - } - - static fromJS(data: any): LoginUser { - data = typeof data === 'object' ? data : {} - let result = new LoginUser() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['email'] = this.email - data['password'] = this.password - return data - } -} - -export interface ILoginUser { - email: string - password: string - - [key: string]: any -} - -export class MulchLayerType implements IMulchLayerType { - readonly id!: number - readonly en!: string - readonly fr!: string; - - [key: string]: any - - constructor(data?: IMulchLayerType) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } - } - - static fromJS(data: any): MulchLayerType { - data = typeof data === 'object' ? data : {} - let result = new MulchLayerType() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['en'] = this.en - data['fr'] = this.fr - return data - } -} - -export interface IMulchLayerType { - id: number - en: string - fr: string - - [key: string]: any -} - -export class PatchedAnnouncement implements IPatchedAnnouncement { - readonly id?: number - body?: string | undefined - link?: string | undefined; - - [key: string]: any - - constructor(data?: IPatchedAnnouncement) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.body = _data['body'] - this.link = _data['link'] - } - } - - static fromJS(data: any): PatchedAnnouncement { - data = typeof data === 'object' ? data : {} - let result = new PatchedAnnouncement() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['body'] = this.body - data['link'] = this.link - return data - } -} - -export interface IPatchedAnnouncement { - id?: number - body?: string | undefined - link?: string | undefined - - [key: string]: any -} - -export class PatchedContact implements IPatchedContact { - readonly id?: number - address?: string | undefined - email?: string | undefined - phone?: string | undefined - facebookLink?: string | undefined - xLink?: string | undefined - instagramLink?: string | undefined - linkedinLink?: string | undefined; - - [key: string]: any - - constructor(data?: IPatchedContact) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.address = _data['address'] - this.email = _data['email'] - this.phone = _data['phone'] - this.facebookLink = _data['facebookLink'] - this.xLink = _data['xLink'] - this.instagramLink = _data['instagramLink'] - this.linkedinLink = _data['linkedinLink'] - } - } - - static fromJS(data: any): PatchedContact { - data = typeof data === 'object' ? data : {} - let result = new PatchedContact() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['address'] = this.address - data['email'] = this.email - data['phone'] = this.phone - data['facebookLink'] = this.facebookLink - data['xLink'] = this.xLink - data['instagramLink'] = this.instagramLink - data['linkedinLink'] = this.linkedinLink - return data - } -} - -export interface IPatchedContact { - id?: number - address?: string | undefined - email?: string | undefined - phone?: string | undefined - facebookLink?: string | undefined - xLink?: string | undefined - instagramLink?: string | undefined - linkedinLink?: string | undefined - - [key: string]: any -} - -export class PatchedSiteAdminUpdateRequest implements IPatchedSiteAdminUpdateRequest { - ids?: number[]; - - [key: string]: any - - constructor(data?: IPatchedSiteAdminUpdateRequest) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - if (Array.isArray(_data['ids'])) { - this.ids = [] as any - for (let item of _data['ids']) { - this.ids!.push(item) - } - } - } - } - - static fromJS(data: any): PatchedSiteAdminUpdateRequest { - data = typeof data === 'object' ? data : {} - let result = new PatchedSiteAdminUpdateRequest() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - if (Array.isArray(this.ids)) { - data['ids'] = [] - for (let item of this.ids) { - data['ids'].push(item) - } - } - return data - } -} - -export interface IPatchedSiteAdminUpdateRequest { - ids?: number[] - - [key: string]: any -} - -export class PatchedUpdateSitePublicStatus implements IPatchedUpdateSitePublicStatus { - isPublic?: boolean; - - [key: string]: any - - constructor(data?: IPatchedUpdateSitePublicStatus) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.isPublic = _data['isPublic'] - } - } - - static fromJS(data: any): PatchedUpdateSitePublicStatus { - data = typeof data === 'object' ? data : {} - let result = new PatchedUpdateSitePublicStatus() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['isPublic'] = this.isPublic - return data - } -} - -export interface IPatchedUpdateSitePublicStatus { - isPublic?: boolean - - [key: string]: any -} - -export class PatchedUpdateUser implements IPatchedUpdateUser { - /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username?: string - email?: string - changePassword?: ChangePassword; - - [key: string]: any - - constructor(data?: IPatchedUpdateUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.username = _data['username'] - this.email = _data['email'] - this.changePassword = _data['changePassword'] - ? ChangePassword.fromJS(_data['changePassword']) - : undefined - } - } - - static fromJS(data: any): PatchedUpdateUser { - data = typeof data === 'object' ? data : {} - let result = new PatchedUpdateUser() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['username'] = this.username - data['email'] = this.email - data['changePassword'] = this.changePassword ? this.changePassword.toJSON() : undefined - return data - } -} - -export interface IPatchedUpdateUser { - /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username?: string - email?: string - changePassword?: ChangePassword - - [key: string]: any -} - -export class PatchedWidget implements IPatchedWidget { - readonly id?: number - title?: string | undefined - body?: string | undefined - site?: number | undefined; - - [key: string]: any - - constructor(data?: IPatchedWidget) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.title = _data['title'] - this.body = _data['body'] - this.site = _data['site'] - } - } - - static fromJS(data: any): PatchedWidget { - data = typeof data === 'object' ? data : {} - let result = new PatchedWidget() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['title'] = this.title - data['body'] = this.body - data['site'] = this.site - return data - } -} - -export interface IPatchedWidget { - id?: number - title?: string | undefined - body?: string | undefined - site?: number | undefined - - [key: string]: any -} - -export class Post implements IPost { - readonly id!: number - site!: SiteOverview - readonly createdAt!: Date - body!: string - readonly likeCount!: number - shareCount?: number - readonly commentCount!: number - readonly hasLiked!: boolean - media!: Asset[]; - - [key: string]: any - - constructor(data?: IPost) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.site = new SiteOverview() - this.media = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.site = _data['site'] ? SiteOverview.fromJS(_data['site']) : new SiteOverview() - ;( this).createdAt = _data['createdAt'] - ? new Date(_data['createdAt'].toString()) - : undefined - this.body = _data['body'] - ;( this).likeCount = _data['likeCount'] - this.shareCount = _data['shareCount'] - ;( this).commentCount = _data['commentCount'] - ;( this).hasLiked = _data['hasLiked'] - if (Array.isArray(_data['media'])) { - this.media = [] as any - for (let item of _data['media']) { - this.media!.push(Asset.fromJS(item)) - } - } - } - } - - static fromJS(data: any): Post { - data = typeof data === 'object' ? data : {} - let result = new Post() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['site'] = this.site ? this.site.toJSON() : undefined - data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined - data['body'] = this.body - data['likeCount'] = this.likeCount - data['shareCount'] = this.shareCount - data['commentCount'] = this.commentCount - data['hasLiked'] = this.hasLiked - if (Array.isArray(this.media)) { - data['media'] = [] - for (let item of this.media) { - data['media'].push(item.toJSON()) - } - } - return data - } -} - -export interface IPost { - id: number - site: SiteOverview - createdAt: Date - body: string - likeCount: number - shareCount?: number - commentCount: number - hasLiked: boolean - media: Asset[] - - [key: string]: any -} - -export class PostPagination implements IPostPagination { - count!: number - next?: string - previous?: string - results!: Post[]; - - [key: string]: any - - constructor(data?: IPostPagination) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.results = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.count = _data['count'] - this.next = _data['next'] - this.previous = _data['previous'] - if (Array.isArray(_data['results'])) { - this.results = [] as any - for (let item of _data['results']) { - this.results!.push(Post.fromJS(item)) - } - } - } - } - - static fromJS(data: any): PostPagination { - data = typeof data === 'object' ? data : {} - let result = new PostPagination() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['count'] = this.count - data['next'] = this.next - data['previous'] = this.previous - if (Array.isArray(this.results)) { - data['results'] = [] - for (let item of this.results) { - data['results'].push(item.toJSON()) - } - } - return data - } -} - -export interface IPostPagination { - count: number - next?: string - previous?: string - results: Post[] - - [key: string]: any -} - -export class RegisterUser implements IRegisterUser { - username!: string - email!: string - password!: string - passwordConfirmation!: string - code?: string; - - [key: string]: any - - constructor(data?: IRegisterUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.username = _data['username'] - this.email = _data['email'] - this.password = _data['password'] - this.passwordConfirmation = _data['passwordConfirmation'] - this.code = _data['code'] - } - } - - static fromJS(data: any): RegisterUser { - data = typeof data === 'object' ? data : {} - let result = new RegisterUser() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['username'] = this.username - data['email'] = this.email - data['password'] = this.password - data['passwordConfirmation'] = this.passwordConfirmation - data['code'] = this.code - return data - } -} - -export interface IRegisterUser { - username: string - email: string - password: string - passwordConfirmation: string - code?: string - - [key: string]: any -} - -export type RoleEnum = 'User' | 'ForestSteward' | 'MegaAdmin' - -export class Site implements ISite { - readonly id!: number - siteType!: SiteType - coordinate!: Coordinates - readonly siteTreeSpecies!: Sitetreespecies[] - contact!: Contact - announcement!: Announcement - image!: Asset - name!: string - isPublic?: boolean - description?: string | undefined - size?: string | undefined - researchPartnership?: boolean | undefined - visibleMap?: boolean | undefined - visitorCount?: number | undefined; - - [key: string]: any - - constructor(data?: ISite) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.siteType = new SiteType() - this.coordinate = new Coordinates() - this.siteTreeSpecies = [] - this.contact = new Contact() - this.announcement = new Announcement() - this.image = new Asset() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - this.coordinate = _data['coordinate'] - ? Coordinates.fromJS(_data['coordinate']) - : new Coordinates() - if (Array.isArray(_data['siteTreeSpecies'])) { - ;( this).siteTreeSpecies = [] as any - for (let item of _data['siteTreeSpecies']) { - ;( this).siteTreeSpecies!.push(Sitetreespecies.fromJS(item)) - } - } - this.contact = _data['contact'] ? Contact.fromJS(_data['contact']) : new Contact() - this.announcement = _data['announcement'] - ? Announcement.fromJS(_data['announcement']) - : new Announcement() - this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() - this.name = _data['name'] - this.isPublic = _data['isPublic'] - this.description = _data['description'] - this.size = _data['size'] - this.researchPartnership = _data['researchPartnership'] - this.visibleMap = _data['visibleMap'] - this.visitorCount = _data['visitorCount'] - } - } - - static fromJS(data: any): Site { - data = typeof data === 'object' ? data : {} - let result = new Site() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['coordinate'] = this.coordinate ? this.coordinate.toJSON() : undefined - if (Array.isArray(this.siteTreeSpecies)) { - data['siteTreeSpecies'] = [] - for (let item of this.siteTreeSpecies) { - data['siteTreeSpecies'].push(item.toJSON()) - } - } - data['contact'] = this.contact ? this.contact.toJSON() : undefined - data['announcement'] = this.announcement ? this.announcement.toJSON() : undefined - data['image'] = this.image ? this.image.toJSON() : undefined - data['name'] = this.name - data['isPublic'] = this.isPublic - data['description'] = this.description - data['size'] = this.size - data['researchPartnership'] = this.researchPartnership - data['visibleMap'] = this.visibleMap - data['visitorCount'] = this.visitorCount - return data - } -} - -export interface ISite { - id: number - siteType: SiteType - coordinate: Coordinates - siteTreeSpecies: Sitetreespecies[] - contact: Contact - announcement: Announcement - image: Asset - name: string - isPublic?: boolean - description?: string | undefined - size?: string | undefined - researchPartnership?: boolean | undefined - visibleMap?: boolean | undefined - visitorCount?: number | undefined - - [key: string]: any -} - -export class SiteAdmin implements ISiteAdmin { - user!: User; - - [key: string]: any - - constructor(data?: ISiteAdmin) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.user = new User() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.user = _data['user'] ? User.fromJS(_data['user']) : new User() - } - } - - static fromJS(data: any): SiteAdmin { - data = typeof data === 'object' ? data : {} - let result = new SiteAdmin() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['user'] = this.user ? this.user.toJSON() : undefined - return data - } -} - -export interface ISiteAdmin { - user: User - - [key: string]: any -} - -export class SiteMap implements ISiteMap { - readonly id!: number - name!: string - siteType!: SiteType - readonly coordinates!: CoordinatesMap - image!: Asset; - - [key: string]: any - - constructor(data?: ISiteMap) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.siteType = new SiteType() - this.coordinates = new CoordinatesMap() - this.image = new Asset() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.name = _data['name'] - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - ;( this).coordinates = _data['coordinates'] - ? CoordinatesMap.fromJS(_data['coordinates']) - : new CoordinatesMap() - this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() - } - } - - static fromJS(data: any): SiteMap { - data = typeof data === 'object' ? data : {} - let result = new SiteMap() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['name'] = this.name - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['coordinates'] = this.coordinates ? this.coordinates.toJSON() : undefined - data['image'] = this.image ? this.image.toJSON() : undefined - return data - } -} - -export interface ISiteMap { - id: number - name: string - siteType: SiteType - coordinates: CoordinatesMap - image: Asset - - [key: string]: any -} - -export class SiteName implements ISiteName { - readonly id!: number - name!: string; - - [key: string]: any - - constructor(data?: ISiteName) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.name = _data['name'] - } - } - - static fromJS(data: any): SiteName { - data = typeof data === 'object' ? data : {} - let result = new SiteName() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['name'] = this.name - return data - } -} - -export interface ISiteName { - id: number - name: string - - [key: string]: any -} - -export class SiteOverview implements ISiteOverview { - readonly id!: number - name!: string - image!: Asset; - - [key: string]: any - - constructor(data?: ISiteOverview) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.image = new Asset() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.name = _data['name'] - this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() - } - } - - static fromJS(data: any): SiteOverview { - data = typeof data === 'object' ? data : {} - let result = new SiteOverview() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['name'] = this.name - data['image'] = this.image ? this.image.toJSON() : undefined - return data - } -} - -export interface ISiteOverview { - id: number - name: string - image: Asset - - [key: string]: any -} - -export class SiteSocial implements ISiteSocial { - readonly id!: number - name!: string - isPublic?: boolean - siteType!: SiteType - image!: Asset - description?: string | undefined - contact!: Contact - announcement!: Announcement - readonly sponsors!: BatchSponsor[] - readonly widget!: Widget[]; - - [key: string]: any - - constructor(data?: ISiteSocial) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.siteType = new SiteType() - this.image = new Asset() - this.contact = new Contact() - this.announcement = new Announcement() - this.sponsors = [] - this.widget = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.name = _data['name'] - this.isPublic = _data['isPublic'] - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() - this.description = _data['description'] - this.contact = _data['contact'] ? Contact.fromJS(_data['contact']) : new Contact() - this.announcement = _data['announcement'] - ? Announcement.fromJS(_data['announcement']) - : new Announcement() - if (Array.isArray(_data['sponsors'])) { - ;( this).sponsors = [] as any - for (let item of _data['sponsors']) { - ;( this).sponsors!.push(BatchSponsor.fromJS(item)) - } - } - if (Array.isArray(_data['widget'])) { - ;( this).widget = [] as any - for (let item of _data['widget']) { - ;( this).widget!.push(Widget.fromJS(item)) - } - } - } - } - - static fromJS(data: any): SiteSocial { - data = typeof data === 'object' ? data : {} - let result = new SiteSocial() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['name'] = this.name - data['isPublic'] = this.isPublic - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['image'] = this.image ? this.image.toJSON() : undefined - data['description'] = this.description - data['contact'] = this.contact ? this.contact.toJSON() : undefined - data['announcement'] = this.announcement ? this.announcement.toJSON() : undefined - if (Array.isArray(this.sponsors)) { - data['sponsors'] = [] - for (let item of this.sponsors) { - data['sponsors'].push(item.toJSON()) - } - } - if (Array.isArray(this.widget)) { - data['widget'] = [] - for (let item of this.widget) { - data['widget'].push(item.toJSON()) - } - } - return data - } -} - -export interface ISiteSocial { - id: number - name: string - isPublic?: boolean - siteType: SiteType - image: Asset - description?: string | undefined - contact: Contact - announcement: Announcement - sponsors: BatchSponsor[] - widget: Widget[] - - [key: string]: any -} - -export class SiteSummary implements ISiteSummary { - readonly id!: number - name!: string - coordinate!: Coordinates - siteType!: SiteType - readonly plantCount!: number - readonly sponsorProgress!: number - readonly survivedCount!: number - readonly propagationCount!: number - visitorCount?: number | undefined - admins!: SiteAdmin[] - readonly batches!: BatchDetail[]; - - [key: string]: any - - constructor(data?: ISiteSummary) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.coordinate = new Coordinates() - this.siteType = new SiteType() - this.admins = [] - this.batches = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.name = _data['name'] - this.coordinate = _data['coordinate'] - ? Coordinates.fromJS(_data['coordinate']) - : new Coordinates() - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - ;( this).plantCount = _data['plantCount'] - ;( this).sponsorProgress = _data['sponsorProgress'] - ;( this).survivedCount = _data['survivedCount'] - ;( this).propagationCount = _data['propagationCount'] - this.visitorCount = _data['visitorCount'] - if (Array.isArray(_data['admins'])) { - this.admins = [] as any - for (let item of _data['admins']) { - this.admins!.push(SiteAdmin.fromJS(item)) - } - } - if (Array.isArray(_data['batches'])) { - ;( this).batches = [] as any - for (let item of _data['batches']) { - ;( this).batches!.push(BatchDetail.fromJS(item)) - } - } - } - } - - static fromJS(data: any): SiteSummary { - data = typeof data === 'object' ? data : {} - let result = new SiteSummary() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['name'] = this.name - data['coordinate'] = this.coordinate ? this.coordinate.toJSON() : undefined - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['plantCount'] = this.plantCount - data['sponsorProgress'] = this.sponsorProgress - data['survivedCount'] = this.survivedCount - data['propagationCount'] = this.propagationCount - data['visitorCount'] = this.visitorCount - if (Array.isArray(this.admins)) { - data['admins'] = [] - for (let item of this.admins) { - data['admins'].push(item.toJSON()) - } - } - if (Array.isArray(this.batches)) { - data['batches'] = [] - for (let item of this.batches) { - data['batches'].push(item.toJSON()) - } - } - return data - } -} - -export interface ISiteSummary { - id: number - name: string - coordinate: Coordinates - siteType: SiteType - plantCount: number - sponsorProgress: number - survivedCount: number - propagationCount: number - visitorCount?: number | undefined - admins: SiteAdmin[] - batches: BatchDetail[] - - [key: string]: any -} - -export class SiteSummaryDetail implements ISiteSummaryDetail { - readonly id!: number - name!: string - coordinate!: Coordinates - siteType!: SiteType - readonly plantCount!: number - readonly sponsorProgress!: number - readonly survivedCount!: number - readonly propagationCount!: number - visitorCount?: number | undefined - readonly sponsors!: BatchSponsor[] - admins!: SiteAdmin[] - readonly batches!: BatchDetail[] - readonly weather!: Weather; - - [key: string]: any - - constructor(data?: ISiteSummaryDetail) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.coordinate = new Coordinates() - this.siteType = new SiteType() - this.sponsors = [] - this.admins = [] - this.batches = [] - this.weather = new Weather() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.name = _data['name'] - this.coordinate = _data['coordinate'] - ? Coordinates.fromJS(_data['coordinate']) - : new Coordinates() - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - ;( this).plantCount = _data['plantCount'] - ;( this).sponsorProgress = _data['sponsorProgress'] - ;( this).survivedCount = _data['survivedCount'] - ;( this).propagationCount = _data['propagationCount'] - this.visitorCount = _data['visitorCount'] - if (Array.isArray(_data['sponsors'])) { - ;( this).sponsors = [] as any - for (let item of _data['sponsors']) { - ;( this).sponsors!.push(BatchSponsor.fromJS(item)) - } - } - if (Array.isArray(_data['admins'])) { - this.admins = [] as any - for (let item of _data['admins']) { - this.admins!.push(SiteAdmin.fromJS(item)) - } - } - if (Array.isArray(_data['batches'])) { - ;( this).batches = [] as any - for (let item of _data['batches']) { - ;( this).batches!.push(BatchDetail.fromJS(item)) - } - } - ;( this).weather = _data['weather'] ? Weather.fromJS(_data['weather']) : new Weather() - } - } - - static fromJS(data: any): SiteSummaryDetail { - data = typeof data === 'object' ? data : {} - let result = new SiteSummaryDetail() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['name'] = this.name - data['coordinate'] = this.coordinate ? this.coordinate.toJSON() : undefined - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['plantCount'] = this.plantCount - data['sponsorProgress'] = this.sponsorProgress - data['survivedCount'] = this.survivedCount - data['propagationCount'] = this.propagationCount - data['visitorCount'] = this.visitorCount - if (Array.isArray(this.sponsors)) { - data['sponsors'] = [] - for (let item of this.sponsors) { - data['sponsors'].push(item.toJSON()) - } - } - if (Array.isArray(this.admins)) { - data['admins'] = [] - for (let item of this.admins) { - data['admins'].push(item.toJSON()) - } - } - if (Array.isArray(this.batches)) { - data['batches'] = [] - for (let item of this.batches) { - data['batches'].push(item.toJSON()) - } - } - data['weather'] = this.weather ? this.weather.toJSON() : undefined - return data - } -} - -export interface ISiteSummaryDetail { - id: number - name: string - coordinate: Coordinates - siteType: SiteType - plantCount: number - sponsorProgress: number - survivedCount: number - propagationCount: number - visitorCount?: number | undefined - sponsors: BatchSponsor[] - admins: SiteAdmin[] - batches: BatchDetail[] - weather: Weather - - [key: string]: any -} - -export class SiteType implements ISiteType { - readonly id!: number - readonly en!: string - readonly fr!: string; - - [key: string]: any - - constructor(data?: ISiteType) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } - } - - static fromJS(data: any): SiteType { - data = typeof data === 'object' ? data : {} - let result = new SiteType() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['en'] = this.en - data['fr'] = this.fr - return data - } -} - -export interface ISiteType { - id: number - en: string - fr: string - - [key: string]: any -} - -export class Sitetreespecies implements ISitetreespecies { - readonly id!: number - quantity!: number - readonly en!: string - readonly fr!: string; - - [key: string]: any - - constructor(data?: ISitetreespecies) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.quantity = _data['quantity'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } - } - - static fromJS(data: any): Sitetreespecies { - data = typeof data === 'object' ? data : {} - let result = new Sitetreespecies() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - data['en'] = this.en - data['fr'] = this.fr - return data - } -} - -export interface ISitetreespecies { - id: number - quantity: number - en: string - fr: string - - [key: string]: any -} - -export class TokenObtainPair implements ITokenObtainPair { - email!: string - password!: string - readonly access!: string - readonly refresh!: string; - - [key: string]: any - - constructor(data?: ITokenObtainPair) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.email = _data['email'] - this.password = _data['password'] - ;( this).access = _data['access'] - ;( this).refresh = _data['refresh'] - } - } - - static fromJS(data: any): TokenObtainPair { - data = typeof data === 'object' ? data : {} - let result = new TokenObtainPair() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['email'] = this.email - data['password'] = this.password - data['access'] = this.access - data['refresh'] = this.refresh - return data - } -} - -export interface ITokenObtainPair { - email: string - password: string - access: string - refresh: string - - [key: string]: any -} - -export class TokenRefresh implements ITokenRefresh { - readonly access!: string - refresh!: string; - - [key: string]: any - - constructor(data?: ITokenRefresh) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).access = _data['access'] - this.refresh = _data['refresh'] - } - } - - static fromJS(data: any): TokenRefresh { - data = typeof data === 'object' ? data : {} - let result = new TokenRefresh() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['access'] = this.access - data['refresh'] = this.refresh - return data - } -} - -export interface ITokenRefresh { - access: string - refresh: string - - [key: string]: any -} - -export class TreeType implements ITreeType { - readonly id!: number - readonly en!: string - readonly fr!: string; - - [key: string]: any - - constructor(data?: ITreeType) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } - } - - static fromJS(data: any): TreeType { - data = typeof data === 'object' ? data : {} - let result = new TreeType() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['en'] = this.en - data['fr'] = this.fr - return data - } -} - -export interface ITreeType { - id: number - en: string - fr: string - - [key: string]: any -} - -export class UpdateSitePublicStatus implements IUpdateSitePublicStatus { - isPublic!: boolean; - - [key: string]: any - - constructor(data?: IUpdateSitePublicStatus) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.isPublic = _data['isPublic'] - } - } - - static fromJS(data: any): UpdateSitePublicStatus { - data = typeof data === 'object' ? data : {} - let result = new UpdateSitePublicStatus() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['isPublic'] = this.isPublic - return data - } -} - -export interface IUpdateSitePublicStatus { - isPublic: boolean - - [key: string]: any -} - -export class User implements IUser { - readonly id!: number - readonly role!: RoleEnum - readonly adminSiteIds!: number[] - readonly followedSiteIds!: number[] - lastLogin?: Date | undefined - /** Designates that this user has all permissions without explicitly assigning them. */ - isSuperuser?: boolean - /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username!: string - firstName?: string - lastName?: string - /** Designates whether the user can log into this admin site. */ - isStaff?: boolean - /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ - isActive?: boolean - dateJoined?: Date - email!: string - /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ - groups?: number[] - /** Specific permissions for this user. */ - userPermissions?: number[]; - - [key: string]: any - - constructor(data?: IUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.adminSiteIds = [] - this.followedSiteIds = [] - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - ;( this).role = _data['role'] - if (Array.isArray(_data['adminSiteIds'])) { - ;( this).adminSiteIds = [] as any - for (let item of _data['adminSiteIds']) { - ;( this).adminSiteIds!.push(item) - } - } - if (Array.isArray(_data['followedSiteIds'])) { - ;( this).followedSiteIds = [] as any - for (let item of _data['followedSiteIds']) { - ;( this).followedSiteIds!.push(item) - } - } - this.lastLogin = _data['lastLogin'] - ? new Date(_data['lastLogin'].toString()) - : undefined - this.isSuperuser = _data['isSuperuser'] - this.username = _data['username'] - this.firstName = _data['firstName'] - this.lastName = _data['lastName'] - this.isStaff = _data['isStaff'] - this.isActive = _data['isActive'] - this.dateJoined = _data['dateJoined'] - ? new Date(_data['dateJoined'].toString()) - : undefined - this.email = _data['email'] - if (Array.isArray(_data['groups'])) { - this.groups = [] as any - for (let item of _data['groups']) { - this.groups!.push(item) - } - } - if (Array.isArray(_data['userPermissions'])) { - this.userPermissions = [] as any - for (let item of _data['userPermissions']) { - this.userPermissions!.push(item) - } - } - } - } - - static fromJS(data: any): User { - data = typeof data === 'object' ? data : {} - let result = new User() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['role'] = this.role - if (Array.isArray(this.adminSiteIds)) { - data['adminSiteIds'] = [] - for (let item of this.adminSiteIds) { - data['adminSiteIds'].push(item) - } - } - if (Array.isArray(this.followedSiteIds)) { - data['followedSiteIds'] = [] - for (let item of this.followedSiteIds) { - data['followedSiteIds'].push(item) - } - } - data['lastLogin'] = this.lastLogin ? this.lastLogin.toISOString() : undefined - data['isSuperuser'] = this.isSuperuser - data['username'] = this.username - data['firstName'] = this.firstName - data['lastName'] = this.lastName - data['isStaff'] = this.isStaff - data['isActive'] = this.isActive - data['dateJoined'] = this.dateJoined ? this.dateJoined.toISOString() : undefined - data['email'] = this.email - if (Array.isArray(this.groups)) { - data['groups'] = [] - for (let item of this.groups) { - data['groups'].push(item) - } - } - if (Array.isArray(this.userPermissions)) { - data['userPermissions'] = [] - for (let item of this.userPermissions) { - data['userPermissions'].push(item) - } - } - return data - } -} - -export interface IUser { - id: number - role: RoleEnum - adminSiteIds: number[] - followedSiteIds: number[] - lastLogin?: Date | undefined - /** Designates that this user has all permissions without explicitly assigning them. */ - isSuperuser?: boolean - /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username: string - firstName?: string - lastName?: string - /** Designates whether the user can log into this admin site. */ - isStaff?: boolean - /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ - isActive?: boolean - dateJoined?: Date - email: string - /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ - groups?: number[] - /** Specific permissions for this user. */ - userPermissions?: number[] - - [key: string]: any -} - -export class UserInvitation implements IUserInvitation { - readonly id!: number - code!: string - email!: string - expiresAt!: Date; - - [key: string]: any - - constructor(data?: IUserInvitation) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.code = _data['code'] - this.email = _data['email'] - this.expiresAt = _data['expiresAt'] - ? new Date(_data['expiresAt'].toString()) - : undefined - } - } - - static fromJS(data: any): UserInvitation { - data = typeof data === 'object' ? data : {} - let result = new UserInvitation() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['code'] = this.code - data['email'] = this.email - data['expiresAt'] = this.expiresAt ? this.expiresAt.toISOString() : undefined - return data - } -} - -export interface IUserInvitation { - id: number - code: string - email: string - expiresAt: Date - - [key: string]: any -} - -export class UserToken implements IUserToken { - token!: TokenRefresh - user!: User; - - [key: string]: any - - constructor(data?: IUserToken) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - if (!data) { - this.token = new TokenRefresh() - this.user = new User() - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.token = _data['token'] ? TokenRefresh.fromJS(_data['token']) : new TokenRefresh() - this.user = _data['user'] ? User.fromJS(_data['user']) : new User() - } - } - - static fromJS(data: any): UserToken { - data = typeof data === 'object' ? data : {} - let result = new UserToken() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['token'] = this.token ? this.token.toJSON() : undefined - data['user'] = this.user ? this.user.toJSON() : undefined - return data - } -} - -export interface IUserToken { - token: TokenRefresh - user: User - - [key: string]: any -} - -export class Weather implements IWeather { - temperature!: string - humidity!: string - description!: string; - - [key: string]: any - - constructor(data?: IWeather) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.temperature = _data['temperature'] - this.humidity = _data['humidity'] - this.description = _data['description'] - } - } - - static fromJS(data: any): Weather { - data = typeof data === 'object' ? data : {} - let result = new Weather() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['temperature'] = this.temperature - data['humidity'] = this.humidity - data['description'] = this.description - return data - } -} - -export interface IWeather { - temperature: string - humidity: string - description: string - - [key: string]: any -} - -export class Widget implements IWidget { - readonly id!: number - title?: string | undefined - body?: string | undefined - site?: number | undefined; - - [key: string]: any - - constructor(data?: IWidget) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - ;( this).id = _data['id'] - this.title = _data['title'] - this.body = _data['body'] - this.site = _data['site'] - } - } - - static fromJS(data: any): Widget { - data = typeof data === 'object' ? data : {} - let result = new Widget() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['title'] = this.title - data['body'] = this.body - data['site'] = this.site - return data - } -} - -export interface IWidget { - id: number - title?: string | undefined - body?: string | undefined - site?: number | undefined - - [key: string]: any -} - -export class Seeds implements ISeeds { - id?: number - quantity?: number; - - [key: string]: any - - constructor(data?: ISeeds) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.id = _data['id'] - this.quantity = _data['quantity'] - } - } - - static fromJS(data: any): Seeds { - data = typeof data === 'object' ? data : {} - let result = new Seeds() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - return data - } -} - -export interface ISeeds { - id?: number - quantity?: number - - [key: string]: any -} - -export class Species implements ISpecies { - id?: number - quantity?: number; - - [key: string]: any - - constructor(data?: ISpecies) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.id = _data['id'] - this.quantity = _data['quantity'] - } - } - - static fromJS(data: any): Species { - data = typeof data === 'object' ? data : {} - let result = new Species() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - return data - } -} - -export interface ISpecies { - id?: number - quantity?: number - - [key: string]: any -} - -export class Seeds2 implements ISeeds2 { - id?: number - quantity?: number; - - [key: string]: any - - constructor(data?: ISeeds2) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.id = _data['id'] - this.quantity = _data['quantity'] - } - } - - static fromJS(data: any): Seeds2 { - data = typeof data === 'object' ? data : {} - let result = new Seeds2() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - return data - } -} - -export interface ISeeds2 { - id?: number - quantity?: number - - [key: string]: any -} - -export class Species2 implements ISpecies2 { - id?: number - quantity?: number; - - [key: string]: any - - constructor(data?: ISpecies2) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.id = _data['id'] - this.quantity = _data['quantity'] - } - } - - static fromJS(data: any): Species2 { - data = typeof data === 'object' ? data : {} - let result = new Species2() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - return data - } -} - -export interface ISpecies2 { - id?: number - quantity?: number - - [key: string]: any -} - -export class Species3 implements ISpecies3 { - id?: number - quantity?: number; - - [key: string]: any - - constructor(data?: ISpecies3) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.id = _data['id'] - this.quantity = _data['quantity'] - } - } - - static fromJS(data: any): Species3 { - data = typeof data === 'object' ? data : {} - let result = new Species3() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - return data - } -} - -export interface ISpecies3 { - id?: number - quantity?: number - - [key: string]: any -} - -export class Species4 implements ISpecies4 { - id?: number - quantity?: number; - - [key: string]: any - - constructor(data?: ISpecies4) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } - } - } - } - - init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.id = _data['id'] - this.quantity = _data['quantity'] - } - } - - static fromJS(data: any): Species4 { - data = typeof data === 'object' ? data : {} - let result = new Species4() - result.init(data) - return result - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {} - for (var property in this) { - if (this.hasOwnProperty(property)) { - data[property] = this[property] - } - } - data['id'] = this.id - data['quantity'] = this.quantity - return data - } -} - -export interface ISpecies4 { - id?: number - quantity?: number - - [key: string]: any -} - -export type Format = 'json' | 'yaml' - -export type Lang = - | 'af' - | 'ar' - | 'ar-dz' - | 'ast' - | 'az' - | 'be' - | 'bg' - | 'bn' - | 'br' - | 'bs' - | 'ca' - | 'ckb' - | 'cs' - | 'cy' - | 'da' - | 'de' - | 'dsb' - | 'el' - | 'en' - | 'en-au' - | 'en-gb' - | 'eo' - | 'es' - | 'es-ar' - | 'es-co' - | 'es-mx' - | 'es-ni' - | 'es-ve' - | 'et' - | 'eu' - | 'fa' - | 'fi' - | 'fr' - | 'fy' - | 'ga' - | 'gd' - | 'gl' - | 'he' - | 'hi' - | 'hr' - | 'hsb' - | 'hu' - | 'hy' - | 'ia' - | 'id' - | 'ig' - | 'io' - | 'is' - | 'it' - | 'ja' - | 'ka' - | 'kab' - | 'kk' - | 'km' - | 'kn' - | 'ko' - | 'ky' - | 'lb' - | 'lt' - | 'lv' - | 'mk' - | 'ml' - | 'mn' - | 'mr' - | 'ms' - | 'my' - | 'nb' - | 'ne' - | 'nl' - | 'nn' - | 'os' - | 'pa' - | 'pl' - | 'pt' - | 'pt-br' - | 'ro' - | 'ru' - | 'sk' - | 'sl' - | 'sq' - | 'sr' - | 'sr-latn' - | 'sv' - | 'sw' - | 'ta' - | 'te' - | 'tg' - | 'th' - | 'tk' - | 'tr' - | 'tt' - | 'udm' - | 'ug' - | 'uk' - | 'ur' - | 'uz' - | 'vi' - | 'zh-hans' - | 'zh-hant' - -export interface FileParameter { - data: any - fileName: string -} - -export class ApiException extends Error { - override message: string - status: number - response: string - headers: { [key: string]: any } - result: any - - constructor( - message: string, - status: number, - response: string, - headers: { [key: string]: any }, - result: any, - ) { - super() - - this.message = message - this.status = status - this.response = response - this.headers = headers - this.result = result - } - - protected isApiException = true - - static isApiException(obj: any): obj is ApiException { - return obj.isApiException === true - } -} - -function throwException( - message: string, - status: number, - response: string, - headers: { [key: string]: any }, - result?: any, -): any { - if (result !== null && result !== undefined) { - throw result - } else { - throw new ApiException(message, status, response, headers, null) - } -} +// ---------------------- +// +// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +// ---------------------- + +/* tslint:disable */ +/* eslint-disable */ +// ReSharper disable InconsistentNaming + +export class AdminUserSitesClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + all(): Promise { + let url_ = this.baseUrl + '/admin-user-sites/' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(AdminUserSites.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class BatchClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + all(): Promise { + let url_ = this.baseUrl + '/analytics/batches/' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(BatchDetail.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + create( + site?: number | undefined, + name?: string | null | undefined, + sponsorName?: string | null | undefined, + sponsorWebsiteUrl?: string | null | undefined, + sponsorLogo?: FileParameter | null | undefined, + size?: number | null | undefined, + soilCondition?: string | null | undefined, + survivedCount?: number | null | undefined, + replaceCount?: number | null | undefined, + totalPropagation?: number | null | undefined, + image?: FileParameter | null | undefined, + fertilizerIds?: number[] | undefined, + mulchLayerIds?: number[] | undefined, + seeds?: Seeds[] | undefined, + species?: Species[] | undefined, + supportedSpecieIds?: number[] | undefined, + ): Promise { + let url_ = this.baseUrl + '/analytics/batches/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = new FormData() + if (site === null || site === undefined) { + throw new Error("The parameter 'site' cannot be null.") + } else { + content_.append('site', site.toString()) + } + if (name !== null && name !== undefined) { + content_.append('name', name.toString()) + } + if (sponsorName !== null && sponsorName !== undefined) { + content_.append('sponsorName', sponsorName.toString()) + } + if (sponsorWebsiteUrl !== null && sponsorWebsiteUrl !== undefined) { + content_.append('sponsorWebsiteUrl', sponsorWebsiteUrl.toString()) + } + if (sponsorLogo !== null && sponsorLogo !== undefined) { + content_.append( + 'sponsorLogo', + sponsorLogo.data, + sponsorLogo.fileName ? sponsorLogo.fileName : 'sponsorLogo', + ) + } + if (size !== null && size !== undefined) { + content_.append('size', size.toString()) + } + if (soilCondition !== null && soilCondition !== undefined) { + content_.append('soilCondition', soilCondition.toString()) + } + if (survivedCount !== null && survivedCount !== undefined) { + content_.append('survivedCount', survivedCount.toString()) + } + if (replaceCount !== null && replaceCount !== undefined) { + content_.append('replaceCount', replaceCount.toString()) + } + if (totalPropagation !== null && totalPropagation !== undefined) { + content_.append('totalPropagation', totalPropagation.toString()) + } + if (image !== null && image !== undefined) { + content_.append('image', image.data, image.fileName ? image.fileName : 'image') + } + if (fertilizerIds === null || fertilizerIds === undefined) { + throw new Error("The parameter 'fertilizerIds' cannot be null.") + } else { + fertilizerIds.forEach(item_ => content_.append('fertilizerIds', item_.toString())) + } + if (mulchLayerIds === null || mulchLayerIds === undefined) { + throw new Error("The parameter 'mulchLayerIds' cannot be null.") + } else { + mulchLayerIds.forEach(item_ => content_.append('mulchLayerIds', item_.toString())) + } + if (seeds === null || seeds === undefined) { + throw new Error("The parameter 'seeds' cannot be null.") + } else { + seeds.forEach(item_ => content_.append('seeds', item_.toString())) + } + if (species === null || species === undefined) { + throw new Error("The parameter 'species' cannot be null.") + } else { + species.forEach(item_ => content_.append('species', item_.toString())) + } + if (supportedSpecieIds === null || supportedSpecieIds === undefined) { + throw new Error("The parameter 'supportedSpecieIds' cannot be null.") + } else { + supportedSpecieIds.forEach(item_ => content_.append('supportedSpecieIds', item_.toString())) + } + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = BatchDetail.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + update( + batchId: number, + name?: string | null | undefined, + sponsorName?: string | null | undefined, + sponsorWebsiteUrl?: string | null | undefined, + sponsorLogo?: FileParameter | null | undefined, + size?: number | null | undefined, + soilCondition?: string | null | undefined, + survivedCount?: number | null | undefined, + replaceCount?: number | null | undefined, + totalPropagation?: number | null | undefined, + fertilizerIds?: number[] | undefined, + mulchLayerIds?: number[] | undefined, + seeds?: Seeds2[] | undefined, + species?: Species2[] | undefined, + supportedSpecieIds?: number[] | undefined, + ): Promise { + let url_ = this.baseUrl + '/analytics/batches/{batchId}/' + if (batchId === undefined || batchId === null) { + throw new Error("The parameter 'batchId' must be defined.") + } + url_ = url_.replace('{batchId}', encodeURIComponent('' + batchId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = new FormData() + if (name !== null && name !== undefined) { + content_.append('name', name.toString()) + } + if (sponsorName !== null && sponsorName !== undefined) { + content_.append('sponsorName', sponsorName.toString()) + } + if (sponsorWebsiteUrl !== null && sponsorWebsiteUrl !== undefined) { + content_.append('sponsorWebsiteUrl', sponsorWebsiteUrl.toString()) + } + if (sponsorLogo !== null && sponsorLogo !== undefined) { + content_.append( + 'sponsorLogo', + sponsorLogo.data, + sponsorLogo.fileName ? sponsorLogo.fileName : 'sponsorLogo', + ) + } + if (size !== null && size !== undefined) { + content_.append('size', size.toString()) + } + if (soilCondition !== null && soilCondition !== undefined) { + content_.append('soilCondition', soilCondition.toString()) + } + if (survivedCount !== null && survivedCount !== undefined) { + content_.append('survivedCount', survivedCount.toString()) + } + if (replaceCount !== null && replaceCount !== undefined) { + content_.append('replaceCount', replaceCount.toString()) + } + if (totalPropagation !== null && totalPropagation !== undefined) { + content_.append('totalPropagation', totalPropagation.toString()) + } + if (fertilizerIds === null || fertilizerIds === undefined) { + throw new Error("The parameter 'fertilizerIds' cannot be null.") + } else { + fertilizerIds.forEach(item_ => content_.append('fertilizerIds', item_.toString())) + } + if (mulchLayerIds === null || mulchLayerIds === undefined) { + throw new Error("The parameter 'mulchLayerIds' cannot be null.") + } else { + mulchLayerIds.forEach(item_ => content_.append('mulchLayerIds', item_.toString())) + } + if (seeds === null || seeds === undefined) { + throw new Error("The parameter 'seeds' cannot be null.") + } else { + seeds.forEach(item_ => content_.append('seeds', item_.toString())) + } + if (species === null || species === undefined) { + throw new Error("The parameter 'species' cannot be null.") + } else { + species.forEach(item_ => content_.append('species', item_.toString())) + } + if (supportedSpecieIds === null || supportedSpecieIds === undefined) { + throw new Error("The parameter 'supportedSpecieIds' cannot be null.") + } else { + supportedSpecieIds.forEach(item_ => content_.append('supportedSpecieIds', item_.toString())) + } + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdate(_response) + }) + } + + protected processUpdate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = BatchDetail.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + delete(batchId: number): Promise { + let url_ = this.baseUrl + '/analytics/batches/{batchId}/' + if (batchId === undefined || batchId === null) { + throw new Error("The parameter 'batchId' must be defined.") + } + url_ = url_.replace('{batchId}', encodeURIComponent('' + batchId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDelete(_response) + }) + } + + protected processDelete(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 204) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class FertilizerClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + allTypes(): Promise { + let url_ = this.baseUrl + '/analytics/fertilizers' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAllTypes(_response) + }) + } + + protected processAllTypes(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(FertilizerType.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class MulchLayerClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + allTypes(): Promise { + let url_ = this.baseUrl + '/analytics/mulch-layers' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAllTypes(_response) + }) + } + + protected processAllTypes(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(MulchLayerType.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class SiteClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + types(): Promise { + let url_ = this.baseUrl + '/analytics/site-types' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processTypes(_response) + }) + } + + protected processTypes(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(SiteType.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + all(): Promise { + let url_ = this.baseUrl + '/analytics/sites/' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(Site.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + create( + name?: string | undefined, + siteType?: number | undefined, + image?: FileParameter | null | undefined, + latitude?: string | undefined, + longitude?: string | undefined, + description?: string | undefined, + size?: number | undefined, + species?: Species3[] | undefined, + researchPartnership?: boolean | undefined, + visibleMap?: boolean | undefined, + ): Promise { + let url_ = this.baseUrl + '/analytics/sites/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = new FormData() + if (name === null || name === undefined) { + throw new Error("The parameter 'name' cannot be null.") + } else { + content_.append('name', name.toString()) + } + if (siteType === null || siteType === undefined) { + throw new Error("The parameter 'siteType' cannot be null.") + } else { + content_.append('siteType', siteType.toString()) + } + if (image !== null && image !== undefined) { + content_.append('image', image.data, image.fileName ? image.fileName : 'image') + } + if (latitude === null || latitude === undefined) { + throw new Error("The parameter 'latitude' cannot be null.") + } else { + content_.append('latitude', latitude.toString()) + } + if (longitude === null || longitude === undefined) { + throw new Error("The parameter 'longitude' cannot be null.") + } else { + content_.append('longitude', longitude.toString()) + } + if (description === null || description === undefined) { + throw new Error("The parameter 'description' cannot be null.") + } else { + content_.append('description', description.toString()) + } + if (size === null || size === undefined) { + throw new Error("The parameter 'size' cannot be null.") + } else { + content_.append('size', size.toString()) + } + if (species === null || species === undefined) { + throw new Error("The parameter 'species' cannot be null.") + } else { + species.forEach(item_ => content_.append('species', item_.toString())) + } + if (researchPartnership === null || researchPartnership === undefined) { + throw new Error("The parameter 'researchPartnership' cannot be null.") + } else { + content_.append('researchPartnership', researchPartnership.toString()) + } + if (visibleMap === null || visibleMap === undefined) { + throw new Error("The parameter 'visibleMap' cannot be null.") + } else { + content_.append('visibleMap', visibleMap.toString()) + } + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = Site.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + detail(siteId: number): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDetail(_response) + }) + } + + protected processDetail(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = Site.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + update( + siteId: number, + name?: string | undefined, + siteType?: number | undefined, + image?: FileParameter | null | undefined, + latitude?: string | undefined, + longitude?: string | undefined, + description?: string | undefined, + size?: number | undefined, + species?: Species4[] | undefined, + researchPartnership?: boolean | undefined, + visibleMap?: boolean | undefined, + ): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = new FormData() + if (name === null || name === undefined) { + throw new Error("The parameter 'name' cannot be null.") + } else { + content_.append('name', name.toString()) + } + if (siteType === null || siteType === undefined) { + throw new Error("The parameter 'siteType' cannot be null.") + } else { + content_.append('siteType', siteType.toString()) + } + if (image !== null && image !== undefined) { + content_.append('image', image.data, image.fileName ? image.fileName : 'image') + } + if (latitude === null || latitude === undefined) { + throw new Error("The parameter 'latitude' cannot be null.") + } else { + content_.append('latitude', latitude.toString()) + } + if (longitude === null || longitude === undefined) { + throw new Error("The parameter 'longitude' cannot be null.") + } else { + content_.append('longitude', longitude.toString()) + } + if (description === null || description === undefined) { + throw new Error("The parameter 'description' cannot be null.") + } else { + content_.append('description', description.toString()) + } + if (size === null || size === undefined) { + throw new Error("The parameter 'size' cannot be null.") + } else { + content_.append('size', size.toString()) + } + if (species === null || species === undefined) { + throw new Error("The parameter 'species' cannot be null.") + } else { + species.forEach(item_ => content_.append('species', item_.toString())) + } + if (researchPartnership === null || researchPartnership === undefined) { + throw new Error("The parameter 'researchPartnership' cannot be null.") + } else { + content_.append('researchPartnership', researchPartnership.toString()) + } + if (visibleMap === null || visibleMap === undefined) { + throw new Error("The parameter 'visibleMap' cannot be null.") + } else { + content_.append('visibleMap', visibleMap.toString()) + } + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdate(_response) + }) + } + + protected processUpdate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = Site.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + delete(siteId: number): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDelete(_response) + }) + } + + protected processDelete(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 204) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + updateAdmins( + siteId: number, + body?: PatchedSiteAdminUpdateRequest | undefined, + ): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/admins' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdateAdmins(_response) + }) + } + + protected processUpdateAdmins(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(SiteAdmin.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + follow(siteId: number): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/followers/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'POST', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processFollow(_response) + }) + } + + protected processFollow(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + unfollow(siteId: number): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/followers/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUnfollow(_response) + }) + } + + protected processUnfollow(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 204) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + isFollowing(siteId: number): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/followers/current-user/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processIsFollowing(_response) + }) + } + + protected processIsFollowing(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = resultData200 !== undefined ? resultData200 : null + + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + summary(siteId: number): Promise { + let url_ = this.baseUrl + '/analytics/sites/{siteId}/summary' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSummary(_response) + }) + } + + protected processSummary(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = SiteSummaryDetail.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + map(): Promise { + let url_ = this.baseUrl + '/map/sites/' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processMap(_response) + }) + } + + protected processMap(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(SiteMap.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + social(siteId: number): Promise { + let url_ = this.baseUrl + '/social/sites/{siteId}/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSocial(_response) + }) + } + + protected processSocial(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = SiteSocial.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class SummaryClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + all(): Promise { + let url_ = this.baseUrl + '/analytics/sites/summary' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(SiteSummary.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class TreeClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + species(): Promise { + let url_ = this.baseUrl + '/analytics/tree-species' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSpecies(_response) + }) + } + + protected processSpecies(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(TreeType.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class SchemaClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + retrieve(format?: Format | undefined, lang?: Lang | undefined): Promise<{ [key: string]: any }> { + let url_ = this.baseUrl + '/api/schema/?' + if (format === null) { + throw new Error("The parameter 'format' cannot be null.") + } else if (format !== undefined) { + url_ += 'format=' + encodeURIComponent('' + format) + '&' + } + if (lang === null) { + throw new Error("The parameter 'lang' cannot be null.") + } else if (lang !== undefined) { + url_ += 'lang=' + encodeURIComponent('' + lang) + '&' + } + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/vnd.oai.openapi', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processRetrieve(_response) + }) + } + + protected processRetrieve(response: Response): Promise<{ [key: string]: any }> { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (resultData200) { + result200 = {} as any + for (let key in resultData200) { + if (resultData200.hasOwnProperty(key)) { + ;( result200)![key] = resultData200[key] !== undefined + ? resultData200[key] + : null + } + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve<{ [key: string]: any }>(null as any) + } +} + +export class AuthenticationClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + login(body: LoginUser): Promise { + let url_ = this.baseUrl + '/auth/login/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processLogin(_response) + }) + } + + protected processLogin(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = UserToken.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + register(body: RegisterUser): Promise { + let url_ = this.baseUrl + '/auth/register/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processRegister(_response) + }) + } + + protected processRegister(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = UserToken.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class TokenClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + create(body: TokenObtainPair): Promise { + let url_ = this.baseUrl + '/auth/token/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = TokenObtainPair.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class RefreshClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + create(body: TokenRefresh): Promise { + let url_ = this.baseUrl + '/auth/token/refresh/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = TokenRefresh.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class ContactClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + update(contactId: number, body?: PatchedContact | undefined): Promise { + let url_ = this.baseUrl + '/social/contacts/{contactId}/' + if (contactId === undefined || contactId === null) { + throw new Error("The parameter 'contactId' must be defined.") + } + url_ = url_.replace('{contactId}', encodeURIComponent('' + contactId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdate(_response) + }) + } + + protected processUpdate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = Contact.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class PostClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + all(page: number, size: number, siteId?: number[] | undefined): Promise { + let url_ = this.baseUrl + '/social/posts/?' + if (page === undefined || page === null) { + throw new Error("The parameter 'page' must be defined and cannot be null.") + } else { + url_ += 'page=' + encodeURIComponent('' + page) + '&' + } + if (size === undefined || size === null) { + throw new Error("The parameter 'size' must be defined and cannot be null.") + } else { + url_ += 'size=' + encodeURIComponent('' + size) + '&' + } + if (siteId === null) { + throw new Error("The parameter 'siteId' cannot be null.") + } else if (siteId !== undefined) { + siteId && siteId.forEach(item => { + url_ += 'siteId=' + encodeURIComponent('' + item) + '&' + }) + } + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = PostPagination.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + create( + site?: number | undefined, + body?: string | undefined, + media?: FileParameter[] | undefined, + ): Promise { + let url_ = this.baseUrl + '/social/posts/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = new FormData() + if (site === null || site === undefined) { + throw new Error("The parameter 'site' cannot be null.") + } else { + content_.append('site', site.toString()) + } + if (body === null || body === undefined) { + throw new Error("The parameter 'body' cannot be null.") + } else { + content_.append('body', body.toString()) + } + if (media === null || media === undefined) { + throw new Error("The parameter 'media' cannot be null.") + } else { + media.forEach(item_ => + content_.append('media', item_.data, item_.fileName ? item_.fileName : 'media') + ) + } + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = Post.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + detail(postId: number): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/' + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDetail(_response) + }) + } + + protected processDetail(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = Post.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + delete(postId: number): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/' + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDelete(_response) + }) + } + + protected processDelete(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 204) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class CommentClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + all(postId: number): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/comments/' + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(Comment.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + create(postId: number, body: CreateComment): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/comments/' + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = Comment.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + delete(commentId: number, postId: number): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/comments/{commentId}/' + if (commentId === undefined || commentId === null) { + throw new Error("The parameter 'commentId' must be defined.") + } + url_ = url_.replace('{commentId}', encodeURIComponent('' + commentId)) + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDelete(_response) + }) + } + + protected processDelete(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 204) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class LikeClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + likePost(postId: number, body?: { [key: string]: any } | undefined): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/likes/' + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processLikePost(_response) + }) + } + + protected processLikePost(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = Like.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + delete(postId: number): Promise { + let url_ = this.baseUrl + '/social/posts/{postId}/likes/' + if (postId === undefined || postId === null) { + throw new Error("The parameter 'postId' must be defined.") + } + url_ = url_.replace('{postId}', encodeURIComponent('' + postId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDelete(_response) + }) + } + + protected processDelete(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = Like.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class AnnouncementClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + update(siteId: number, body?: PatchedAnnouncement | undefined): Promise { + let url_ = this.baseUrl + '/social/sites/{siteId}/announcements/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdate(_response) + }) + } + + protected processUpdate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = Announcement.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class SocialClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + updatePublicStatus( + siteId: number, + body?: PatchedUpdateSitePublicStatus | undefined, + ): Promise { + let url_ = this.baseUrl + '/social/sites/{siteId}/public-status' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdatePublicStatus(_response) + }) + } + + protected processUpdatePublicStatus(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = UpdateSitePublicStatus.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class WidgetClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + create(siteId: number, body?: Widget | undefined): Promise { + let url_ = this.baseUrl + '/social/sites/{siteId}/widgets/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 201) { + return response.text().then(_responseText => { + let result201: any = null + let resultData201 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result201 = Widget.fromJS(resultData201) + return result201 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + update(siteId: number, widgetId: number, body?: PatchedWidget | undefined): Promise { + let url_ = this.baseUrl + '/social/sites/{siteId}/widgets/{widgetId}/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + if (widgetId === undefined || widgetId === null) { + throw new Error("The parameter 'widgetId' must be defined.") + } + url_ = url_.replace('{widgetId}', encodeURIComponent('' + widgetId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdate(_response) + }) + } + + protected processUpdate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = Widget.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + /** + * @return No response body + */ + delete(siteId: number, widgetId: number): Promise { + let url_ = this.baseUrl + '/social/sites/{siteId}/widgets/{widgetId}/' + if (siteId === undefined || siteId === null) { + throw new Error("The parameter 'siteId' must be defined.") + } + url_ = url_.replace('{siteId}', encodeURIComponent('' + siteId)) + if (widgetId === undefined || widgetId === null) { + throw new Error("The parameter 'widgetId' must be defined.") + } + url_ = url_.replace('{widgetId}', encodeURIComponent('' + widgetId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'DELETE', + headers: {}, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDelete(_response) + }) + } + + protected processDelete(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 204) { + return response.text().then(_responseText => { + return + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class UserInvitationClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + create(body: CreateUserInvitation): Promise { + let url_ = this.baseUrl + '/user-invitations/' + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCreate(_response) + }) + } + + protected processCreate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = UserInvitation.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + detail(code: string): Promise { + let url_ = this.baseUrl + '/user-invitations/{code}' + if (code === undefined || code === null) { + throw new Error("The parameter 'code' must be defined.") + } + url_ = url_.replace('{code}', encodeURIComponent('' + code)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDetail(_response) + }) + } + + protected processDetail(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = UserInvitation.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class UserClient { + private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } + private baseUrl: string + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + + constructor( + baseUrl?: string, + http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }, + ) { + this.http = http ? http : window as any + this.baseUrl = baseUrl ?? '' + } + + all(): Promise { + let url_ = this.baseUrl + '/users/' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAll(_response) + }) + } + + protected processAll(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(User.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + detail(userId: number): Promise { + let url_ = this.baseUrl + '/users/{userId}/' + if (userId === undefined || userId === null) { + throw new Error("The parameter 'userId' must be defined.") + } + url_ = url_.replace('{userId}', encodeURIComponent('' + userId)) + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processDetail(_response) + }) + } + + protected processDetail(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = User.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + update(userId: number, body?: PatchedUpdateUser | undefined): Promise { + let url_ = this.baseUrl + '/users/{userId}/' + if (userId === undefined || userId === null) { + throw new Error("The parameter 'userId' must be defined.") + } + url_ = url_.replace('{userId}', encodeURIComponent('' + userId)) + url_ = url_.replace(/[?&]$/, '') + + const content_ = JSON.stringify(body) + + let options_: RequestInit = { + body: content_, + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUpdate(_response) + }) + } + + protected processUpdate(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = User.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + current(): Promise { + let url_ = this.baseUrl + '/users/current_user/' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCurrent(_response) + }) + } + + protected processCurrent(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + result200 = User.fromJS(resultData200) + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } + + allForestStewards(): Promise { + let url_ = this.baseUrl + '/users/forest-stewards' + url_ = url_.replace(/[?&]$/, '') + + let options_: RequestInit = { + method: 'GET', + headers: { + Accept: 'application/json', + }, + } + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAllForestStewards(_response) + }) + } + + protected processAllForestStewards(response: Response): Promise { + const status = response.status + let _headers: any = {} + if (response.headers && response.headers.forEach) { + response.headers.forEach((v: any, k: any) => _headers[k] = v) + } + if (status === 200) { + return response.text().then(_responseText => { + let result200: any = null + let resultData200 = _responseText === '' + ? null + : JSON.parse(_responseText, this.jsonParseReviver) + if (Array.isArray(resultData200)) { + result200 = [] as any + for (let item of resultData200) { + result200!.push(User.fromJS(item)) + } + } else { + result200 = null + } + return result200 + }) + } else if (status !== 200 && status !== 204) { + return response.text().then(_responseText => { + return throwException( + 'An unexpected server error occurred.', + status, + _responseText, + _headers, + ) + }) + } + return Promise.resolve(null as any) + } +} + +export class AdminUserSites implements IAdminUserSites { + readonly id!: number + /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ + username!: string + email!: string + readonly sites!: SiteName[]; + + [key: string]: any + + constructor(data?: IAdminUserSites) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.sites = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.username = _data['username'] + this.email = _data['email'] + if (Array.isArray(_data['sites'])) { + ;( this).sites = [] as any + for (let item of _data['sites']) { + ;( this).sites!.push(SiteName.fromJS(item)) + } + } + } + } + + static fromJS(data: any): AdminUserSites { + data = typeof data === 'object' ? data : {} + let result = new AdminUserSites() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['username'] = this.username + data['email'] = this.email + if (Array.isArray(this.sites)) { + data['sites'] = [] + for (let item of this.sites) { + data['sites'].push(item.toJSON()) + } + } + return data + } +} + +export interface IAdminUserSites { + id: number + /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ + username: string + email: string + sites: SiteName[] + + [key: string]: any +} + +export class Announcement implements IAnnouncement { + readonly id!: number + body?: string | undefined + link?: string | undefined; + + [key: string]: any + + constructor(data?: IAnnouncement) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.body = _data['body'] + this.link = _data['link'] + } + } + + static fromJS(data: any): Announcement { + data = typeof data === 'object' ? data : {} + let result = new Announcement() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['body'] = this.body + data['link'] = this.link + return data + } +} + +export interface IAnnouncement { + id: number + body?: string | undefined + link?: string | undefined + + [key: string]: any +} + +export class Asset implements IAsset { + readonly id!: number + asset!: string; + + [key: string]: any + + constructor(data?: IAsset) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.asset = _data['asset'] + } + } + + static fromJS(data: any): Asset { + data = typeof data === 'object' ? data : {} + let result = new Asset() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['asset'] = this.asset + return data + } +} + +export interface IAsset { + id: number + asset: string + + [key: string]: any +} + +export class BatchDetail implements IBatchDetail { + readonly id!: number + readonly fertilizers!: FertilizerType[] + readonly mulchLayers!: MulchLayerType[] + readonly supportedSpecies!: TreeType[] + readonly seeds!: BatchSeed[] + readonly totalNumberSeeds!: number + readonly species!: BatchSpecies[] + readonly plantCount!: number + readonly sponsor!: BatchSponsor + image?: Asset + readonly createdAt!: Date | undefined + readonly updatedAt!: Date | undefined + name?: string | undefined + size?: number | undefined + soilCondition?: string | undefined + survivedCount?: number | undefined + replaceCount?: number | undefined + totalPropagation?: number | undefined + site!: number; + + [key: string]: any + + constructor(data?: IBatchDetail) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.fertilizers = [] + this.mulchLayers = [] + this.supportedSpecies = [] + this.seeds = [] + this.species = [] + this.sponsor = new BatchSponsor() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + if (Array.isArray(_data['fertilizers'])) { + ;( this).fertilizers = [] as any + for (let item of _data['fertilizers']) { + ;( this).fertilizers!.push(FertilizerType.fromJS(item)) + } + } + if (Array.isArray(_data['mulchLayers'])) { + ;( this).mulchLayers = [] as any + for (let item of _data['mulchLayers']) { + ;( this).mulchLayers!.push(MulchLayerType.fromJS(item)) + } + } + if (Array.isArray(_data['supportedSpecies'])) { + ;( this).supportedSpecies = [] as any + for (let item of _data['supportedSpecies']) { + ;( this).supportedSpecies!.push(TreeType.fromJS(item)) + } + } + if (Array.isArray(_data['seeds'])) { + ;( this).seeds = [] as any + for (let item of _data['seeds']) { + ;( this).seeds!.push(BatchSeed.fromJS(item)) + } + } + ;( this).totalNumberSeeds = _data['totalNumberSeeds'] + if (Array.isArray(_data['species'])) { + ;( this).species = [] as any + for (let item of _data['species']) { + ;( this).species!.push(BatchSpecies.fromJS(item)) + } + } + ;( this).plantCount = _data['plantCount'] + ;( this).sponsor = _data['sponsor'] + ? BatchSponsor.fromJS(_data['sponsor']) + : new BatchSponsor() + this.image = _data['image'] ? Asset.fromJS(_data['image']) : undefined + ;( this).createdAt = _data['createdAt'] + ? new Date(_data['createdAt'].toString()) + : undefined + ;( this).updatedAt = _data['updatedAt'] + ? new Date(_data['updatedAt'].toString()) + : undefined + this.name = _data['name'] + this.size = _data['size'] + this.soilCondition = _data['soilCondition'] + this.survivedCount = _data['survivedCount'] + this.replaceCount = _data['replaceCount'] + this.totalPropagation = _data['totalPropagation'] + this.site = _data['site'] + } + } + + static fromJS(data: any): BatchDetail { + data = typeof data === 'object' ? data : {} + let result = new BatchDetail() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + if (Array.isArray(this.fertilizers)) { + data['fertilizers'] = [] + for (let item of this.fertilizers) { + data['fertilizers'].push(item.toJSON()) + } + } + if (Array.isArray(this.mulchLayers)) { + data['mulchLayers'] = [] + for (let item of this.mulchLayers) { + data['mulchLayers'].push(item.toJSON()) + } + } + if (Array.isArray(this.supportedSpecies)) { + data['supportedSpecies'] = [] + for (let item of this.supportedSpecies) { + data['supportedSpecies'].push(item.toJSON()) + } + } + if (Array.isArray(this.seeds)) { + data['seeds'] = [] + for (let item of this.seeds) { + data['seeds'].push(item.toJSON()) + } + } + data['totalNumberSeeds'] = this.totalNumberSeeds + if (Array.isArray(this.species)) { + data['species'] = [] + for (let item of this.species) { + data['species'].push(item.toJSON()) + } + } + data['plantCount'] = this.plantCount + data['sponsor'] = this.sponsor ? this.sponsor.toJSON() : undefined + data['image'] = this.image ? this.image.toJSON() : undefined + data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined + data['updatedAt'] = this.updatedAt ? this.updatedAt.toISOString() : undefined + data['name'] = this.name + data['size'] = this.size + data['soilCondition'] = this.soilCondition + data['survivedCount'] = this.survivedCount + data['replaceCount'] = this.replaceCount + data['totalPropagation'] = this.totalPropagation + data['site'] = this.site + return data + } +} + +export interface IBatchDetail { + id: number + fertilizers: FertilizerType[] + mulchLayers: MulchLayerType[] + supportedSpecies: TreeType[] + seeds: BatchSeed[] + totalNumberSeeds: number + species: BatchSpecies[] + plantCount: number + sponsor: BatchSponsor + image?: Asset + createdAt: Date | undefined + updatedAt: Date | undefined + name?: string | undefined + size?: number | undefined + soilCondition?: string | undefined + survivedCount?: number | undefined + replaceCount?: number | undefined + totalPropagation?: number | undefined + site: number + + [key: string]: any +} + +export class BatchSeed implements IBatchSeed { + readonly id!: number + quantity!: number + readonly treeType!: TreeType; + + [key: string]: any + + constructor(data?: IBatchSeed) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.treeType = new TreeType() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.quantity = _data['quantity'] + ;( this).treeType = _data['treeType'] + ? TreeType.fromJS(_data['treeType']) + : new TreeType() + } + } + + static fromJS(data: any): BatchSeed { + data = typeof data === 'object' ? data : {} + let result = new BatchSeed() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + data['treeType'] = this.treeType ? this.treeType.toJSON() : undefined + return data + } +} + +export interface IBatchSeed { + id: number + quantity: number + treeType: TreeType + + [key: string]: any +} + +export class BatchSpecies implements IBatchSpecies { + readonly id!: number + quantity!: number + readonly treeType!: TreeType; + + [key: string]: any + + constructor(data?: IBatchSpecies) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.treeType = new TreeType() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.quantity = _data['quantity'] + ;( this).treeType = _data['treeType'] + ? TreeType.fromJS(_data['treeType']) + : new TreeType() + } + } + + static fromJS(data: any): BatchSpecies { + data = typeof data === 'object' ? data : {} + let result = new BatchSpecies() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + data['treeType'] = this.treeType ? this.treeType.toJSON() : undefined + return data + } +} + +export interface IBatchSpecies { + id: number + quantity: number + treeType: TreeType + + [key: string]: any +} + +export class BatchSponsor implements IBatchSponsor { + readonly id!: number + logo!: Asset + name!: string + url!: string; + + [key: string]: any + + constructor(data?: IBatchSponsor) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.logo = new Asset() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.logo = _data['logo'] ? Asset.fromJS(_data['logo']) : new Asset() + this.name = _data['name'] + this.url = _data['url'] + } + } + + static fromJS(data: any): BatchSponsor { + data = typeof data === 'object' ? data : {} + let result = new BatchSponsor() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['logo'] = this.logo ? this.logo.toJSON() : undefined + data['name'] = this.name + data['url'] = this.url + return data + } +} + +export interface IBatchSponsor { + id: number + logo: Asset + name: string + url: string + + [key: string]: any +} + +export class ChangePassword implements IChangePassword { + currentPassword!: string + newPassword!: string + newPasswordConfirmation!: string; + + [key: string]: any + + constructor(data?: IChangePassword) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.currentPassword = _data['currentPassword'] + this.newPassword = _data['newPassword'] + this.newPasswordConfirmation = _data['newPasswordConfirmation'] + } + } + + static fromJS(data: any): ChangePassword { + data = typeof data === 'object' ? data : {} + let result = new ChangePassword() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['currentPassword'] = this.currentPassword + data['newPassword'] = this.newPassword + data['newPasswordConfirmation'] = this.newPasswordConfirmation + return data + } +} + +export interface IChangePassword { + currentPassword: string + newPassword: string + newPasswordConfirmation: string + + [key: string]: any +} + +export class Comment implements IComment { + readonly id!: number + body!: string + readonly authorId!: number + readonly authorUsername!: string + readonly createdAt!: Date; + + [key: string]: any + + constructor(data?: IComment) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.body = _data['body'] + ;( this).authorId = _data['authorId'] + ;( this).authorUsername = _data['authorUsername'] + ;( this).createdAt = _data['createdAt'] + ? new Date(_data['createdAt'].toString()) + : undefined + } + } + + static fromJS(data: any): Comment { + data = typeof data === 'object' ? data : {} + let result = new Comment() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['body'] = this.body + data['authorId'] = this.authorId + data['authorUsername'] = this.authorUsername + data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined + return data + } +} + +export interface IComment { + id: number + body: string + authorId: number + authorUsername: string + createdAt: Date + + [key: string]: any +} + +export class Contact implements IContact { + readonly id!: number + address?: string | undefined + email?: string | undefined + phone?: string | undefined + facebookLink?: string | undefined + xLink?: string | undefined + instagramLink?: string | undefined + linkedinLink?: string | undefined; + + [key: string]: any + + constructor(data?: IContact) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.address = _data['address'] + this.email = _data['email'] + this.phone = _data['phone'] + this.facebookLink = _data['facebookLink'] + this.xLink = _data['xLink'] + this.instagramLink = _data['instagramLink'] + this.linkedinLink = _data['linkedinLink'] + } + } + + static fromJS(data: any): Contact { + data = typeof data === 'object' ? data : {} + let result = new Contact() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['address'] = this.address + data['email'] = this.email + data['phone'] = this.phone + data['facebookLink'] = this.facebookLink + data['xLink'] = this.xLink + data['instagramLink'] = this.instagramLink + data['linkedinLink'] = this.linkedinLink + return data + } +} + +export interface IContact { + id: number + address?: string | undefined + email?: string | undefined + phone?: string | undefined + facebookLink?: string | undefined + xLink?: string | undefined + instagramLink?: string | undefined + linkedinLink?: string | undefined + + [key: string]: any +} + +export class Coordinates implements ICoordinates { + readonly id!: number + dmsLatitude?: string | undefined + dmsLongitude?: string | undefined + ddLatitude?: string | undefined + ddLongitude?: string | undefined + address?: string | undefined; + + [key: string]: any + + constructor(data?: ICoordinates) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.dmsLatitude = _data['dmsLatitude'] + this.dmsLongitude = _data['dmsLongitude'] + this.ddLatitude = _data['ddLatitude'] + this.ddLongitude = _data['ddLongitude'] + this.address = _data['address'] + } + } + + static fromJS(data: any): Coordinates { + data = typeof data === 'object' ? data : {} + let result = new Coordinates() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['dmsLatitude'] = this.dmsLatitude + data['dmsLongitude'] = this.dmsLongitude + data['ddLatitude'] = this.ddLatitude + data['ddLongitude'] = this.ddLongitude + data['address'] = this.address + return data + } +} + +export interface ICoordinates { + id: number + dmsLatitude?: string | undefined + dmsLongitude?: string | undefined + ddLatitude?: string | undefined + ddLongitude?: string | undefined + address?: string | undefined + + [key: string]: any +} + +export class CoordinatesMap implements ICoordinatesMap { + readonly latitude!: number | undefined + readonly longitude!: number | undefined + address?: string | undefined; + + [key: string]: any + + constructor(data?: ICoordinatesMap) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).latitude = _data['latitude'] + ;( this).longitude = _data['longitude'] + this.address = _data['address'] + } + } + + static fromJS(data: any): CoordinatesMap { + data = typeof data === 'object' ? data : {} + let result = new CoordinatesMap() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['latitude'] = this.latitude + data['longitude'] = this.longitude + data['address'] = this.address + return data + } +} + +export interface ICoordinatesMap { + latitude: number | undefined + longitude: number | undefined + address?: string | undefined + + [key: string]: any +} + +export class CreateComment implements ICreateComment { + body!: string; + + [key: string]: any + + constructor(data?: ICreateComment) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.body = _data['body'] + } + } + + static fromJS(data: any): CreateComment { + data = typeof data === 'object' ? data : {} + let result = new CreateComment() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['body'] = this.body + return data + } +} + +export interface ICreateComment { + body: string + + [key: string]: any +} + +export class CreateUserInvitation implements ICreateUserInvitation { + siteIds!: number[] + email!: string; + + [key: string]: any + + constructor(data?: ICreateUserInvitation) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.siteIds = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + if (Array.isArray(_data['siteIds'])) { + this.siteIds = [] as any + for (let item of _data['siteIds']) { + this.siteIds!.push(item) + } + } + this.email = _data['email'] + } + } + + static fromJS(data: any): CreateUserInvitation { + data = typeof data === 'object' ? data : {} + let result = new CreateUserInvitation() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + if (Array.isArray(this.siteIds)) { + data['siteIds'] = [] + for (let item of this.siteIds) { + data['siteIds'].push(item) + } + } + data['email'] = this.email + return data + } +} + +export interface ICreateUserInvitation { + siteIds: number[] + email: string + + [key: string]: any +} + +export class FertilizerType implements IFertilizerType { + readonly id!: number + readonly en!: string + readonly fr!: string; + + [key: string]: any + + constructor(data?: IFertilizerType) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + ;( this).en = _data['en'] + ;( this).fr = _data['fr'] + } + } + + static fromJS(data: any): FertilizerType { + data = typeof data === 'object' ? data : {} + let result = new FertilizerType() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['en'] = this.en + data['fr'] = this.fr + return data + } +} + +export interface IFertilizerType { + id: number + en: string + fr: string + + [key: string]: any +} + +export class Like implements ILike { + readonly id!: number + user!: number + post!: number; + + [key: string]: any + + constructor(data?: ILike) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.user = _data['user'] + this.post = _data['post'] + } + } + + static fromJS(data: any): Like { + data = typeof data === 'object' ? data : {} + let result = new Like() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['user'] = this.user + data['post'] = this.post + return data + } +} + +export interface ILike { + id: number + user: number + post: number + + [key: string]: any +} + +export class LoginUser implements ILoginUser { + email!: string + password!: string; + + [key: string]: any + + constructor(data?: ILoginUser) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.email = _data['email'] + this.password = _data['password'] + } + } + + static fromJS(data: any): LoginUser { + data = typeof data === 'object' ? data : {} + let result = new LoginUser() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['email'] = this.email + data['password'] = this.password + return data + } +} + +export interface ILoginUser { + email: string + password: string + + [key: string]: any +} + +export class MulchLayerType implements IMulchLayerType { + readonly id!: number + readonly en!: string + readonly fr!: string; + + [key: string]: any + + constructor(data?: IMulchLayerType) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + ;( this).en = _data['en'] + ;( this).fr = _data['fr'] + } + } + + static fromJS(data: any): MulchLayerType { + data = typeof data === 'object' ? data : {} + let result = new MulchLayerType() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['en'] = this.en + data['fr'] = this.fr + return data + } +} + +export interface IMulchLayerType { + id: number + en: string + fr: string + + [key: string]: any +} + +export class PatchedAnnouncement implements IPatchedAnnouncement { + readonly id?: number + body?: string | undefined + link?: string | undefined; + + [key: string]: any + + constructor(data?: IPatchedAnnouncement) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.body = _data['body'] + this.link = _data['link'] + } + } + + static fromJS(data: any): PatchedAnnouncement { + data = typeof data === 'object' ? data : {} + let result = new PatchedAnnouncement() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['body'] = this.body + data['link'] = this.link + return data + } +} + +export interface IPatchedAnnouncement { + id?: number + body?: string | undefined + link?: string | undefined + + [key: string]: any +} + +export class PatchedContact implements IPatchedContact { + readonly id?: number + address?: string | undefined + email?: string | undefined + phone?: string | undefined + facebookLink?: string | undefined + xLink?: string | undefined + instagramLink?: string | undefined + linkedinLink?: string | undefined; + + [key: string]: any + + constructor(data?: IPatchedContact) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.address = _data['address'] + this.email = _data['email'] + this.phone = _data['phone'] + this.facebookLink = _data['facebookLink'] + this.xLink = _data['xLink'] + this.instagramLink = _data['instagramLink'] + this.linkedinLink = _data['linkedinLink'] + } + } + + static fromJS(data: any): PatchedContact { + data = typeof data === 'object' ? data : {} + let result = new PatchedContact() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['address'] = this.address + data['email'] = this.email + data['phone'] = this.phone + data['facebookLink'] = this.facebookLink + data['xLink'] = this.xLink + data['instagramLink'] = this.instagramLink + data['linkedinLink'] = this.linkedinLink + return data + } +} + +export interface IPatchedContact { + id?: number + address?: string | undefined + email?: string | undefined + phone?: string | undefined + facebookLink?: string | undefined + xLink?: string | undefined + instagramLink?: string | undefined + linkedinLink?: string | undefined + + [key: string]: any +} + +export class PatchedSiteAdminUpdateRequest implements IPatchedSiteAdminUpdateRequest { + ids?: number[]; + + [key: string]: any + + constructor(data?: IPatchedSiteAdminUpdateRequest) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + if (Array.isArray(_data['ids'])) { + this.ids = [] as any + for (let item of _data['ids']) { + this.ids!.push(item) + } + } + } + } + + static fromJS(data: any): PatchedSiteAdminUpdateRequest { + data = typeof data === 'object' ? data : {} + let result = new PatchedSiteAdminUpdateRequest() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + if (Array.isArray(this.ids)) { + data['ids'] = [] + for (let item of this.ids) { + data['ids'].push(item) + } + } + return data + } +} + +export interface IPatchedSiteAdminUpdateRequest { + ids?: number[] + + [key: string]: any +} + +export class PatchedUpdateSitePublicStatus implements IPatchedUpdateSitePublicStatus { + isPublic?: boolean; + + [key: string]: any + + constructor(data?: IPatchedUpdateSitePublicStatus) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.isPublic = _data['isPublic'] + } + } + + static fromJS(data: any): PatchedUpdateSitePublicStatus { + data = typeof data === 'object' ? data : {} + let result = new PatchedUpdateSitePublicStatus() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['isPublic'] = this.isPublic + return data + } +} + +export interface IPatchedUpdateSitePublicStatus { + isPublic?: boolean + + [key: string]: any +} + +export class PatchedUpdateUser implements IPatchedUpdateUser { + /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ + username?: string + email?: string + changePassword?: ChangePassword; + + [key: string]: any + + constructor(data?: IPatchedUpdateUser) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.username = _data['username'] + this.email = _data['email'] + this.changePassword = _data['changePassword'] + ? ChangePassword.fromJS(_data['changePassword']) + : undefined + } + } + + static fromJS(data: any): PatchedUpdateUser { + data = typeof data === 'object' ? data : {} + let result = new PatchedUpdateUser() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['username'] = this.username + data['email'] = this.email + data['changePassword'] = this.changePassword ? this.changePassword.toJSON() : undefined + return data + } +} + +export interface IPatchedUpdateUser { + /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ + username?: string + email?: string + changePassword?: ChangePassword + + [key: string]: any +} + +export class PatchedWidget implements IPatchedWidget { + readonly id?: number + title?: string | undefined + body?: string | undefined + site?: number | undefined; + + [key: string]: any + + constructor(data?: IPatchedWidget) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.title = _data['title'] + this.body = _data['body'] + this.site = _data['site'] + } + } + + static fromJS(data: any): PatchedWidget { + data = typeof data === 'object' ? data : {} + let result = new PatchedWidget() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['title'] = this.title + data['body'] = this.body + data['site'] = this.site + return data + } +} + +export interface IPatchedWidget { + id?: number + title?: string | undefined + body?: string | undefined + site?: number | undefined + + [key: string]: any +} + +export class Post implements IPost { + readonly id!: number + site!: SiteOverview + readonly createdAt!: Date + body!: string + readonly likeCount!: number + readonly commentCount!: number + readonly hasLiked!: boolean + media!: Asset[]; + + [key: string]: any + + constructor(data?: IPost) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.site = new SiteOverview() + this.media = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.site = _data['site'] ? SiteOverview.fromJS(_data['site']) : new SiteOverview() + ;( this).createdAt = _data['createdAt'] + ? new Date(_data['createdAt'].toString()) + : undefined + this.body = _data['body'] + ;( this).likeCount = _data['likeCount'] + ;( this).commentCount = _data['commentCount'] + ;( this).hasLiked = _data['hasLiked'] + if (Array.isArray(_data['media'])) { + this.media = [] as any + for (let item of _data['media']) { + this.media!.push(Asset.fromJS(item)) + } + } + } + } + + static fromJS(data: any): Post { + data = typeof data === 'object' ? data : {} + let result = new Post() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['site'] = this.site ? this.site.toJSON() : undefined + data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined + data['body'] = this.body + data['likeCount'] = this.likeCount + data['commentCount'] = this.commentCount + data['hasLiked'] = this.hasLiked + if (Array.isArray(this.media)) { + data['media'] = [] + for (let item of this.media) { + data['media'].push(item.toJSON()) + } + } + return data + } +} + +export interface IPost { + id: number + site: SiteOverview + createdAt: Date + body: string + likeCount: number + commentCount: number + hasLiked: boolean + media: Asset[] + + [key: string]: any +} + +export class PostPagination implements IPostPagination { + count!: number + next?: string + previous?: string + results!: Post[]; + + [key: string]: any + + constructor(data?: IPostPagination) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.results = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.count = _data['count'] + this.next = _data['next'] + this.previous = _data['previous'] + if (Array.isArray(_data['results'])) { + this.results = [] as any + for (let item of _data['results']) { + this.results!.push(Post.fromJS(item)) + } + } + } + } + + static fromJS(data: any): PostPagination { + data = typeof data === 'object' ? data : {} + let result = new PostPagination() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['count'] = this.count + data['next'] = this.next + data['previous'] = this.previous + if (Array.isArray(this.results)) { + data['results'] = [] + for (let item of this.results) { + data['results'].push(item.toJSON()) + } + } + return data + } +} + +export interface IPostPagination { + count: number + next?: string + previous?: string + results: Post[] + + [key: string]: any +} + +export class RegisterUser implements IRegisterUser { + username!: string + email!: string + password!: string + passwordConfirmation!: string + code?: string; + + [key: string]: any + + constructor(data?: IRegisterUser) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.username = _data['username'] + this.email = _data['email'] + this.password = _data['password'] + this.passwordConfirmation = _data['passwordConfirmation'] + this.code = _data['code'] + } + } + + static fromJS(data: any): RegisterUser { + data = typeof data === 'object' ? data : {} + let result = new RegisterUser() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['username'] = this.username + data['email'] = this.email + data['password'] = this.password + data['passwordConfirmation'] = this.passwordConfirmation + data['code'] = this.code + return data + } +} + +export interface IRegisterUser { + username: string + email: string + password: string + passwordConfirmation: string + code?: string + + [key: string]: any +} + +export type RoleEnum = 'User' | 'ForestSteward' | 'MegaAdmin' + +export class Site implements ISite { + readonly id!: number + siteType!: SiteType + coordinate!: Coordinates + readonly siteTreeSpecies!: Sitetreespecies[] + contact!: Contact + announcement!: Announcement + image!: Asset + name!: string + isPublic?: boolean + description?: string | undefined + size?: string | undefined + researchPartnership?: boolean | undefined + visibleMap?: boolean | undefined + visitorCount?: number | undefined; + + [key: string]: any + + constructor(data?: ISite) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.siteType = new SiteType() + this.coordinate = new Coordinates() + this.siteTreeSpecies = [] + this.contact = new Contact() + this.announcement = new Announcement() + this.image = new Asset() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() + this.coordinate = _data['coordinate'] + ? Coordinates.fromJS(_data['coordinate']) + : new Coordinates() + if (Array.isArray(_data['siteTreeSpecies'])) { + ;( this).siteTreeSpecies = [] as any + for (let item of _data['siteTreeSpecies']) { + ;( this).siteTreeSpecies!.push(Sitetreespecies.fromJS(item)) + } + } + this.contact = _data['contact'] ? Contact.fromJS(_data['contact']) : new Contact() + this.announcement = _data['announcement'] + ? Announcement.fromJS(_data['announcement']) + : new Announcement() + this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() + this.name = _data['name'] + this.isPublic = _data['isPublic'] + this.description = _data['description'] + this.size = _data['size'] + this.researchPartnership = _data['researchPartnership'] + this.visibleMap = _data['visibleMap'] + this.visitorCount = _data['visitorCount'] + } + } + + static fromJS(data: any): Site { + data = typeof data === 'object' ? data : {} + let result = new Site() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined + data['coordinate'] = this.coordinate ? this.coordinate.toJSON() : undefined + if (Array.isArray(this.siteTreeSpecies)) { + data['siteTreeSpecies'] = [] + for (let item of this.siteTreeSpecies) { + data['siteTreeSpecies'].push(item.toJSON()) + } + } + data['contact'] = this.contact ? this.contact.toJSON() : undefined + data['announcement'] = this.announcement ? this.announcement.toJSON() : undefined + data['image'] = this.image ? this.image.toJSON() : undefined + data['name'] = this.name + data['isPublic'] = this.isPublic + data['description'] = this.description + data['size'] = this.size + data['researchPartnership'] = this.researchPartnership + data['visibleMap'] = this.visibleMap + data['visitorCount'] = this.visitorCount + return data + } +} + +export interface ISite { + id: number + siteType: SiteType + coordinate: Coordinates + siteTreeSpecies: Sitetreespecies[] + contact: Contact + announcement: Announcement + image: Asset + name: string + isPublic?: boolean + description?: string | undefined + size?: string | undefined + researchPartnership?: boolean | undefined + visibleMap?: boolean | undefined + visitorCount?: number | undefined + + [key: string]: any +} + +export class SiteAdmin implements ISiteAdmin { + user!: User; + + [key: string]: any + + constructor(data?: ISiteAdmin) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.user = new User() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.user = _data['user'] ? User.fromJS(_data['user']) : new User() + } + } + + static fromJS(data: any): SiteAdmin { + data = typeof data === 'object' ? data : {} + let result = new SiteAdmin() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['user'] = this.user ? this.user.toJSON() : undefined + return data + } +} + +export interface ISiteAdmin { + user: User + + [key: string]: any +} + +export class SiteMap implements ISiteMap { + readonly id!: number + name!: string + siteType!: SiteType + readonly coordinates!: CoordinatesMap + image!: Asset; + + [key: string]: any + + constructor(data?: ISiteMap) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.siteType = new SiteType() + this.coordinates = new CoordinatesMap() + this.image = new Asset() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.name = _data['name'] + this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() + ;( this).coordinates = _data['coordinates'] + ? CoordinatesMap.fromJS(_data['coordinates']) + : new CoordinatesMap() + this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() + } + } + + static fromJS(data: any): SiteMap { + data = typeof data === 'object' ? data : {} + let result = new SiteMap() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['name'] = this.name + data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined + data['coordinates'] = this.coordinates ? this.coordinates.toJSON() : undefined + data['image'] = this.image ? this.image.toJSON() : undefined + return data + } +} + +export interface ISiteMap { + id: number + name: string + siteType: SiteType + coordinates: CoordinatesMap + image: Asset + + [key: string]: any +} + +export class SiteName implements ISiteName { + readonly id!: number + name!: string; + + [key: string]: any + + constructor(data?: ISiteName) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.name = _data['name'] + } + } + + static fromJS(data: any): SiteName { + data = typeof data === 'object' ? data : {} + let result = new SiteName() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['name'] = this.name + return data + } +} + +export interface ISiteName { + id: number + name: string + + [key: string]: any +} + +export class SiteOverview implements ISiteOverview { + readonly id!: number + name!: string + image!: Asset; + + [key: string]: any + + constructor(data?: ISiteOverview) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.image = new Asset() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.name = _data['name'] + this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() + } + } + + static fromJS(data: any): SiteOverview { + data = typeof data === 'object' ? data : {} + let result = new SiteOverview() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['name'] = this.name + data['image'] = this.image ? this.image.toJSON() : undefined + return data + } +} + +export interface ISiteOverview { + id: number + name: string + image: Asset + + [key: string]: any +} + +export class SiteSocial implements ISiteSocial { + readonly id!: number + name!: string + isPublic?: boolean + siteType!: SiteType + image!: Asset + description?: string | undefined + contact!: Contact + announcement!: Announcement + readonly sponsors!: BatchSponsor[] + readonly widget!: Widget[]; + + [key: string]: any + + constructor(data?: ISiteSocial) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.siteType = new SiteType() + this.image = new Asset() + this.contact = new Contact() + this.announcement = new Announcement() + this.sponsors = [] + this.widget = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.name = _data['name'] + this.isPublic = _data['isPublic'] + this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() + this.image = _data['image'] ? Asset.fromJS(_data['image']) : new Asset() + this.description = _data['description'] + this.contact = _data['contact'] ? Contact.fromJS(_data['contact']) : new Contact() + this.announcement = _data['announcement'] + ? Announcement.fromJS(_data['announcement']) + : new Announcement() + if (Array.isArray(_data['sponsors'])) { + ;( this).sponsors = [] as any + for (let item of _data['sponsors']) { + ;( this).sponsors!.push(BatchSponsor.fromJS(item)) + } + } + if (Array.isArray(_data['widget'])) { + ;( this).widget = [] as any + for (let item of _data['widget']) { + ;( this).widget!.push(Widget.fromJS(item)) + } + } + } + } + + static fromJS(data: any): SiteSocial { + data = typeof data === 'object' ? data : {} + let result = new SiteSocial() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['name'] = this.name + data['isPublic'] = this.isPublic + data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined + data['image'] = this.image ? this.image.toJSON() : undefined + data['description'] = this.description + data['contact'] = this.contact ? this.contact.toJSON() : undefined + data['announcement'] = this.announcement ? this.announcement.toJSON() : undefined + if (Array.isArray(this.sponsors)) { + data['sponsors'] = [] + for (let item of this.sponsors) { + data['sponsors'].push(item.toJSON()) + } + } + if (Array.isArray(this.widget)) { + data['widget'] = [] + for (let item of this.widget) { + data['widget'].push(item.toJSON()) + } + } + return data + } +} + +export interface ISiteSocial { + id: number + name: string + isPublic?: boolean + siteType: SiteType + image: Asset + description?: string | undefined + contact: Contact + announcement: Announcement + sponsors: BatchSponsor[] + widget: Widget[] + + [key: string]: any +} + +export class SiteSummary implements ISiteSummary { + readonly id!: number + name!: string + coordinate!: Coordinates + siteType!: SiteType + readonly plantCount!: number + readonly sponsorProgress!: number + readonly survivedCount!: number + readonly propagationCount!: number + visitorCount?: number | undefined + admins!: SiteAdmin[] + readonly batches!: BatchDetail[]; + + [key: string]: any + + constructor(data?: ISiteSummary) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.coordinate = new Coordinates() + this.siteType = new SiteType() + this.admins = [] + this.batches = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.name = _data['name'] + this.coordinate = _data['coordinate'] + ? Coordinates.fromJS(_data['coordinate']) + : new Coordinates() + this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() + ;( this).plantCount = _data['plantCount'] + ;( this).sponsorProgress = _data['sponsorProgress'] + ;( this).survivedCount = _data['survivedCount'] + ;( this).propagationCount = _data['propagationCount'] + this.visitorCount = _data['visitorCount'] + if (Array.isArray(_data['admins'])) { + this.admins = [] as any + for (let item of _data['admins']) { + this.admins!.push(SiteAdmin.fromJS(item)) + } + } + if (Array.isArray(_data['batches'])) { + ;( this).batches = [] as any + for (let item of _data['batches']) { + ;( this).batches!.push(BatchDetail.fromJS(item)) + } + } + } + } + + static fromJS(data: any): SiteSummary { + data = typeof data === 'object' ? data : {} + let result = new SiteSummary() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['name'] = this.name + data['coordinate'] = this.coordinate ? this.coordinate.toJSON() : undefined + data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined + data['plantCount'] = this.plantCount + data['sponsorProgress'] = this.sponsorProgress + data['survivedCount'] = this.survivedCount + data['propagationCount'] = this.propagationCount + data['visitorCount'] = this.visitorCount + if (Array.isArray(this.admins)) { + data['admins'] = [] + for (let item of this.admins) { + data['admins'].push(item.toJSON()) + } + } + if (Array.isArray(this.batches)) { + data['batches'] = [] + for (let item of this.batches) { + data['batches'].push(item.toJSON()) + } + } + return data + } +} + +export interface ISiteSummary { + id: number + name: string + coordinate: Coordinates + siteType: SiteType + plantCount: number + sponsorProgress: number + survivedCount: number + propagationCount: number + visitorCount?: number | undefined + admins: SiteAdmin[] + batches: BatchDetail[] + + [key: string]: any +} + +export class SiteSummaryDetail implements ISiteSummaryDetail { + readonly id!: number + name!: string + coordinate!: Coordinates + siteType!: SiteType + readonly plantCount!: number + readonly sponsorProgress!: number + readonly survivedCount!: number + readonly propagationCount!: number + visitorCount?: number | undefined + readonly sponsors!: BatchSponsor[] + admins!: SiteAdmin[] + readonly batches!: BatchDetail[] + readonly weather!: Weather; + + [key: string]: any + + constructor(data?: ISiteSummaryDetail) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.coordinate = new Coordinates() + this.siteType = new SiteType() + this.sponsors = [] + this.admins = [] + this.batches = [] + this.weather = new Weather() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.name = _data['name'] + this.coordinate = _data['coordinate'] + ? Coordinates.fromJS(_data['coordinate']) + : new Coordinates() + this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() + ;( this).plantCount = _data['plantCount'] + ;( this).sponsorProgress = _data['sponsorProgress'] + ;( this).survivedCount = _data['survivedCount'] + ;( this).propagationCount = _data['propagationCount'] + this.visitorCount = _data['visitorCount'] + if (Array.isArray(_data['sponsors'])) { + ;( this).sponsors = [] as any + for (let item of _data['sponsors']) { + ;( this).sponsors!.push(BatchSponsor.fromJS(item)) + } + } + if (Array.isArray(_data['admins'])) { + this.admins = [] as any + for (let item of _data['admins']) { + this.admins!.push(SiteAdmin.fromJS(item)) + } + } + if (Array.isArray(_data['batches'])) { + ;( this).batches = [] as any + for (let item of _data['batches']) { + ;( this).batches!.push(BatchDetail.fromJS(item)) + } + } + ;( this).weather = _data['weather'] ? Weather.fromJS(_data['weather']) : new Weather() + } + } + + static fromJS(data: any): SiteSummaryDetail { + data = typeof data === 'object' ? data : {} + let result = new SiteSummaryDetail() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['name'] = this.name + data['coordinate'] = this.coordinate ? this.coordinate.toJSON() : undefined + data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined + data['plantCount'] = this.plantCount + data['sponsorProgress'] = this.sponsorProgress + data['survivedCount'] = this.survivedCount + data['propagationCount'] = this.propagationCount + data['visitorCount'] = this.visitorCount + if (Array.isArray(this.sponsors)) { + data['sponsors'] = [] + for (let item of this.sponsors) { + data['sponsors'].push(item.toJSON()) + } + } + if (Array.isArray(this.admins)) { + data['admins'] = [] + for (let item of this.admins) { + data['admins'].push(item.toJSON()) + } + } + if (Array.isArray(this.batches)) { + data['batches'] = [] + for (let item of this.batches) { + data['batches'].push(item.toJSON()) + } + } + data['weather'] = this.weather ? this.weather.toJSON() : undefined + return data + } +} + +export interface ISiteSummaryDetail { + id: number + name: string + coordinate: Coordinates + siteType: SiteType + plantCount: number + sponsorProgress: number + survivedCount: number + propagationCount: number + visitorCount?: number | undefined + sponsors: BatchSponsor[] + admins: SiteAdmin[] + batches: BatchDetail[] + weather: Weather + + [key: string]: any +} + +export class SiteType implements ISiteType { + readonly id!: number + readonly en!: string + readonly fr!: string; + + [key: string]: any + + constructor(data?: ISiteType) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + ;( this).en = _data['en'] + ;( this).fr = _data['fr'] + } + } + + static fromJS(data: any): SiteType { + data = typeof data === 'object' ? data : {} + let result = new SiteType() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['en'] = this.en + data['fr'] = this.fr + return data + } +} + +export interface ISiteType { + id: number + en: string + fr: string + + [key: string]: any +} + +export class Sitetreespecies implements ISitetreespecies { + readonly id!: number + quantity!: number + readonly en!: string + readonly fr!: string; + + [key: string]: any + + constructor(data?: ISitetreespecies) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.quantity = _data['quantity'] + ;( this).en = _data['en'] + ;( this).fr = _data['fr'] + } + } + + static fromJS(data: any): Sitetreespecies { + data = typeof data === 'object' ? data : {} + let result = new Sitetreespecies() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + data['en'] = this.en + data['fr'] = this.fr + return data + } +} + +export interface ISitetreespecies { + id: number + quantity: number + en: string + fr: string + + [key: string]: any +} + +export class TokenObtainPair implements ITokenObtainPair { + email!: string + password!: string + readonly access!: string + readonly refresh!: string; + + [key: string]: any + + constructor(data?: ITokenObtainPair) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.email = _data['email'] + this.password = _data['password'] + ;( this).access = _data['access'] + ;( this).refresh = _data['refresh'] + } + } + + static fromJS(data: any): TokenObtainPair { + data = typeof data === 'object' ? data : {} + let result = new TokenObtainPair() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['email'] = this.email + data['password'] = this.password + data['access'] = this.access + data['refresh'] = this.refresh + return data + } +} + +export interface ITokenObtainPair { + email: string + password: string + access: string + refresh: string + + [key: string]: any +} + +export class TokenRefresh implements ITokenRefresh { + readonly access!: string + refresh!: string; + + [key: string]: any + + constructor(data?: ITokenRefresh) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).access = _data['access'] + this.refresh = _data['refresh'] + } + } + + static fromJS(data: any): TokenRefresh { + data = typeof data === 'object' ? data : {} + let result = new TokenRefresh() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['access'] = this.access + data['refresh'] = this.refresh + return data + } +} + +export interface ITokenRefresh { + access: string + refresh: string + + [key: string]: any +} + +export class TreeType implements ITreeType { + readonly id!: number + readonly en!: string + readonly fr!: string; + + [key: string]: any + + constructor(data?: ITreeType) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + ;( this).en = _data['en'] + ;( this).fr = _data['fr'] + } + } + + static fromJS(data: any): TreeType { + data = typeof data === 'object' ? data : {} + let result = new TreeType() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['en'] = this.en + data['fr'] = this.fr + return data + } +} + +export interface ITreeType { + id: number + en: string + fr: string + + [key: string]: any +} + +export class UpdateSitePublicStatus implements IUpdateSitePublicStatus { + isPublic!: boolean; + + [key: string]: any + + constructor(data?: IUpdateSitePublicStatus) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.isPublic = _data['isPublic'] + } + } + + static fromJS(data: any): UpdateSitePublicStatus { + data = typeof data === 'object' ? data : {} + let result = new UpdateSitePublicStatus() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['isPublic'] = this.isPublic + return data + } +} + +export interface IUpdateSitePublicStatus { + isPublic: boolean + + [key: string]: any +} + +export class User implements IUser { + readonly id!: number + readonly role!: RoleEnum + readonly adminSiteIds!: number[] + readonly followedSiteIds!: number[] + lastLogin?: Date | undefined + /** Designates that this user has all permissions without explicitly assigning them. */ + isSuperuser?: boolean + /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ + username!: string + firstName?: string + lastName?: string + /** Designates whether the user can log into this admin site. */ + isStaff?: boolean + /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ + isActive?: boolean + dateJoined?: Date + email!: string + /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ + groups?: number[] + /** Specific permissions for this user. */ + userPermissions?: number[]; + + [key: string]: any + + constructor(data?: IUser) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.adminSiteIds = [] + this.followedSiteIds = [] + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + ;( this).role = _data['role'] + if (Array.isArray(_data['adminSiteIds'])) { + ;( this).adminSiteIds = [] as any + for (let item of _data['adminSiteIds']) { + ;( this).adminSiteIds!.push(item) + } + } + if (Array.isArray(_data['followedSiteIds'])) { + ;( this).followedSiteIds = [] as any + for (let item of _data['followedSiteIds']) { + ;( this).followedSiteIds!.push(item) + } + } + this.lastLogin = _data['lastLogin'] + ? new Date(_data['lastLogin'].toString()) + : undefined + this.isSuperuser = _data['isSuperuser'] + this.username = _data['username'] + this.firstName = _data['firstName'] + this.lastName = _data['lastName'] + this.isStaff = _data['isStaff'] + this.isActive = _data['isActive'] + this.dateJoined = _data['dateJoined'] + ? new Date(_data['dateJoined'].toString()) + : undefined + this.email = _data['email'] + if (Array.isArray(_data['groups'])) { + this.groups = [] as any + for (let item of _data['groups']) { + this.groups!.push(item) + } + } + if (Array.isArray(_data['userPermissions'])) { + this.userPermissions = [] as any + for (let item of _data['userPermissions']) { + this.userPermissions!.push(item) + } + } + } + } + + static fromJS(data: any): User { + data = typeof data === 'object' ? data : {} + let result = new User() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['role'] = this.role + if (Array.isArray(this.adminSiteIds)) { + data['adminSiteIds'] = [] + for (let item of this.adminSiteIds) { + data['adminSiteIds'].push(item) + } + } + if (Array.isArray(this.followedSiteIds)) { + data['followedSiteIds'] = [] + for (let item of this.followedSiteIds) { + data['followedSiteIds'].push(item) + } + } + data['lastLogin'] = this.lastLogin ? this.lastLogin.toISOString() : undefined + data['isSuperuser'] = this.isSuperuser + data['username'] = this.username + data['firstName'] = this.firstName + data['lastName'] = this.lastName + data['isStaff'] = this.isStaff + data['isActive'] = this.isActive + data['dateJoined'] = this.dateJoined ? this.dateJoined.toISOString() : undefined + data['email'] = this.email + if (Array.isArray(this.groups)) { + data['groups'] = [] + for (let item of this.groups) { + data['groups'].push(item) + } + } + if (Array.isArray(this.userPermissions)) { + data['userPermissions'] = [] + for (let item of this.userPermissions) { + data['userPermissions'].push(item) + } + } + return data + } +} + +export interface IUser { + id: number + role: RoleEnum + adminSiteIds: number[] + followedSiteIds: number[] + lastLogin?: Date | undefined + /** Designates that this user has all permissions without explicitly assigning them. */ + isSuperuser?: boolean + /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ + username: string + firstName?: string + lastName?: string + /** Designates whether the user can log into this admin site. */ + isStaff?: boolean + /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ + isActive?: boolean + dateJoined?: Date + email: string + /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ + groups?: number[] + /** Specific permissions for this user. */ + userPermissions?: number[] + + [key: string]: any +} + +export class UserInvitation implements IUserInvitation { + readonly id!: number + code!: string + email!: string + expiresAt!: Date; + + [key: string]: any + + constructor(data?: IUserInvitation) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.code = _data['code'] + this.email = _data['email'] + this.expiresAt = _data['expiresAt'] + ? new Date(_data['expiresAt'].toString()) + : undefined + } + } + + static fromJS(data: any): UserInvitation { + data = typeof data === 'object' ? data : {} + let result = new UserInvitation() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['code'] = this.code + data['email'] = this.email + data['expiresAt'] = this.expiresAt ? this.expiresAt.toISOString() : undefined + return data + } +} + +export interface IUserInvitation { + id: number + code: string + email: string + expiresAt: Date + + [key: string]: any +} + +export class UserToken implements IUserToken { + token!: TokenRefresh + user!: User; + + [key: string]: any + + constructor(data?: IUserToken) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + if (!data) { + this.token = new TokenRefresh() + this.user = new User() + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.token = _data['token'] ? TokenRefresh.fromJS(_data['token']) : new TokenRefresh() + this.user = _data['user'] ? User.fromJS(_data['user']) : new User() + } + } + + static fromJS(data: any): UserToken { + data = typeof data === 'object' ? data : {} + let result = new UserToken() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['token'] = this.token ? this.token.toJSON() : undefined + data['user'] = this.user ? this.user.toJSON() : undefined + return data + } +} + +export interface IUserToken { + token: TokenRefresh + user: User + + [key: string]: any +} + +export class Weather implements IWeather { + temperature!: string + humidity!: string + description!: string; + + [key: string]: any + + constructor(data?: IWeather) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.temperature = _data['temperature'] + this.humidity = _data['humidity'] + this.description = _data['description'] + } + } + + static fromJS(data: any): Weather { + data = typeof data === 'object' ? data : {} + let result = new Weather() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['temperature'] = this.temperature + data['humidity'] = this.humidity + data['description'] = this.description + return data + } +} + +export interface IWeather { + temperature: string + humidity: string + description: string + + [key: string]: any +} + +export class Widget implements IWidget { + readonly id!: number + title?: string | undefined + body?: string | undefined + site?: number | undefined; + + [key: string]: any + + constructor(data?: IWidget) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + ;( this).id = _data['id'] + this.title = _data['title'] + this.body = _data['body'] + this.site = _data['site'] + } + } + + static fromJS(data: any): Widget { + data = typeof data === 'object' ? data : {} + let result = new Widget() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['title'] = this.title + data['body'] = this.body + data['site'] = this.site + return data + } +} + +export interface IWidget { + id: number + title?: string | undefined + body?: string | undefined + site?: number | undefined + + [key: string]: any +} + +export class Seeds implements ISeeds { + id?: number + quantity?: number; + + [key: string]: any + + constructor(data?: ISeeds) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.id = _data['id'] + this.quantity = _data['quantity'] + } + } + + static fromJS(data: any): Seeds { + data = typeof data === 'object' ? data : {} + let result = new Seeds() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + return data + } +} + +export interface ISeeds { + id?: number + quantity?: number + + [key: string]: any +} + +export class Species implements ISpecies { + id?: number + quantity?: number; + + [key: string]: any + + constructor(data?: ISpecies) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.id = _data['id'] + this.quantity = _data['quantity'] + } + } + + static fromJS(data: any): Species { + data = typeof data === 'object' ? data : {} + let result = new Species() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + return data + } +} + +export interface ISpecies { + id?: number + quantity?: number + + [key: string]: any +} + +export class Seeds2 implements ISeeds2 { + id?: number + quantity?: number; + + [key: string]: any + + constructor(data?: ISeeds2) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.id = _data['id'] + this.quantity = _data['quantity'] + } + } + + static fromJS(data: any): Seeds2 { + data = typeof data === 'object' ? data : {} + let result = new Seeds2() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + return data + } +} + +export interface ISeeds2 { + id?: number + quantity?: number + + [key: string]: any +} + +export class Species2 implements ISpecies2 { + id?: number + quantity?: number; + + [key: string]: any + + constructor(data?: ISpecies2) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.id = _data['id'] + this.quantity = _data['quantity'] + } + } + + static fromJS(data: any): Species2 { + data = typeof data === 'object' ? data : {} + let result = new Species2() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + return data + } +} + +export interface ISpecies2 { + id?: number + quantity?: number + + [key: string]: any +} + +export class Species3 implements ISpecies3 { + id?: number + quantity?: number; + + [key: string]: any + + constructor(data?: ISpecies3) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.id = _data['id'] + this.quantity = _data['quantity'] + } + } + + static fromJS(data: any): Species3 { + data = typeof data === 'object' ? data : {} + let result = new Species3() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + return data + } +} + +export interface ISpecies3 { + id?: number + quantity?: number + + [key: string]: any +} + +export class Species4 implements ISpecies4 { + id?: number + quantity?: number; + + [key: string]: any + + constructor(data?: ISpecies4) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) { + ;( this)[property] = ( data)[property] + } + } + } + } + + init(_data?: any) { + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) { + this[property] = _data[property] + } + } + this.id = _data['id'] + this.quantity = _data['quantity'] + } + } + + static fromJS(data: any): Species4 { + data = typeof data === 'object' ? data : {} + let result = new Species4() + result.init(data) + return result + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {} + for (var property in this) { + if (this.hasOwnProperty(property)) { + data[property] = this[property] + } + } + data['id'] = this.id + data['quantity'] = this.quantity + return data + } +} + +export interface ISpecies4 { + id?: number + quantity?: number + + [key: string]: any +} + +export type Format = 'json' | 'yaml' + +export type Lang = + | 'af' + | 'ar' + | 'ar-dz' + | 'ast' + | 'az' + | 'be' + | 'bg' + | 'bn' + | 'br' + | 'bs' + | 'ca' + | 'ckb' + | 'cs' + | 'cy' + | 'da' + | 'de' + | 'dsb' + | 'el' + | 'en' + | 'en-au' + | 'en-gb' + | 'eo' + | 'es' + | 'es-ar' + | 'es-co' + | 'es-mx' + | 'es-ni' + | 'es-ve' + | 'et' + | 'eu' + | 'fa' + | 'fi' + | 'fr' + | 'fy' + | 'ga' + | 'gd' + | 'gl' + | 'he' + | 'hi' + | 'hr' + | 'hsb' + | 'hu' + | 'hy' + | 'ia' + | 'id' + | 'ig' + | 'io' + | 'is' + | 'it' + | 'ja' + | 'ka' + | 'kab' + | 'kk' + | 'km' + | 'kn' + | 'ko' + | 'ky' + | 'lb' + | 'lt' + | 'lv' + | 'mk' + | 'ml' + | 'mn' + | 'mr' + | 'ms' + | 'my' + | 'nb' + | 'ne' + | 'nl' + | 'nn' + | 'os' + | 'pa' + | 'pl' + | 'pt' + | 'pt-br' + | 'ro' + | 'ru' + | 'sk' + | 'sl' + | 'sq' + | 'sr' + | 'sr-latn' + | 'sv' + | 'sw' + | 'ta' + | 'te' + | 'tg' + | 'th' + | 'tk' + | 'tr' + | 'tt' + | 'udm' + | 'ug' + | 'uk' + | 'ur' + | 'uz' + | 'vi' + | 'zh-hans' + | 'zh-hant' + +export interface FileParameter { + data: any + fileName: string +} + +export class ApiException extends Error { + override message: string + status: number + response: string + headers: { [key: string]: any } + result: any + + constructor( + message: string, + status: number, + response: string, + headers: { [key: string]: any }, + result: any, + ) { + super() + + this.message = message + this.status = status + this.response = response + this.headers = headers + this.result = result + } + + protected isApiException = true + + static isApiException(obj: any): obj is ApiException { + return obj.isApiException === true + } +} + +function throwException( + message: string, + status: number, + response: string, + headers: { [key: string]: any }, + result?: any, +): any { + if (result !== null && result !== undefined) { + throw result + } else { + throw new ApiException(message, status, response, headers, null) + } +} diff --git a/docs/canopeum.nswag b/docs/canopeum.nswag index 65acc7db9..288368e3a 100644 --- a/docs/canopeum.nswag +++ b/docs/canopeum.nswag @@ -3,7 +3,7 @@ "defaultVariables": null, "documentGenerator": { "fromDocument": { - "url": "../canopeum_frontend/src/config/openapi.yaml", + "url": "../canopeum_frontend/openapi.yaml", "output": null, "newLineBehavior": "Auto" }