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
+}
+
+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"];
+ (