From c0d975f6cb4dd48ae8ff10ac6b2eae40b1bc3a9d Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Wed, 8 Sep 2021 14:50:41 -0700 Subject: [PATCH 1/2] Add created_at on order response --- patch_api/__init__.py | 2 +- patch_api/api_client.py | 2 +- patch_api/configuration.py | 2 +- .../models/create_bitcoin_estimate_request.py | 6 ++-- patch_api/models/order.py | 29 +++++++++++++++++++ setup.py | 2 +- test/test_orders_api.py | 3 ++ 7 files changed, 39 insertions(+), 7 deletions(-) diff --git a/patch_api/__init__.py b/patch_api/__init__.py index fd3b8c1..99d396d 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -15,7 +15,7 @@ from __future__ import absolute_import -__version__ = "1.11.0" +__version__ = "1.12.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 29dc578..ec0e433 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.11.0" + self.user_agent = "patch-python/1.12.0" def __del__(self): if self._pool: diff --git a/patch_api/configuration.py b/patch_api/configuration.py index f82378a..66d2e8c 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.11.0".format( + "SDK Package Version: 1.12.0".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/patch_api/models/create_bitcoin_estimate_request.py b/patch_api/models/create_bitcoin_estimate_request.py index 0ce2401..a4eb9d3 100644 --- a/patch_api/models/create_bitcoin_estimate_request.py +++ b/patch_api/models/create_bitcoin_estimate_request.py @@ -34,7 +34,7 @@ class CreateBitcoinEstimateRequest(object): and the value is json key in definition. """ openapi_types = { - "timestamp": "str", + "timestamp": "datetime", "transaction_value_btc_sats": "int", "project_id": "str", "create_order": "bool", @@ -77,7 +77,7 @@ def timestamp(self): :return: The timestamp of this CreateBitcoinEstimateRequest. # noqa: E501 - :rtype: str + :rtype: datetime """ return self._timestamp @@ -87,7 +87,7 @@ def timestamp(self, timestamp): :param timestamp: The timestamp of this CreateBitcoinEstimateRequest. # noqa: E501 - :type: str + :type: datetime """ self._timestamp = timestamp diff --git a/patch_api/models/order.py b/patch_api/models/order.py index 130d2d6..f58b162 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -35,6 +35,7 @@ class Order(object): """ openapi_types = { "id": "str", + "created_at": "datetime", "mass_g": "int", "production": "bool", "state": "str", @@ -48,6 +49,7 @@ class Order(object): attribute_map = { "id": "id", + "created_at": "created_at", "mass_g": "mass_g", "production": "production", "state": "state", @@ -62,6 +64,7 @@ class Order(object): def __init__( self, id=None, + created_at=None, mass_g=None, production=None, state=None, @@ -79,6 +82,7 @@ def __init__( self.local_vars_configuration = local_vars_configuration self._id = None + self._created_at = None self._mass_g = None self._production = None self._state = None @@ -91,6 +95,8 @@ def __init__( self.discriminator = None self.id = id + if created_at is not None: + self.created_at = created_at self.mass_g = mass_g self.production = production self.state = state @@ -129,6 +135,29 @@ def id(self, id): self._id = id + @property + def created_at(self): + """Gets the created_at of this Order. # noqa: E501 + + The timestamp at which the order was created # noqa: E501 + + :return: The created_at of this Order. # noqa: E501 + :rtype: datetime + """ + return self._created_at + + @created_at.setter + def created_at(self, created_at): + """Sets the created_at of this Order. + + The timestamp at which the order was created # noqa: E501 + + :param created_at: The created_at of this Order. # noqa: E501 + :type: datetime + """ + + self._created_at = created_at + @property def mass_g(self): """Gets the mass_g of this Order. # noqa: E501 diff --git a/setup.py b/setup.py index 03d7bab..e7017b3 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "patch-api" -VERSION = "1.11.0" +VERSION = "1.12.0" # To install the library, run the following # # python setup.py install diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 2520384..b0432b2 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -15,6 +15,7 @@ import unittest import os +import datetime from patch_api.api_client import ApiClient @@ -38,6 +39,8 @@ def test_interactions_with_an_order(self): self.assertTrue(order) + self.assertIsInstance(order.data.created_at, datetime.datetime) + self.assertEqual(order.data.mass_g, 100) """Create an order on price From 6433e85d3a901d6fb0afa0cd3ea4c3b3de71c77a Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Wed, 8 Sep 2021 14:51:37 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60cc622..46dfff2 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.12.0] - 2021-09-08 + +### Added + +- Adds a `created_at` attribute in all order responses + ## [1.11.0] - 2021-09-07 ### Added