709 lines
29 KiB
Python
709 lines
29 KiB
Python
import datetime
|
|
from collections.abc import Mapping
|
|
from typing import Any, TypeVar, Union, cast
|
|
|
|
from attrs import define as _attrs_define
|
|
from attrs import field as _attrs_field
|
|
from dateutil.parser import isoparse
|
|
|
|
from .. import types
|
|
from ..models.event_status_enum import EventStatusEnum
|
|
from ..models.moderation_status_enum import ModerationStatusEnum
|
|
from ..types import UNSET, Unset
|
|
|
|
T = TypeVar("T", bound="Event")
|
|
|
|
|
|
@_attrs_define
|
|
class Event:
|
|
"""Serializer for Node model
|
|
|
|
Attributes:
|
|
id (int):
|
|
unit_id (int):
|
|
name (str):
|
|
moderation_status (ModerationStatusEnum): * `not_requested` - Not requested
|
|
* `requested` - Requested
|
|
* `change_requested` - Change requested
|
|
* `validated` - Validated
|
|
are_registrations_allowed (bool):
|
|
are_payments_allowed (bool):
|
|
frontend_title (str): Main name of the event shown to end users. I.e. shown on the Ticket Office webpage
|
|
frontend_path (str): Root of public path of the event url
|
|
location_address (str):
|
|
ticket_office_url (str):
|
|
ticket_office_testing_url (str):
|
|
is_status_public (bool):
|
|
status (Union[Unset, EventStatusEnum]): * `draft` - Draft
|
|
* `public` - Public
|
|
* `closed` - Closed (force)
|
|
* `archived` - Archived
|
|
registrations_start_date (Union[None, Unset, datetime.datetime]):
|
|
payments_start_date (Union[None, Unset, datetime.datetime]):
|
|
payments_end_date (Union[None, Unset, datetime.datetime]):
|
|
closed_start_date (Union[None, Unset, datetime.date]):
|
|
registrations_end_date (Union[None, Unset, datetime.datetime]):
|
|
start_date (Union[None, Unset, datetime.datetime]):
|
|
end_date (Union[None, Unset, datetime.datetime]):
|
|
custom_key (Union[Unset, str]):
|
|
welcome_text (Union[Unset, str]): Welcome text displayed on the Ticket Office event page. Some restricted HTML
|
|
markup is allowed, everything else is filtered out automatically.
|
|
frontend_url (Union[Unset, str]): External url provided by the organizer. I.e. their website or social media
|
|
page
|
|
frontend_organizers (Union[Unset, str]): Name of the organizer, displayed on the Ticket Office event page
|
|
multiple_registration_per_login (Union[Unset, bool]):
|
|
user_nickname_enabled (Union[Unset, bool]):
|
|
user_registration_link_unique (Union[Unset, bool]):
|
|
description_header_image (Union[None, Unset, int]):
|
|
terms_of_service (Union[Unset, str]):
|
|
location_text (Union[Unset, str]):
|
|
location (Union[None, Unset, str]):
|
|
is_public_visible (Union[Unset, bool]):
|
|
is_unit_visible (Union[Unset, bool]):
|
|
is_basket_item_modification_allowed (Union[Unset, bool]): This field informs the front end on what actions
|
|
should be allowed or prevented, in the front end only.
|
|
is_in_lausanne (Union[Unset, bool]): if the event physically takes place in the city of Lausanne, set this
|
|
boolean so that taxes are calculated properly
|
|
"""
|
|
|
|
id: int
|
|
unit_id: int
|
|
name: str
|
|
moderation_status: ModerationStatusEnum
|
|
are_registrations_allowed: bool
|
|
are_payments_allowed: bool
|
|
frontend_title: str
|
|
frontend_path: str
|
|
location_address: str
|
|
ticket_office_url: str
|
|
ticket_office_testing_url: str
|
|
is_status_public: bool
|
|
status: Union[Unset, EventStatusEnum] = UNSET
|
|
registrations_start_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
payments_start_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
payments_end_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
closed_start_date: Union[None, Unset, datetime.date] = UNSET
|
|
registrations_end_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
start_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
end_date: Union[None, Unset, datetime.datetime] = UNSET
|
|
custom_key: Union[Unset, str] = UNSET
|
|
welcome_text: Union[Unset, str] = UNSET
|
|
frontend_url: Union[Unset, str] = UNSET
|
|
frontend_organizers: Union[Unset, str] = UNSET
|
|
multiple_registration_per_login: Union[Unset, bool] = UNSET
|
|
user_nickname_enabled: Union[Unset, bool] = UNSET
|
|
user_registration_link_unique: Union[Unset, bool] = UNSET
|
|
description_header_image: Union[None, Unset, int] = UNSET
|
|
terms_of_service: Union[Unset, str] = UNSET
|
|
location_text: Union[Unset, str] = UNSET
|
|
location: Union[None, Unset, str] = UNSET
|
|
is_public_visible: Union[Unset, bool] = UNSET
|
|
is_unit_visible: Union[Unset, bool] = UNSET
|
|
is_basket_item_modification_allowed: Union[Unset, bool] = UNSET
|
|
is_in_lausanne: Union[Unset, bool] = UNSET
|
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> dict[str, Any]:
|
|
id = self.id
|
|
|
|
unit_id = self.unit_id
|
|
|
|
name = self.name
|
|
|
|
moderation_status = self.moderation_status.value
|
|
|
|
are_registrations_allowed = self.are_registrations_allowed
|
|
|
|
are_payments_allowed = self.are_payments_allowed
|
|
|
|
frontend_title = self.frontend_title
|
|
|
|
frontend_path = self.frontend_path
|
|
|
|
location_address = self.location_address
|
|
|
|
ticket_office_url = self.ticket_office_url
|
|
|
|
ticket_office_testing_url = self.ticket_office_testing_url
|
|
|
|
is_status_public = self.is_status_public
|
|
|
|
status: Union[Unset, str] = UNSET
|
|
if not isinstance(self.status, Unset):
|
|
status = self.status.value
|
|
|
|
registrations_start_date: Union[None, Unset, str]
|
|
if isinstance(self.registrations_start_date, Unset):
|
|
registrations_start_date = UNSET
|
|
elif isinstance(self.registrations_start_date, datetime.datetime):
|
|
registrations_start_date = self.registrations_start_date.isoformat()
|
|
else:
|
|
registrations_start_date = self.registrations_start_date
|
|
|
|
payments_start_date: Union[None, Unset, str]
|
|
if isinstance(self.payments_start_date, Unset):
|
|
payments_start_date = UNSET
|
|
elif isinstance(self.payments_start_date, datetime.datetime):
|
|
payments_start_date = self.payments_start_date.isoformat()
|
|
else:
|
|
payments_start_date = self.payments_start_date
|
|
|
|
payments_end_date: Union[None, Unset, str]
|
|
if isinstance(self.payments_end_date, Unset):
|
|
payments_end_date = UNSET
|
|
elif isinstance(self.payments_end_date, datetime.datetime):
|
|
payments_end_date = self.payments_end_date.isoformat()
|
|
else:
|
|
payments_end_date = self.payments_end_date
|
|
|
|
closed_start_date: Union[None, Unset, str]
|
|
if isinstance(self.closed_start_date, Unset):
|
|
closed_start_date = UNSET
|
|
elif isinstance(self.closed_start_date, datetime.date):
|
|
closed_start_date = self.closed_start_date.isoformat()
|
|
else:
|
|
closed_start_date = self.closed_start_date
|
|
|
|
registrations_end_date: Union[None, Unset, str]
|
|
if isinstance(self.registrations_end_date, Unset):
|
|
registrations_end_date = UNSET
|
|
elif isinstance(self.registrations_end_date, datetime.datetime):
|
|
registrations_end_date = self.registrations_end_date.isoformat()
|
|
else:
|
|
registrations_end_date = self.registrations_end_date
|
|
|
|
start_date: Union[None, Unset, str]
|
|
if isinstance(self.start_date, Unset):
|
|
start_date = UNSET
|
|
elif isinstance(self.start_date, datetime.datetime):
|
|
start_date = self.start_date.isoformat()
|
|
else:
|
|
start_date = self.start_date
|
|
|
|
end_date: Union[None, Unset, str]
|
|
if isinstance(self.end_date, Unset):
|
|
end_date = UNSET
|
|
elif isinstance(self.end_date, datetime.datetime):
|
|
end_date = self.end_date.isoformat()
|
|
else:
|
|
end_date = self.end_date
|
|
|
|
custom_key = self.custom_key
|
|
|
|
welcome_text = self.welcome_text
|
|
|
|
frontend_url = self.frontend_url
|
|
|
|
frontend_organizers = self.frontend_organizers
|
|
|
|
multiple_registration_per_login = self.multiple_registration_per_login
|
|
|
|
user_nickname_enabled = self.user_nickname_enabled
|
|
|
|
user_registration_link_unique = self.user_registration_link_unique
|
|
|
|
description_header_image: Union[None, Unset, int]
|
|
if isinstance(self.description_header_image, Unset):
|
|
description_header_image = UNSET
|
|
else:
|
|
description_header_image = self.description_header_image
|
|
|
|
terms_of_service = self.terms_of_service
|
|
|
|
location_text = self.location_text
|
|
|
|
location: Union[None, Unset, str]
|
|
if isinstance(self.location, Unset):
|
|
location = UNSET
|
|
else:
|
|
location = self.location
|
|
|
|
is_public_visible = self.is_public_visible
|
|
|
|
is_unit_visible = self.is_unit_visible
|
|
|
|
is_basket_item_modification_allowed = self.is_basket_item_modification_allowed
|
|
|
|
is_in_lausanne = self.is_in_lausanne
|
|
|
|
field_dict: dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update(
|
|
{
|
|
"id": id,
|
|
"unit_id": unit_id,
|
|
"name": name,
|
|
"moderation_status": moderation_status,
|
|
"are_registrations_allowed": are_registrations_allowed,
|
|
"are_payments_allowed": are_payments_allowed,
|
|
"frontend_title": frontend_title,
|
|
"frontend_path": frontend_path,
|
|
"location_address": location_address,
|
|
"ticket_office_url": ticket_office_url,
|
|
"ticket_office_testing_url": ticket_office_testing_url,
|
|
"is_status_public": is_status_public,
|
|
}
|
|
)
|
|
if status is not UNSET:
|
|
field_dict["status"] = status
|
|
if registrations_start_date is not UNSET:
|
|
field_dict["registrations_start_date"] = registrations_start_date
|
|
if payments_start_date is not UNSET:
|
|
field_dict["payments_start_date"] = payments_start_date
|
|
if payments_end_date is not UNSET:
|
|
field_dict["payments_end_date"] = payments_end_date
|
|
if closed_start_date is not UNSET:
|
|
field_dict["closed_start_date"] = closed_start_date
|
|
if registrations_end_date is not UNSET:
|
|
field_dict["registrations_end_date"] = registrations_end_date
|
|
if start_date is not UNSET:
|
|
field_dict["start_date"] = start_date
|
|
if end_date is not UNSET:
|
|
field_dict["end_date"] = end_date
|
|
if custom_key is not UNSET:
|
|
field_dict["custom_key"] = custom_key
|
|
if welcome_text is not UNSET:
|
|
field_dict["welcome_text"] = welcome_text
|
|
if frontend_url is not UNSET:
|
|
field_dict["frontend_url"] = frontend_url
|
|
if frontend_organizers is not UNSET:
|
|
field_dict["frontend_organizers"] = frontend_organizers
|
|
if multiple_registration_per_login is not UNSET:
|
|
field_dict["multiple_registration_per_login"] = multiple_registration_per_login
|
|
if user_nickname_enabled is not UNSET:
|
|
field_dict["user_nickname_enabled"] = user_nickname_enabled
|
|
if user_registration_link_unique is not UNSET:
|
|
field_dict["user_registration_link_unique"] = user_registration_link_unique
|
|
if description_header_image is not UNSET:
|
|
field_dict["description_header_image"] = description_header_image
|
|
if terms_of_service is not UNSET:
|
|
field_dict["terms_of_service"] = terms_of_service
|
|
if location_text is not UNSET:
|
|
field_dict["location_text"] = location_text
|
|
if location is not UNSET:
|
|
field_dict["location"] = location
|
|
if is_public_visible is not UNSET:
|
|
field_dict["is_public_visible"] = is_public_visible
|
|
if is_unit_visible is not UNSET:
|
|
field_dict["is_unit_visible"] = is_unit_visible
|
|
if is_basket_item_modification_allowed is not UNSET:
|
|
field_dict["is_basket_item_modification_allowed"] = is_basket_item_modification_allowed
|
|
if is_in_lausanne is not UNSET:
|
|
field_dict["is_in_lausanne"] = is_in_lausanne
|
|
|
|
return field_dict
|
|
|
|
def to_multipart(self) -> types.RequestFiles:
|
|
files: types.RequestFiles = []
|
|
|
|
files.append(("id", (None, str(self.id).encode(), "text/plain")))
|
|
|
|
files.append(("unit_id", (None, str(self.unit_id).encode(), "text/plain")))
|
|
|
|
files.append(("name", (None, str(self.name).encode(), "text/plain")))
|
|
|
|
files.append(("moderation_status", (None, str(self.moderation_status.value).encode(), "text/plain")))
|
|
|
|
files.append(("are_registrations_allowed", (None, str(self.are_registrations_allowed).encode(), "text/plain")))
|
|
|
|
files.append(("are_payments_allowed", (None, str(self.are_payments_allowed).encode(), "text/plain")))
|
|
|
|
files.append(("frontend_title", (None, str(self.frontend_title).encode(), "text/plain")))
|
|
|
|
files.append(("frontend_path", (None, str(self.frontend_path).encode(), "text/plain")))
|
|
|
|
files.append(("location_address", (None, str(self.location_address).encode(), "text/plain")))
|
|
|
|
files.append(("ticket_office_url", (None, str(self.ticket_office_url).encode(), "text/plain")))
|
|
|
|
files.append(("ticket_office_testing_url", (None, str(self.ticket_office_testing_url).encode(), "text/plain")))
|
|
|
|
files.append(("is_status_public", (None, str(self.is_status_public).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.status, Unset):
|
|
files.append(("status", (None, str(self.status.value).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.registrations_start_date, Unset):
|
|
if isinstance(self.registrations_start_date, datetime.datetime):
|
|
files.append(
|
|
(
|
|
"registrations_start_date",
|
|
(None, self.registrations_start_date.isoformat().encode(), "text/plain"),
|
|
)
|
|
)
|
|
else:
|
|
files.append(
|
|
("registrations_start_date", (None, str(self.registrations_start_date).encode(), "text/plain"))
|
|
)
|
|
|
|
if not isinstance(self.payments_start_date, Unset):
|
|
if isinstance(self.payments_start_date, datetime.datetime):
|
|
files.append(
|
|
("payments_start_date", (None, self.payments_start_date.isoformat().encode(), "text/plain"))
|
|
)
|
|
else:
|
|
files.append(("payments_start_date", (None, str(self.payments_start_date).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.payments_end_date, Unset):
|
|
if isinstance(self.payments_end_date, datetime.datetime):
|
|
files.append(("payments_end_date", (None, self.payments_end_date.isoformat().encode(), "text/plain")))
|
|
else:
|
|
files.append(("payments_end_date", (None, str(self.payments_end_date).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.closed_start_date, Unset):
|
|
if isinstance(self.closed_start_date, datetime.date):
|
|
files.append(("closed_start_date", (None, self.closed_start_date.isoformat().encode(), "text/plain")))
|
|
else:
|
|
files.append(("closed_start_date", (None, str(self.closed_start_date).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.registrations_end_date, Unset):
|
|
if isinstance(self.registrations_end_date, datetime.datetime):
|
|
files.append(
|
|
("registrations_end_date", (None, self.registrations_end_date.isoformat().encode(), "text/plain"))
|
|
)
|
|
else:
|
|
files.append(
|
|
("registrations_end_date", (None, str(self.registrations_end_date).encode(), "text/plain"))
|
|
)
|
|
|
|
if not isinstance(self.start_date, Unset):
|
|
if isinstance(self.start_date, datetime.datetime):
|
|
files.append(("start_date", (None, self.start_date.isoformat().encode(), "text/plain")))
|
|
else:
|
|
files.append(("start_date", (None, str(self.start_date).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.end_date, Unset):
|
|
if isinstance(self.end_date, datetime.datetime):
|
|
files.append(("end_date", (None, self.end_date.isoformat().encode(), "text/plain")))
|
|
else:
|
|
files.append(("end_date", (None, str(self.end_date).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.custom_key, Unset):
|
|
files.append(("custom_key", (None, str(self.custom_key).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.welcome_text, Unset):
|
|
files.append(("welcome_text", (None, str(self.welcome_text).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.frontend_url, Unset):
|
|
files.append(("frontend_url", (None, str(self.frontend_url).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.frontend_organizers, Unset):
|
|
files.append(("frontend_organizers", (None, str(self.frontend_organizers).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.multiple_registration_per_login, Unset):
|
|
files.append(
|
|
(
|
|
"multiple_registration_per_login",
|
|
(None, str(self.multiple_registration_per_login).encode(), "text/plain"),
|
|
)
|
|
)
|
|
|
|
if not isinstance(self.user_nickname_enabled, Unset):
|
|
files.append(("user_nickname_enabled", (None, str(self.user_nickname_enabled).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.user_registration_link_unique, Unset):
|
|
files.append(
|
|
(
|
|
"user_registration_link_unique",
|
|
(None, str(self.user_registration_link_unique).encode(), "text/plain"),
|
|
)
|
|
)
|
|
|
|
if not isinstance(self.description_header_image, Unset):
|
|
if isinstance(self.description_header_image, int):
|
|
files.append(
|
|
("description_header_image", (None, str(self.description_header_image).encode(), "text/plain"))
|
|
)
|
|
else:
|
|
files.append(
|
|
("description_header_image", (None, str(self.description_header_image).encode(), "text/plain"))
|
|
)
|
|
|
|
if not isinstance(self.terms_of_service, Unset):
|
|
files.append(("terms_of_service", (None, str(self.terms_of_service).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.location_text, Unset):
|
|
files.append(("location_text", (None, str(self.location_text).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.location, Unset):
|
|
if isinstance(self.location, str):
|
|
files.append(("location", (None, str(self.location).encode(), "text/plain")))
|
|
else:
|
|
files.append(("location", (None, str(self.location).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.is_public_visible, Unset):
|
|
files.append(("is_public_visible", (None, str(self.is_public_visible).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.is_unit_visible, Unset):
|
|
files.append(("is_unit_visible", (None, str(self.is_unit_visible).encode(), "text/plain")))
|
|
|
|
if not isinstance(self.is_basket_item_modification_allowed, Unset):
|
|
files.append(
|
|
(
|
|
"is_basket_item_modification_allowed",
|
|
(None, str(self.is_basket_item_modification_allowed).encode(), "text/plain"),
|
|
)
|
|
)
|
|
|
|
if not isinstance(self.is_in_lausanne, Unset):
|
|
files.append(("is_in_lausanne", (None, str(self.is_in_lausanne).encode(), "text/plain")))
|
|
|
|
for prop_name, prop in self.additional_properties.items():
|
|
files.append((prop_name, (None, str(prop).encode(), "text/plain")))
|
|
|
|
return files
|
|
|
|
@classmethod
|
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
d = dict(src_dict)
|
|
id = d.pop("id")
|
|
|
|
unit_id = d.pop("unit_id")
|
|
|
|
name = d.pop("name")
|
|
|
|
moderation_status = ModerationStatusEnum(d.pop("moderation_status"))
|
|
|
|
are_registrations_allowed = d.pop("are_registrations_allowed")
|
|
|
|
are_payments_allowed = d.pop("are_payments_allowed")
|
|
|
|
frontend_title = d.pop("frontend_title")
|
|
|
|
frontend_path = d.pop("frontend_path")
|
|
|
|
location_address = d.pop("location_address")
|
|
|
|
ticket_office_url = d.pop("ticket_office_url")
|
|
|
|
ticket_office_testing_url = d.pop("ticket_office_testing_url")
|
|
|
|
is_status_public = d.pop("is_status_public")
|
|
|
|
_status = d.pop("status", UNSET)
|
|
status: Union[Unset, EventStatusEnum]
|
|
if isinstance(_status, Unset):
|
|
status = UNSET
|
|
else:
|
|
status = EventStatusEnum(_status)
|
|
|
|
def _parse_registrations_start_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
registrations_start_date_type_0 = isoparse(data)
|
|
|
|
return registrations_start_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.datetime], data)
|
|
|
|
registrations_start_date = _parse_registrations_start_date(d.pop("registrations_start_date", UNSET))
|
|
|
|
def _parse_payments_start_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
payments_start_date_type_0 = isoparse(data)
|
|
|
|
return payments_start_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.datetime], data)
|
|
|
|
payments_start_date = _parse_payments_start_date(d.pop("payments_start_date", UNSET))
|
|
|
|
def _parse_payments_end_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
payments_end_date_type_0 = isoparse(data)
|
|
|
|
return payments_end_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.datetime], data)
|
|
|
|
payments_end_date = _parse_payments_end_date(d.pop("payments_end_date", UNSET))
|
|
|
|
def _parse_closed_start_date(data: object) -> Union[None, Unset, datetime.date]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
closed_start_date_type_0 = isoparse(data).date()
|
|
|
|
return closed_start_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.date], data)
|
|
|
|
closed_start_date = _parse_closed_start_date(d.pop("closed_start_date", UNSET))
|
|
|
|
def _parse_registrations_end_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
registrations_end_date_type_0 = isoparse(data)
|
|
|
|
return registrations_end_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.datetime], data)
|
|
|
|
registrations_end_date = _parse_registrations_end_date(d.pop("registrations_end_date", UNSET))
|
|
|
|
def _parse_start_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
start_date_type_0 = isoparse(data)
|
|
|
|
return start_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.datetime], data)
|
|
|
|
start_date = _parse_start_date(d.pop("start_date", UNSET))
|
|
|
|
def _parse_end_date(data: object) -> Union[None, Unset, datetime.datetime]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
try:
|
|
if not isinstance(data, str):
|
|
raise TypeError()
|
|
end_date_type_0 = isoparse(data)
|
|
|
|
return end_date_type_0
|
|
except: # noqa: E722
|
|
pass
|
|
return cast(Union[None, Unset, datetime.datetime], data)
|
|
|
|
end_date = _parse_end_date(d.pop("end_date", UNSET))
|
|
|
|
custom_key = d.pop("custom_key", UNSET)
|
|
|
|
welcome_text = d.pop("welcome_text", UNSET)
|
|
|
|
frontend_url = d.pop("frontend_url", UNSET)
|
|
|
|
frontend_organizers = d.pop("frontend_organizers", UNSET)
|
|
|
|
multiple_registration_per_login = d.pop("multiple_registration_per_login", UNSET)
|
|
|
|
user_nickname_enabled = d.pop("user_nickname_enabled", UNSET)
|
|
|
|
user_registration_link_unique = d.pop("user_registration_link_unique", UNSET)
|
|
|
|
def _parse_description_header_image(data: object) -> Union[None, Unset, int]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
return cast(Union[None, Unset, int], data)
|
|
|
|
description_header_image = _parse_description_header_image(d.pop("description_header_image", UNSET))
|
|
|
|
terms_of_service = d.pop("terms_of_service", UNSET)
|
|
|
|
location_text = d.pop("location_text", UNSET)
|
|
|
|
def _parse_location(data: object) -> Union[None, Unset, str]:
|
|
if data is None:
|
|
return data
|
|
if isinstance(data, Unset):
|
|
return data
|
|
return cast(Union[None, Unset, str], data)
|
|
|
|
location = _parse_location(d.pop("location", UNSET))
|
|
|
|
is_public_visible = d.pop("is_public_visible", UNSET)
|
|
|
|
is_unit_visible = d.pop("is_unit_visible", UNSET)
|
|
|
|
is_basket_item_modification_allowed = d.pop("is_basket_item_modification_allowed", UNSET)
|
|
|
|
is_in_lausanne = d.pop("is_in_lausanne", UNSET)
|
|
|
|
event = cls(
|
|
id=id,
|
|
unit_id=unit_id,
|
|
name=name,
|
|
moderation_status=moderation_status,
|
|
are_registrations_allowed=are_registrations_allowed,
|
|
are_payments_allowed=are_payments_allowed,
|
|
frontend_title=frontend_title,
|
|
frontend_path=frontend_path,
|
|
location_address=location_address,
|
|
ticket_office_url=ticket_office_url,
|
|
ticket_office_testing_url=ticket_office_testing_url,
|
|
is_status_public=is_status_public,
|
|
status=status,
|
|
registrations_start_date=registrations_start_date,
|
|
payments_start_date=payments_start_date,
|
|
payments_end_date=payments_end_date,
|
|
closed_start_date=closed_start_date,
|
|
registrations_end_date=registrations_end_date,
|
|
start_date=start_date,
|
|
end_date=end_date,
|
|
custom_key=custom_key,
|
|
welcome_text=welcome_text,
|
|
frontend_url=frontend_url,
|
|
frontend_organizers=frontend_organizers,
|
|
multiple_registration_per_login=multiple_registration_per_login,
|
|
user_nickname_enabled=user_nickname_enabled,
|
|
user_registration_link_unique=user_registration_link_unique,
|
|
description_header_image=description_header_image,
|
|
terms_of_service=terms_of_service,
|
|
location_text=location_text,
|
|
location=location,
|
|
is_public_visible=is_public_visible,
|
|
is_unit_visible=is_unit_visible,
|
|
is_basket_item_modification_allowed=is_basket_item_modification_allowed,
|
|
is_in_lausanne=is_in_lausanne,
|
|
)
|
|
|
|
event.additional_properties = d
|
|
return event
|
|
|
|
@property
|
|
def additional_keys(self) -> list[str]:
|
|
return list(self.additional_properties.keys())
|
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
return self.additional_properties[key]
|
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
self.additional_properties[key] = value
|
|
|
|
def __delitem__(self, key: str) -> None:
|
|
del self.additional_properties[key]
|
|
|
|
def __contains__(self, key: str) -> bool:
|
|
return key in self.additional_properties
|