From 29119f5b9592013a033bf332d8daf6bc889d08a7 Mon Sep 17 00:00:00 2001 From: Vicky Enalen Date: Fri, 14 Apr 2023 13:45:54 -0700 Subject: [PATCH] Update to 2.1.1 --- CHANGELOG.md | 7 + patch_api/__init__.py | 2 +- patch_api/api_client.py | 2 +- patch_api/configuration.py | 2 +- patch_api/models/__init__.py | 1 + patch_api/models/disclaimer.py | 252 ++++++++++++++++++++++++++++ patch_api/models/order.py | 4 +- patch_api/models/order_line_item.py | 4 +- patch_api/models/project.py | 68 ++++++++ setup.py | 2 +- test/test_projects_api.py | 11 ++ 11 files changed, 347 insertions(+), 8 deletions(-) create mode 100644 patch_api/models/disclaimer.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 68e7278..b049740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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). +## [2.1.1] - 2023-04-18 + +### Added + +- Adds `issuance_type` to `project` responses +- Adds `disclaimers` to `project` responses + ## [2.1.0] - 2023-04-04 ### Added diff --git a/patch_api/__init__.py b/patch_api/__init__.py index f92471d..4426d4a 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "2.1.0" +__version__ = "2.1.1" # import ApiClient from patch_api.api_client import ApiClient diff --git a/patch_api/api_client.py b/patch_api/api_client.py index ed472c8..d1584a0 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -92,7 +92,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "patch-python/2.1.0" + self.user_agent = "patch-python/2.1.1" # Set default Patch-Version self.patch_version = 2 diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 0021f03..e61902b 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: 2\n" - "SDK Package Version: 2.1.0".format(env=sys.platform, pyversion=sys.version) + "SDK Package Version: 2.1.1".format(env=sys.platform, pyversion=sys.version) ) def get_host_settings(self): diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 24eb011..f5cdad7 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -49,6 +49,7 @@ CreateVehicleEstimateRequest, ) from patch_api.models.delete_order_response import DeleteOrderResponse +from patch_api.models.disclaimer import Disclaimer from patch_api.models.error_response import ErrorResponse from patch_api.models.estimate import Estimate from patch_api.models.estimate_list_response import EstimateListResponse diff --git a/patch_api/models/disclaimer.py b/patch_api/models/disclaimer.py new file mode 100644 index 0000000..a71ed43 --- /dev/null +++ b/patch_api/models/disclaimer.py @@ -0,0 +1,252 @@ +# coding: utf-8 + +""" + Patch API V2 + + The core API used to integrate with Patch's service # noqa: E501 + + The version of the OpenAPI document: 2 + Contact: engineering@usepatch.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from patch_api.configuration import Configuration + + +class Disclaimer(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 = { + "body": "str", + "header": "str", + "severity": "str", + "link_text": "str", + "link_destination": "str", + } + + attribute_map = { + "body": "body", + "header": "header", + "severity": "severity", + "link_text": "link_text", + "link_destination": "link_destination", + } + + def __init__( + self, + body=None, + header=None, + severity=None, + link_text=None, + link_destination=None, + local_vars_configuration=None, + ): # noqa: E501 + """Disclaimer - 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._body = None + self._header = None + self._severity = None + self._link_text = None + self._link_destination = None + self.discriminator = None + + self.body = body + self.header = header + self.severity = severity + self.link_text = link_text + self.link_destination = link_destination + + @property + def body(self): + """Gets the body of this Disclaimer. # noqa: E501 + + The body of the disclaimer. # noqa: E501 + + :return: The body of this Disclaimer. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this Disclaimer. + + The body of the disclaimer. # noqa: E501 + + :param body: The body of this Disclaimer. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def header(self): + """Gets the header of this Disclaimer. # noqa: E501 + + The header for the disclaimer. # noqa: E501 + + :return: The header of this Disclaimer. # noqa: E501 + :rtype: str + """ + return self._header + + @header.setter + def header(self, header): + """Sets the header of this Disclaimer. + + The header for the disclaimer. # noqa: E501 + + :param header: The header of this Disclaimer. # noqa: E501 + :type: str + """ + if ( + self.local_vars_configuration.client_side_validation and header is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `header`, must not be `None`" + ) # noqa: E501 + + self._header = header + + @property + def severity(self): + """Gets the severity of this Disclaimer. # noqa: E501 + + The severity of the disclaimer. # noqa: E501 + + :return: The severity of this Disclaimer. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this Disclaimer. + + The severity of the disclaimer. # noqa: E501 + + :param severity: The severity of this Disclaimer. # noqa: E501 + :type: str + """ + if ( + self.local_vars_configuration.client_side_validation and severity is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `severity`, must not be `None`" + ) # noqa: E501 + + self._severity = severity + + @property + def link_text(self): + """Gets the link_text of this Disclaimer. # noqa: E501 + + The text for the provided link. # noqa: E501 + + :return: The link_text of this Disclaimer. # noqa: E501 + :rtype: str + """ + return self._link_text + + @link_text.setter + def link_text(self, link_text): + """Sets the link_text of this Disclaimer. + + The text for the provided link. # noqa: E501 + + :param link_text: The link_text of this Disclaimer. # noqa: E501 + :type: str + """ + + self._link_text = link_text + + @property + def link_destination(self): + """Gets the link_destination of this Disclaimer. # noqa: E501 + + The destination of the provided link. # noqa: E501 + + :return: The link_destination of this Disclaimer. # noqa: E501 + :rtype: str + """ + return self._link_destination + + @link_destination.setter + def link_destination(self, link_destination): + """Sets the link_destination of this Disclaimer. + + The destination of the provided link. # noqa: E501 + + :param link_destination: The link_destination of this Disclaimer. # noqa: E501 + :type: str + """ + + self._link_destination = link_destination + + 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, Disclaimer): + 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, Disclaimer): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/order.py b/patch_api/models/order.py index e718a54..e284ac3 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -410,7 +410,7 @@ def currency(self, currency): def registry_url(self): """Gets the registry_url of this Order. # noqa: E501 - The url of this order in the public registry. # noqa: E501 + The URL of this order in the public registry. Use this URL to access the order's accompanying certificate. # noqa: E501 :return: The registry_url of this Order. # noqa: E501 :rtype: str @@ -421,7 +421,7 @@ def registry_url(self): def registry_url(self, registry_url): """Sets the registry_url of this Order. - The url of this order in the public registry. # noqa: E501 + The URL of this order in the public registry. Use this URL to access the order's accompanying certificate. # noqa: E501 :param registry_url: The registry_url of this Order. # noqa: E501 :type: str diff --git a/patch_api/models/order_line_item.py b/patch_api/models/order_line_item.py index 5e1d61f..01626ad 100644 --- a/patch_api/models/order_line_item.py +++ b/patch_api/models/order_line_item.py @@ -183,7 +183,7 @@ def vintage_year(self, vintage_year): def vintage_start_year(self): """Gets the vintage_start_year of this OrderLineItem. # noqa: E501 - The starting_year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + The starting year in which the climate impacts of the project occurred, or will occur. # noqa: E501 :return: The vintage_start_year of this OrderLineItem. # noqa: E501 :rtype: int @@ -194,7 +194,7 @@ def vintage_start_year(self): def vintage_start_year(self, vintage_start_year): """Sets the vintage_start_year of this OrderLineItem. - The starting_year in which the climate impacts of the project occurred, or will occur. # noqa: E501 + The starting year in which the climate impacts of the project occurred, or will occur. # noqa: E501 :param vintage_start_year: The vintage_start_year of this OrderLineItem. # noqa: E501 :type: int diff --git a/patch_api/models/project.py b/patch_api/models/project.py index 236c38f..0273f2a 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -41,6 +41,7 @@ class Project(object): "mechanism": "str", "country": "str", "state": "str", + "issuance_type": "str", "latitude": "float", "longitude": "float", "project_partner": "str", @@ -52,6 +53,7 @@ class Project(object): "technology_type": "TechnologyType", "highlights": "list[Highlight]", "inventory": "list[Inventory]", + "disclaimers": "list[Disclaimer]", } attribute_map = { @@ -62,6 +64,7 @@ class Project(object): "mechanism": "mechanism", "country": "country", "state": "state", + "issuance_type": "issuance_type", "latitude": "latitude", "longitude": "longitude", "project_partner": "project_partner", @@ -73,6 +76,7 @@ class Project(object): "technology_type": "technology_type", "highlights": "highlights", "inventory": "inventory", + "disclaimers": "disclaimers", } def __init__( @@ -84,6 +88,7 @@ def __init__( mechanism=None, country=None, state=None, + issuance_type=None, latitude=None, longitude=None, project_partner=None, @@ -95,6 +100,7 @@ def __init__( technology_type=None, highlights=None, inventory=None, + disclaimers=None, local_vars_configuration=None, ): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 @@ -109,6 +115,7 @@ def __init__( self._mechanism = None self._country = None self._state = None + self._issuance_type = None self._latitude = None self._longitude = None self._project_partner = None @@ -120,6 +127,7 @@ def __init__( self._technology_type = None self._highlights = None self._inventory = None + self._disclaimers = None self.discriminator = None self.id = id @@ -130,6 +138,8 @@ def __init__( self.mechanism = mechanism self.country = country self.state = state + if issuance_type is not None: + self.issuance_type = issuance_type self.latitude = latitude self.longitude = longitude self.project_partner = project_partner @@ -143,6 +153,8 @@ def __init__( self.technology_type = technology_type self.highlights = highlights self.inventory = inventory + if disclaimers is not None: + self.disclaimers = disclaimers @property def id(self): @@ -333,6 +345,39 @@ def state(self, state): self._state = state + @property + def issuance_type(self): + """Gets the issuance_type of this Project. # noqa: E501 + + The issuance type of the project. One of: ex-ante, ex-post. # noqa: E501 + + :return: The issuance_type of this Project. # noqa: E501 + :rtype: str + """ + return self._issuance_type + + @issuance_type.setter + def issuance_type(self, issuance_type): + """Sets the issuance_type of this Project. + + The issuance type of the project. One of: ex-ante, ex-post. # noqa: E501 + + :param issuance_type: The issuance_type of this Project. # noqa: E501 + :type: str + """ + allowed_values = ["ex-ante", "ex-post"] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and issuance_type not in allowed_values + ): # noqa: E501 + raise ValueError( + "Invalid value for `issuance_type` ({0}), must be one of {1}".format( # noqa: E501 + issuance_type, allowed_values + ) + ) + + self._issuance_type = issuance_type + @property def latitude(self): """Gets the latitude of this Project. # noqa: E501 @@ -610,6 +655,29 @@ def inventory(self, inventory): self._inventory = inventory + @property + def disclaimers(self): + """Gets the disclaimers of this Project. # noqa: E501 + + An array of objects containing disclaimers about the project. Information, warnings, and critical concerns may be present. # noqa: E501 + + :return: The disclaimers of this Project. # noqa: E501 + :rtype: list[Disclaimer] + """ + return self._disclaimers + + @disclaimers.setter + def disclaimers(self, disclaimers): + """Sets the disclaimers of this Project. + + An array of objects containing disclaimers about the project. Information, warnings, and critical concerns may be present. # noqa: E501 + + :param disclaimers: The disclaimers of this Project. # noqa: E501 + :type: list[Disclaimer] + """ + + self._disclaimers = disclaimers + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/setup.py b/setup.py index 3dbfb72..ca51a2b 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "2.1.0" +VERSION = "2.1.1" # 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 92e1c16..0c5c92d 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -66,6 +66,17 @@ def test_retrieve_project(self): self.assertTrue(isinstance(inventory[0].currency, str)) self.assertTrue(isinstance(inventory[0].unit, str)) + issuance_type = project.issuance_type + self.assertTrue(isinstance(issuance_type, str)) + + disclaimers = project.disclaimers + self.assertTrue(isinstance(disclaimers, list)) + self.assertTrue(isinstance(disclaimers[0].header, str)) + self.assertTrue(isinstance(disclaimers[0].body, str)) + self.assertTrue(isinstance(disclaimers[0].severity, str)) + self.assertTrue(isinstance(disclaimers[0].link_text, str)) + self.assertTrue(isinstance(disclaimers[0].link_destination, str)) + def test_retrieve_project_language(self): """Test case for retrieve_project