diff --git a/CHANGELOG.md b/CHANGELOG.md index 4153e06..7d276b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.14.0] - 2021-09-27 + +### Added + +- Adds mechanism, tagline, state, latitude, longitude, and technology_type to project responses + ## [1.13.0] - 2021-09-10 ### Added diff --git a/patch_api/__init__.py b/patch_api/__init__.py index e1b2831..998d988 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.13.0" +__version__ = "1.14.0" # import ApiClient from patch_api.api_client import ApiClient diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 5cdae55..493f7fa 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "patch-python/1.13.0" + self.user_agent = "patch-python/1.14.0" def __del__(self): if self._pool: diff --git a/patch_api/configuration.py b/patch_api/configuration.py index b1f950b..cfbb138 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -341,7 +341,7 @@ def to_debug_report(self): "OS: {env}\n" "Python Version: {pyversion}\n" "Version of the API: v1\n" - "SDK Package Version: 1.13.0".format( + "SDK Package Version: 1.14.0".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 6003644..f7f2792 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -41,6 +41,7 @@ from patch_api.models.order import Order from patch_api.models.order_list_response import OrderListResponse from patch_api.models.order_response import OrderResponse +from patch_api.models.parent_technology_type import ParentTechnologyType from patch_api.models.photo import Photo from patch_api.models.preference import Preference from patch_api.models.preference_list_response import PreferenceListResponse @@ -50,3 +51,4 @@ from patch_api.models.project_response import ProjectResponse from patch_api.models.sdg import Sdg from patch_api.models.standard import Standard +from patch_api.models.technology_type import TechnologyType diff --git a/patch_api/models/parent_technology_type.py b/patch_api/models/parent_technology_type.py new file mode 100644 index 0000000..8b94940 --- /dev/null +++ b/patch_api/models/parent_technology_type.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + Contact: developers@usepatch.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from patch_api.configuration import Configuration + + +class ParentTechnologyType(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_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. + """ + openapi_types = {"slug": "str", "name": "str"} + + attribute_map = {"slug": "slug", "name": "name"} + + def __init__( + self, slug=None, name=None, local_vars_configuration=None + ): # noqa: E501 + """ParentTechnologyType - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._slug = None + self._name = None + self.discriminator = None + + if slug is not None: + self.slug = slug + if name is not None: + self.name = name + + @property + def slug(self): + """Gets the slug of this ParentTechnologyType. # noqa: E501 + + Unique identifier for this type of technology. # noqa: E501 + + :return: The slug of this ParentTechnologyType. # noqa: E501 + :rtype: str + """ + return self._slug + + @slug.setter + def slug(self, slug): + """Sets the slug of this ParentTechnologyType. + + Unique identifier for this type of technology. # noqa: E501 + + :param slug: The slug of this ParentTechnologyType. # noqa: E501 + :type: str + """ + + self._slug = slug + + @property + def name(self): + """Gets the name of this ParentTechnologyType. # noqa: E501 + + Name of this technology type. # noqa: E501 + + :return: The name of this ParentTechnologyType. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ParentTechnologyType. + + Name of this technology type. # noqa: E501 + + :param name: The name of this ParentTechnologyType. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 + + 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, ParentTechnologyType): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, ParentTechnologyType): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project.py b/patch_api/models/project.py index c1a9ffa..a7d3f74 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -39,13 +39,19 @@ class Project(object): "name": "str", "description": "str", "type": "str", + "mechanism": "str", "country": "str", + "state": "str", + "latitude": "float", + "longitude": "float", "developer": "str", "photos": "list[Photo]", "average_price_per_tonne_cents_usd": "int", "remaining_mass_g": "int", "standard": "Standard", "sdgs": "list[Sdg]", + "technology_type": "TechnologyType", + "tagline": "str", } attribute_map = { @@ -54,13 +60,19 @@ class Project(object): "name": "name", "description": "description", "type": "type", + "mechanism": "mechanism", "country": "country", + "state": "state", + "latitude": "latitude", + "longitude": "longitude", "developer": "developer", "photos": "photos", "average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd", "remaining_mass_g": "remaining_mass_g", "standard": "standard", "sdgs": "sdgs", + "technology_type": "technology_type", + "tagline": "tagline", } def __init__( @@ -70,13 +82,19 @@ def __init__( name=None, description=None, type=None, + mechanism=None, country=None, + state=None, + latitude=None, + longitude=None, developer=None, photos=None, average_price_per_tonne_cents_usd=None, remaining_mass_g=None, standard=None, sdgs=None, + technology_type=None, + tagline=None, local_vars_configuration=None, ): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 @@ -89,13 +107,19 @@ def __init__( self._name = None self._description = None self._type = None + self._mechanism = None self._country = None + self._state = None + self._latitude = None + self._longitude = None self._developer = None self._photos = None self._average_price_per_tonne_cents_usd = None self._remaining_mass_g = None self._standard = None self._sdgs = None + self._technology_type = None + self._tagline = None self.discriminator = None self.id = id @@ -104,13 +128,21 @@ def __init__( self.description = description if type is not None: self.type = type + if mechanism is not None: + self.mechanism = mechanism self.country = country + self.state = state + self.latitude = latitude + self.longitude = longitude self.developer = developer self.photos = photos self.average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd self.remaining_mass_g = remaining_mass_g self.standard = standard self.sdgs = sdgs + if technology_type is not None: + self.technology_type = technology_type + self.tagline = tagline @property def id(self): @@ -267,6 +299,39 @@ def type(self, type): self._type = type + @property + def mechanism(self): + """Gets the mechanism of this Project. # noqa: E501 + + The mechanism of the project. removal or avoidance. # noqa: E501 + + :return: The mechanism of this Project. # noqa: E501 + :rtype: str + """ + return self._mechanism + + @mechanism.setter + def mechanism(self, mechanism): + """Sets the mechanism of this Project. + + The mechanism of the project. removal or avoidance. # noqa: E501 + + :param mechanism: The mechanism of this Project. # noqa: E501 + :type: str + """ + allowed_values = ["removal", "avoidance"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mechanism not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `mechanism` ({0}), must be one of {1}".format( # noqa: E501 + mechanism, allowed_values + ) + ) + + self._mechanism = mechanism + @property def country(self): """Gets the country of this Project. # noqa: E501 @@ -296,6 +361,75 @@ def country(self, country): self._country = country + @property + def state(self): + """Gets the state of this Project. # noqa: E501 + + The state where this project is located. # noqa: E501 + + :return: The state of this Project. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Project. + + The state where this project is located. # noqa: E501 + + :param state: The state of this Project. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def latitude(self): + """Gets the latitude of this Project. # noqa: E501 + + The latitude at which this project is located. # noqa: E501 + + :return: The latitude of this Project. # noqa: E501 + :rtype: float + """ + return self._latitude + + @latitude.setter + def latitude(self, latitude): + """Sets the latitude of this Project. + + The latitude at which this project is located. # noqa: E501 + + :param latitude: The latitude of this Project. # noqa: E501 + :type: float + """ + + self._latitude = latitude + + @property + def longitude(self): + """Gets the longitude of this Project. # noqa: E501 + + The longitude at which this project is located. # noqa: E501 + + :return: The longitude of this Project. # noqa: E501 + :rtype: float + """ + return self._longitude + + @longitude.setter + def longitude(self, longitude): + """Sets the longitude of this Project. + + The longitude at which this project is located. # noqa: E501 + + :param longitude: The longitude of this Project. # noqa: E501 + :type: float + """ + + self._longitude = longitude + @property def developer(self): """Gets the developer of this Project. # noqa: E501 @@ -454,6 +588,50 @@ def sdgs(self, sdgs): self._sdgs = sdgs + @property + def technology_type(self): + """Gets the technology_type of this Project. # noqa: E501 + + + :return: The technology_type of this Project. # noqa: E501 + :rtype: TechnologyType + """ + return self._technology_type + + @technology_type.setter + def technology_type(self, technology_type): + """Sets the technology_type of this Project. + + + :param technology_type: The technology_type of this Project. # noqa: E501 + :type: TechnologyType + """ + + self._technology_type = technology_type + + @property + def tagline(self): + """Gets the tagline of this Project. # noqa: E501 + + A short description of the project # noqa: E501 + + :return: The tagline of this Project. # noqa: E501 + :rtype: str + """ + return self._tagline + + @tagline.setter + def tagline(self, tagline): + """Sets the tagline of this Project. + + A short description of the project # noqa: E501 + + :param tagline: The tagline of this Project. # noqa: E501 + :type: str + """ + + self._tagline = tagline + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/patch_api/models/technology_type.py b/patch_api/models/technology_type.py new file mode 100644 index 0000000..a8de96e --- /dev/null +++ b/patch_api/models/technology_type.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + Patch API V1 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: v1 + Contact: developers@usepatch.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from patch_api.configuration import Configuration + + +class TechnologyType(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_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. + """ + openapi_types = { + "slug": "str", + "name": "str", + "parent_technology_type": "ParentTechnologyType", + } + + attribute_map = { + "slug": "slug", + "name": "name", + "parent_technology_type": "parent_technology_type", + } + + def __init__( + self, + slug=None, + name=None, + parent_technology_type=None, + local_vars_configuration=None, + ): # noqa: E501 + """TechnologyType - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._slug = None + self._name = None + self._parent_technology_type = None + self.discriminator = None + + if slug is not None: + self.slug = slug + if name is not None: + self.name = name + if parent_technology_type is not None: + self.parent_technology_type = parent_technology_type + + @property + def slug(self): + """Gets the slug of this TechnologyType. # noqa: E501 + + Unique identifier for this type of technology. # noqa: E501 + + :return: The slug of this TechnologyType. # noqa: E501 + :rtype: str + """ + return self._slug + + @slug.setter + def slug(self, slug): + """Sets the slug of this TechnologyType. + + Unique identifier for this type of technology. # noqa: E501 + + :param slug: The slug of this TechnologyType. # noqa: E501 + :type: str + """ + + self._slug = slug + + @property + def name(self): + """Gets the name of this TechnologyType. # noqa: E501 + + Name of this technology type. # noqa: E501 + + :return: The name of this TechnologyType. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TechnologyType. + + Name of this technology type. # noqa: E501 + + :param name: The name of this TechnologyType. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def parent_technology_type(self): + """Gets the parent_technology_type of this TechnologyType. # noqa: E501 + + + :return: The parent_technology_type of this TechnologyType. # noqa: E501 + :rtype: ParentTechnologyType + """ + return self._parent_technology_type + + @parent_technology_type.setter + def parent_technology_type(self, parent_technology_type): + """Sets the parent_technology_type of this TechnologyType. + + + :param parent_technology_type: The parent_technology_type of this TechnologyType. # noqa: E501 + :type: ParentTechnologyType + """ + + self._parent_technology_type = parent_technology_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 + + 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, TechnologyType): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, TechnologyType): + return True + + return self.to_dict() != other.to_dict() diff --git a/setup.py b/setup.py index cf053d0..a6d8956 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.13.0" +VERSION = "1.14.0" # To install the library, run the following # # python setup.py install diff --git a/test/test_projects_api.py b/test/test_projects_api.py index 11f2d90..643f610 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -40,6 +40,21 @@ def test_retrieve_project(self): self.assertEqual(project.production, False) self.assertTrue(isinstance(project.photos, list)) + self.assertTrue(hasattr(project, "tagline")) + self.assertTrue(hasattr(project, "latitude")) + self.assertTrue(hasattr(project, "longitude")) + + self.assertTrue(isinstance(project.mechanism, str)) + self.assertTrue(isinstance(project.state, str)) + + technology_type = project.technology_type + self.assertTrue(isinstance(technology_type.name, str)) + self.assertTrue(isinstance(technology_type.slug, str)) + + parent_technology_type = technology_type.parent_technology_type + self.assertTrue(isinstance(parent_technology_type.name, str)) + self.assertTrue(isinstance(parent_technology_type.slug, str)) + def test_retrieve_projects(self): """Test case for retrieve_projects