From 2553f302708961fa89089a54c7167279a48526aa Mon Sep 17 00:00:00 2001 From: Sunayana Ghosh Date: Sun, 29 Aug 2021 18:54:26 +0200 Subject: [PATCH] #3 Completed CategoryResponseApi and incorporation of data models for geometry, event, source etc. --- apps/retrieve_category.py | 8 +- swagger_client/__init__.py | 7 + swagger_client/models/__init__.py | 7 + swagger_client/models/category_response.py | 34 +- swagger_client/models/event.py | 308 ++++++++++++++++++ swagger_client/models/geometry.py | 226 +++++++++++++ .../one_of_category_response_events_items.py | 84 +++++ .../models/one_of_event_categories_items.py | 84 +++++ .../models/one_of_event_geometry_items.py | 84 +++++ .../models/one_of_event_sources_items.py | 84 +++++ swagger_client/models/source.py | 196 +++++++++++ 11 files changed, 1118 insertions(+), 4 deletions(-) create mode 100644 swagger_client/models/event.py create mode 100644 swagger_client/models/geometry.py create mode 100644 swagger_client/models/one_of_category_response_events_items.py create mode 100644 swagger_client/models/one_of_event_categories_items.py create mode 100644 swagger_client/models/one_of_event_geometry_items.py create mode 100644 swagger_client/models/one_of_event_sources_items.py create mode 100644 swagger_client/models/source.py diff --git a/apps/retrieve_category.py b/apps/retrieve_category.py index 35e04a2..1f9756d 100644 --- a/apps/retrieve_category.py +++ b/apps/retrieve_category.py @@ -5,9 +5,15 @@ def main(): api = DefaultApi() + # Example 1: Obtain wildfire response object wildfire_response: CategoryResponse = api.categories_category_id_get("wildfires") - + # Example 2: Obtain wildfire response object from a specific source + wildfire_response_source: CategoryResponse = api.categories_category_id_get( + "wildfires", source="InciWeb" + ) + # Example 3: print(wildfire_response) + print(wildfire_response_source._description) if __name__ == "__main__": diff --git a/swagger_client/__init__.py b/swagger_client/__init__.py index 1110912..3cf8ea2 100644 --- a/swagger_client/__init__.py +++ b/swagger_client/__init__.py @@ -22,3 +22,10 @@ # import models into sdk package from swagger_client.models.category import Category from swagger_client.models.category_response import CategoryResponse +from swagger_client.models.event import Event +from swagger_client.models.geometry import Geometry +from swagger_client.models.one_of_category_response_events_items import OneOfCategoryResponseEventsItems +from swagger_client.models.one_of_event_categories_items import OneOfEventCategoriesItems +from swagger_client.models.one_of_event_geometry_items import OneOfEventGeometryItems +from swagger_client.models.one_of_event_sources_items import OneOfEventSourcesItems +from swagger_client.models.source import Source diff --git a/swagger_client/models/__init__.py b/swagger_client/models/__init__.py index 8a43909..7e6b521 100644 --- a/swagger_client/models/__init__.py +++ b/swagger_client/models/__init__.py @@ -16,3 +16,10 @@ # import models into model package from swagger_client.models.category import Category from swagger_client.models.category_response import CategoryResponse +from swagger_client.models.event import Event +from swagger_client.models.geometry import Geometry +from swagger_client.models.one_of_category_response_events_items import OneOfCategoryResponseEventsItems +from swagger_client.models.one_of_event_categories_items import OneOfEventCategoriesItems +from swagger_client.models.one_of_event_geometry_items import OneOfEventGeometryItems +from swagger_client.models.one_of_event_sources_items import OneOfEventSourcesItems +from swagger_client.models.source import Source diff --git a/swagger_client/models/category_response.py b/swagger_client/models/category_response.py index 223f409..03d7bfe 100644 --- a/swagger_client/models/category_response.py +++ b/swagger_client/models/category_response.py @@ -30,20 +30,23 @@ class CategoryResponse(object): swagger_types = { 'title': 'str', 'description': 'str', - 'link': 'str' + 'link': 'str', + 'events': 'list[OneOfCategoryResponseEventsItems]' } attribute_map = { 'title': 'title', 'description': 'description', - 'link': 'link' + 'link': 'link', + 'events': 'events' } - def __init__(self, title=None, description=None, link=None): # noqa: E501 + def __init__(self, title=None, description=None, link=None, events=None): # noqa: E501 """CategoryResponse - a model defined in Swagger""" # noqa: E501 self._title = None self._description = None self._link = None + self._events = None self.discriminator = None if title is not None: self.title = title @@ -51,6 +54,8 @@ def __init__(self, title=None, description=None, link=None): # noqa: E501 self.description = description if link is not None: self.link = link + if events is not None: + self.events = events @property def title(self): @@ -115,6 +120,29 @@ def link(self, link): self._link = link + @property + def events(self): + """Gets the events of this CategoryResponse. # noqa: E501 + + An array of events. # noqa: E501 + + :return: The events of this CategoryResponse. # noqa: E501 + :rtype: list[OneOfCategoryResponseEventsItems] + """ + return self._events + + @events.setter + def events(self, events): + """Sets the events of this CategoryResponse. + + An array of events. # noqa: E501 + + :param events: The events of this CategoryResponse. # noqa: E501 + :type: list[OneOfCategoryResponseEventsItems] + """ + + self._events = events + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/swagger_client/models/event.py b/swagger_client/models/event.py new file mode 100644 index 0000000..144191e --- /dev/null +++ b/swagger_client/models/event.py @@ -0,0 +1,308 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class Event(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'description': 'str', + 'link': 'str', + 'closed': 'str', + 'categories': 'list[OneOfEventCategoriesItems]', + 'sources': 'list[OneOfEventSourcesItems]', + 'geometry': 'list[OneOfEventGeometryItems]' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'description': 'description', + 'link': 'link', + 'closed': 'closed', + 'categories': 'categories', + 'sources': 'sources', + 'geometry': 'geometry' + } + + def __init__(self, id=None, title=None, description=None, link=None, closed=None, categories=None, sources=None, geometry=None): # noqa: E501 + """Event - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._description = None + self._link = None + self._closed = None + self._categories = None + self._sources = None + self._geometry = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if description is not None: + self.description = description + if link is not None: + self.link = link + if closed is not None: + self.closed = closed + if categories is not None: + self.categories = categories + if sources is not None: + self.sources = sources + if geometry is not None: + self.geometry = geometry + + @property + def id(self): + """Gets the id of this Event. # noqa: E501 + + Unique id for this event. # noqa: E501 + + :return: The id of this Event. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Event. + + Unique id for this event. # noqa: E501 + + :param id: The id of this Event. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this Event. # noqa: E501 + + The title of the event. # noqa: E501 + + :return: The title of this Event. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Event. + + The title of the event. # noqa: E501 + + :param title: The title of this Event. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def description(self): + """Gets the description of this Event. # noqa: E501 + + Optional longer description of the event. Most likely only a sentence or two. # noqa: E501 + + :return: The description of this Event. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Event. + + Optional longer description of the event. Most likely only a sentence or two. # noqa: E501 + + :param description: The description of this Event. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def link(self): + """Gets the link of this Event. # noqa: E501 + + The full link to the API endpoint for this specific event. # noqa: E501 + + :return: The link of this Event. # noqa: E501 + :rtype: str + """ + return self._link + + @link.setter + def link(self, link): + """Sets the link of this Event. + + The full link to the API endpoint for this specific event. # noqa: E501 + + :param link: The link of this Event. # noqa: E501 + :type: str + """ + + self._link = link + + @property + def closed(self): + """Gets the closed of this Event. # noqa: E501 + + An event is deemed “closed” when it has ended. The closed field will include a date/time when the event has ended. Depending upon the nature of the event, the closed value may or may not accurately represent the absolute ending of the event. If the event is open, this will show “null”. # noqa: E501 + + :return: The closed of this Event. # noqa: E501 + :rtype: str + """ + return self._closed + + @closed.setter + def closed(self, closed): + """Sets the closed of this Event. + + An event is deemed “closed” when it has ended. The closed field will include a date/time when the event has ended. Depending upon the nature of the event, the closed value may or may not accurately represent the absolute ending of the event. If the event is open, this will show “null”. # noqa: E501 + + :param closed: The closed of this Event. # noqa: E501 + :type: str + """ + + self._closed = closed + + @property + def categories(self): + """Gets the categories of this Event. # noqa: E501 + + One or more categories assigned to the event. # noqa: E501 + + :return: The categories of this Event. # noqa: E501 + :rtype: list[OneOfEventCategoriesItems] + """ + return self._categories + + @categories.setter + def categories(self, categories): + """Sets the categories of this Event. + + One or more categories assigned to the event. # noqa: E501 + + :param categories: The categories of this Event. # noqa: E501 + :type: list[OneOfEventCategoriesItems] + """ + + self._categories = categories + + @property + def sources(self): + """Gets the sources of this Event. # noqa: E501 + + One or more sources that refer to more information about the event. # noqa: E501 + + :return: The sources of this Event. # noqa: E501 + :rtype: list[OneOfEventSourcesItems] + """ + return self._sources + + @sources.setter + def sources(self, sources): + """Sets the sources of this Event. + + One or more sources that refer to more information about the event. # noqa: E501 + + :param sources: The sources of this Event. # noqa: E501 + :type: list[OneOfEventSourcesItems] + """ + + self._sources = sources + + @property + def geometry(self): + """Gets the geometry of this Event. # noqa: E501 + + One or more event geometries are the pairing of a specific date/time with a location. Information regarding the event magnitude, if available, is displayed here. # noqa: E501 + + :return: The geometry of this Event. # noqa: E501 + :rtype: list[OneOfEventGeometryItems] + """ + return self._geometry + + @geometry.setter + def geometry(self, geometry): + """Sets the geometry of this Event. + + One or more event geometries are the pairing of a specific date/time with a location. Information regarding the event magnitude, if available, is displayed here. # noqa: E501 + + :param geometry: The geometry of this Event. # noqa: E501 + :type: list[OneOfEventGeometryItems] + """ + + self._geometry = geometry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Event, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Event): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/swagger_client/models/geometry.py b/swagger_client/models/geometry.py new file mode 100644 index 0000000..eaa8d10 --- /dev/null +++ b/swagger_client/models/geometry.py @@ -0,0 +1,226 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class Geometry(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'magnitude_value': 'str', + 'magnitude_unit': 'str', + '_date': 'str', + 'type': 'str', + 'coordinates': 'list[float]' + } + + attribute_map = { + 'magnitude_value': 'magnitudeValue', + 'magnitude_unit': 'magnitudeUnit', + '_date': 'date', + 'type': 'type', + 'coordinates': 'coordinates' + } + + def __init__(self, magnitude_value=None, magnitude_unit=None, _date=None, type=None, coordinates=None): # noqa: E501 + """Geometry - a model defined in Swagger""" # noqa: E501 + self._magnitude_value = None + self._magnitude_unit = None + self.__date = None + self._type = None + self._coordinates = None + self.discriminator = None + if magnitude_value is not None: + self.magnitude_value = magnitude_value + if magnitude_unit is not None: + self.magnitude_unit = magnitude_unit + if _date is not None: + self._date = _date + if type is not None: + self.type = type + if coordinates is not None: + self.coordinates = coordinates + + @property + def magnitude_value(self): + """Gets the magnitude_value of this Geometry. # noqa: E501 + + Information regarding the event magnitude is displayed if available. # noqa: E501 + + :return: The magnitude_value of this Geometry. # noqa: E501 + :rtype: str + """ + return self._magnitude_value + + @magnitude_value.setter + def magnitude_value(self, magnitude_value): + """Sets the magnitude_value of this Geometry. + + Information regarding the event magnitude is displayed if available. # noqa: E501 + + :param magnitude_value: The magnitude_value of this Geometry. # noqa: E501 + :type: str + """ + + self._magnitude_value = magnitude_value + + @property + def magnitude_unit(self): + """Gets the magnitude_unit of this Geometry. # noqa: E501 + + Information regarding the event magnitude unit is displayed if available. # noqa: E501 + + :return: The magnitude_unit of this Geometry. # noqa: E501 + :rtype: str + """ + return self._magnitude_unit + + @magnitude_unit.setter + def magnitude_unit(self, magnitude_unit): + """Sets the magnitude_unit of this Geometry. + + Information regarding the event magnitude unit is displayed if available. # noqa: E501 + + :param magnitude_unit: The magnitude_unit of this Geometry. # noqa: E501 + :type: str + """ + + self._magnitude_unit = magnitude_unit + + @property + def _date(self): + """Gets the _date of this Geometry. # noqa: E501 + + The date/time will most likely be 00:00Z unless the source provided a particular time. # noqa: E501 + + :return: The _date of this Geometry. # noqa: E501 + :rtype: str + """ + return self.__date + + @_date.setter + def _date(self, _date): + """Sets the _date of this Geometry. + + The date/time will most likely be 00:00Z unless the source provided a particular time. # noqa: E501 + + :param _date: The _date of this Geometry. # noqa: E501 + :type: str + """ + + self.__date = _date + + @property + def type(self): + """Gets the type of this Geometry. # noqa: E501 + + + :return: The type of this Geometry. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Geometry. + + + :param type: The type of this Geometry. # noqa: E501 + :type: str + """ + allowed_values = ["Point", "Polygon"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def coordinates(self): + """Gets the coordinates of this Geometry. # noqa: E501 + + + :return: The coordinates of this Geometry. # noqa: E501 + :rtype: list[float] + """ + return self._coordinates + + @coordinates.setter + def coordinates(self, coordinates): + """Sets the coordinates of this Geometry. + + + :param coordinates: The coordinates of this Geometry. # noqa: E501 + :type: list[float] + """ + + self._coordinates = coordinates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Geometry, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Geometry): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/swagger_client/models/one_of_category_response_events_items.py b/swagger_client/models/one_of_category_response_events_items.py new file mode 100644 index 0000000..dd5082a --- /dev/null +++ b/swagger_client/models/one_of_category_response_events_items.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OneOfCategoryResponseEventsItems(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OneOfCategoryResponseEventsItems - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OneOfCategoryResponseEventsItems, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OneOfCategoryResponseEventsItems): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/swagger_client/models/one_of_event_categories_items.py b/swagger_client/models/one_of_event_categories_items.py new file mode 100644 index 0000000..fa3606b --- /dev/null +++ b/swagger_client/models/one_of_event_categories_items.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OneOfEventCategoriesItems(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OneOfEventCategoriesItems - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OneOfEventCategoriesItems, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OneOfEventCategoriesItems): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/swagger_client/models/one_of_event_geometry_items.py b/swagger_client/models/one_of_event_geometry_items.py new file mode 100644 index 0000000..8f49ddf --- /dev/null +++ b/swagger_client/models/one_of_event_geometry_items.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OneOfEventGeometryItems(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OneOfEventGeometryItems - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OneOfEventGeometryItems, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OneOfEventGeometryItems): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/swagger_client/models/one_of_event_sources_items.py b/swagger_client/models/one_of_event_sources_items.py new file mode 100644 index 0000000..64357e6 --- /dev/null +++ b/swagger_client/models/one_of_event_sources_items.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OneOfEventSourcesItems(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OneOfEventSourcesItems - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OneOfEventSourcesItems, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OneOfEventSourcesItems): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/swagger_client/models/source.py b/swagger_client/models/source.py new file mode 100644 index 0000000..cb83b69 --- /dev/null +++ b/swagger_client/models/source.py @@ -0,0 +1,196 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class Source(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'source': 'str', + 'link': 'str' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'source': 'source', + 'link': 'link' + } + + def __init__(self, id=None, title=None, source=None, link=None): # noqa: E501 + """Source - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._source = None + self._link = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if source is not None: + self.source = source + if link is not None: + self.link = link + + @property + def id(self): + """Gets the id of this Source. # noqa: E501 + + unique id of source type # noqa: E501 + + :return: The id of this Source. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Source. + + unique id of source type # noqa: E501 + + :param id: The id of this Source. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this Source. # noqa: E501 + + title of this source # noqa: E501 + + :return: The title of this Source. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Source. + + title of this source # noqa: E501 + + :param title: The title of this Source. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def source(self): + """Gets the source of this Source. # noqa: E501 + + homepage URL for this source # noqa: E501 + + :return: The source of this Source. # noqa: E501 + :rtype: str + """ + return self._source + + @source.setter + def source(self, source): + """Sets the source of this Source. + + homepage URL for this source # noqa: E501 + + :param source: The source of this Source. # noqa: E501 + :type: str + """ + + self._source = source + + @property + def link(self): + """Gets the link of this Source. # noqa: E501 + + The full link to the API endpoint for this specific source, which is the same as the Events API endpoint only filtered to return only events from this source. # noqa: E501 + + :return: The link of this Source. # noqa: E501 + :rtype: str + """ + return self._link + + @link.setter + def link(self, link): + """Sets the link of this Source. + + The full link to the API endpoint for this specific source, which is the same as the Events API endpoint only filtered to return only events from this source. # noqa: E501 + + :param link: The link of this Source. # noqa: E501 + :type: str + """ + + self._link = link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Source, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Source): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other