From 85b10b38fcfe7b02dda1aaeb739da8349233adf5 Mon Sep 17 00:00:00 2001 From: alianam Date: Tue, 11 Jan 2022 10:48:01 -0500 Subject: [PATCH] Update SDK to make the order allocations array optional --- CHANGELOG.md | 6 ++++++ patch_api/__init__.py | 2 +- patch_api/api_client.py | 2 +- patch_api/configuration.py | 2 +- patch_api/models/order.py | 15 +++++---------- patch_api/models/project.py | 4 ++-- setup.py | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f63dfe3..5e0e977 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.17.0] - 2022-01-11 + +### Changed + +- Set the order allocatations array as optional. + ## [1.16.0] - 2021-12-07 ### Removed diff --git a/patch_api/__init__.py b/patch_api/__init__.py index b19ec24..4263eeb 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.16.0" +__version__ = "1.17.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 900c835..0037da3 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.16.0" + self.user_agent = "patch-python/1.17.0" def __del__(self): if self._pool: diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 6f3fe3f..c8f02f0 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.16.0".format( + "SDK Package Version: 1.17.0".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/patch_api/models/order.py b/patch_api/models/order.py index 6a60e77..5aa083b 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -103,7 +103,8 @@ def __init__( self.allocation_state = allocation_state self.price_cents_usd = price_cents_usd self.patch_fee_cents_usd = patch_fee_cents_usd - self.allocations = allocations + if allocations is not None: + self.allocations = allocations if registry_url is not None: self.registry_url = registry_url self.metadata = metadata @@ -304,7 +305,7 @@ def allocation_state(self, allocation_state): raise ValueError( "Invalid value for `allocation_state`, must not be `None`" ) # noqa: E501 - allowed_values = ["pending", "partially_allocated", "allocated"] # noqa: E501 + allowed_values = ["pending", "allocated"] # noqa: E501 if ( self.local_vars_configuration.client_side_validation and allocation_state not in allowed_values @@ -367,7 +368,7 @@ def patch_fee_cents_usd(self, patch_fee_cents_usd): def allocations(self): """Gets the allocations of this Order. # noqa: E501 - An array containing the inventory allocations for this order. # noqa: E501 + DEPRECATED. An array containing the inventory allocations for this order. # noqa: E501 :return: The allocations of this Order. # noqa: E501 :rtype: list[Allocation] @@ -378,17 +379,11 @@ def allocations(self): def allocations(self, allocations): """Sets the allocations of this Order. - An array containing the inventory allocations for this order. # noqa: E501 + DEPRECATED. An array containing the inventory allocations for this order. # noqa: E501 :param allocations: The allocations of this Order. # noqa: E501 :type: list[Allocation] """ - if ( - self.local_vars_configuration.client_side_validation and allocations is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocations`, must not be `None`" - ) # noqa: E501 self._allocations = allocations diff --git a/patch_api/models/project.py b/patch_api/models/project.py index c283939..1014a8a 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -273,7 +273,7 @@ def description(self, description): def type(self): """Gets the type of this Project. # noqa: E501 - Deprecated. Favor the technology_type field instead. # noqa: E501 + DEPRECATED. Favor the technology_type field instead. # noqa: E501 :return: The type of this Project. # noqa: E501 :rtype: str @@ -284,7 +284,7 @@ def type(self): def type(self, type): """Sets the type of this Project. - Deprecated. Favor the technology_type field instead. # noqa: E501 + DEPRECATED. Favor the technology_type field instead. # noqa: E501 :param type: The type of this Project. # noqa: E501 :type: str diff --git a/setup.py b/setup.py index 5cfb5fd..1c11353 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.16.0" +VERSION = "1.17.0" # To install the library, run the following # # python setup.py install