diff --git a/canopeum_backend/canopeum_backend/serializers.py b/canopeum_backend/canopeum_backend/serializers.py index 06fdd52a9..815f6fb8d 100644 --- a/canopeum_backend/canopeum_backend/serializers.py +++ b/canopeum_backend/canopeum_backend/serializers.py @@ -17,6 +17,7 @@ Mulchlayertype, Post, Site, + Siteadmin, Sitetreespecies, Sitetype, Treetype, @@ -296,25 +297,47 @@ def get_species(self, obj): return BatchSpeciesSerializer(obj.batchspecies_set.all(), many=True).data +class SiteAdminSerializer(serializers.ModelSerializer): + user_id = serializers.SerializerMethodField() + username = serializers.SerializerMethodField() + + class Meta: + model = Siteadmin + fields = ("id", "user_id", "username") + + @extend_schema_field(str) # pyright: ignore[reportArgumentType] + def get_user_id(self, obj): + return AuthUserSerializer().get_attribute("id") + + @extend_schema_field(str) # pyright: ignore[reportArgumentType] + def get_username(self, obj): + return AuthUserSerializer().get_attribute("username") + + class SiteSummarySerializer(serializers.ModelSerializer): site_type = SiteTypeSerializer() + coordinate = CoordinatesSerializer() plant_count = serializers.SerializerMethodField() survived_count = serializers.SerializerMethodField() propagation_count = serializers.SerializerMethodField() progress = serializers.SerializerMethodField() - sponsor = serializers.SerializerMethodField() + sponsors = serializers.SerializerMethodField() + admins = SiteAdminSerializer(many=True) class Meta: model = Site fields = ( + "id", "name", + "coordinate", "site_type", "plant_count", "survived_count", "propagation_count", "visitor_count", - "sponsor", + "sponsors", "progress", + "admins", ) @extend_schema_field(int) # pyright: ignore[reportArgumentType] @@ -333,9 +356,14 @@ def get_propagation_count(self, obj): def get_progress(self, obj): return self.context.get("progress") - @extend_schema_field(BatchSerializer(many=True)) - def get_sponsor(self, obj): - return BatchSerializer(obj).data.get("sponsor", None) + @extend_schema_field(list[str]) # pyright: ignore[reportArgumentType] + def get_sponsors(self, obj): + return BatchSerializer(obj, many=True).get_attribute("sponsor") + + def get_admins(self, obj): + admins = obj.siteadmin_set.all() + serializer = SiteAdminSerializer(admins, many=True) + return serializer.data class CoordinatesMapSerializer(serializers.ModelSerializer): diff --git a/canopeum_frontend/canopeum-mockoon.json b/canopeum_frontend/canopeum-mockoon.json index df7b60306..d075b03ed 100644 --- a/canopeum_frontend/canopeum-mockoon.json +++ b/canopeum_frontend/canopeum-mockoon.json @@ -588,7 +588,7 @@ "responses": [ { "uuid": "e2a65576-e324-4689-9d73-45df19729b05", - "body": "{\n \"name\": \"{{lorem (int 1 3)}}\",\n \"siteType\": {\n \"id\": {{int 0 6}},\n \"en\": \"{{lorem (int 1 2)}}\",\n \"fr\": \"{{lorem (int 1 2)}}\"\n },\n \"plantCount\": {{int 0 5000}},\n \"survivedCount\": {{int 0 5000}},\n \"propagationCount\": {{int 0 500}},\n \"visitorCount\": {{int 0 500}},\n \"sponsors\": {{{someOf (array (lorem 2) (lorem 2) (lorem 2) (lorem 2) (lorem 2)) 0 5 true}}},\n \"progress\": {{float 0 100}},\n \"image\": \"\"\n}", + "body": "{\n \"id\": \"{{int (int 1 9999)}}\",\n \"name\": \"{{lorem (int 1 3)}}\",\n \"siteType\": {\n \"id\": {{int 0 6}},\n \"en\": \"{{lorem (int 1 2)}}\",\n \"fr\": \"{{lorem (int 1 2)}}\"\n },\n \"coordinate\": {\n \"id\": {{int 1 9999}},\n \"dmsLatitude\": \"{{int 50 60}} {{int 15 30}} {{int 30 60}} {{int 1000 9999}} N\",\n \"dmsLongitude\": \"{{int 50 80}} {{int 20 45}} {{int 10 55}} {{int 1000 9999}} W\",\n \"address\": \"{{faker 'location.city'}}\"\n },\n \"plantCount\": {{int 0 5000}},\n \"survivedCount\": {{int 0 5000}},\n \"propagationCount\": {{int 0 500}},\n \"visitorCount\": {{int 0 500}},\n \"sponsors\": {{{someOf (array (faker 'company.name') (faker 'company.name') (faker 'company.name') (faker 'company.name') (faker 'company.name')) 0 5 true}}},\n \"progress\": {{float 0 100}},\n \"admins\": [\n {{#repeat 1 (int 1 3) comma=true}}\n {\n \"id\": {{int 1 9999}},\n \"userId\": \"{{int 1 9999}}\",\n \"username\": \"{{faker 'person.fullName'}}\"\n }\n {{/repeat}}\n ]\n }", "latency": 0, "statusCode": 200, "label": "", @@ -656,7 +656,7 @@ "responses": [ { "uuid": "ac5b893d-b30e-43c9-8988-4c13a7e0c819", - "body": "[\n {{#repeat 1 1 comma=true}}\n {\n \"id\": 0,\n \"name\": \"{{lorem (int 1 3)}}\",\n \"siteType\": {\n \"id\": {{int 0 6}},\n \"en\": \"{{lorem (int 1 2)}}\",\n \"fr\": \"{{lorem (int 1 2)}}\"\n },\n \"plantCount\": {{int 0 5000}},\n \"survivedCount\": {{int 0 5000}},\n \"propagationCount\": {{int 0 500}},\n \"visitorCount\": {{int 0 500}},\n \"sponsors\": {{{someOf (array (lorem 2) (lorem 2) (lorem 2) (lorem 2) (lorem 2)) 0 5 true}}},\n \"progress\": {{float 0 100}}\n }\n {{/repeat}}\n]", + "body": "[\n {{#repeat 1 (int 1 14) comma=true}}\n {\n \"id\": \"{{int (int 1 9999)}}\",\n \"name\": \"{{lorem (int 1 3)}}\",\n \"siteType\": {\n \"id\": {{int 0 6}},\n \"en\": \"{{lorem (int 1 2)}}\",\n \"fr\": \"{{lorem (int 1 2)}}\"\n },\n \"coordinate\": {\n \"id\": {{int 1 9999}},\n \"dmsLatitude\": \"{{int 50 60}} {{int 15 30}} {{int 30 60}} {{int 1000 9999}} N\",\n \"dmsLongitude\": \"{{int 50 80}} {{int 20 45}} {{int 10 55}} {{int 1000 9999}} W\",\n \"address\": \"{{faker 'location.city'}}\"\n },\n \"plantCount\": {{int 0 5000}},\n \"survivedCount\": {{int 0 5000}},\n \"propagationCount\": {{int 0 500}},\n \"visitorCount\": {{int 0 500}},\n \"sponsors\": {{{someOf (array (faker 'company.name') (faker 'company.name') (faker 'company.name') (faker 'company.name') (faker 'company.name')) 0 5 true}}},\n \"progress\": {{float 0 100}},\n \"admins\": [\n {{#repeat 1 (int 1 3) comma=true}}\n {\n \"id\": {{int 1 9999}},\n \"userId\": \"{{int 1 9999}}\",\n \"username\": \"{{faker 'person.fullName'}}\"\n }\n {{/repeat}}\n ]\n }\n {{/repeat}}\n]", "latency": 0, "statusCode": 200, "label": "", diff --git a/canopeum_frontend/src/App.scss b/canopeum_frontend/src/App.scss index f061712e3..802b5bb54 100644 --- a/canopeum_frontend/src/App.scss +++ b/canopeum_frontend/src/App.scss @@ -23,9 +23,105 @@ body { background-image: url('@assets/images/TreeBackground.png'); } -.material-symbols-outlined { +.material-symbols-outlined, +.custom-icon { color: inherit; - font-size: inherit; + font-size: 24px; + + &.custom-icon { + width: 24px; + height: 24px; + } + + &.icon-2xs { + font-size: 12px; + + &.custom-icon { + width: 12px; + height: 12px; + } + } + + &.icon-xs { + font-size: 16px; + + &.custom-icon { + width: 16px; + height: 16px; + } + } + + &.icon-sm { + font-size: 20px; + + &.custom-icon { + width: 20px; + height: 20px; + } + } + + &.icon-lg { + font-size: 28px; + + &.custom-icon { + width: 28px; + height: 28px; + } + } + + &.icon-xl { + font-size: 32px; + + &.custom-icon { + width: 32px; + height: 32px; + } + } + + &.icon-2xl { + font-size: 36px; + + &.custom-icon { + width: 36px; + height: 36px; + } + } + + &.icon-3xl { + font-size: 40px; + + &.custom-icon { + width: 40px; + height: 40px; + } + } + + &.icon-4xl { + font-size: 44px; + + &.custom-icon { + width: 44px; + height: 44px; + } + } + + &.icon-5xl { + font-size: 48px; + + &.custom-icon { + width: 48px; + height: 48px; + } + } + + &.icon-6xl { + font-size: 52px; + + &.custom-icon { + width: 52px; + height: 52px; + } + } } .navbar { @@ -61,6 +157,20 @@ body { text-align: center; } +.lightgreen-color { + color: #E8F3E9; +} + +.bg-lightgreen { + background: #E8F3E9; +} + +.text-ellipsis { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .btn-secondary { color: #fff; } diff --git a/canopeum_frontend/src/assets/icons/site-planted.svg b/canopeum_frontend/src/assets/icons/site-planted.svg new file mode 100644 index 000000000..44c390b52 --- /dev/null +++ b/canopeum_frontend/src/assets/icons/site-planted.svg @@ -0,0 +1,3 @@ + + + diff --git a/canopeum_frontend/src/assets/icons/site-propagation.svg b/canopeum_frontend/src/assets/icons/site-propagation.svg new file mode 100644 index 000000000..8d890e42f --- /dev/null +++ b/canopeum_frontend/src/assets/icons/site-propagation.svg @@ -0,0 +1,3 @@ + + + diff --git a/canopeum_frontend/src/assets/icons/site-survived.svg b/canopeum_frontend/src/assets/icons/site-survived.svg new file mode 100644 index 000000000..2f80babe2 --- /dev/null +++ b/canopeum_frontend/src/assets/icons/site-survived.svg @@ -0,0 +1,3 @@ + + + diff --git a/canopeum_frontend/src/assets/icons/site-type-canopeum.svg b/canopeum_frontend/src/assets/icons/site-type-canopeum.svg new file mode 100644 index 000000000..0040974fa --- /dev/null +++ b/canopeum_frontend/src/assets/icons/site-type-canopeum.svg @@ -0,0 +1,3 @@ + + + diff --git a/canopeum_frontend/src/assets/icons/site-type-farm-land.svg b/canopeum_frontend/src/assets/icons/site-type-farm-land.svg new file mode 100644 index 000000000..299220400 --- /dev/null +++ b/canopeum_frontend/src/assets/icons/site-type-farm-land.svg @@ -0,0 +1,3 @@ + + + diff --git a/canopeum_frontend/src/assets/icons/site-visitors.svg b/canopeum_frontend/src/assets/icons/site-visitors.svg new file mode 100644 index 000000000..cc2240eb7 --- /dev/null +++ b/canopeum_frontend/src/assets/icons/site-visitors.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/canopeum_frontend/src/components/CustomIconBadge.tsx b/canopeum_frontend/src/components/CustomIconBadge.tsx new file mode 100644 index 000000000..9946e8412 --- /dev/null +++ b/canopeum_frontend/src/components/CustomIconBadge.tsx @@ -0,0 +1,18 @@ +import CustomIcon, { type IconSize } from '@components/icons/CustomIcon' +import type { CustomIconType } from '@components/icons/customIconList' + +type Props = { + readonly icon: CustomIconType, + readonly size?: IconSize, +} + +const CustomIconBadge = ({ icon, size }: Props) => ( +
+ +
+) + +export default CustomIconBadge diff --git a/canopeum_frontend/src/components/analytics/SiteSponsorProgress.tsx b/canopeum_frontend/src/components/analytics/SiteSponsorProgress.tsx new file mode 100644 index 000000000..a84d0ccdd --- /dev/null +++ b/canopeum_frontend/src/components/analytics/SiteSponsorProgress.tsx @@ -0,0 +1,31 @@ +import { useTranslation } from 'react-i18next' + +type Props = { + readonly progress: number, +} + +const SiteSponsorProgress = ({ progress }: Props) => { + const { t: translate } = useTranslation() + + return ( +
+
+ {/* eslint-disable-next-line jsx-a11y/prefer-tag-over-role -- this is how the bootstrap component is built */} +
+
+ + + {Math.round(progress)}% {translate('analytics.site-summary.sponsored')} + +
+ ) +} + +export default SiteSponsorProgress diff --git a/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx b/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx index 110fb9c28..284e94bd4 100644 --- a/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx +++ b/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx @@ -1,7 +1,10 @@ +import SiteSponsorProgress from '@components/analytics/SiteSponsorProgress' import type { SiteSummary } from '@services/api' import { useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' +import CustomIcon from '../icons/CustomIcon' + type Props = { readonly site: SiteSummary, } @@ -9,6 +12,10 @@ type Props = { const SiteSummaryCard = ({ site }: Props) => { const { t: translate } = useTranslation() + const siteAdminsDisplay = site.admins.length > 0 + ? site.admins.map(admin => admin.username).join(', ') + : translate('analytics.site-summary.no-amins') + return (
{
school
-
{site.name ?? 'Unnamed site'}
+
{site.name ?? translate('analytics.site-summary.unnamed-site')}
location_on - Missing Location + + {site.coordinate.address ?? translate('analytics.site-summary.unknown')} +
person - Missing Owner + {siteAdminsDisplay}
-
- psychiatry +
+
- {site.plantCount} + {site.plantCount} {translate('analytics.site-summary.planted')}
-
- forest +
+
- {site.survivedCount} + {site.survivedCount} {translate('analytics.site-summary.survived')}
-
- forest +
+
- {site.propagationCount} + {site.propagationCount} {translate('analytics.site-summary.propagation')}
-
-
-
-
- - - {Math.round(site.progress)}% {translate('analytics.site-summary.sponsored')} - +
+
diff --git a/canopeum_frontend/src/components/icons/CustomIcon.tsx b/canopeum_frontend/src/components/icons/CustomIcon.tsx new file mode 100644 index 000000000..ceb5795a1 --- /dev/null +++ b/canopeum_frontend/src/components/icons/CustomIcon.tsx @@ -0,0 +1,34 @@ +import { customIcons, type CustomIconType } from './customIconList' + +// These sizes match the custom icon scss sizes determined in App.scss +export type IconSize = + // eslint-disable-next-line @typescript-eslint/sort-type-constituents -- Sort them in order of size + | '2xs' + | 'xs' + | 'sm' + | 'md' + | 'lg' + | 'xl' + | '2xl' + | '3xl' + | '4xl' + | '5xl' + | '6xl' + +type Props = { + readonly icon: CustomIconType, + readonly size?: IconSize, +} + +// TODO(NicolasDontigny): Find the best way to set the svg's fill color +// This is currently not possible using the tag in the CustomIcon component +const CustomIcon = ({ icon, size }: Props) => { + let iconClassName = 'custom-icon' + if (size) { + iconClassName += ` icon-${size}` + } + + return {icon} +} + +export default CustomIcon diff --git a/canopeum_frontend/src/components/icons/customIconList.ts b/canopeum_frontend/src/components/icons/customIconList.ts new file mode 100644 index 000000000..a8702364f --- /dev/null +++ b/canopeum_frontend/src/components/icons/customIconList.ts @@ -0,0 +1,15 @@ +import sitePlantedIcon from '../../assets/icons/site-planted.svg' +import sitePropagationIcon from '../../assets/icons/site-propagation.svg' +import siteSurvivedIcon from '../../assets/icons/site-survived.svg' +import siteTypeCanopeumIcon from '../../assets/icons/site-type-canopeum.svg' +import siteVisitorsIcon from '../../assets/icons/site-visitors.svg' + +export const customIcons = { + sitePlantedIcon, + siteSurvivedIcon, + sitePropagationIcon, + siteVisitorsIcon, + siteTypeCanopeumIcon, +} + +export type CustomIconType = keyof typeof customIcons diff --git a/canopeum_frontend/src/locale/en/analytics.json b/canopeum_frontend/src/locale/en/analytics.json index 2124fe0ab..223f50665 100644 --- a/canopeum_frontend/src/locale/en/analytics.json +++ b/canopeum_frontend/src/locale/en/analytics.json @@ -21,6 +21,10 @@ "planted": "Planted", "survived": "Survived", "propagation": "Propagation", - "sponsored": "Sponsored" + "visitors": "Visitors", + "sponsored": "Sponsored", + "no-admins": "No Admins", + "unknown": "Unknown", + "unnamed-site": "Unnamed site" } } diff --git a/canopeum_frontend/src/locale/en/analyticsSite.json b/canopeum_frontend/src/locale/en/analyticsSite.json index 6cd3f30fb..7ae8a9b14 100644 --- a/canopeum_frontend/src/locale/en/analyticsSite.json +++ b/canopeum_frontend/src/locale/en/analyticsSite.json @@ -1,4 +1,6 @@ { "location": "Location", - "batch-tracking": "Batch Tracking" + "batch-tracking": "Batch Tracking", + "social-page": "Social Page", + "sponsors": "Sponsors" } diff --git a/canopeum_frontend/src/locale/fr/analytics.json b/canopeum_frontend/src/locale/fr/analytics.json index 2ed0d2ac5..25dbd4fac 100644 --- a/canopeum_frontend/src/locale/fr/analytics.json +++ b/canopeum_frontend/src/locale/fr/analytics.json @@ -21,6 +21,10 @@ "planted": "Planté", "survived": "Survécu", "propagation": "Propagation", - "sponsored": "Sponsorisé" + "visitors": "Visiteurs", + "sponsored": "Sponsorisé", + "no-admins": "Pas d'administrateurs", + "unknown": "Inconnu", + "unnamed-site": "Site sans nom" } } diff --git a/canopeum_frontend/src/locale/fr/analyticsSite.json b/canopeum_frontend/src/locale/fr/analyticsSite.json index 869fd68f3..780cab2b3 100644 --- a/canopeum_frontend/src/locale/fr/analyticsSite.json +++ b/canopeum_frontend/src/locale/fr/analyticsSite.json @@ -1,4 +1,6 @@ { "location": "Localisation", - "batch-tracking": "Suivi des lots" + "batch-tracking": "Suivi des lots", + "social-page": "Page Sociale", + "sponsors": "Sponsors" } diff --git a/canopeum_frontend/src/pages/Analytics.tsx b/canopeum_frontend/src/pages/Analytics.tsx index 5351464b6..642639c60 100644 --- a/canopeum_frontend/src/pages/Analytics.tsx +++ b/canopeum_frontend/src/pages/Analytics.tsx @@ -182,7 +182,7 @@ const Analytics = () => {
-
+
{siteSummaries.map(site => )}
diff --git a/canopeum_frontend/src/pages/AnalyticsSite.module.scss b/canopeum_frontend/src/pages/AnalyticsSite.module.scss new file mode 100644 index 000000000..03d8b385e --- /dev/null +++ b/canopeum_frontend/src/pages/AnalyticsSite.module.scss @@ -0,0 +1,3 @@ +.analyticsCountsContainer { + max-width: 880px; +} diff --git a/canopeum_frontend/src/pages/AnalyticsSite.tsx b/canopeum_frontend/src/pages/AnalyticsSite.tsx index 660a88f18..d61b09cb4 100644 --- a/canopeum_frontend/src/pages/AnalyticsSite.tsx +++ b/canopeum_frontend/src/pages/AnalyticsSite.tsx @@ -1,16 +1,23 @@ -import type { Site } from '@services/api' +import SiteSponsorProgress from '@components/analytics/SiteSponsorProgress' +import { LanguageContext } from '@components/context/LanguageContext' +import CustomIconBadge from '@components/CustomIconBadge' +import type { SiteSummary } from '@services/api' import api from '@services/apiInterface' -import { useEffect, useState } from 'react' +import { useContext, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { useParams } from 'react-router-dom' +import { Link, useParams } from 'react-router-dom' + +import CustomIcon from '../components/icons/CustomIcon' +import classes from './AnalyticsSite.module.scss' const AnalyticsSite = () => { - const { t: translate } = useTranslation() + const { t: translate } = useTranslation<'analytics'>() const { siteId: siteIdFromParams } = useParams() + const { translateValue } = useContext(LanguageContext) - const [site, setSite] = useState() + const [site, setSite] = useState() - const fetchSite = async (siteId: number) => setSite(await api().analytics.site(siteId)) + const fetchSite = async (siteId: number) => setSite(await api().analytics.siteSummary(siteId)) useEffect(() => { if (!siteIdFromParams) return @@ -21,6 +28,10 @@ const AnalyticsSite = () => { void fetchSite(siteIdNumber) }, [siteIdFromParams]) + if (!site) { + return
Loading...
+ } + return (
@@ -28,8 +39,74 @@ const AnalyticsSite = () => { {translate('analyticsSite.location')}
-
-

{site?.name}

+
+
+
+

{site.name}

+
+ + {translateValue(site.siteType)} +
+
+ + + + +
+ +
+
+
+ +
+
+ {site.plantCount} + {translate('analytics.site-summary.planted')} +
+
+ +
+
+ +
+
+ {site.survivedCount} + {translate('analytics.site-summary.survived')} +
+
+ +
+
+ +
+
+ {site.propagationCount} + {translate('analytics.site-summary.propagation')} +
+
+ +
+
+ +
+
+ {site.visitorCount} + {translate('analytics.site-summary.visitors')} +
+
+
+ +
+
+ group + {translate('analyticsSite.sponsors')}: + {site.sponsors.map(sponsor => {sponsor})} +
+
+ +
+ +
diff --git a/canopeum_frontend/src/pages/Map.tsx b/canopeum_frontend/src/pages/Map.tsx index a6df0a6b5..7d1f53360 100644 --- a/canopeum_frontend/src/pages/Map.tsx +++ b/canopeum_frontend/src/pages/Map.tsx @@ -4,7 +4,7 @@ import EducationalFacilityPin from '@assets/icons/pins/educational-facility-pin. import FarmsLandPin from '@assets/icons/pins/farms-land-pin.svg' import IndegeniousCommunityPin from '@assets/icons/pins/indegenious-community-pin.svg' import ParkPin from '@assets/icons/pins/park-pin.svg' -import { useCallback, useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import ReactMap, { GeolocateControl, Marker, NavigationControl, ScaleControl, type ViewState } from 'react-map-gl/maplibre' import { Link } from 'react-router-dom' diff --git a/canopeum_frontend/src/pages/Utilities.tsx b/canopeum_frontend/src/pages/Utilities.tsx index 7956554fa..409ec6a6e 100644 --- a/canopeum_frontend/src/pages/Utilities.tsx +++ b/canopeum_frontend/src/pages/Utilities.tsx @@ -8,15 +8,15 @@ const Utilities = () => (

Utilities

Icons

- home - home - donut_small + home + home + donut_small donut_small - pin_drop - pin_drop - account_circle - account_circle - eco + pin_drop + pin_drop + account_circle + account_circle + eco eco sms sms diff --git a/canopeum_frontend/src/services/api.ts b/canopeum_frontend/src/services/api.ts index fe6f5c297..6576ea784 100644 --- a/canopeum_frontend/src/services/api.ts +++ b/canopeum_frontend/src/services/api.ts @@ -1,3897 +1,3800 @@ -// ---------------------- +//---------------------- // -// Generated using the NSwag toolchain v14.0.3.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // -// ---------------------- +//---------------------- /* tslint:disable */ /* eslint-disable */ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise } - private baseUrl: string - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined + 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 ?? '' + this.http = http ? http : window as any; + this.baseUrl = baseUrl ?? ""; } batchAll(): Promise { - let url_ = this.baseUrl + '/analytics/batches/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/analytics/batches/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processBatchAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processBatchAll(_response); + }); } protected processBatchAll(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(BatchAnalytics.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) + 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(BatchAnalytics.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); } batchCreate(body: Batch | undefined): Promise { - let url_ = this.baseUrl + '/analytics/batches/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/analytics/batches/"; + url_ = url_.replace(/[?&]$/, ""); - const content_ = JSON.stringify(body) + const content_ = JSON.stringify(body); - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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.processBatchCreate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processBatchCreate(_response); + }); } protected processBatchCreate(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 = Batch.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) + 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 = Batch.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); } batchUpdate(batchId: number, body: PatchedBatch | 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_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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_ = 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.processBatchUpdate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processBatchUpdate(_response); + }); } protected processBatchUpdate(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 = Batch.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) + 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 = Batch.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 */ batchDelete(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: {}, - } + 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.processBatchDelete(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processBatchDelete(_response); + }); } protected processBatchDelete(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) + 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); } siteAll(): Promise { - let url_ = this.baseUrl + '/analytics/sites/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/analytics/sites/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSiteAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteAll(_response); + }); } protected processSiteAll(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) + 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); } siteCreate(body: Site): Promise { - let url_ = this.baseUrl + '/analytics/sites/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/analytics/sites/"; + url_ = url_.replace(/[?&]$/, ""); - const content_ = JSON.stringify(body) + const content_ = JSON.stringify(body); - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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.processSiteCreate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteCreate(_response); + }); } protected processSiteCreate(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) + 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); } siteDetail(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', - }, - } + 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.processSiteDetail(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteDetail(_response); + }); } protected processSiteDetail(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) + 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); } siteUpdate(siteId: number, body: PatchedSite | 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_ = JSON.stringify(body) - - let options_: RequestInit = { - body: content_, - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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_ = 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.processSiteUpdate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteUpdate(_response); + }); } protected processSiteUpdate(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) - } - - siteDelete(siteId: number): Promise<{ [key: string]: any }> { - 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: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSiteDelete(_response) - }) - } - - protected processSiteDelete(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) + 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); + } + + siteDelete(siteId: number): Promise<{ [key: string]: any; }> { + 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: { + "Accept": "application/json" + } + }; + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteDelete(_response); + }); + } + + protected processSiteDelete(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); } siteSummary(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', - }, - } + 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.processSiteSummary(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteSummary(_response); + }); } protected processSiteSummary(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 = SiteSummary.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) + 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 = SiteSummary.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); } siteSummaryAll(): Promise { - let url_ = this.baseUrl + '/analytics/sites/summary' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/analytics/sites/summary"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSiteSummaryAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteSummaryAll(_response); + }); } protected processSiteSummaryAll(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) - } - - apiSchemaRetrieve(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.processApiSchemaRetrieve(_response) - }) - } - - protected processApiSchemaRetrieve(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) + 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); + } + + apiSchemaRetrieve(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.processApiSchemaRetrieve(_response); + }); + } + + protected processApiSchemaRetrieve(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); } authenticationLogin(body: AuthUser): Promise { - let url_ = this.baseUrl + '/auth/login/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/auth/login/"; + url_ = url_.replace(/[?&]$/, ""); - const content_ = JSON.stringify(body) + const content_ = JSON.stringify(body); - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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.processAuthenticationLogin(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAuthenticationLogin(_response); + }); } protected processAuthenticationLogin(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) - } - - authenticationLogout(): Promise<{ [key: string]: any }> { - let url_ = this.baseUrl + '/auth/logout/' - url_ = url_.replace(/[?&]$/, '') - - let options_: RequestInit = { - method: 'POST', - headers: { - Accept: 'application/json', - }, - } - - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processAuthenticationLogout(_response) - }) - } - - protected processAuthenticationLogout(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) + 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); + } + + authenticationLogout(): Promise<{ [key: string]: any; }> { + let url_ = this.baseUrl + "/auth/logout/"; + url_ = url_.replace(/[?&]$/, ""); + + let options_: RequestInit = { + method: "POST", + headers: { + "Accept": "application/json" + } + }; + + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAuthenticationLogout(_response); + }); + } + + protected processAuthenticationLogout(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); } authenticationRegister(body: User): Promise { - let url_ = this.baseUrl + '/auth/register/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/auth/register/"; + url_ = url_.replace(/[?&]$/, ""); - const content_ = JSON.stringify(body) + const content_ = JSON.stringify(body); - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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.processAuthenticationRegister(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAuthenticationRegister(_response); + }); } protected processAuthenticationRegister(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 = AuthUser.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) + 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 = AuthUser.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); } siteMap(): Promise { - let url_ = this.baseUrl + '/map/sites/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/map/sites/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSiteMap(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteMap(_response); + }); } protected processSiteMap(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) + 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); } postAll(): Promise { - let url_ = this.baseUrl + '/social/posts/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/social/posts/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processPostAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processPostAll(_response); + }); } protected processPostAll(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(Post.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) + 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(Post.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); } postCreate(body: Post): Promise { - let url_ = this.baseUrl + '/social/posts/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/social/posts/"; + url_ = url_.replace(/[?&]$/, ""); - const content_ = JSON.stringify(body) + const content_ = JSON.stringify(body); - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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.processPostCreate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processPostCreate(_response); + }); } protected processPostCreate(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) + 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); } commentAll(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', - }, - } + 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.processCommentAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCommentAll(_response); + }); } protected processCommentAll(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) + 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); } commentCreate(postId: number, body: Comment | undefined): 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', - }, - } + 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.processCommentCreate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processCommentCreate(_response); + }); } protected processCommentCreate(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 = Comment.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) + 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 = Comment.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 */ commentDelete(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.processCommentDelete(_response) - }) + 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.processCommentDelete(_response); + }); } protected processCommentDelete(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) + 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); } likeAll(postId: number, body: Like | 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', - }, - } + 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.processLikeAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processLikeAll(_response); + }); } protected processLikeAll(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 = Like.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) + 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 = Like.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); } siteSocialAll(): Promise { - let url_ = this.baseUrl + '/social/sites/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/social/sites/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processSiteSocialAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteSocialAll(_response); + }); } protected processSiteSocialAll(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) + 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); } siteSocial(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', - }, - } + 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.processSiteSocial(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processSiteSocial(_response); + }); } protected processSiteSocial(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) + 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); } announcementUpdate(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', - }, - } + 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.processAnnouncementUpdate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processAnnouncementUpdate(_response); + }); } protected processAnnouncementUpdate(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) + 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); } contactUpdate(contactId: number, siteId: number, body: PatchedContact | undefined): Promise { - let url_ = this.baseUrl + '/social/sites/{siteId}/contacts/{contactId}/' - if (contactId === undefined || contactId === null) { - throw new Error("The parameter 'contactId' must be defined.") - } - url_ = url_.replace('{contactId}', encodeURIComponent('' + contactId)) - 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.processContactUpdate(_response) - }) + let url_ = this.baseUrl + "/social/sites/{siteId}/contacts/{contactId}/"; + if (contactId === undefined || contactId === null) + throw new Error("The parameter 'contactId' must be defined."); + url_ = url_.replace("{contactId}", encodeURIComponent("" + contactId)); + 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.processContactUpdate(_response); + }); } protected processContactUpdate(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) + 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); } widgetCreate(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', - }, - } + 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.processWidgetCreate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processWidgetCreate(_response); + }); } protected processWidgetCreate(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) + 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); } widgetUpdate(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.processWidgetUpdate(_response) - }) + 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.processWidgetUpdate(_response); + }); } protected processWidgetUpdate(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) + 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 */ widgetDelete(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.processWidgetDelete(_response) - }) + 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.processWidgetDelete(_response); + }); } protected processWidgetDelete(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) + 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); } userAll(): Promise { - let url_ = this.baseUrl + '/users/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/users/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUserAll(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUserAll(_response); + }); } protected processUserAll(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) + 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); } userCreate(body: User): Promise { - let url_ = this.baseUrl + '/users/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/users/"; + url_ = url_.replace(/[?&]$/, ""); - const content_ = JSON.stringify(body) + const content_ = JSON.stringify(body); - let options_: RequestInit = { - body: content_, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - } + 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.processUserCreate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUserCreate(_response); + }); } protected processUserCreate(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) + 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); } userDetail(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', - }, - } + 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.processUserDetail(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUserDetail(_response); + }); } protected processUserDetail(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) + 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); } userUpdate(userId: number, body: PatchedUser | 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', - }, - } + 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.processUserUpdate(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUserUpdate(_response); + }); } protected processUserUpdate(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) + 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); } userCurrentUser(): Promise { - let url_ = this.baseUrl + '/users/current_user/' - url_ = url_.replace(/[?&]$/, '') + let url_ = this.baseUrl + "/users/current_user/"; + url_ = url_.replace(/[?&]$/, ""); - let options_: RequestInit = { - method: 'GET', - headers: { - Accept: 'application/json', - }, - } + let options_: RequestInit = { + method: "GET", + headers: { + "Accept": "application/json" + } + }; - return this.http.fetch(url_, options_).then((_response: Response) => { - return this.processUserCurrentUser(_response) - }) + return this.http.fetch(url_, options_).then((_response: Response) => { + return this.processUserCurrentUser(_response); + }); } protected processUserCurrentUser(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) + 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); } } export class Announcement implements IAnnouncement { - readonly id!: number - body?: string | undefined + readonly id!: number; + body?: string | undefined; link?: string | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IAnnouncement) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + 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 + id: number; + body?: string | undefined; + link?: string | undefined; - [key: string]: any + [key: string]: any; } export class AuthUser implements IAuthUser { - readonly id!: number + readonly id!: number; /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username!: string - email?: string + username!: string; + email?: string; password!: string; - [key: string]: any + [key: string]: any; constructor(data?: IAuthUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; + this.password = _data["password"]; } - ;( this).id = _data['id'] - this.username = _data['username'] - this.email = _data['email'] - this.password = _data['password'] - } } static fromJS(data: any): AuthUser { - data = typeof data === 'object' ? data : {} - let result = new AuthUser() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new AuthUser(); + 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 = 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 - data['password'] = this.password - return data + data["id"] = this.id; + data["username"] = this.username; + data["email"] = this.email; + data["password"] = this.password; + return data; } } export interface IAuthUser { - id: number + id: number; /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username: string - email?: string - password: string + username: string; + email?: string; + password: string; - [key: string]: any + [key: string]: any; } export class Batch implements IBatch { - readonly id!: number - createdAt?: Date | undefined - name?: string | undefined - sponsor?: string | undefined - size?: string | undefined - soilCondition?: string | undefined - totalNumberSeed?: number | undefined - totalPropagation?: number | undefined + readonly id!: number; + createdAt?: Date | undefined; + name?: string | undefined; + sponsor?: string | undefined; + size?: string | undefined; + soilCondition?: string | undefined; + totalNumberSeed?: number | undefined; + totalPropagation?: number | undefined; site?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IBatch) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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.createdAt = _data['createdAt'] ? new Date(_data['createdAt'].toString()) : undefined - this.name = _data['name'] - this.sponsor = _data['sponsor'] - this.size = _data['size'] - this.soilCondition = _data['soilCondition'] - this.totalNumberSeed = _data['totalNumberSeed'] - this.totalPropagation = _data['totalPropagation'] - this.site = _data['site'] - } + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.createdAt = _data["createdAt"] ? new Date(_data["createdAt"].toString()) : undefined; + this.name = _data["name"]; + this.sponsor = _data["sponsor"]; + this.size = _data["size"]; + this.soilCondition = _data["soilCondition"]; + this.totalNumberSeed = _data["totalNumberSeed"]; + this.totalPropagation = _data["totalPropagation"]; + this.site = _data["site"]; + } } static fromJS(data: any): Batch { - data = typeof data === 'object' ? data : {} - let result = new Batch() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new Batch(); + 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 = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; } - } - data['id'] = this.id - data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined - data['name'] = this.name - data['sponsor'] = this.sponsor - data['size'] = this.size - data['soilCondition'] = this.soilCondition - data['totalNumberSeed'] = this.totalNumberSeed - data['totalPropagation'] = this.totalPropagation - data['site'] = this.site - return data + data["id"] = this.id; + data["createdAt"] = this.createdAt ? this.createdAt.toISOString() : undefined; + data["name"] = this.name; + data["sponsor"] = this.sponsor; + data["size"] = this.size; + data["soilCondition"] = this.soilCondition; + data["totalNumberSeed"] = this.totalNumberSeed; + data["totalPropagation"] = this.totalPropagation; + data["site"] = this.site; + return data; } } export interface IBatch { - id: number - createdAt?: Date | undefined - name?: string | undefined - sponsor?: string | undefined - size?: string | undefined - soilCondition?: string | undefined - totalNumberSeed?: number | undefined - totalPropagation?: number | undefined - site?: number | undefined + id: number; + createdAt?: Date | undefined; + name?: string | undefined; + sponsor?: string | undefined; + size?: string | undefined; + soilCondition?: string | undefined; + totalNumberSeed?: number | undefined; + totalPropagation?: number | undefined; + site?: number | undefined; - [key: string]: any + [key: string]: any; } export class BatchAnalytics implements IBatchAnalytics { - readonly id!: number - name?: string | undefined - size?: string | undefined - soilCondition?: string | undefined - readonly fertilizers!: Batchfertilizer[] - readonly mulchLayers!: BatchMulchLayer[] - readonly supportedSpecies!: BatchSupportedSpecies[] - readonly plantCount!: number - readonly survivedCount!: number - readonly replaceCount!: number - readonly seedCollectedCount!: number - readonly seeds!: BatchSeed[] + readonly id!: number; + name?: string | undefined; + size?: string | undefined; + soilCondition?: string | undefined; + readonly fertilizers!: Batchfertilizer[]; + readonly mulchLayers!: BatchMulchLayer[]; + readonly supportedSpecies!: BatchSupportedSpecies[]; + readonly plantCount!: number; + readonly survivedCount!: number; + readonly replaceCount!: number; + readonly seedCollectedCount!: number; + readonly seeds!: BatchSeed[]; readonly species!: BatchSpecies[]; - [key: string]: any + [key: string]: any; constructor(data?: IBatchAnalytics) { - 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 = [] - } + 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 = []; + } } 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.size = _data['size'] - this.soilCondition = _data['soilCondition'] - if (Array.isArray(_data['fertilizers'])) { - ;( this).fertilizers = [] as any - for (let item of _data['fertilizers']) { - ;( this).fertilizers!.push(Batchfertilizer.fromJS(item)) - } - } - if (Array.isArray(_data['mulchLayers'])) { - ;( this).mulchLayers = [] as any - for (let item of _data['mulchLayers']) { - ;( this).mulchLayers!.push(BatchMulchLayer.fromJS(item)) - } - } - if (Array.isArray(_data['supportedSpecies'])) { - ;( this).supportedSpecies = [] as any - for (let item of _data['supportedSpecies']) { - ;( this).supportedSpecies!.push(BatchSupportedSpecies.fromJS(item)) - } - } - ;( this).plantCount = _data['plantCount'] - ;( this).survivedCount = _data['survivedCount'] - ;( this).replaceCount = _data['replaceCount'] - ;( this).seedCollectedCount = _data['seedCollectedCount'] - if (Array.isArray(_data['seeds'])) { - ;( this).seeds = [] as any - for (let item of _data['seeds']) { - ;( this).seeds!.push(BatchSeed.fromJS(item)) - } - } - if (Array.isArray(_data['species'])) { - ;( this).species = [] as any - for (let item of _data['species']) { - ;( this).species!.push(BatchSpecies.fromJS(item)) - } - } - } + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.name = _data["name"]; + this.size = _data["size"]; + this.soilCondition = _data["soilCondition"]; + if (Array.isArray(_data["fertilizers"])) { + (this).fertilizers = [] as any; + for (let item of _data["fertilizers"]) + (this).fertilizers!.push(Batchfertilizer.fromJS(item)); + } + if (Array.isArray(_data["mulchLayers"])) { + (this).mulchLayers = [] as any; + for (let item of _data["mulchLayers"]) + (this).mulchLayers!.push(BatchMulchLayer.fromJS(item)); + } + if (Array.isArray(_data["supportedSpecies"])) { + (this).supportedSpecies = [] as any; + for (let item of _data["supportedSpecies"]) + (this).supportedSpecies!.push(BatchSupportedSpecies.fromJS(item)); + } + (this).plantCount = _data["plantCount"]; + (this).survivedCount = _data["survivedCount"]; + (this).replaceCount = _data["replaceCount"]; + (this).seedCollectedCount = _data["seedCollectedCount"]; + if (Array.isArray(_data["seeds"])) { + (this).seeds = [] as any; + for (let item of _data["seeds"]) + (this).seeds!.push(BatchSeed.fromJS(item)); + } + if (Array.isArray(_data["species"])) { + (this).species = [] as any; + for (let item of _data["species"]) + (this).species!.push(BatchSpecies.fromJS(item)); + } + } } static fromJS(data: any): BatchAnalytics { - data = typeof data === 'object' ? data : {} - let result = new BatchAnalytics() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new BatchAnalytics(); + 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['size'] = this.size - data['soilCondition'] = this.soilCondition - 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()) - } - } - data['plantCount'] = this.plantCount - data['survivedCount'] = this.survivedCount - data['replaceCount'] = this.replaceCount - data['seedCollectedCount'] = this.seedCollectedCount - if (Array.isArray(this.seeds)) { - data['seeds'] = [] - for (let item of this.seeds) { - data['seeds'].push(item.toJSON()) - } - } - if (Array.isArray(this.species)) { - data['species'] = [] - for (let item of this.species) { - data['species'].push(item.toJSON()) - } - } - return data + 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["size"] = this.size; + data["soilCondition"] = this.soilCondition; + 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()); + } + data["plantCount"] = this.plantCount; + data["survivedCount"] = this.survivedCount; + data["replaceCount"] = this.replaceCount; + data["seedCollectedCount"] = this.seedCollectedCount; + if (Array.isArray(this.seeds)) { + data["seeds"] = []; + for (let item of this.seeds) + data["seeds"].push(item.toJSON()); + } + if (Array.isArray(this.species)) { + data["species"] = []; + for (let item of this.species) + data["species"].push(item.toJSON()); + } + return data; } } export interface IBatchAnalytics { - id: number - name?: string | undefined - size?: string | undefined - soilCondition?: string | undefined - fertilizers: Batchfertilizer[] - mulchLayers: BatchMulchLayer[] - supportedSpecies: BatchSupportedSpecies[] - plantCount: number - survivedCount: number - replaceCount: number - seedCollectedCount: number - seeds: BatchSeed[] - species: BatchSpecies[] - - [key: string]: any + id: number; + name?: string | undefined; + size?: string | undefined; + soilCondition?: string | undefined; + fertilizers: Batchfertilizer[]; + mulchLayers: BatchMulchLayer[]; + supportedSpecies: BatchSupportedSpecies[]; + plantCount: number; + survivedCount: number; + replaceCount: number; + seedCollectedCount: number; + seeds: BatchSeed[]; + species: BatchSpecies[]; + + [key: string]: any; } export class BatchMulchLayer implements IBatchMulchLayer { - readonly id!: number - readonly en!: string + readonly id!: number; + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: IBatchMulchLayer) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( this).id = _data['id'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } } static fromJS(data: any): BatchMulchLayer { - data = typeof data === 'object' ? data : {} - let result = new BatchMulchLayer() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new BatchMulchLayer(); + 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 = 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 + data["id"] = this.id; + data["en"] = this.en; + data["fr"] = this.fr; + return data; } } export interface IBatchMulchLayer { - id: number - en: string - fr: string + id: number; + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class BatchSeed implements IBatchSeed { - quantity?: number | undefined - readonly en!: string + quantity?: number | undefined; + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: IBatchSeed) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + this.quantity = _data["quantity"]; + (this).en = _data["en"]; + (this).fr = _data["fr"]; } - this.quantity = _data['quantity'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } } static fromJS(data: any): BatchSeed { - data = typeof data === 'object' ? data : {} - let result = new BatchSeed() - result.init(data) - return result + 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 = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; } - } - data['quantity'] = this.quantity - data['en'] = this.en - data['fr'] = this.fr - return data + data["quantity"] = this.quantity; + data["en"] = this.en; + data["fr"] = this.fr; + return data; } } export interface IBatchSeed { - quantity?: number | undefined - en: string - fr: string + quantity?: number | undefined; + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class BatchSpecies implements IBatchSpecies { - quantity?: number | undefined - readonly en!: string + quantity?: number | undefined; + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: IBatchSpecies) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + this.quantity = _data["quantity"]; + (this).en = _data["en"]; + (this).fr = _data["fr"]; } - this.quantity = _data['quantity'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } } static fromJS(data: any): BatchSpecies { - data = typeof data === 'object' ? data : {} - let result = new BatchSpecies() - result.init(data) - return result + 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 = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; } - } - data['quantity'] = this.quantity - data['en'] = this.en - data['fr'] = this.fr - return data + data["quantity"] = this.quantity; + data["en"] = this.en; + data["fr"] = this.fr; + return data; } } export interface IBatchSpecies { - quantity?: number | undefined - en: string - fr: string + quantity?: number | undefined; + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class BatchSupportedSpecies implements IBatchSupportedSpecies { - readonly en!: string + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: IBatchSupportedSpecies) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).en = _data["en"]; + (this).fr = _data["fr"]; } - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } } static fromJS(data: any): BatchSupportedSpecies { - data = typeof data === 'object' ? data : {} - let result = new BatchSupportedSpecies() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new BatchSupportedSpecies(); + 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 = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; } - } - data['en'] = this.en - data['fr'] = this.fr - return data + data["en"] = this.en; + data["fr"] = this.fr; + return data; } } export interface IBatchSupportedSpecies { - en: string - fr: string + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class Batchfertilizer implements IBatchfertilizer { - readonly id!: number - readonly en!: string + readonly id!: number; + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: IBatchfertilizer) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( this).id = _data['id'] - ;( this).en = _data['en'] - ;( this).fr = _data['fr'] - } } static fromJS(data: any): Batchfertilizer { - data = typeof data === 'object' ? data : {} - let result = new Batchfertilizer() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new Batchfertilizer(); + 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 = 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 + data["id"] = this.id; + data["en"] = this.en; + data["fr"] = this.fr; + return data; } } export interface IBatchfertilizer { - id: number - en: string - fr: string + id: number; + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class Comment implements IComment { - readonly id!: number - body?: string | undefined - authUser?: number | undefined + readonly id!: number; + body?: string | undefined; + authUser?: number | undefined; createdAt?: Date | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IComment) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.body = _data["body"]; + this.authUser = _data["authUser"]; + this.createdAt = _data["createdAt"] ? new Date(_data["createdAt"].toString()) : undefined; } - ;( this).id = _data['id'] - this.body = _data['body'] - this.authUser = _data['authUser'] - 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 + 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 = 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['authUser'] = this.authUser - data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined - return data + data["id"] = this.id; + data["body"] = this.body; + data["authUser"] = this.authUser; + data["createdAt"] = this.createdAt ? this.createdAt.toISOString() : undefined; + return data; } } export interface IComment { - id: number - body?: string | undefined - authUser?: number | undefined - createdAt?: Date | undefined + id: number; + body?: string | undefined; + authUser?: number | undefined; + createdAt?: Date | undefined; - [key: string]: any + [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 + 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 + [key: string]: any; constructor(data?: IContact) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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'] - } + 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 + 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 = 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 + 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 + 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 + [key: string]: any; } export class Coordinates implements ICoordinates { - readonly id!: number - dmsLatitude?: string | undefined - dmsLongitude?: string | undefined - ddLatitude?: string | undefined - ddLongitude?: string | undefined + readonly id!: number; + dmsLatitude?: string | undefined; + dmsLongitude?: string | undefined; + ddLatitude?: string | undefined; + ddLongitude?: string | undefined; address?: string | undefined; - [key: string]: any + [key: string]: any; constructor(data?: ICoordinates) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + 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 + id: number; + dmsLatitude?: string | undefined; + dmsLongitude?: string | undefined; + ddLatitude?: string | undefined; + ddLongitude?: string | undefined; + address?: string | undefined; - [key: string]: any + [key: string]: any; } export class CoordinatesMap implements ICoordinatesMap { - readonly latitude!: string - readonly longitude!: string + readonly latitude!: string; + readonly longitude!: string; address?: string | undefined; - [key: string]: any + [key: string]: any; constructor(data?: ICoordinatesMap) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + data["latitude"] = this.latitude; + data["longitude"] = this.longitude; + data["address"] = this.address; + return data; } } export interface ICoordinatesMap { - latitude: string - longitude: string - address?: string | undefined + latitude: string; + longitude: string; + address?: string | undefined; - [key: string]: any + [key: string]: any; } export class Like implements ILike { - readonly id!: number - authUser?: number | undefined + readonly id!: number; + authUser?: number | undefined; post?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: ILike) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.authUser = _data["authUser"]; + this.post = _data["post"]; } - ;( this).id = _data['id'] - this.authUser = _data['authUser'] - this.post = _data['post'] - } } static fromJS(data: any): Like { - data = typeof data === 'object' ? data : {} - let result = new Like() - result.init(data) - return result + 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 = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; } - } - data['id'] = this.id - data['authUser'] = this.authUser - data['post'] = this.post - return data + data["id"] = this.id; + data["authUser"] = this.authUser; + data["post"] = this.post; + return data; } } export interface ILike { - id: number - authUser?: number | undefined - post?: number | undefined + id: number; + authUser?: number | undefined; + post?: number | undefined; - [key: string]: any + [key: string]: any; } export class PatchedAnnouncement implements IPatchedAnnouncement { - readonly id?: number - body?: string | undefined + readonly id?: number; + body?: string | undefined; link?: string | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IPatchedAnnouncement) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + 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 + id?: number; + body?: string | undefined; + link?: string | undefined; - [key: string]: any + [key: string]: any; } export class PatchedBatch implements IPatchedBatch { - readonly id?: number - createdAt?: Date | undefined - name?: string | undefined - sponsor?: string | undefined - size?: string | undefined - soilCondition?: string | undefined - totalNumberSeed?: number | undefined - totalPropagation?: number | undefined + readonly id?: number; + createdAt?: Date | undefined; + name?: string | undefined; + sponsor?: string | undefined; + size?: string | undefined; + soilCondition?: string | undefined; + totalNumberSeed?: number | undefined; + totalPropagation?: number | undefined; site?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IPatchedBatch) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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.createdAt = _data['createdAt'] ? new Date(_data['createdAt'].toString()) : undefined - this.name = _data['name'] - this.sponsor = _data['sponsor'] - this.size = _data['size'] - this.soilCondition = _data['soilCondition'] - this.totalNumberSeed = _data['totalNumberSeed'] - this.totalPropagation = _data['totalPropagation'] - this.site = _data['site'] - } + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.createdAt = _data["createdAt"] ? new Date(_data["createdAt"].toString()) : undefined; + this.name = _data["name"]; + this.sponsor = _data["sponsor"]; + this.size = _data["size"]; + this.soilCondition = _data["soilCondition"]; + this.totalNumberSeed = _data["totalNumberSeed"]; + this.totalPropagation = _data["totalPropagation"]; + this.site = _data["site"]; + } } static fromJS(data: any): PatchedBatch { - data = typeof data === 'object' ? data : {} - let result = new PatchedBatch() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new PatchedBatch(); + 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 = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; } - } - data['id'] = this.id - data['createdAt'] = this.createdAt ? this.createdAt.toISOString() : undefined - data['name'] = this.name - data['sponsor'] = this.sponsor - data['size'] = this.size - data['soilCondition'] = this.soilCondition - data['totalNumberSeed'] = this.totalNumberSeed - data['totalPropagation'] = this.totalPropagation - data['site'] = this.site - return data + data["id"] = this.id; + data["createdAt"] = this.createdAt ? this.createdAt.toISOString() : undefined; + data["name"] = this.name; + data["sponsor"] = this.sponsor; + data["size"] = this.size; + data["soilCondition"] = this.soilCondition; + data["totalNumberSeed"] = this.totalNumberSeed; + data["totalPropagation"] = this.totalPropagation; + data["site"] = this.site; + return data; } } export interface IPatchedBatch { - id?: number - createdAt?: Date | undefined - name?: string | undefined - sponsor?: string | undefined - size?: string | undefined - soilCondition?: string | undefined - totalNumberSeed?: number | undefined - totalPropagation?: number | undefined - site?: number | undefined + id?: number; + createdAt?: Date | undefined; + name?: string | undefined; + sponsor?: string | undefined; + size?: string | undefined; + soilCondition?: string | undefined; + totalNumberSeed?: number | undefined; + totalPropagation?: number | undefined; + site?: number | undefined; - [key: string]: any + [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 + 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 + [key: string]: any; constructor(data?: IPatchedContact) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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'] - } + 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 + 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 = 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 + 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 + 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 + [key: string]: any; } export class PatchedSite implements IPatchedSite { - readonly id?: number - siteType?: SiteType - coordinate?: Coordinates - readonly siteTreeSpecies?: Sitetreespecies[] - contact?: Contact - announcement?: Announcement - name?: string | undefined - description?: string | undefined - size?: string | undefined - researchPartnership?: boolean | undefined - visibleMap?: boolean | undefined - visitorCount?: number | undefined + readonly id?: number; + siteType?: SiteType; + coordinate?: Coordinates; + readonly siteTreeSpecies?: Sitetreespecies[]; + contact?: Contact; + announcement?: Announcement; + name?: string | undefined; + description?: string | undefined; + size?: string | undefined; + researchPartnership?: boolean | undefined; + visibleMap?: boolean | undefined; + visitorCount?: number | undefined; image?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IPatchedSite) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : undefined - this.coordinate = _data['coordinate'] ? Coordinates.fromJS(_data['coordinate']) : undefined - 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']) : undefined - this.announcement = _data['announcement'] ? Announcement.fromJS(_data['announcement']) : undefined - this.name = _data['name'] - this.description = _data['description'] - this.size = _data['size'] - this.researchPartnership = _data['researchPartnership'] - this.visibleMap = _data['visibleMap'] - this.visitorCount = _data['visitorCount'] - this.image = _data['image'] - } + 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"]) : undefined; + this.coordinate = _data["coordinate"] ? Coordinates.fromJS(_data["coordinate"]) : undefined; + 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"]) : undefined; + this.announcement = _data["announcement"] ? Announcement.fromJS(_data["announcement"]) : undefined; + this.name = _data["name"]; + this.description = _data["description"]; + this.size = _data["size"]; + this.researchPartnership = _data["researchPartnership"]; + this.visibleMap = _data["visibleMap"]; + this.visitorCount = _data["visitorCount"]; + this.image = _data["image"]; + } } static fromJS(data: any): PatchedSite { - data = typeof data === 'object' ? data : {} - let result = new PatchedSite() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new PatchedSite(); + 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['name'] = this.name - data['description'] = this.description - data['size'] = this.size - data['researchPartnership'] = this.researchPartnership - data['visibleMap'] = this.visibleMap - data['visitorCount'] = this.visitorCount - data['image'] = this.image - return data + 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["name"] = this.name; + data["description"] = this.description; + data["size"] = this.size; + data["researchPartnership"] = this.researchPartnership; + data["visibleMap"] = this.visibleMap; + data["visitorCount"] = this.visitorCount; + data["image"] = this.image; + return data; } } export interface IPatchedSite { - id?: number - siteType?: SiteType - coordinate?: Coordinates - siteTreeSpecies?: Sitetreespecies[] - contact?: Contact - announcement?: Announcement - name?: string | undefined - description?: string | undefined - size?: string | undefined - researchPartnership?: boolean | undefined - visibleMap?: boolean | undefined - visitorCount?: number | undefined - image?: number | undefined - - [key: string]: any + id?: number; + siteType?: SiteType; + coordinate?: Coordinates; + siteTreeSpecies?: Sitetreespecies[]; + contact?: Contact; + announcement?: Announcement; + name?: string | undefined; + description?: string | undefined; + size?: string | undefined; + researchPartnership?: boolean | undefined; + visibleMap?: boolean | undefined; + visitorCount?: number | undefined; + image?: number | undefined; + + [key: string]: any; } export class PatchedUser implements IPatchedUser { - readonly id?: number - password?: string - lastLogin?: Date | undefined + readonly id?: number; + password?: string; + lastLogin?: Date | undefined; /** Designates that this user has all permissions without explicitly assigning them. */ - isSuperuser?: boolean + isSuperuser?: boolean; /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username?: string - firstName?: string - lastName?: string - email?: string + username?: string; + firstName?: string; + lastName?: string; + email?: string; /** Designates whether the user can log into this admin site. */ - isStaff?: boolean + isStaff?: boolean; /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ - isActive?: boolean - dateJoined?: Date + isActive?: boolean; + dateJoined?: Date; /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ - groups?: number[] + groups?: number[]; /** Specific permissions for this user. */ userPermissions?: number[]; - [key: string]: any + [key: string]: any; constructor(data?: IPatchedUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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.password = _data['password'] - 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.email = _data['email'] - this.isStaff = _data['isStaff'] - this.isActive = _data['isActive'] - this.dateJoined = _data['dateJoined'] ? new Date(_data['dateJoined'].toString()) : undefined - 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) - } - } - } + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.password = _data["password"]; + 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.email = _data["email"]; + this.isStaff = _data["isStaff"]; + this.isActive = _data["isActive"]; + this.dateJoined = _data["dateJoined"] ? new Date(_data["dateJoined"].toString()) : undefined; + 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): PatchedUser { - data = typeof data === 'object' ? data : {} - let result = new PatchedUser() - result.init(data) - return result + data = typeof data === 'object' ? data : {}; + let result = new PatchedUser(); + 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['password'] = this.password - 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['email'] = this.email - data['isStaff'] = this.isStaff - data['isActive'] = this.isActive - data['dateJoined'] = this.dateJoined ? this.dateJoined.toISOString() : undefined - 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 + data = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; + } + data["id"] = this.id; + data["password"] = this.password; + 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["email"] = this.email; + data["isStaff"] = this.isStaff; + data["isActive"] = this.isActive; + data["dateJoined"] = this.dateJoined ? this.dateJoined.toISOString() : undefined; + 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 IPatchedUser { - id?: number - password?: string - lastLogin?: Date | undefined + id?: number; + password?: string; + lastLogin?: Date | undefined; /** Designates that this user has all permissions without explicitly assigning them. */ - isSuperuser?: boolean + isSuperuser?: boolean; /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username?: string - firstName?: string - lastName?: string - email?: string + username?: string; + firstName?: string; + lastName?: string; + email?: string; /** Designates whether the user can log into this admin site. */ - isStaff?: boolean + isStaff?: boolean; /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ - isActive?: boolean - dateJoined?: Date + isActive?: boolean; + dateJoined?: Date; /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ - groups?: number[] + groups?: number[]; /** Specific permissions for this user. */ - userPermissions?: number[] + userPermissions?: number[]; - [key: string]: any + [key: string]: any; } export class PatchedWidget implements IPatchedWidget { - readonly id?: number - title?: string | undefined - body?: string | undefined + readonly id?: number; + title?: string | undefined; + body?: string | undefined; site?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IPatchedWidget) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + 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 + id?: number; + title?: string | undefined; + body?: string | undefined; + site?: number | undefined; - [key: string]: any + [key: string]: any; } export class Post implements IPost { - readonly id!: number - site!: SiteOverview - createdAt?: Date | undefined - body?: string | undefined - likeCount?: number | undefined - shareCount?: number | undefined - readonly commentCount!: number + readonly id!: number; + site!: SiteOverview; + createdAt?: Date | undefined; + body?: string | undefined; + likeCount?: number | undefined; + shareCount?: number | undefined; + readonly commentCount!: number; readonly hasLiked!: boolean; - [key: string]: any + [key: string]: any; constructor(data?: IPost) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + if (!data) { + this.site = new SiteOverview(); } - } - if (!data) { - this.site = new SiteOverview() - } } 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 (_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"]; + } } static fromJS(data: any): Post { - data = typeof data === 'object' ? data : {} - let result = new Post() - result.init(data) - return result + 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 = 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 - return data + 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; + return data; } } export interface IPost { - id: number - site: SiteOverview - createdAt?: Date | undefined - body?: string | undefined - likeCount?: number | undefined - shareCount?: number | undefined - commentCount: number - hasLiked: boolean + id: number; + site: SiteOverview; + createdAt?: Date | undefined; + body?: string | undefined; + likeCount?: number | undefined; + shareCount?: number | undefined; + commentCount: number; + hasLiked: boolean; - [key: string]: any + [key: string]: any; } export class Site implements ISite { - readonly id!: number - siteType!: SiteType - coordinate!: Coordinates - readonly siteTreeSpecies!: Sitetreespecies[] - contact!: Contact - announcement!: Announcement - name?: string | undefined - description?: string | undefined - size?: string | undefined - researchPartnership?: boolean | undefined - visibleMap?: boolean | undefined - visitorCount?: number | undefined + readonly id!: number; + siteType!: SiteType; + coordinate!: Coordinates; + readonly siteTreeSpecies!: Sitetreespecies[]; + contact!: Contact; + announcement!: Announcement; + name?: string | undefined; + description?: string | undefined; + size?: string | undefined; + researchPartnership?: boolean | undefined; + visibleMap?: boolean | undefined; + visitorCount?: number | undefined; image?: number | undefined; - [key: string]: any + [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() - } + 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(); + } } 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.name = _data['name'] - this.description = _data['description'] - this.size = _data['size'] - this.researchPartnership = _data['researchPartnership'] - this.visibleMap = _data['visibleMap'] - this.visitorCount = _data['visitorCount'] - this.image = _data['image'] - } + 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.name = _data["name"]; + this.description = _data["description"]; + this.size = _data["size"]; + this.researchPartnership = _data["researchPartnership"]; + this.visibleMap = _data["visibleMap"]; + this.visitorCount = _data["visitorCount"]; + this.image = _data["image"]; + } } static fromJS(data: any): Site { - data = typeof data === 'object' ? data : {} - let result = new Site() - result.init(data) - return result + 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['name'] = this.name - data['description'] = this.description - data['size'] = this.size - data['researchPartnership'] = this.researchPartnership - data['visibleMap'] = this.visibleMap - data['visitorCount'] = this.visitorCount - data['image'] = this.image - return data + 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["name"] = this.name; + data["description"] = this.description; + data["size"] = this.size; + data["researchPartnership"] = this.researchPartnership; + data["visibleMap"] = this.visibleMap; + data["visitorCount"] = this.visitorCount; + data["image"] = this.image; + return data; } } export interface ISite { - id: number - siteType: SiteType - coordinate: Coordinates - siteTreeSpecies: Sitetreespecies[] - contact: Contact - announcement: Announcement - name?: string | undefined - description?: string | undefined - size?: string | undefined - researchPartnership?: boolean | undefined - visibleMap?: boolean | undefined - visitorCount?: number | undefined - image?: number | undefined - - [key: string]: any + id: number; + siteType: SiteType; + coordinate: Coordinates; + siteTreeSpecies: Sitetreespecies[]; + contact: Contact; + announcement: Announcement; + name?: string | undefined; + description?: string | undefined; + size?: string | undefined; + researchPartnership?: boolean | undefined; + visibleMap?: boolean | undefined; + visitorCount?: number | undefined; + image?: number | undefined; + + [key: string]: any; +} + +export class SiteAdmin implements ISiteAdmin { + readonly id!: number; + readonly userId!: string; + readonly username!: string; + + [key: string]: any; + + constructor(data?: ISiteAdmin) { + 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).userId = _data["userId"]; + (this).username = _data["username"]; + } + } + + 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["id"] = this.id; + data["userId"] = this.userId; + data["username"] = this.username; + return data; + } +} + +export interface ISiteAdmin { + id: number; + userId: string; + username: string; + + [key: string]: any; } export class SiteMap implements ISiteMap { - readonly id!: number - name?: string | undefined - siteType!: SiteType - readonly coordinates!: CoordinatesMap + readonly id!: number; + name?: string | undefined; + siteType!: SiteType; + readonly coordinates!: CoordinatesMap; image?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: ISiteMap) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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(); } - } - if (!data) { - this.siteType = new SiteType() - this.coordinates = new CoordinatesMap() - } } 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'] - } + 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"]; + } } static fromJS(data: any): SiteMap { - data = typeof data === 'object' ? data : {} - let result = new SiteMap() - result.init(data) - return result + 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 = 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 - return data + 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; + return data; } } export interface ISiteMap { - id: number - name?: string | undefined - siteType: SiteType - coordinates: CoordinatesMap - image?: number | undefined + id: number; + name?: string | undefined; + siteType: SiteType; + coordinates: CoordinatesMap; + image?: number | undefined; - [key: string]: any + [key: string]: any; } export class SiteOverview implements ISiteOverview { - readonly id!: number + readonly id!: number; name?: string | undefined; - [key: string]: any + [key: string]: any; constructor(data?: ISiteOverview) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.name = _data["name"]; } - ;( this).id = _data['id'] - this.name = _data['name'] - } } static fromJS(data: any): SiteOverview { - data = typeof data === 'object' ? data : {} - let result = new SiteOverview() - result.init(data) - return result + 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 = 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 + data["id"] = this.id; + data["name"] = this.name; + return data; } } export interface ISiteOverview { - id: number - name?: string | undefined + id: number; + name?: string | undefined; - [key: string]: any + [key: string]: any; } export class SiteSocial implements ISiteSocial { - name?: string | undefined - siteType!: SiteType - image?: number | undefined - description?: string | undefined - contact!: Contact - announcement!: Announcement - readonly sponsors!: string[] + name?: string | undefined; + siteType!: SiteType; + image?: number | undefined; + description?: string | undefined; + contact!: Contact; + announcement!: Announcement; + readonly sponsors!: string[]; readonly widget!: Widget[]; - [key: string]: any + [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.contact = new Contact() - this.announcement = new Announcement() - this.sponsors = [] - this.widget = [] - } + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + if (!data) { + this.siteType = new SiteType(); + 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.name = _data['name'] - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - this.image = _data['image'] - 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(item) - } - } - if (Array.isArray(_data['widget'])) { - ;( this).widget = [] as any - for (let item of _data['widget']) { - ;( this).widget!.push(Widget.fromJS(item)) - } - } - } + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + this.name = _data["name"]; + this.siteType = _data["siteType"] ? SiteType.fromJS(_data["siteType"]) : new SiteType(); + this.image = _data["image"]; + 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(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 + 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['name'] = this.name - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['image'] = this.image - 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) - } - } - if (Array.isArray(this.widget)) { - data['widget'] = [] - for (let item of this.widget) { - data['widget'].push(item.toJSON()) - } - } - return data + data = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; + } + data["name"] = this.name; + data["siteType"] = this.siteType ? this.siteType.toJSON() : undefined; + data["image"] = this.image; + 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); + } + if (Array.isArray(this.widget)) { + data["widget"] = []; + for (let item of this.widget) + data["widget"].push(item.toJSON()); + } + return data; } } export interface ISiteSocial { - name?: string | undefined - siteType: SiteType - image?: number | undefined - description?: string | undefined - contact: Contact - announcement: Announcement - sponsors: string[] - widget: Widget[] + name?: string | undefined; + siteType: SiteType; + image?: number | undefined; + description?: string | undefined; + contact: Contact; + announcement: Announcement; + sponsors: string[]; + widget: Widget[]; - [key: string]: any + [key: string]: any; } export class SiteSummary implements ISiteSummary { - name?: string | undefined - siteType!: SiteType - readonly plantCount!: number - readonly survivedCount!: number - readonly propagationCount!: number - visitorCount?: number | undefined - readonly sponsor!: Batch[] + readonly id!: number; + name?: string | undefined; + coordinate!: Coordinates; + siteType!: SiteType; + readonly plantCount!: number; + readonly survivedCount!: number; + readonly propagationCount!: number; + visitorCount?: number | undefined; + readonly sponsors!: string[]; readonly progress!: number; + admins!: SiteAdmin[]; - [key: string]: any + [key: string]: any; constructor(data?: ISiteSummary) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 = []; } - } - if (!data) { - this.siteType = new SiteType() - this.sponsor = [] - } } init(_data?: any) { - if (_data) { - for (var property in _data) { - if (_data.hasOwnProperty(property)) { - this[property] = _data[property] - } - } - this.name = _data['name'] - this.siteType = _data['siteType'] ? SiteType.fromJS(_data['siteType']) : new SiteType() - ;( this).plantCount = _data['plantCount'] - ;( this).survivedCount = _data['survivedCount'] - ;( this).propagationCount = _data['propagationCount'] - this.visitorCount = _data['visitorCount'] - if (Array.isArray(_data['sponsor'])) { - ;( this).sponsor = [] as any - for (let item of _data['sponsor']) { - ;( this).sponsor!.push(Batch.fromJS(item)) - } - } - ;( this).progress = _data['progress'] - } + 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).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(item); + } + (this).progress = _data["progress"]; + if (Array.isArray(_data["admins"])) { + this.admins = [] as any; + for (let item of _data["admins"]) + this.admins!.push(SiteAdmin.fromJS(item)); + } + } } static fromJS(data: any): SiteSummary { - data = typeof data === 'object' ? data : {} - let result = new SiteSummary() - result.init(data) - return result + 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['name'] = this.name - data['siteType'] = this.siteType ? this.siteType.toJSON() : undefined - data['plantCount'] = this.plantCount - data['survivedCount'] = this.survivedCount - data['propagationCount'] = this.propagationCount - data['visitorCount'] = this.visitorCount - if (Array.isArray(this.sponsor)) { - data['sponsor'] = [] - for (let item of this.sponsor) { - data['sponsor'].push(item.toJSON()) - } - } - data['progress'] = this.progress - return data + 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["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); + } + data["progress"] = this.progress; + if (Array.isArray(this.admins)) { + data["admins"] = []; + for (let item of this.admins) + data["admins"].push(item.toJSON()); + } + return data; } } export interface ISiteSummary { - name?: string | undefined - siteType: SiteType - plantCount: number - survivedCount: number - propagationCount: number - visitorCount?: number | undefined - sponsor: Batch[] - progress: number + id: number; + name?: string | undefined; + coordinate: Coordinates; + siteType: SiteType; + plantCount: number; + survivedCount: number; + propagationCount: number; + visitorCount?: number | undefined; + sponsors: string[]; + progress: number; + admins: SiteAdmin[]; - [key: string]: any + [key: string]: any; } export class SiteType implements ISiteType { - readonly id!: number - readonly en!: string + readonly id!: number; + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: ISiteType) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + data["id"] = this.id; + data["en"] = this.en; + data["fr"] = this.fr; + return data; } } export interface ISiteType { - id: number - en: string - fr: string + id: number; + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class Sitetreespecies implements ISitetreespecies { - readonly id!: number - quantity?: number | undefined - readonly en!: string + readonly id!: number; + quantity?: number | undefined; + readonly en!: string; readonly fr!: string; - [key: string]: any + [key: string]: any; constructor(data?: ISitetreespecies) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + 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 | undefined - en: string - fr: string + id: number; + quantity?: number | undefined; + en: string; + fr: string; - [key: string]: any + [key: string]: any; } export class User implements IUser { - readonly id!: number - password!: string - lastLogin?: Date | undefined + readonly id!: number; + password!: string; + lastLogin?: Date | undefined; /** Designates that this user has all permissions without explicitly assigning them. */ - isSuperuser?: boolean + isSuperuser?: boolean; /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username!: string - firstName?: string - lastName?: string - email?: string + username!: string; + firstName?: string; + lastName?: string; + email?: string; /** Designates whether the user can log into this admin site. */ - isStaff?: boolean + isStaff?: boolean; /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ - isActive?: boolean - dateJoined?: Date + isActive?: boolean; + dateJoined?: Date; /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ - groups?: number[] + groups?: number[]; /** Specific permissions for this user. */ userPermissions?: number[]; - [key: string]: any + [key: string]: any; constructor(data?: IUser) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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.password = _data['password'] - 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.email = _data['email'] - this.isStaff = _data['isStaff'] - this.isActive = _data['isActive'] - this.dateJoined = _data['dateJoined'] ? new Date(_data['dateJoined'].toString()) : undefined - 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) - } - } - } + if (_data) { + for (var property in _data) { + if (_data.hasOwnProperty(property)) + this[property] = _data[property]; + } + (this).id = _data["id"]; + this.password = _data["password"]; + 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.email = _data["email"]; + this.isStaff = _data["isStaff"]; + this.isActive = _data["isActive"]; + this.dateJoined = _data["dateJoined"] ? new Date(_data["dateJoined"].toString()) : undefined; + 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 + 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['password'] = this.password - 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['email'] = this.email - data['isStaff'] = this.isStaff - data['isActive'] = this.isActive - data['dateJoined'] = this.dateJoined ? this.dateJoined.toISOString() : undefined - 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 + data = typeof data === 'object' ? data : {}; + for (var property in this) { + if (this.hasOwnProperty(property)) + data[property] = this[property]; + } + data["id"] = this.id; + data["password"] = this.password; + 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["email"] = this.email; + data["isStaff"] = this.isStaff; + data["isActive"] = this.isActive; + data["dateJoined"] = this.dateJoined ? this.dateJoined.toISOString() : undefined; + 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 - password: string - lastLogin?: Date | undefined + id: number; + password: string; + lastLogin?: Date | undefined; /** Designates that this user has all permissions without explicitly assigning them. */ - isSuperuser?: boolean + isSuperuser?: boolean; /** Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. */ - username: string - firstName?: string - lastName?: string - email?: string + username: string; + firstName?: string; + lastName?: string; + email?: string; /** Designates whether the user can log into this admin site. */ - isStaff?: boolean + isStaff?: boolean; /** Designates whether this user should be treated as active. Unselect this instead of deleting accounts. */ - isActive?: boolean - dateJoined?: Date + isActive?: boolean; + dateJoined?: Date; /** The groups this user belongs to. A user will get all permissions granted to each of their groups. */ - groups?: number[] + groups?: number[]; /** Specific permissions for this user. */ - userPermissions?: number[] + userPermissions?: number[]; - [key: string]: any + [key: string]: any; } export class Widget implements IWidget { - readonly id!: number - title?: string | undefined - body?: string | undefined + readonly id!: number; + title?: string | undefined; + body?: string | undefined; site?: number | undefined; - [key: string]: any + [key: string]: any; constructor(data?: IWidget) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) { - ;( this)[property] = ( data)[property] - } + 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 (_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"]; } - ;( 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 + 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 = 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 + 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 + id: number; + title?: string | undefined; + body?: string | undefined; + site?: number | undefined; - [key: string]: any + [key: string]: any; } export enum Format { - Json = 'json', - Yaml = 'yaml', + Json = "json", + Yaml = "yaml", } export enum Lang { - Af = 'af', - Ar = 'ar', - ArDz = 'ar-dz', - Ast = 'ast', - Az = 'az', - Be = 'be', - Bg = 'bg', - Bn = 'bn', - Br = 'br', - Bs = 'bs', - Ca = 'ca', - Ckb = 'ckb', - Cs = 'cs', - Cy = 'cy', - Da = 'da', - De = 'de', - Dsb = 'dsb', - El = 'el', - En = 'en', - EnAu = 'en-au', - EnGb = 'en-gb', - Eo = 'eo', - Es = 'es', - EsAr = 'es-ar', - EsCo = 'es-co', - EsMx = 'es-mx', - EsNi = 'es-ni', - EsVe = 'es-ve', - Et = 'et', - Eu = 'eu', - Fa = 'fa', - Fi = 'fi', - Fr = 'fr', - Fy = 'fy', - Ga = 'ga', - Gd = 'gd', - Gl = 'gl', - He = 'he', - Hi = 'hi', - Hr = 'hr', - Hsb = 'hsb', - Hu = 'hu', - Hy = 'hy', - Ia = 'ia', - Id = 'id', - Ig = 'ig', - Io = 'io', - Is = 'is', - It = 'it', - Ja = 'ja', - Ka = 'ka', - Kab = 'kab', - Kk = 'kk', - Km = 'km', - Kn = 'kn', - Ko = 'ko', - Ky = 'ky', - Lb = 'lb', - Lt = 'lt', - Lv = 'lv', - Mk = 'mk', - Ml = 'ml', - Mn = 'mn', - Mr = 'mr', - Ms = 'ms', - My = 'my', - Nb = 'nb', - Ne = 'ne', - Nl = 'nl', - Nn = 'nn', - Os = 'os', - Pa = 'pa', - Pl = 'pl', - Pt = 'pt', - PtBr = 'pt-br', - Ro = 'ro', - Ru = 'ru', - Sk = 'sk', - Sl = 'sl', - Sq = 'sq', - Sr = 'sr', - SrLatn = 'sr-latn', - Sv = 'sv', - Sw = 'sw', - Ta = 'ta', - Te = 'te', - Tg = 'tg', - Th = 'th', - Tk = 'tk', - Tr = 'tr', - Tt = 'tt', - Udm = 'udm', - Ug = 'ug', - Uk = 'uk', - Ur = 'ur', - Uz = 'uz', - Vi = 'vi', - ZhHans = 'zh-hans', - ZhHant = 'zh-hant', + Af = "af", + Ar = "ar", + ArDz = "ar-dz", + Ast = "ast", + Az = "az", + Be = "be", + Bg = "bg", + Bn = "bn", + Br = "br", + Bs = "bs", + Ca = "ca", + Ckb = "ckb", + Cs = "cs", + Cy = "cy", + Da = "da", + De = "de", + Dsb = "dsb", + El = "el", + En = "en", + EnAu = "en-au", + EnGb = "en-gb", + Eo = "eo", + Es = "es", + EsAr = "es-ar", + EsCo = "es-co", + EsMx = "es-mx", + EsNi = "es-ni", + EsVe = "es-ve", + Et = "et", + Eu = "eu", + Fa = "fa", + Fi = "fi", + Fr = "fr", + Fy = "fy", + Ga = "ga", + Gd = "gd", + Gl = "gl", + He = "he", + Hi = "hi", + Hr = "hr", + Hsb = "hsb", + Hu = "hu", + Hy = "hy", + Ia = "ia", + Id = "id", + Ig = "ig", + Io = "io", + Is = "is", + It = "it", + Ja = "ja", + Ka = "ka", + Kab = "kab", + Kk = "kk", + Km = "km", + Kn = "kn", + Ko = "ko", + Ky = "ky", + Lb = "lb", + Lt = "lt", + Lv = "lv", + Mk = "mk", + Ml = "ml", + Mn = "mn", + Mr = "mr", + Ms = "ms", + My = "my", + Nb = "nb", + Ne = "ne", + Nl = "nl", + Nn = "nn", + Os = "os", + Pa = "pa", + Pl = "pl", + Pt = "pt", + PtBr = "pt-br", + Ro = "ro", + Ru = "ru", + Sk = "sk", + Sl = "sl", + Sq = "sq", + Sr = "sr", + SrLatn = "sr-latn", + Sv = "sv", + Sw = "sw", + Ta = "ta", + Te = "te", + Tg = "tg", + Th = "th", + Tk = "tk", + Tr = "tr", + Tt = "tt", + Udm = "udm", + Ug = "ug", + Uk = "uk", + Ur = "ur", + Uz = "uz", + Vi = "vi", + ZhHans = "zh-hans", + ZhHant = "zh-hant", } export class ApiException extends Error { @@ -3901,33 +3804,26 @@ export class ApiException extends Error { headers: { [key: string]: any; }; result: any; - constructor(message: string, status: number, response: string, headers: { [key: string]: any }, result: any) { - super() + 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 + this.message = message; + this.status = status; + this.response = response; + this.headers = headers; + this.result = result; } - protected isApiException = true + protected isApiException = true; static isApiException(obj: any): obj is ApiException { - return obj.isApiException === true + 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) - } +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); }