From 659831db2dd28c40dc4be00c46904350f08b797c Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 22 Jan 2021 15:30:33 +0100 Subject: [PATCH 01/23] add github configuration --- .github/PULL_REQUEST_TEMPLATTE.md | 15 +++++++++++++++ .github/workflows/test.yml | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATTE.md create mode 100644 .github/workflows/test.yml diff --git a/.github/PULL_REQUEST_TEMPLATTE.md b/.github/PULL_REQUEST_TEMPLATTE.md new file mode 100644 index 0000000..b3f9d31 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATTE.md @@ -0,0 +1,15 @@ +### What + +** CHANGEME: What are you changing? ** + +### Why + +** CHANGEME: Why are these changes needed? ** + +### SDK Release Checklist + +- [ ] Have you added an integration test for the changes? +- [ ] Have you built the gem locally and made queries against it successfully? +- [ ] Did you update the changelog? +- [ ] Did you bump the package version? +- [ ] For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production? diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d846fa3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Test +on: + push: + branches: + - main + pull_request: + +jobs: + build-and-test: + runs-on: ubuntu-latest + name: Python Library tests + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Setup Python + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Run tests + env: + SANDBOX_API_KEY: ${{ secrets.SANDBOX_API_KEY }} + run: make test From 258b89a2f74c66cd1510fc021e16f84c112ba7a7 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 22 Jan 2021 15:31:02 +0100 Subject: [PATCH 02/23] Code, tests, etc --- .gitignore | 66 ++ .openapi-generator-ignore | 23 + .openapi-generator/VERSION | 1 + CHANGELOG.md | 14 + Makefile | 10 + git_push.sh | 58 ++ patch_api/__init__.py | 72 ++ patch_api/api/__init__.py | 10 + patch_api/api/estimates_api.py | 380 ++++++++++ patch_api/api/orders_api.py | 608 ++++++++++++++++ patch_api/api/photos_api.py | 161 +++++ patch_api/api/preferences_api.py | 494 +++++++++++++ patch_api/api/projects_api.py | 262 +++++++ patch_api/api_client.py | 667 ++++++++++++++++++ patch_api/configuration.py | 394 +++++++++++ patch_api/exceptions.py | 121 ++++ patch_api/models/__init__.py | 53 ++ patch_api/models/allocation.py | 182 +++++ .../models/create_mass_estimate_request.py | 154 ++++ patch_api/models/create_membership_request.py | 179 +++++ patch_api/models/create_offset_request.py | 233 ++++++ patch_api/models/create_order_request.py | 208 ++++++ .../models/create_organization_request.py | 155 ++++ patch_api/models/create_photo_request.py | 175 +++++ patch_api/models/create_preference_request.py | 122 ++++ patch_api/models/create_project_request.py | 398 +++++++++++ patch_api/models/error_response.py | 174 +++++ patch_api/models/estimate.py | 209 ++++++ patch_api/models/estimate_list_response.py | 201 ++++++ patch_api/models/estimate_response.py | 174 +++++ patch_api/models/fulfill_offset_request.py | 120 ++++ patch_api/models/membership.py | 182 +++++ patch_api/models/membership_response.py | 174 +++++ patch_api/models/meta_index_object.py | 145 ++++ patch_api/models/offset.py | 422 +++++++++++ patch_api/models/offset_list_response.py | 201 ++++++ patch_api/models/offset_response.py | 174 +++++ patch_api/models/order.py | 370 ++++++++++ patch_api/models/order_list_response.py | 201 ++++++ patch_api/models/order_response.py | 174 +++++ patch_api/models/photo.py | 149 ++++ patch_api/models/photo_response.py | 174 +++++ patch_api/models/preference.py | 182 +++++ patch_api/models/preference_list_response.py | 201 ++++++ patch_api/models/preference_response.py | 174 +++++ patch_api/models/project.py | 415 +++++++++++ patch_api/models/project_list_response.py | 201 ++++++ patch_api/models/project_response.py | 174 +++++ .../models/project_type_list_response.py | 201 ++++++ patch_api/models/standard.py | 182 +++++ patch_api/models/standard_list_response.py | 201 ++++++ patch_api/models/update_offset_request.py | 207 ++++++ patch_api/models/update_project_request.py | 398 +++++++++++ patch_api/rest.py | 296 ++++++++ requirements.txt | 6 + setup.cfg | 2 + setup.py | 41 ++ test-requirements.txt | 4 + test/__init__.py | 0 test/factories.py | 114 +++ test/test_allocation.py | 54 ++ test/test_create_mass_estimate_request.py | 58 ++ test/test_create_membership_request.py | 58 ++ test/test_create_offset_request.py | 60 ++ test/test_create_order_request.py | 59 ++ test/test_create_organization_request.py | 59 ++ test/test_create_photo_request.py | 60 ++ test/test_create_preference_request.py | 57 ++ test/test_create_project_request.py | 65 ++ test/test_error_response.py | 60 ++ test/test_estimate.py | 57 ++ test/test_estimate_list_response.py | 67 ++ test/test_estimate_response.py | 61 ++ test/test_estimates_api.py | 55 ++ test/test_fulfill_offset_request.py | 57 ++ test/test_membership.py | 61 ++ test/test_membership_response.py | 66 ++ test/test_meta_index_object.py | 57 ++ test/test_offset.py | 76 ++ test/test_offset_list_response.py | 68 ++ test/test_offset_response.py | 62 ++ test/test_order.py | 78 ++ test/test_order_list_response.py | 68 ++ test/test_order_response.py | 62 ++ test/test_orders_api.py | 69 ++ test/test_photo.py | 59 ++ test/test_photo_response.py | 62 ++ test/test_photos_api.py | 41 ++ test/test_preference.py | 54 ++ test/test_preference_list_response.py | 68 ++ test/test_preference_response.py | 62 ++ test/test_preferences_api.py | 81 +++ test/test_project.py | 57 ++ test/test_project_list_response.py | 67 ++ test/test_project_response.py | 62 ++ test/test_project_type_list_response.py | 68 ++ test/test_projects_api.py | 55 ++ test/test_standard.py | 61 ++ test/test_standard_list_response.py | 68 ++ test/test_update_offset_request.py | 59 ++ test/test_update_project_request.py | 66 ++ 101 files changed, 13987 insertions(+) create mode 100644 .gitignore create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/VERSION create mode 100644 CHANGELOG.md create mode 100644 Makefile create mode 100644 git_push.sh create mode 100644 patch_api/__init__.py create mode 100644 patch_api/api/__init__.py create mode 100644 patch_api/api/estimates_api.py create mode 100644 patch_api/api/orders_api.py create mode 100644 patch_api/api/photos_api.py create mode 100644 patch_api/api/preferences_api.py create mode 100644 patch_api/api/projects_api.py create mode 100644 patch_api/api_client.py create mode 100644 patch_api/configuration.py create mode 100644 patch_api/exceptions.py create mode 100644 patch_api/models/__init__.py create mode 100644 patch_api/models/allocation.py create mode 100644 patch_api/models/create_mass_estimate_request.py create mode 100644 patch_api/models/create_membership_request.py create mode 100644 patch_api/models/create_offset_request.py create mode 100644 patch_api/models/create_order_request.py create mode 100644 patch_api/models/create_organization_request.py create mode 100644 patch_api/models/create_photo_request.py create mode 100644 patch_api/models/create_preference_request.py create mode 100644 patch_api/models/create_project_request.py create mode 100644 patch_api/models/error_response.py create mode 100644 patch_api/models/estimate.py create mode 100644 patch_api/models/estimate_list_response.py create mode 100644 patch_api/models/estimate_response.py create mode 100644 patch_api/models/fulfill_offset_request.py create mode 100644 patch_api/models/membership.py create mode 100644 patch_api/models/membership_response.py create mode 100644 patch_api/models/meta_index_object.py create mode 100644 patch_api/models/offset.py create mode 100644 patch_api/models/offset_list_response.py create mode 100644 patch_api/models/offset_response.py create mode 100644 patch_api/models/order.py create mode 100644 patch_api/models/order_list_response.py create mode 100644 patch_api/models/order_response.py create mode 100644 patch_api/models/photo.py create mode 100644 patch_api/models/photo_response.py create mode 100644 patch_api/models/preference.py create mode 100644 patch_api/models/preference_list_response.py create mode 100644 patch_api/models/preference_response.py create mode 100644 patch_api/models/project.py create mode 100644 patch_api/models/project_list_response.py create mode 100644 patch_api/models/project_response.py create mode 100644 patch_api/models/project_type_list_response.py create mode 100644 patch_api/models/standard.py create mode 100644 patch_api/models/standard_list_response.py create mode 100644 patch_api/models/update_offset_request.py create mode 100644 patch_api/models/update_project_request.py create mode 100644 patch_api/rest.py create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 test/__init__.py create mode 100644 test/factories.py create mode 100644 test/test_allocation.py create mode 100644 test/test_create_mass_estimate_request.py create mode 100644 test/test_create_membership_request.py create mode 100644 test/test_create_offset_request.py create mode 100644 test/test_create_order_request.py create mode 100644 test/test_create_organization_request.py create mode 100644 test/test_create_photo_request.py create mode 100644 test/test_create_preference_request.py create mode 100644 test/test_create_project_request.py create mode 100644 test/test_error_response.py create mode 100644 test/test_estimate.py create mode 100644 test/test_estimate_list_response.py create mode 100644 test/test_estimate_response.py create mode 100644 test/test_estimates_api.py create mode 100644 test/test_fulfill_offset_request.py create mode 100644 test/test_membership.py create mode 100644 test/test_membership_response.py create mode 100644 test/test_meta_index_object.py create mode 100644 test/test_offset.py create mode 100644 test/test_offset_list_response.py create mode 100644 test/test_offset_response.py create mode 100644 test/test_order.py create mode 100644 test/test_order_list_response.py create mode 100644 test/test_order_response.py create mode 100644 test/test_orders_api.py create mode 100644 test/test_photo.py create mode 100644 test/test_photo_response.py create mode 100644 test/test_photos_api.py create mode 100644 test/test_preference.py create mode 100644 test/test_preference_list_response.py create mode 100644 test/test_preference_response.py create mode 100644 test/test_preferences_api.py create mode 100644 test/test_project.py create mode 100644 test/test_project_list_response.py create mode 100644 test/test_project_response.py create mode 100644 test/test_project_type_list_response.py create mode 100644 test/test_projects_api.py create mode 100644 test/test_standard.py create mode 100644 test/test_standard_list_response.py create mode 100644 test/test_update_offset_request.py create mode 100644 test/test_update_project_request.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..43995bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..ecedc98 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c64dc83 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +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.0.0.pre] - 2021-01-22 + +### Added + +- Pre-release of v1 Library +- Adds support for Orders, Estimates, Projects and Preferences + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c7b8c6b --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +SHELL = /bin/bash + +build: + pip install -r requirements.txt + +test: + pip install -r test-requirements.txt && \ + python -m unittest discover test/ + +.PHONY: build test diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/patch_api/__init__.py b/patch_api/__init__.py new file mode 100644 index 0000000..19ebc85 --- /dev/null +++ b/patch_api/__init__.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +# flake8: noqa + +""" + 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 +""" + + +from __future__ import absolute_import + +__version__ = "1.0.0" + +# import apis into sdk package +from patch_api.api.estimates_api import EstimatesApi +from patch_api.api.orders_api import OrdersApi +from patch_api.api.photos_api import PhotosApi +from patch_api.api.preferences_api import PreferencesApi +from patch_api.api.projects_api import ProjectsApi + +# import ApiClient +from patch_api.api_client import ApiClient +from patch_api.configuration import Configuration +from patch_api.exceptions import OpenApiException +from patch_api.exceptions import ApiTypeError +from patch_api.exceptions import ApiValueError +from patch_api.exceptions import ApiKeyError +from patch_api.exceptions import ApiException +# import models into sdk package +from patch_api.models.allocation import Allocation +from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest +from patch_api.models.create_membership_request import CreateMembershipRequest +from patch_api.models.create_offset_request import CreateOffsetRequest +from patch_api.models.create_order_request import CreateOrderRequest +from patch_api.models.create_organization_request import CreateOrganizationRequest +from patch_api.models.create_photo_request import CreatePhotoRequest +from patch_api.models.create_preference_request import CreatePreferenceRequest +from patch_api.models.create_project_request import CreateProjectRequest +from patch_api.models.error_response import ErrorResponse +from patch_api.models.estimate import Estimate +from patch_api.models.estimate_list_response import EstimateListResponse +from patch_api.models.estimate_response import EstimateResponse +from patch_api.models.fulfill_offset_request import FulfillOffsetRequest +from patch_api.models.membership import Membership +from patch_api.models.membership_response import MembershipResponse +from patch_api.models.meta_index_object import MetaIndexObject +from patch_api.models.offset import Offset +from patch_api.models.offset_list_response import OffsetListResponse +from patch_api.models.offset_response import OffsetResponse +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.photo import Photo +from patch_api.models.photo_response import PhotoResponse +from patch_api.models.preference import Preference +from patch_api.models.preference_list_response import PreferenceListResponse +from patch_api.models.preference_response import PreferenceResponse +from patch_api.models.project import Project +from patch_api.models.project_list_response import ProjectListResponse +from patch_api.models.project_response import ProjectResponse +from patch_api.models.project_type_list_response import ProjectTypeListResponse +from patch_api.models.standard import Standard +from patch_api.models.standard_list_response import StandardListResponse +from patch_api.models.update_offset_request import UpdateOffsetRequest +from patch_api.models.update_project_request import UpdateProjectRequest + diff --git a/patch_api/api/__init__.py b/patch_api/api/__init__.py new file mode 100644 index 0000000..ee00ace --- /dev/null +++ b/patch_api/api/__init__.py @@ -0,0 +1,10 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from patch_api.api.estimates_api import EstimatesApi +from patch_api.api.orders_api import OrdersApi +from patch_api.api.photos_api import PhotosApi +from patch_api.api.preferences_api import PreferencesApi +from patch_api.api.projects_api import ProjectsApi diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py new file mode 100644 index 0000000..7659ec7 --- /dev/null +++ b/patch_api/api/estimates_api.py @@ -0,0 +1,380 @@ +# 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 +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from patch_api.api_client import ApiClient +from patch_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class EstimatesApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_mass_estimate(self, create_mass_estimate_request, **kwargs): # noqa: E501 + """Create an estimate based on mass of CO2 # noqa: E501 + + Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_mass_estimate(create_mass_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateMassEstimateRequest create_mass_estimate_request: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: EstimateResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.create_mass_estimate_with_http_info(create_mass_estimate_request, **kwargs) # noqa: E501 + + def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kwargs): # noqa: E501 + """Create an estimate based on mass of CO2 # noqa: E501 + + Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_mass_estimate_with_http_info(create_mass_estimate_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateMassEstimateRequest create_mass_estimate_request: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'create_mass_estimate_request' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_mass_estimate" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'create_mass_estimate_request' is set + if self.api_client.client_side_validation and ('create_mass_estimate_request' not in local_var_params or # noqa: E501 + local_var_params['create_mass_estimate_request'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'create_mass_estimate_request' in local_var_params: + body_params = local_var_params['create_mass_estimate_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/estimates/mass', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EstimateResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_estimate(self, id, **kwargs): # noqa: E501 + """Retrieves an estimate # noqa: E501 + + Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_estimate(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: EstimateResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501 + + def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 + """Retrieves an estimate # noqa: E501 + + Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_estimate_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(EstimateResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_estimate" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_estimate`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/estimates/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EstimateResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_estimates(self, **kwargs): # noqa: E501 + """Retrieves a list of estimates # noqa: E501 + + Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_estimates(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: EstimateListResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501 + + def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 + """Retrieves a list of estimates # noqa: E501 + + Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_estimates_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(EstimateListResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'page' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_estimates" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 + query_params.append(('page', local_var_params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/estimates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EstimateListResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py new file mode 100644 index 0000000..2116924 --- /dev/null +++ b/patch_api/api/orders_api.py @@ -0,0 +1,608 @@ +# 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 +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from patch_api.api_client import ApiClient +from patch_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class OrdersApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def cancel_order(self, id, **kwargs): # noqa: E501 + """Cancel an order # noqa: E501 + + Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.cancel_order(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: OrderResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.cancel_order_with_http_info(id, **kwargs) # noqa: E501 + + def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 + """Cancel an order # noqa: E501 + + Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.cancel_order_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(OrderResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method cancel_order" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `cancel_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/orders/{id}/cancel', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OrderResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_order(self, create_order_request, **kwargs): # noqa: E501 + """Creates an order # noqa: E501 + + Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_order(create_order_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateOrderRequest create_order_request: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: OrderResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.create_order_with_http_info(create_order_request, **kwargs) # noqa: E501 + + def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 + """Creates an order # noqa: E501 + + Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_order_with_http_info(create_order_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreateOrderRequest create_order_request: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(OrderResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'create_order_request' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_order" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'create_order_request' is set + if self.api_client.client_side_validation and ('create_order_request' not in local_var_params or # noqa: E501 + local_var_params['create_order_request'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `create_order_request` when calling `create_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'create_order_request' in local_var_params: + body_params = local_var_params['create_order_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/orders', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OrderResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def place_order(self, id, **kwargs): # noqa: E501 + """Place an order # noqa: E501 + + Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.place_order(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: OrderResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.place_order_with_http_info(id, **kwargs) # noqa: E501 + + def place_order_with_http_info(self, id, **kwargs): # noqa: E501 + """Place an order # noqa: E501 + + Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.place_order_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(OrderResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method place_order" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `place_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/orders/{id}/place', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OrderResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_order(self, id, **kwargs): # noqa: E501 + """Retrieves an order # noqa: E501 + + Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_order(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: OrderResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_order_with_http_info(id, **kwargs) # noqa: E501 + + def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 + """Retrieves an order # noqa: E501 + + Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_order_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(OrderResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_order" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/orders/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OrderResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_orders(self, **kwargs): # noqa: E501 + """Retrieves a list of orders # noqa: E501 + + Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_orders(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: OrderListResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_orders_with_http_info(**kwargs) # noqa: E501 + + def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 + """Retrieves a list of orders # noqa: E501 + + Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_orders_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(OrderListResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'page' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_orders" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 + query_params.append(('page', local_var_params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/orders', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OrderListResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/patch_api/api/photos_api.py b/patch_api/api/photos_api.py new file mode 100644 index 0000000..bffd597 --- /dev/null +++ b/patch_api/api/photos_api.py @@ -0,0 +1,161 @@ +# 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 +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from patch_api.api_client import ApiClient +from patch_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class PhotosApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_photo(self, photo_id, uid, **kwargs): # noqa: E501 + """Deletes a photo for the project # noqa: E501 + + Deletes the given `photo` for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_photo(photo_id, uid, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str photo_id: (required) + :param str uid: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: PhotoResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.delete_photo_with_http_info(photo_id, uid, **kwargs) # noqa: E501 + + def delete_photo_with_http_info(self, photo_id, uid, **kwargs): # noqa: E501 + """Deletes a photo for the project # noqa: E501 + + Deletes the given `photo` for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_photo_with_http_info(photo_id, uid, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str photo_id: (required) + :param str uid: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(PhotoResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'photo_id', + 'uid' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_photo" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'photo_id' is set + if self.api_client.client_side_validation and ('photo_id' not in local_var_params or # noqa: E501 + local_var_params['photo_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `photo_id` when calling `delete_photo`") # noqa: E501 + # verify the required parameter 'uid' is set + if self.api_client.client_side_validation and ('uid' not in local_var_params or # noqa: E501 + local_var_params['uid'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `uid` when calling `delete_photo`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'photo_id' in local_var_params: + path_params['photo_id'] = local_var_params['photo_id'] # noqa: E501 + if 'uid' in local_var_params: + path_params['uid'] = local_var_params['uid'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/projects/{uid}/photos/{photo_id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PhotoResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py new file mode 100644 index 0000000..fd713d1 --- /dev/null +++ b/patch_api/api/preferences_api.py @@ -0,0 +1,494 @@ +# 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 +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from patch_api.api_client import ApiClient +from patch_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class PreferencesApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_preference(self, create_preference_request, **kwargs): # noqa: E501 + """creates a project preference # noqa: E501 + + Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_preference(create_preference_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreatePreferenceRequest create_preference_request: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: PreferenceResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.create_preference_with_http_info(create_preference_request, **kwargs) # noqa: E501 + + def create_preference_with_http_info(self, create_preference_request, **kwargs): # noqa: E501 + """creates a project preference # noqa: E501 + + Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_preference_with_http_info(create_preference_request, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param CreatePreferenceRequest create_preference_request: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(PreferenceResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'create_preference_request' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_preference" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'create_preference_request' is set + if self.api_client.client_side_validation and ('create_preference_request' not in local_var_params or # noqa: E501 + local_var_params['create_preference_request'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `create_preference_request` when calling `create_preference`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'create_preference_request' in local_var_params: + body_params = local_var_params['create_preference_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/preferences', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PreferenceResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_preference(self, id, **kwargs): # noqa: E501 + """Deletes an organization's preference for a project # noqa: E501 + + Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_preference(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: PreferenceResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.delete_preference_with_http_info(id, **kwargs) # noqa: E501 + + def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 + """Deletes an organization's preference for a project # noqa: E501 + + Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_preference_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(PreferenceResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_preference" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `delete_preference`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/preferences/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PreferenceResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_preference(self, id, **kwargs): # noqa: E501 + """Retrieve the preference # noqa: E501 + + Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_preference(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: PreferenceResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_preference_with_http_info(id, **kwargs) # noqa: E501 + + def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 + """Retrieve the preference # noqa: E501 + + Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_preference_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(PreferenceResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_preference" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_preference`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/preferences/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PreferenceResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_preferences(self, **kwargs): # noqa: E501 + """Retrieves a list of preferences # noqa: E501 + + Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_preferences(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: PreferenceListResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_preferences_with_http_info(**kwargs) # noqa: E501 + + def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 + """Retrieves a list of preferences # noqa: E501 + + Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_preferences_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(PreferenceListResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'page' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_preferences" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 + query_params.append(('page', local_var_params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/preferences', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PreferenceListResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py new file mode 100644 index 0000000..9da709f --- /dev/null +++ b/patch_api/api/projects_api.py @@ -0,0 +1,262 @@ +# 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 +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from patch_api.api_client import ApiClient +from patch_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class ProjectsApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def retrieve_project(self, id, **kwargs): # noqa: E501 + """Retrieves a project # noqa: E501 + + Retrieves a project available on Patch's platform. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_project(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: ProjectResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_project_with_http_info(id, **kwargs) # noqa: E501 + + def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 + """Retrieves a project # noqa: E501 + + Retrieves a project available on Patch's platform. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_project_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(ProjectResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_project" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'id' is set + if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 + local_var_params['id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `id` when calling `retrieve_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in local_var_params: + path_params['id'] = local_var_params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/projects/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ProjectResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def retrieve_projects(self, **kwargs): # noqa: E501 + """Retrieves a list of projects # noqa: E501 + + Retrieves a list of projects available for purchase on Patch's platform. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_projects(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: ProjectListResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.retrieve_projects_with_http_info(**kwargs) # noqa: E501 + + def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 + """Retrieves a list of projects # noqa: E501 + + Retrieves a list of projects available for purchase on Patch's platform. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.retrieve_projects_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param int page: + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(ProjectListResponse, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'page' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method retrieve_projects" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 + query_params.append(('page', local_var_params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['bearer_auth'] # noqa: E501 + + return self.api_client.call_api( + '/v1/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ProjectListResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/patch_api/api_client.py b/patch_api/api_client.py new file mode 100644 index 0000000..54fcc67 --- /dev/null +++ b/patch_api/api_client.py @@ -0,0 +1,667 @@ +# 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 +""" + +from __future__ import absolute_import + +import atexit +import datetime +from dateutil.parser import parse +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from patch_api.configuration import Configuration +import patch_api.models +from patch_api import rest +from patch_api.exceptions import ApiValueError, ApiException + + +class ApiClient(object): + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1): + if configuration is None: + configuration = Configuration.get_default_copy() + self.configuration = configuration + self.pool_threads = pool_threads + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + atexit.register(self.close) + self._pool = ThreadPool(self.pool_threads) + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') + + self.last_response = response_data + + return_data = response_data + + if not _preload_content: + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(patch_api.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async_req request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + if not async_req: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host) + + return self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, + query_params, + header_params, body, + post_params, files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host)) + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True + + if not klass.openapi_types and has_discriminator is False: + return data + + kwargs = {} + if (data is not None and + klass.openapi_types is not None and + isinstance(data, (list, dict))): + for attr, attr_type in six.iteritems(klass.openapi_types): + if klass.attribute_map[attr] in data: + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if has_discriminator: + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/patch_api/configuration.py b/patch_api/configuration.py new file mode 100644 index 0000000..036f1bb --- /dev/null +++ b/patch_api/configuration.py @@ -0,0 +1,394 @@ +# 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 +""" + + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class Configuration(object): + """NOTE: This class is auto generated by OpenAPI Generator + + Ref: https://openapi-generator.tech + Do not edit the class manually. + + :param host: Base url + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication + :param password: Password for HTTP basic authentication + :param discard_unknown_keys: Boolean value indicating whether to discard + unknown properties. A server may send a response that includes additional + properties that are not known by the client in the following scenarios: + 1. The OpenAPI document is incomplete, i.e. it does not match the server + implementation. + 2. The client was generated using an older version of the OpenAPI document + and the server has been upgraded since then. + If a schema in the OpenAPI document defines the additionalProperties attribute, + then all undeclared properties received by the server are injected into the + additional properties map. In that case, there are undeclared properties, and + nothing to discard. + + :Example: + """ + + _default = None + + def __init__(self, host="https://api.usepatch.com", + api_key=None, api_key_prefix=None, + username=None, password=None, + discard_unknown_keys=False, + ): + """Constructor + """ + self.host = host + """Default Base url + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.discard_unknown_keys = discard_unknown_keys + self.access_token = None + """access token for OAuth/Bearer + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("patch_api") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = None + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Disable client side validation + self.client_side_validation = True + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = copy.deepcopy(default) + + @classmethod + def get_default_copy(cls): + """Return new instance of configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration passed by the set_default method. + + :return: The configuration object. + """ + if cls._default is not None: + return copy.deepcopy(cls._default) + return Configuration() + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if self.access_token is not None: + auth['bearer_auth'] = { + 'type': 'bearer', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: v1\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://{defaultHost}", + 'description': "No description provided", + 'variables': { + 'defaultHost': { + 'description': "No description provided", + 'default_value': "api.usepatch.com", + } + } + } + ] + + def get_host_from_settings(self, index, variables=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :return: URL based on host settings + """ + variables = {} if variables is None else variables + servers = self.get_host_settings() + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server['variables'].items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url diff --git a/patch_api/exceptions.py b/patch_api/exceptions.py new file mode 100644 index 0000000..e2bd822 --- /dev/null +++ b/patch_api/exceptions.py @@ -0,0 +1,121 @@ +# 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 six + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None): + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, six.integer_types): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py new file mode 100644 index 0000000..e6eccd2 --- /dev/null +++ b/patch_api/models/__init__.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +# flake8: noqa +""" + 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 +""" + + +from __future__ import absolute_import + +# import models into model package +from patch_api.models.allocation import Allocation +from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest +from patch_api.models.create_membership_request import CreateMembershipRequest +from patch_api.models.create_offset_request import CreateOffsetRequest +from patch_api.models.create_order_request import CreateOrderRequest +from patch_api.models.create_organization_request import CreateOrganizationRequest +from patch_api.models.create_photo_request import CreatePhotoRequest +from patch_api.models.create_preference_request import CreatePreferenceRequest +from patch_api.models.create_project_request import CreateProjectRequest +from patch_api.models.error_response import ErrorResponse +from patch_api.models.estimate import Estimate +from patch_api.models.estimate_list_response import EstimateListResponse +from patch_api.models.estimate_response import EstimateResponse +from patch_api.models.fulfill_offset_request import FulfillOffsetRequest +from patch_api.models.membership import Membership +from patch_api.models.membership_response import MembershipResponse +from patch_api.models.meta_index_object import MetaIndexObject +from patch_api.models.offset import Offset +from patch_api.models.offset_list_response import OffsetListResponse +from patch_api.models.offset_response import OffsetResponse +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.photo import Photo +from patch_api.models.photo_response import PhotoResponse +from patch_api.models.preference import Preference +from patch_api.models.preference_list_response import PreferenceListResponse +from patch_api.models.preference_response import PreferenceResponse +from patch_api.models.project import Project +from patch_api.models.project_list_response import ProjectListResponse +from patch_api.models.project_response import ProjectResponse +from patch_api.models.project_type_list_response import ProjectTypeListResponse +from patch_api.models.standard import Standard +from patch_api.models.standard_list_response import StandardListResponse +from patch_api.models.update_offset_request import UpdateOffsetRequest +from patch_api.models.update_project_request import UpdateProjectRequest diff --git a/patch_api/models/allocation.py b/patch_api/models/allocation.py new file mode 100644 index 0000000..e37d829 --- /dev/null +++ b/patch_api/models/allocation.py @@ -0,0 +1,182 @@ +# 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 Allocation(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 = { + 'id': 'str', + 'production': 'bool', + 'mass_g': 'int' + } + + attribute_map = { + 'id': 'id', + 'production': 'production', + 'mass_g': 'mass_g' + } + + def __init__(self, id=None, production=None, mass_g=None, local_vars_configuration=None): # noqa: E501 + """Allocation - 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._id = None + self._production = None + self._mass_g = None + self.discriminator = None + + self.id = id + self.production = production + self.mass_g = mass_g + + @property + def id(self): + """Gets the id of this Allocation. # noqa: E501 + + A unique uid for the record. UIDs will be prepended by all_prod or all_test depending on the mode it was created in. # noqa: E501 + + :return: The id of this Allocation. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Allocation. + + A unique uid for the record. UIDs will be prepended by all_prod or all_test depending on the mode it was created in. # noqa: E501 + + :param id: The id of this Allocation. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def production(self): + """Gets the production of this Allocation. # noqa: E501 + + A boolean indicating if this project is a production or test mode project. # noqa: E501 + + :return: The production of this Allocation. # noqa: E501 + :rtype: bool + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this Allocation. + + A boolean indicating if this project is a production or test mode project. # noqa: E501 + + :param production: The production of this Allocation. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + + self._production = production + + @property + def mass_g(self): + """Gets the mass_g of this Allocation. # noqa: E501 + + The amount (in grams) of allocated carbon offsets. # noqa: E501 + + :return: The mass_g of this Allocation. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this Allocation. + + The amount (in grams) of allocated carbon offsets. # noqa: E501 + + :param mass_g: The mass_g of this Allocation. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + + self._mass_g = mass_g + + 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, Allocation): + 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, Allocation): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_mass_estimate_request.py b/patch_api/models/create_mass_estimate_request.py new file mode 100644 index 0000000..06ccc2f --- /dev/null +++ b/patch_api/models/create_mass_estimate_request.py @@ -0,0 +1,154 @@ +# 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 CreateMassEstimateRequest(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 = { + 'mass_g': 'int', + 'project_id': 'str' + } + + attribute_map = { + 'mass_g': 'mass_g', + 'project_id': 'project_id' + } + + def __init__(self, mass_g=None, project_id=None, local_vars_configuration=None): # noqa: E501 + """CreateMassEstimateRequest - 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._mass_g = None + self._project_id = None + self.discriminator = None + + self.mass_g = mass_g + if project_id is not None: + self.project_id = project_id + + @property + def mass_g(self): + """Gets the mass_g of this CreateMassEstimateRequest. # noqa: E501 + + + :return: The mass_g of this CreateMassEstimateRequest. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this CreateMassEstimateRequest. + + + :param mass_g: The mass_g of this CreateMassEstimateRequest. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 1): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + + self._mass_g = mass_g + + @property + def project_id(self): + """Gets the project_id of this CreateMassEstimateRequest. # noqa: E501 + + + :return: The project_id of this CreateMassEstimateRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateMassEstimateRequest. + + + :param project_id: The project_id of this CreateMassEstimateRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + 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, CreateMassEstimateRequest): + 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, CreateMassEstimateRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_membership_request.py b/patch_api/models/create_membership_request.py new file mode 100644 index 0000000..23f36ae --- /dev/null +++ b/patch_api/models/create_membership_request.py @@ -0,0 +1,179 @@ +# 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 CreateMembershipRequest(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 = { + 'email': 'str', + 'role': 'str', + 'organization_id': 'str' + } + + attribute_map = { + 'email': 'email', + 'role': 'role', + 'organization_id': 'organization_id' + } + + def __init__(self, email=None, role=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + """CreateMembershipRequest - 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._email = None + self._role = None + self._organization_id = None + self.discriminator = None + + if email is not None: + self.email = email + if role is not None: + self.role = role + if organization_id is not None: + self.organization_id = organization_id + + @property + def email(self): + """Gets the email of this CreateMembershipRequest. # noqa: E501 + + + :return: The email of this CreateMembershipRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this CreateMembershipRequest. + + + :param email: The email of this CreateMembershipRequest. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def role(self): + """Gets the role of this CreateMembershipRequest. # noqa: E501 + + + :return: The role of this CreateMembershipRequest. # noqa: E501 + :rtype: str + """ + return self._role + + @role.setter + def role(self, role): + """Sets the role of this CreateMembershipRequest. + + + :param role: The role of this CreateMembershipRequest. # noqa: E501 + :type: str + """ + allowed_values = ["admin", "developer", "member"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 + .format(role, allowed_values) + ) + + self._role = role + + @property + def organization_id(self): + """Gets the organization_id of this CreateMembershipRequest. # noqa: E501 + + + :return: The organization_id of this CreateMembershipRequest. # noqa: E501 + :rtype: str + """ + return self._organization_id + + @organization_id.setter + def organization_id(self, organization_id): + """Sets the organization_id of this CreateMembershipRequest. + + + :param organization_id: The organization_id of this CreateMembershipRequest. # noqa: E501 + :type: str + """ + + self._organization_id = organization_id + + 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, CreateMembershipRequest): + 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, CreateMembershipRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_offset_request.py b/patch_api/models/create_offset_request.py new file mode 100644 index 0000000..dd77842 --- /dev/null +++ b/patch_api/models/create_offset_request.py @@ -0,0 +1,233 @@ +# 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 CreateOffsetRequest(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 = { + 'mass_g': 'int', + 'price_cents_usd': 'int', + 'project_id': 'str', + 'vintage_year': 'int', + 'serial_number': 'str' + } + + attribute_map = { + 'mass_g': 'mass_g', + 'price_cents_usd': 'price_cents_usd', + 'project_id': 'project_id', + 'vintage_year': 'vintage_year', + 'serial_number': 'serial_number' + } + + def __init__(self, mass_g=None, price_cents_usd=None, project_id=None, vintage_year=None, serial_number=None, local_vars_configuration=None): # noqa: E501 + """CreateOffsetRequest - 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._mass_g = None + self._price_cents_usd = None + self._project_id = None + self._vintage_year = None + self._serial_number = None + self.discriminator = None + + if mass_g is not None: + self.mass_g = mass_g + if price_cents_usd is not None: + self.price_cents_usd = price_cents_usd + if project_id is not None: + self.project_id = project_id + if vintage_year is not None: + self.vintage_year = vintage_year + self.serial_number = serial_number + + @property + def mass_g(self): + """Gets the mass_g of this CreateOffsetRequest. # noqa: E501 + + + :return: The mass_g of this CreateOffsetRequest. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this CreateOffsetRequest. + + + :param mass_g: The mass_g of this CreateOffsetRequest. # noqa: E501 + :type: int + """ + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 1000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 1): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + + self._mass_g = mass_g + + @property + def price_cents_usd(self): + """Gets the price_cents_usd of this CreateOffsetRequest. # noqa: E501 + + + :return: The price_cents_usd of this CreateOffsetRequest. # noqa: E501 + :rtype: int + """ + return self._price_cents_usd + + @price_cents_usd.setter + def price_cents_usd(self, price_cents_usd): + """Sets the price_cents_usd of this CreateOffsetRequest. + + + :param price_cents_usd: The price_cents_usd of this CreateOffsetRequest. # noqa: E501 + :type: int + """ + if (self.local_vars_configuration.client_side_validation and + price_cents_usd is not None and price_cents_usd < 1): # noqa: E501 + raise ValueError("Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + + self._price_cents_usd = price_cents_usd + + @property + def project_id(self): + """Gets the project_id of this CreateOffsetRequest. # noqa: E501 + + + :return: The project_id of this CreateOffsetRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateOffsetRequest. + + + :param project_id: The project_id of this CreateOffsetRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + @property + def vintage_year(self): + """Gets the vintage_year of this CreateOffsetRequest. # noqa: E501 + + + :return: The vintage_year of this CreateOffsetRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_year + + @vintage_year.setter + def vintage_year(self, vintage_year): + """Sets the vintage_year of this CreateOffsetRequest. + + + :param vintage_year: The vintage_year of this CreateOffsetRequest. # noqa: E501 + :type: int + """ + + self._vintage_year = vintage_year + + @property + def serial_number(self): + """Gets the serial_number of this CreateOffsetRequest. # noqa: E501 + + + :return: The serial_number of this CreateOffsetRequest. # noqa: E501 + :rtype: str + """ + return self._serial_number + + @serial_number.setter + def serial_number(self, serial_number): + """Sets the serial_number of this CreateOffsetRequest. + + + :param serial_number: The serial_number of this CreateOffsetRequest. # noqa: E501 + :type: str + """ + + self._serial_number = serial_number + + 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, CreateOffsetRequest): + 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, CreateOffsetRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py new file mode 100644 index 0000000..794ff86 --- /dev/null +++ b/patch_api/models/create_order_request.py @@ -0,0 +1,208 @@ +# 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 CreateOrderRequest(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 = { + 'mass_g': 'int', + 'total_price_cents_usd': 'int', + 'project_id': 'str', + 'metadata': 'object' + } + + attribute_map = { + 'mass_g': 'mass_g', + 'total_price_cents_usd': 'total_price_cents_usd', + 'project_id': 'project_id', + 'metadata': 'metadata' + } + + def __init__(self, mass_g=None, total_price_cents_usd=None, project_id=None, metadata=None, local_vars_configuration=None): # noqa: E501 + """CreateOrderRequest - 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._mass_g = None + self._total_price_cents_usd = None + self._project_id = None + self._metadata = None + self.discriminator = None + + if mass_g is not None: + self.mass_g = mass_g + if total_price_cents_usd is not None: + self.total_price_cents_usd = total_price_cents_usd + if project_id is not None: + self.project_id = project_id + if metadata is not None: + self.metadata = metadata + + @property + def mass_g(self): + """Gets the mass_g of this CreateOrderRequest. # noqa: E501 + + + :return: The mass_g of this CreateOrderRequest. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this CreateOrderRequest. + + + :param mass_g: The mass_g of this CreateOrderRequest. # noqa: E501 + :type: int + """ + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 1): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + + self._mass_g = mass_g + + @property + def total_price_cents_usd(self): + """Gets the total_price_cents_usd of this CreateOrderRequest. # noqa: E501 + + + :return: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 + :rtype: int + """ + return self._total_price_cents_usd + + @total_price_cents_usd.setter + def total_price_cents_usd(self, total_price_cents_usd): + """Sets the total_price_cents_usd of this CreateOrderRequest. + + + :param total_price_cents_usd: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 + :type: int + """ + if (self.local_vars_configuration.client_side_validation and + total_price_cents_usd is not None and total_price_cents_usd < 1): # noqa: E501 + raise ValueError("Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + + self._total_price_cents_usd = total_price_cents_usd + + @property + def project_id(self): + """Gets the project_id of this CreateOrderRequest. # noqa: E501 + + + :return: The project_id of this CreateOrderRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreateOrderRequest. + + + :param project_id: The project_id of this CreateOrderRequest. # noqa: E501 + :type: str + """ + + self._project_id = project_id + + @property + def metadata(self): + """Gets the metadata of this CreateOrderRequest. # noqa: E501 + + + :return: The metadata of this CreateOrderRequest. # noqa: E501 + :rtype: object + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this CreateOrderRequest. + + + :param metadata: The metadata of this CreateOrderRequest. # noqa: E501 + :type: object + """ + + self._metadata = metadata + + 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, CreateOrderRequest): + 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, CreateOrderRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_organization_request.py b/patch_api/models/create_organization_request.py new file mode 100644 index 0000000..316dc30 --- /dev/null +++ b/patch_api/models/create_organization_request.py @@ -0,0 +1,155 @@ +# 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 CreateOrganizationRequest(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 = { + 'name': 'str', + 'type': 'str' + } + + attribute_map = { + 'name': 'name', + 'type': 'type' + } + + def __init__(self, name=None, type=None, local_vars_configuration=None): # noqa: E501 + """CreateOrganizationRequest - 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._name = None + self._type = None + self.discriminator = None + + self.name = name + self.type = type + + @property + def name(self): + """Gets the name of this CreateOrganizationRequest. # noqa: E501 + + + :return: The name of this CreateOrganizationRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CreateOrganizationRequest. + + + :param name: The name of this CreateOrganizationRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this CreateOrganizationRequest. # noqa: E501 + + + :return: The type of this CreateOrganizationRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this CreateOrganizationRequest. + + + :param type: The type of this CreateOrganizationRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["consumer", "supplier"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = 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, CreateOrganizationRequest): + 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, CreateOrganizationRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_photo_request.py b/patch_api/models/create_photo_request.py new file mode 100644 index 0000000..cf256ca --- /dev/null +++ b/patch_api/models/create_photo_request.py @@ -0,0 +1,175 @@ +# 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 CreatePhotoRequest(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 = { + 'project_id': 'str', + 'url': 'str', + 'sort_order': 'int' + } + + attribute_map = { + 'project_id': 'project_id', + 'url': 'url', + 'sort_order': 'sort_order' + } + + def __init__(self, project_id=None, url=None, sort_order=None, local_vars_configuration=None): # noqa: E501 + """CreatePhotoRequest - 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._project_id = None + self._url = None + self._sort_order = None + self.discriminator = None + + self.project_id = project_id + self.url = url + if sort_order is not None: + self.sort_order = sort_order + + @property + def project_id(self): + """Gets the project_id of this CreatePhotoRequest. # noqa: E501 + + + :return: The project_id of this CreatePhotoRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreatePhotoRequest. + + + :param project_id: The project_id of this CreatePhotoRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 + raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + + self._project_id = project_id + + @property + def url(self): + """Gets the url of this CreatePhotoRequest. # noqa: E501 + + + :return: The url of this CreatePhotoRequest. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this CreatePhotoRequest. + + + :param url: The url of this CreatePhotoRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 + + self._url = url + + @property + def sort_order(self): + """Gets the sort_order of this CreatePhotoRequest. # noqa: E501 + + + :return: The sort_order of this CreatePhotoRequest. # noqa: E501 + :rtype: int + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this CreatePhotoRequest. + + + :param sort_order: The sort_order of this CreatePhotoRequest. # noqa: E501 + :type: int + """ + + self._sort_order = sort_order + + 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, CreatePhotoRequest): + 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, CreatePhotoRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_preference_request.py b/patch_api/models/create_preference_request.py new file mode 100644 index 0000000..8abb43d --- /dev/null +++ b/patch_api/models/create_preference_request.py @@ -0,0 +1,122 @@ +# 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 CreatePreferenceRequest(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 = { + 'project_id': 'str' + } + + attribute_map = { + 'project_id': 'project_id' + } + + def __init__(self, project_id=None, local_vars_configuration=None): # noqa: E501 + """CreatePreferenceRequest - 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._project_id = None + self.discriminator = None + + self.project_id = project_id + + @property + def project_id(self): + """Gets the project_id of this CreatePreferenceRequest. # noqa: E501 + + + :return: The project_id of this CreatePreferenceRequest. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this CreatePreferenceRequest. + + + :param project_id: The project_id of this CreatePreferenceRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 + raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + + self._project_id = project_id + + 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, CreatePreferenceRequest): + 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, CreatePreferenceRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_project_request.py b/patch_api/models/create_project_request.py new file mode 100644 index 0000000..39fe7ba --- /dev/null +++ b/patch_api/models/create_project_request.py @@ -0,0 +1,398 @@ +# 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 CreateProjectRequest(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 = { + 'name': 'str', + 'description': 'str', + 'country': 'str', + 'state': 'str', + 'verifier': 'str', + 'type': 'str', + 'standard_type': 'str', + 'longitude': 'str', + 'latitude': 'str', + 'production': 'str', + 'organization_id': 'str' + } + + attribute_map = { + 'name': 'name', + 'description': 'description', + 'country': 'country', + 'state': 'state', + 'verifier': 'verifier', + 'type': 'type', + 'standard_type': 'standard_type', + 'longitude': 'longitude', + 'latitude': 'latitude', + 'production': 'production', + 'organization_id': 'organization_id' + } + + def __init__(self, name=None, description=None, country=None, state=None, verifier=None, type=None, standard_type=None, longitude=None, latitude=None, production=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + """CreateProjectRequest - 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._name = None + self._description = None + self._country = None + self._state = None + self._verifier = None + self._type = None + self._standard_type = None + self._longitude = None + self._latitude = None + self._production = None + self._organization_id = None + self.discriminator = None + + if name is not None: + self.name = name + if description is not None: + self.description = description + if country is not None: + self.country = country + if state is not None: + self.state = state + if verifier is not None: + self.verifier = verifier + if type is not None: + self.type = type + if standard_type is not None: + self.standard_type = standard_type + if longitude is not None: + self.longitude = longitude + if latitude is not None: + self.latitude = latitude + self.production = production + if organization_id is not None: + self.organization_id = organization_id + + @property + def name(self): + """Gets the name of this CreateProjectRequest. # noqa: E501 + + + :return: The name of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CreateProjectRequest. + + + :param name: The name of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this CreateProjectRequest. # noqa: E501 + + + :return: The description of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this CreateProjectRequest. + + + :param description: The description of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def country(self): + """Gets the country of this CreateProjectRequest. # noqa: E501 + + + :return: The country of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this CreateProjectRequest. + + + :param country: The country of this CreateProjectRequest. # noqa: E501 + :type: str + """ + allowed_values = ["TJ", "JM", "HT", "ST", "MS", "AE", "PK", "NL", "LU", "BZ", "IR", "BO", "UY", "GH", "SA", "CI", "MF", "TF", "AI", "QA", "SX", "LY", "BV", "PG", "KG", "GQ", "EH", "NU", "PR", "GD", "KR", "HM", "SM", "SL", "CD", "MK", "TR", "DZ", "GE", "PS", "BB", "UA", "GP", "PF", "NA", "BW", "SY", "TG", "DO", "AQ", "CH", "MG", "FO", "VG", "GI", "BN", "LA", "IS", "EE", "UM", "LT", "RS", "MR", "AD", "HU", "TK", "MY", "AO", "CV", "NF", "PA", "GW", "BE", "PT", "GB", "IM", "US", "YE", "HK", "AZ", "CC", "ML", "SK", "VU", "TL", "HR", "SR", "MU", "CZ", "PM", "LS", "WS", "KM", "IT", "BI", "WF", "GN", "SG", "CO", "CN", "AW", "MA", "FI", "VA", "ZW", "KY", "BH", "PY", "EC", "LR", "RU", "PL", "OM", "MT", "SS", "DE", "TM", "SJ", "MM", "TT", "IL", "BD", "NR", "LK", "UG", "NG", "BQ", "MX", "CW", "SI", "MN", "CA", "AX", "VN", "TW", "JP", "IO", "RO", "BG", "GU", "BR", "AM", "ZM", "DJ", "JE", "AT", "CM", "SE", "FJ", "KZ", "GL", "GY", "CX", "MW", "TN", "ZA", "TO", "CY", "MV", "PN", "RW", "NI", "KN", "BJ", "ET", "GM", "TZ", "VC", "FK", "SD", "MC", "AU", "CL", "DK", "FR", "TC", "CU", "AL", "MZ", "BS", "NE", "GT", "LI", "NP", "BF", "PW", "KW", "IN", "GA", "TV", "MO", "SH", "MD", "CK", "AR", "SC", "IE", "ES", "LB", "BM", "RE", "KI", "AG", "MQ", "SV", "JO", "TH", "SO", "MH", "CG", "KP", "GF", "BA", "YT", "GS", "KE", "PE", "BT", "SZ", "CR", "TD", "DM", "NC", "GR", "GG", "HN", "VI", "CF", "SN", "AF", "MP", "PH", "BY", "LV", "NO", "EG", "KH", "IQ", "LC", "NZ", "BL", "UZ", "ID", "ER", "VE", "FM", "SB", "ME", "AS"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and country not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `country` ({0}), must be one of {1}" # noqa: E501 + .format(country, allowed_values) + ) + + self._country = country + + @property + def state(self): + """Gets the state of this CreateProjectRequest. # noqa: E501 + + + :return: The state of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this CreateProjectRequest. + + + :param state: The state of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def verifier(self): + """Gets the verifier of this CreateProjectRequest. # noqa: E501 + + + :return: The verifier of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._verifier + + @verifier.setter + def verifier(self, verifier): + """Sets the verifier of this CreateProjectRequest. + + + :param verifier: The verifier of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._verifier = verifier + + @property + def type(self): + """Gets the type of this CreateProjectRequest. # noqa: E501 + + + :return: The type of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this CreateProjectRequest. + + + :param type: The type of this CreateProjectRequest. # noqa: E501 + :type: str + """ + allowed_values = ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def standard_type(self): + """Gets the standard_type of this CreateProjectRequest. # noqa: E501 + + + :return: The standard_type of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._standard_type + + @standard_type.setter + def standard_type(self, standard_type): + """Sets the standard_type of this CreateProjectRequest. + + + :param standard_type: The standard_type of this CreateProjectRequest. # noqa: E501 + :type: str + """ + allowed_values = ["american_carbon_registry", "climate_action_reserve", "verified_carbon_standard", "european_biochar_certificate"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and standard_type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `standard_type` ({0}), must be one of {1}" # noqa: E501 + .format(standard_type, allowed_values) + ) + + self._standard_type = standard_type + + @property + def longitude(self): + """Gets the longitude of this CreateProjectRequest. # noqa: E501 + + + :return: The longitude of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._longitude + + @longitude.setter + def longitude(self, longitude): + """Sets the longitude of this CreateProjectRequest. + + + :param longitude: The longitude of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._longitude = longitude + + @property + def latitude(self): + """Gets the latitude of this CreateProjectRequest. # noqa: E501 + + + :return: The latitude of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._latitude + + @latitude.setter + def latitude(self, latitude): + """Sets the latitude of this CreateProjectRequest. + + + :param latitude: The latitude of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._latitude = latitude + + @property + def production(self): + """Gets the production of this CreateProjectRequest. # noqa: E501 + + + :return: The production of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this CreateProjectRequest. + + + :param production: The production of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._production = production + + @property + def organization_id(self): + """Gets the organization_id of this CreateProjectRequest. # noqa: E501 + + + :return: The organization_id of this CreateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._organization_id + + @organization_id.setter + def organization_id(self, organization_id): + """Sets the organization_id of this CreateProjectRequest. + + + :param organization_id: The organization_id of this CreateProjectRequest. # noqa: E501 + :type: str + """ + + self._organization_id = organization_id + + 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, CreateProjectRequest): + 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, CreateProjectRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/error_response.py b/patch_api/models/error_response.py new file mode 100644 index 0000000..efb6ee8 --- /dev/null +++ b/patch_api/models/error_response.py @@ -0,0 +1,174 @@ +# 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 ErrorResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'object' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """ErrorResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this ErrorResponse. # noqa: E501 + + + :return: The success of this ErrorResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this ErrorResponse. + + + :param success: The success of this ErrorResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this ErrorResponse. # noqa: E501 + + + :return: The error of this ErrorResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this ErrorResponse. + + + :param error: The error of this ErrorResponse. # noqa: E501 + :type: object + """ + if self.local_vars_configuration.client_side_validation and error is None: # noqa: E501 + raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 + + self._error = error + + @property + def data(self): + """Gets the data of this ErrorResponse. # noqa: E501 + + + :return: The data of this ErrorResponse. # noqa: E501 + :rtype: object + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this ErrorResponse. + + + :param data: The data of this ErrorResponse. # noqa: E501 + :type: object + """ + + self._data = data + + 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, ErrorResponse): + 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, ErrorResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py new file mode 100644 index 0000000..6acc285 --- /dev/null +++ b/patch_api/models/estimate.py @@ -0,0 +1,209 @@ +# 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 Estimate(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 = { + 'id': 'str', + 'production': 'bool', + 'type': 'str', + 'order': 'Order' + } + + attribute_map = { + 'id': 'id', + 'production': 'production', + 'type': 'type', + 'order': 'order' + } + + def __init__(self, id=None, production=None, type=None, order=None, local_vars_configuration=None): # noqa: E501 + """Estimate - 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._id = None + self._production = None + self._type = None + self._order = None + self.discriminator = None + + self.id = id + self.production = production + self.type = type + self.order = order + + @property + def id(self): + """Gets the id of this Estimate. # noqa: E501 + + A unique uid for the record. UIDs will be prepended by est_prod or est_test depending on the mode it was created in. # noqa: E501 + + :return: The id of this Estimate. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Estimate. + + A unique uid for the record. UIDs will be prepended by est_prod or est_test depending on the mode it was created in. # noqa: E501 + + :param id: The id of this Estimate. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def production(self): + """Gets the production of this Estimate. # noqa: E501 + + A boolean indicating if this estimate is a production or test mode estimate. # noqa: E501 + + :return: The production of this Estimate. # noqa: E501 + :rtype: bool + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this Estimate. + + A boolean indicating if this estimate is a production or test mode estimate. # noqa: E501 + + :param production: The production of this Estimate. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + + self._production = production + + @property + def type(self): + """Gets the type of this Estimate. # noqa: E501 + + The type of estimate. Currently mass is the only supported value. # noqa: E501 + + :return: The type of this Estimate. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Estimate. + + The type of estimate. Currently mass is the only supported value. # noqa: E501 + + :param type: The type of this Estimate. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def order(self): + """Gets the order of this Estimate. # noqa: E501 + + An object returning the order associated with this estimate. See the [Order section](/?id=orders) for the full schema. # noqa: E501 + + :return: The order of this Estimate. # noqa: E501 + :rtype: Order + """ + return self._order + + @order.setter + def order(self, order): + """Sets the order of this Estimate. + + An object returning the order associated with this estimate. See the [Order section](/?id=orders) for the full schema. # noqa: E501 + + :param order: The order of this Estimate. # noqa: E501 + :type: Order + """ + + self._order = order + + 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, Estimate): + 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, Estimate): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/estimate_list_response.py b/patch_api/models/estimate_list_response.py new file mode 100644 index 0000000..1b42b43 --- /dev/null +++ b/patch_api/models/estimate_list_response.py @@ -0,0 +1,201 @@ +# 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 EstimateListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Estimate]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """EstimateListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this EstimateListResponse. # noqa: E501 + + + :return: The success of this EstimateListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this EstimateListResponse. + + + :param success: The success of this EstimateListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this EstimateListResponse. # noqa: E501 + + + :return: The error of this EstimateListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this EstimateListResponse. + + + :param error: The error of this EstimateListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this EstimateListResponse. # noqa: E501 + + + :return: The data of this EstimateListResponse. # noqa: E501 + :rtype: list[Estimate] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this EstimateListResponse. + + + :param data: The data of this EstimateListResponse. # noqa: E501 + :type: list[Estimate] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this EstimateListResponse. # noqa: E501 + + + :return: The meta of this EstimateListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this EstimateListResponse. + + + :param meta: The meta of this EstimateListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, EstimateListResponse): + 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, EstimateListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/estimate_response.py b/patch_api/models/estimate_response.py new file mode 100644 index 0000000..bee841e --- /dev/null +++ b/patch_api/models/estimate_response.py @@ -0,0 +1,174 @@ +# 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 EstimateResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'Estimate' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """EstimateResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this EstimateResponse. # noqa: E501 + + + :return: The success of this EstimateResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this EstimateResponse. + + + :param success: The success of this EstimateResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this EstimateResponse. # noqa: E501 + + + :return: The error of this EstimateResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this EstimateResponse. + + + :param error: The error of this EstimateResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this EstimateResponse. # noqa: E501 + + + :return: The data of this EstimateResponse. # noqa: E501 + :rtype: Estimate + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this EstimateResponse. + + + :param data: The data of this EstimateResponse. # noqa: E501 + :type: Estimate + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, EstimateResponse): + 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, EstimateResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/fulfill_offset_request.py b/patch_api/models/fulfill_offset_request.py new file mode 100644 index 0000000..e3a3933 --- /dev/null +++ b/patch_api/models/fulfill_offset_request.py @@ -0,0 +1,120 @@ +# 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 FulfillOffsetRequest(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 = { + 'serial_number': 'str' + } + + attribute_map = { + 'serial_number': 'serial_number' + } + + def __init__(self, serial_number=None, local_vars_configuration=None): # noqa: E501 + """FulfillOffsetRequest - 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._serial_number = None + self.discriminator = None + + self.serial_number = serial_number + + @property + def serial_number(self): + """Gets the serial_number of this FulfillOffsetRequest. # noqa: E501 + + + :return: The serial_number of this FulfillOffsetRequest. # noqa: E501 + :rtype: str + """ + return self._serial_number + + @serial_number.setter + def serial_number(self, serial_number): + """Sets the serial_number of this FulfillOffsetRequest. + + + :param serial_number: The serial_number of this FulfillOffsetRequest. # noqa: E501 + :type: str + """ + + self._serial_number = serial_number + + 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, FulfillOffsetRequest): + 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, FulfillOffsetRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/membership.py b/patch_api/models/membership.py new file mode 100644 index 0000000..43669f2 --- /dev/null +++ b/patch_api/models/membership.py @@ -0,0 +1,182 @@ +# 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 Membership(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 = { + 'email': 'str', + 'role': 'str', + 'organization_id': 'str' + } + + attribute_map = { + 'email': 'email', + 'role': 'role', + 'organization_id': 'organization_id' + } + + def __init__(self, email=None, role=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + """Membership - 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._email = None + self._role = None + self._organization_id = None + self.discriminator = None + + self.email = email + self.role = role + self.organization_id = organization_id + + @property + def email(self): + """Gets the email of this Membership. # noqa: E501 + + + :return: The email of this Membership. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Membership. + + + :param email: The email of this Membership. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501 + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def role(self): + """Gets the role of this Membership. # noqa: E501 + + + :return: The role of this Membership. # noqa: E501 + :rtype: str + """ + return self._role + + @role.setter + def role(self, role): + """Sets the role of this Membership. + + + :param role: The role of this Membership. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and role is None: # noqa: E501 + raise ValueError("Invalid value for `role`, must not be `None`") # noqa: E501 + allowed_values = ["admin", "developer", "member"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 + .format(role, allowed_values) + ) + + self._role = role + + @property + def organization_id(self): + """Gets the organization_id of this Membership. # noqa: E501 + + + :return: The organization_id of this Membership. # noqa: E501 + :rtype: str + """ + return self._organization_id + + @organization_id.setter + def organization_id(self, organization_id): + """Sets the organization_id of this Membership. + + + :param organization_id: The organization_id of this Membership. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and organization_id is None: # noqa: E501 + raise ValueError("Invalid value for `organization_id`, must not be `None`") # noqa: E501 + + self._organization_id = organization_id + + 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, Membership): + 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, Membership): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/membership_response.py b/patch_api/models/membership_response.py new file mode 100644 index 0000000..912c499 --- /dev/null +++ b/patch_api/models/membership_response.py @@ -0,0 +1,174 @@ +# 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 MembershipResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Membership]' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """MembershipResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this MembershipResponse. # noqa: E501 + + + :return: The success of this MembershipResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this MembershipResponse. + + + :param success: The success of this MembershipResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this MembershipResponse. # noqa: E501 + + + :return: The error of this MembershipResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this MembershipResponse. + + + :param error: The error of this MembershipResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this MembershipResponse. # noqa: E501 + + + :return: The data of this MembershipResponse. # noqa: E501 + :rtype: list[Membership] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this MembershipResponse. + + + :param data: The data of this MembershipResponse. # noqa: E501 + :type: list[Membership] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, MembershipResponse): + 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, MembershipResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/meta_index_object.py b/patch_api/models/meta_index_object.py new file mode 100644 index 0000000..5de83d5 --- /dev/null +++ b/patch_api/models/meta_index_object.py @@ -0,0 +1,145 @@ +# 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 MetaIndexObject(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 = { + 'prev_page': 'int', + 'next_page': 'int' + } + + attribute_map = { + 'prev_page': 'prev_page', + 'next_page': 'next_page' + } + + def __init__(self, prev_page=None, next_page=None, local_vars_configuration=None): # noqa: E501 + """MetaIndexObject - 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._prev_page = None + self._next_page = None + self.discriminator = None + + self.prev_page = prev_page + self.next_page = next_page + + @property + def prev_page(self): + """Gets the prev_page of this MetaIndexObject. # noqa: E501 + + + :return: The prev_page of this MetaIndexObject. # noqa: E501 + :rtype: int + """ + return self._prev_page + + @prev_page.setter + def prev_page(self, prev_page): + """Sets the prev_page of this MetaIndexObject. + + + :param prev_page: The prev_page of this MetaIndexObject. # noqa: E501 + :type: int + """ + + self._prev_page = prev_page + + @property + def next_page(self): + """Gets the next_page of this MetaIndexObject. # noqa: E501 + + + :return: The next_page of this MetaIndexObject. # noqa: E501 + :rtype: int + """ + return self._next_page + + @next_page.setter + def next_page(self, next_page): + """Sets the next_page of this MetaIndexObject. + + + :param next_page: The next_page of this MetaIndexObject. # noqa: E501 + :type: int + """ + + self._next_page = next_page + + 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, MetaIndexObject): + 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, MetaIndexObject): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/offset.py b/patch_api/models/offset.py new file mode 100644 index 0000000..a7381a2 --- /dev/null +++ b/patch_api/models/offset.py @@ -0,0 +1,422 @@ +# 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 Offset(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 = { + 'id': 'str', + 'allocated_mass_g': 'int', + 'fulfilled_at': 'str', + 'fulfillment_state': 'str', + 'mass_g': 'int', + 'price_cents_usd': 'str', + 'production': 'bool', + 'retired': 'bool', + 'serial_number': 'str', + 'vintage_year': 'int', + 'project_id': 'str' + } + + attribute_map = { + 'id': 'id', + 'allocated_mass_g': 'allocated_mass_g', + 'fulfilled_at': 'fulfilled_at', + 'fulfillment_state': 'fulfillment_state', + 'mass_g': 'mass_g', + 'price_cents_usd': 'price_cents_usd', + 'production': 'production', + 'retired': 'retired', + 'serial_number': 'serial_number', + 'vintage_year': 'vintage_year', + 'project_id': 'project_id' + } + + def __init__(self, id=None, allocated_mass_g=None, fulfilled_at=None, fulfillment_state=None, mass_g=None, price_cents_usd=None, production=None, retired=None, serial_number=None, vintage_year=None, project_id=None, local_vars_configuration=None): # noqa: E501 + """Offset - 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._id = None + self._allocated_mass_g = None + self._fulfilled_at = None + self._fulfillment_state = None + self._mass_g = None + self._price_cents_usd = None + self._production = None + self._retired = None + self._serial_number = None + self._vintage_year = None + self._project_id = None + self.discriminator = None + + self.id = id + self.allocated_mass_g = allocated_mass_g + self.fulfilled_at = fulfilled_at + self.fulfillment_state = fulfillment_state + self.mass_g = mass_g + self.price_cents_usd = price_cents_usd + self.production = production + self.retired = retired + self.serial_number = serial_number + self.vintage_year = vintage_year + self.project_id = project_id + + @property + def id(self): + """Gets the id of this Offset. # noqa: E501 + + A unique uid for the record. UIDs will be prepended by off_prod or off_test depending on the mode it was created in. # noqa: E501 + + :return: The id of this Offset. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Offset. + + A unique uid for the record. UIDs will be prepended by off_prod or off_test depending on the mode it was created in. # noqa: E501 + + :param id: The id of this Offset. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def allocated_mass_g(self): + """Gets the allocated_mass_g of this Offset. # noqa: E501 + + The amount of carbon offset mass in grams already allocated from this offset. # noqa: E501 + + :return: The allocated_mass_g of this Offset. # noqa: E501 + :rtype: int + """ + return self._allocated_mass_g + + @allocated_mass_g.setter + def allocated_mass_g(self, allocated_mass_g): + """Sets the allocated_mass_g of this Offset. + + The amount of carbon offset mass in grams already allocated from this offset. # noqa: E501 + + :param allocated_mass_g: The allocated_mass_g of this Offset. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and allocated_mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `allocated_mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + allocated_mass_g is not None and allocated_mass_g > 1000000000): # noqa: E501 + raise ValueError("Invalid value for `allocated_mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + allocated_mass_g is not None and allocated_mass_g < 0): # noqa: E501 + raise ValueError("Invalid value for `allocated_mass_g`, must be a value greater than or equal to `0`") # noqa: E501 + + self._allocated_mass_g = allocated_mass_g + + @property + def fulfilled_at(self): + """Gets the fulfilled_at of this Offset. # noqa: E501 + + The date in which the orders allocated to this offset were fulfilled. # noqa: E501 + + :return: The fulfilled_at of this Offset. # noqa: E501 + :rtype: str + """ + return self._fulfilled_at + + @fulfilled_at.setter + def fulfilled_at(self, fulfilled_at): + """Sets the fulfilled_at of this Offset. + + The date in which the orders allocated to this offset were fulfilled. # noqa: E501 + + :param fulfilled_at: The fulfilled_at of this Offset. # noqa: E501 + :type: str + """ + + self._fulfilled_at = fulfilled_at + + @property + def fulfillment_state(self): + """Gets the fulfillment_state of this Offset. # noqa: E501 + + The current fulfillment state of the offset. # noqa: E501 + + :return: The fulfillment_state of this Offset. # noqa: E501 + :rtype: str + """ + return self._fulfillment_state + + @fulfillment_state.setter + def fulfillment_state(self, fulfillment_state): + """Sets the fulfillment_state of this Offset. + + The current fulfillment state of the offset. # noqa: E501 + + :param fulfillment_state: The fulfillment_state of this Offset. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and fulfillment_state is None: # noqa: E501 + raise ValueError("Invalid value for `fulfillment_state`, must not be `None`") # noqa: E501 + allowed_values = ["pending", "fulfilled"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and fulfillment_state not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `fulfillment_state` ({0}), must be one of {1}" # noqa: E501 + .format(fulfillment_state, allowed_values) + ) + + self._fulfillment_state = fulfillment_state + + @property + def mass_g(self): + """Gets the mass_g of this Offset. # noqa: E501 + + The amount of carbon offsets in grams for this offset. # noqa: E501 + + :return: The mass_g of this Offset. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this Offset. + + The amount of carbon offsets in grams for this offset. # noqa: E501 + + :param mass_g: The mass_g of this Offset. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 1000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 1): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + + self._mass_g = mass_g + + @property + def price_cents_usd(self): + """Gets the price_cents_usd of this Offset. # noqa: E501 + + The total price in cents USD of this carbon offset. # noqa: E501 + + :return: The price_cents_usd of this Offset. # noqa: E501 + :rtype: str + """ + return self._price_cents_usd + + @price_cents_usd.setter + def price_cents_usd(self, price_cents_usd): + """Sets the price_cents_usd of this Offset. + + The total price in cents USD of this carbon offset. # noqa: E501 + + :param price_cents_usd: The price_cents_usd of this Offset. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and price_cents_usd is None: # noqa: E501 + raise ValueError("Invalid value for `price_cents_usd`, must not be `None`") # noqa: E501 + + self._price_cents_usd = price_cents_usd + + @property + def production(self): + """Gets the production of this Offset. # noqa: E501 + + A boolean indicating if this offset is a production or test mode offset. # noqa: E501 + + :return: The production of this Offset. # noqa: E501 + :rtype: bool + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this Offset. + + A boolean indicating if this offset is a production or test mode offset. # noqa: E501 + + :param production: The production of this Offset. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + + self._production = production + + @property + def retired(self): + """Gets the retired of this Offset. # noqa: E501 + + + :return: The retired of this Offset. # noqa: E501 + :rtype: bool + """ + return self._retired + + @retired.setter + def retired(self, retired): + """Sets the retired of this Offset. + + + :param retired: The retired of this Offset. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and retired is None: # noqa: E501 + raise ValueError("Invalid value for `retired`, must not be `None`") # noqa: E501 + + self._retired = retired + + @property + def serial_number(self): + """Gets the serial_number of this Offset. # noqa: E501 + + The serial number for this offset. # noqa: E501 + + :return: The serial_number of this Offset. # noqa: E501 + :rtype: str + """ + return self._serial_number + + @serial_number.setter + def serial_number(self, serial_number): + """Sets the serial_number of this Offset. + + The serial number for this offset. # noqa: E501 + + :param serial_number: The serial_number of this Offset. # noqa: E501 + :type: str + """ + + self._serial_number = serial_number + + @property + def vintage_year(self): + """Gets the vintage_year of this Offset. # noqa: E501 + + + :return: The vintage_year of this Offset. # noqa: E501 + :rtype: int + """ + return self._vintage_year + + @vintage_year.setter + def vintage_year(self, vintage_year): + """Sets the vintage_year of this Offset. + + + :param vintage_year: The vintage_year of this Offset. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and vintage_year is None: # noqa: E501 + raise ValueError("Invalid value for `vintage_year`, must not be `None`") # noqa: E501 + + self._vintage_year = vintage_year + + @property + def project_id(self): + """Gets the project_id of this Offset. # noqa: E501 + + + :return: The project_id of this Offset. # noqa: E501 + :rtype: str + """ + return self._project_id + + @project_id.setter + def project_id(self, project_id): + """Sets the project_id of this Offset. + + + :param project_id: The project_id of this Offset. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 + raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + + self._project_id = project_id + + 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, Offset): + 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, Offset): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/offset_list_response.py b/patch_api/models/offset_list_response.py new file mode 100644 index 0000000..2b52d96 --- /dev/null +++ b/patch_api/models/offset_list_response.py @@ -0,0 +1,201 @@ +# 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 OffsetListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Offset]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """OffsetListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this OffsetListResponse. # noqa: E501 + + + :return: The success of this OffsetListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this OffsetListResponse. + + + :param success: The success of this OffsetListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this OffsetListResponse. # noqa: E501 + + + :return: The error of this OffsetListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this OffsetListResponse. + + + :param error: The error of this OffsetListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this OffsetListResponse. # noqa: E501 + + + :return: The data of this OffsetListResponse. # noqa: E501 + :rtype: list[Offset] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OffsetListResponse. + + + :param data: The data of this OffsetListResponse. # noqa: E501 + :type: list[Offset] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this OffsetListResponse. # noqa: E501 + + + :return: The meta of this OffsetListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this OffsetListResponse. + + + :param meta: The meta of this OffsetListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, OffsetListResponse): + 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, OffsetListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/offset_response.py b/patch_api/models/offset_response.py new file mode 100644 index 0000000..553dd6b --- /dev/null +++ b/patch_api/models/offset_response.py @@ -0,0 +1,174 @@ +# 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 OffsetResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'Offset' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """OffsetResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this OffsetResponse. # noqa: E501 + + + :return: The success of this OffsetResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this OffsetResponse. + + + :param success: The success of this OffsetResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this OffsetResponse. # noqa: E501 + + + :return: The error of this OffsetResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this OffsetResponse. + + + :param error: The error of this OffsetResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this OffsetResponse. # noqa: E501 + + + :return: The data of this OffsetResponse. # noqa: E501 + :rtype: Offset + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OffsetResponse. + + + :param data: The data of this OffsetResponse. # noqa: E501 + :type: Offset + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, OffsetResponse): + 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, OffsetResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/order.py b/patch_api/models/order.py new file mode 100644 index 0000000..32d052f --- /dev/null +++ b/patch_api/models/order.py @@ -0,0 +1,370 @@ +# 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 Order(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 = { + 'id': 'str', + 'mass_g': 'int', + 'production': 'bool', + 'state': 'str', + 'allocation_state': 'str', + 'price_cents_usd': 'str', + 'patch_fee_cents_usd': 'str', + 'allocations': 'list[Allocation]', + 'metadata': 'object' + } + + attribute_map = { + 'id': 'id', + 'mass_g': 'mass_g', + 'production': 'production', + 'state': 'state', + 'allocation_state': 'allocation_state', + 'price_cents_usd': 'price_cents_usd', + 'patch_fee_cents_usd': 'patch_fee_cents_usd', + 'allocations': 'allocations', + 'metadata': 'metadata' + } + + def __init__(self, id=None, mass_g=None, production=None, state=None, allocation_state=None, price_cents_usd=None, patch_fee_cents_usd=None, allocations=None, metadata=None, local_vars_configuration=None): # noqa: E501 + """Order - 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._id = None + self._mass_g = None + self._production = None + self._state = None + self._allocation_state = None + self._price_cents_usd = None + self._patch_fee_cents_usd = None + self._allocations = None + self._metadata = None + self.discriminator = None + + self.id = id + self.mass_g = mass_g + self.production = production + self.state = state + self.allocation_state = allocation_state + self.price_cents_usd = price_cents_usd + self.patch_fee_cents_usd = patch_fee_cents_usd + self.allocations = allocations + self.metadata = metadata + + @property + def id(self): + """Gets the id of this Order. # noqa: E501 + + A unique uid for the record. UIDs will be prepended by ord_prod or ord_test depending on the mode it was created in. # noqa: E501 + + :return: The id of this Order. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Order. + + A unique uid for the record. UIDs will be prepended by ord_prod or ord_test depending on the mode it was created in. # noqa: E501 + + :param id: The id of this Order. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def mass_g(self): + """Gets the mass_g of this Order. # noqa: E501 + + The amount of carbon offsets in grams purchased through this order. # noqa: E501 + + :return: The mass_g of this Order. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this Order. + + The amount of carbon offsets in grams purchased through this order. # noqa: E501 + + :param mass_g: The mass_g of this Order. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 2000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 1): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + + self._mass_g = mass_g + + @property + def production(self): + """Gets the production of this Order. # noqa: E501 + + A boolean indicating if this order is a production or test mode order. # noqa: E501 + + :return: The production of this Order. # noqa: E501 + :rtype: bool + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this Order. + + A boolean indicating if this order is a production or test mode order. # noqa: E501 + + :param production: The production of this Order. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + + self._production = production + + @property + def state(self): + """Gets the state of this Order. # noqa: E501 + + The current state of the order. # noqa: E501 + + :return: The state of this Order. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Order. + + The current state of the order. # noqa: E501 + + :param state: The state of this Order. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and state is None: # noqa: E501 + raise ValueError("Invalid value for `state`, must not be `None`") # noqa: E501 + allowed_values = ["draft", "placed", "complete", "cancelled"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and state not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + @property + def allocation_state(self): + """Gets the allocation_state of this Order. # noqa: E501 + + The current state of the allocated carbon offsets of the order. # noqa: E501 + + :return: The allocation_state of this Order. # noqa: E501 + :rtype: str + """ + return self._allocation_state + + @allocation_state.setter + def allocation_state(self, allocation_state): + """Sets the allocation_state of this Order. + + The current state of the allocated carbon offsets of the order. # noqa: E501 + + :param allocation_state: The allocation_state of this Order. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and allocation_state is None: # noqa: E501 + raise ValueError("Invalid value for `allocation_state`, must not be `None`") # noqa: E501 + allowed_values = ["pending", "partially_allocated", "allocated"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and allocation_state not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `allocation_state` ({0}), must be one of {1}" # noqa: E501 + .format(allocation_state, allowed_values) + ) + + self._allocation_state = allocation_state + + @property + def price_cents_usd(self): + """Gets the price_cents_usd of this Order. # noqa: E501 + + The total price in cents USD of the carbon offsets purchased through this order. # noqa: E501 + + :return: The price_cents_usd of this Order. # noqa: E501 + :rtype: str + """ + return self._price_cents_usd + + @price_cents_usd.setter + def price_cents_usd(self, price_cents_usd): + """Sets the price_cents_usd of this Order. + + The total price in cents USD of the carbon offsets purchased through this order. # noqa: E501 + + :param price_cents_usd: The price_cents_usd of this Order. # noqa: E501 + :type: str + """ + + self._price_cents_usd = price_cents_usd + + @property + def patch_fee_cents_usd(self): + """Gets the patch_fee_cents_usd of this Order. # noqa: E501 + + The Patch Fee in cents USD for this order. # noqa: E501 + + :return: The patch_fee_cents_usd of this Order. # noqa: E501 + :rtype: str + """ + return self._patch_fee_cents_usd + + @patch_fee_cents_usd.setter + def patch_fee_cents_usd(self, patch_fee_cents_usd): + """Sets the patch_fee_cents_usd of this Order. + + The Patch Fee in cents USD for this order. # noqa: E501 + + :param patch_fee_cents_usd: The patch_fee_cents_usd of this Order. # noqa: E501 + :type: str + """ + + self._patch_fee_cents_usd = patch_fee_cents_usd + + @property + def allocations(self): + """Gets the allocations of this Order. # noqa: E501 + + An array containing the inventory allocations for this order. # noqa: E501 + + :return: The allocations of this Order. # noqa: E501 + :rtype: list[Allocation] + """ + return self._allocations + + @allocations.setter + def allocations(self, allocations): + """Sets the allocations of this Order. + + 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 + + @property + def metadata(self): + """Gets the metadata of this Order. # noqa: E501 + + An optional JSON object containing metadata for this order. # noqa: E501 + + :return: The metadata of this Order. # noqa: E501 + :rtype: object + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this Order. + + An optional JSON object containing metadata for this order. # noqa: E501 + + :param metadata: The metadata of this Order. # noqa: E501 + :type: object + """ + if self.local_vars_configuration.client_side_validation and metadata is None: # noqa: E501 + raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + + self._metadata = metadata + + 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, Order): + 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, Order): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/order_list_response.py b/patch_api/models/order_list_response.py new file mode 100644 index 0000000..d9c6b4c --- /dev/null +++ b/patch_api/models/order_list_response.py @@ -0,0 +1,201 @@ +# 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 OrderListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Order]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """OrderListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this OrderListResponse. # noqa: E501 + + + :return: The success of this OrderListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this OrderListResponse. + + + :param success: The success of this OrderListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this OrderListResponse. # noqa: E501 + + + :return: The error of this OrderListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this OrderListResponse. + + + :param error: The error of this OrderListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this OrderListResponse. # noqa: E501 + + + :return: The data of this OrderListResponse. # noqa: E501 + :rtype: list[Order] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OrderListResponse. + + + :param data: The data of this OrderListResponse. # noqa: E501 + :type: list[Order] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this OrderListResponse. # noqa: E501 + + + :return: The meta of this OrderListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this OrderListResponse. + + + :param meta: The meta of this OrderListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, OrderListResponse): + 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, OrderListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/order_response.py b/patch_api/models/order_response.py new file mode 100644 index 0000000..ffc9f94 --- /dev/null +++ b/patch_api/models/order_response.py @@ -0,0 +1,174 @@ +# 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 OrderResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'Order' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """OrderResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this OrderResponse. # noqa: E501 + + + :return: The success of this OrderResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this OrderResponse. + + + :param success: The success of this OrderResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this OrderResponse. # noqa: E501 + + + :return: The error of this OrderResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this OrderResponse. + + + :param error: The error of this OrderResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this OrderResponse. # noqa: E501 + + + :return: The data of this OrderResponse. # noqa: E501 + :rtype: Order + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OrderResponse. + + + :param data: The data of this OrderResponse. # noqa: E501 + :type: Order + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, OrderResponse): + 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, OrderResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/photo.py b/patch_api/models/photo.py new file mode 100644 index 0000000..7716e55 --- /dev/null +++ b/patch_api/models/photo.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 Photo(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 = { + 'url': 'str', + 'id': 'str' + } + + attribute_map = { + 'url': 'url', + 'id': 'id' + } + + def __init__(self, url=None, id=None, local_vars_configuration=None): # noqa: E501 + """Photo - 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._url = None + self._id = None + self.discriminator = None + + self.url = url + self.id = id + + @property + def url(self): + """Gets the url of this Photo. # noqa: E501 + + + :return: The url of this Photo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Photo. + + + :param url: The url of this Photo. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 + + self._url = url + + @property + def id(self): + """Gets the id of this Photo. # noqa: E501 + + + :return: The id of this Photo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Photo. + + + :param id: The id of this Photo. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + 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, Photo): + 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, Photo): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/photo_response.py b/patch_api/models/photo_response.py new file mode 100644 index 0000000..3f27026 --- /dev/null +++ b/patch_api/models/photo_response.py @@ -0,0 +1,174 @@ +# 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 PhotoResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'Photo' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """PhotoResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this PhotoResponse. # noqa: E501 + + + :return: The success of this PhotoResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this PhotoResponse. + + + :param success: The success of this PhotoResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this PhotoResponse. # noqa: E501 + + + :return: The error of this PhotoResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this PhotoResponse. + + + :param error: The error of this PhotoResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this PhotoResponse. # noqa: E501 + + + :return: The data of this PhotoResponse. # noqa: E501 + :rtype: Photo + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PhotoResponse. + + + :param data: The data of this PhotoResponse. # noqa: E501 + :type: Photo + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, PhotoResponse): + 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, PhotoResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/preference.py b/patch_api/models/preference.py new file mode 100644 index 0000000..ff30fc6 --- /dev/null +++ b/patch_api/models/preference.py @@ -0,0 +1,182 @@ +# 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 Preference(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 = { + 'id': 'str', + 'allocation_percentage': 'int', + 'project': 'Project' + } + + attribute_map = { + 'id': 'id', + 'allocation_percentage': 'allocation_percentage', + 'project': 'project' + } + + def __init__(self, id=None, allocation_percentage=None, project=None, local_vars_configuration=None): # noqa: E501 + """Preference - 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._id = None + self._allocation_percentage = None + self._project = None + self.discriminator = None + + self.id = id + self.allocation_percentage = allocation_percentage + self.project = project + + @property + def id(self): + """Gets the id of this Preference. # noqa: E501 + + A unique uid for the record. UIDs will be prepended by pre_prod or pre_test depending on the mode it was created in. # noqa: E501 + + :return: The id of this Preference. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Preference. + + A unique uid for the record. UIDs will be prepended by pre_prod or pre_test depending on the mode it was created in. # noqa: E501 + + :param id: The id of this Preference. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def allocation_percentage(self): + """Gets the allocation_percentage of this Preference. # noqa: E501 + + Percentage of total purchased offsets that should go to a project. Default is 100%. # noqa: E501 + + :return: The allocation_percentage of this Preference. # noqa: E501 + :rtype: int + """ + return self._allocation_percentage + + @allocation_percentage.setter + def allocation_percentage(self, allocation_percentage): + """Sets the allocation_percentage of this Preference. + + Percentage of total purchased offsets that should go to a project. Default is 100%. # noqa: E501 + + :param allocation_percentage: The allocation_percentage of this Preference. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and allocation_percentage is None: # noqa: E501 + raise ValueError("Invalid value for `allocation_percentage`, must not be `None`") # noqa: E501 + + self._allocation_percentage = allocation_percentage + + @property + def project(self): + """Gets the project of this Preference. # noqa: E501 + + An object returning the Project record this Preference is associated with. See the [Project section](/?id=projects) for the full schema. # noqa: E501 + + :return: The project of this Preference. # noqa: E501 + :rtype: Project + """ + return self._project + + @project.setter + def project(self, project): + """Sets the project of this Preference. + + An object returning the Project record this Preference is associated with. See the [Project section](/?id=projects) for the full schema. # noqa: E501 + + :param project: The project of this Preference. # noqa: E501 + :type: Project + """ + if self.local_vars_configuration.client_side_validation and project is None: # noqa: E501 + raise ValueError("Invalid value for `project`, must not be `None`") # noqa: E501 + + self._project = project + + 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, Preference): + 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, Preference): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/preference_list_response.py b/patch_api/models/preference_list_response.py new file mode 100644 index 0000000..7ed2d12 --- /dev/null +++ b/patch_api/models/preference_list_response.py @@ -0,0 +1,201 @@ +# 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 PreferenceListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Preference]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """PreferenceListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this PreferenceListResponse. # noqa: E501 + + + :return: The success of this PreferenceListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this PreferenceListResponse. + + + :param success: The success of this PreferenceListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this PreferenceListResponse. # noqa: E501 + + + :return: The error of this PreferenceListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this PreferenceListResponse. + + + :param error: The error of this PreferenceListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this PreferenceListResponse. # noqa: E501 + + + :return: The data of this PreferenceListResponse. # noqa: E501 + :rtype: list[Preference] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PreferenceListResponse. + + + :param data: The data of this PreferenceListResponse. # noqa: E501 + :type: list[Preference] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this PreferenceListResponse. # noqa: E501 + + + :return: The meta of this PreferenceListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this PreferenceListResponse. + + + :param meta: The meta of this PreferenceListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, PreferenceListResponse): + 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, PreferenceListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/preference_response.py b/patch_api/models/preference_response.py new file mode 100644 index 0000000..4fa0965 --- /dev/null +++ b/patch_api/models/preference_response.py @@ -0,0 +1,174 @@ +# 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 PreferenceResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'Preference' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """PreferenceResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this PreferenceResponse. # noqa: E501 + + + :return: The success of this PreferenceResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this PreferenceResponse. + + + :param success: The success of this PreferenceResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this PreferenceResponse. # noqa: E501 + + + :return: The error of this PreferenceResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this PreferenceResponse. + + + :param error: The error of this PreferenceResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this PreferenceResponse. # noqa: E501 + + + :return: The data of this PreferenceResponse. # noqa: E501 + :rtype: Preference + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PreferenceResponse. + + + :param data: The data of this PreferenceResponse. # noqa: E501 + :type: Preference + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, PreferenceResponse): + 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, PreferenceResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project.py b/patch_api/models/project.py new file mode 100644 index 0000000..452969c --- /dev/null +++ b/patch_api/models/project.py @@ -0,0 +1,415 @@ +# 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 Project(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 = { + 'id': 'str', + 'production': 'bool', + 'name': 'str', + 'description': 'str', + 'type': 'str', + 'country': 'str', + 'developer': 'str', + 'photos': 'list[Photo]', + 'average_price_per_tonne_cents_usd': 'int', + 'remaining_mass_g': 'int', + 'standard': 'Standard' + } + + attribute_map = { + 'id': 'id', + 'production': 'production', + 'name': 'name', + 'description': 'description', + 'type': 'type', + 'country': 'country', + 'developer': 'developer', + 'photos': 'photos', + 'average_price_per_tonne_cents_usd': 'average_price_per_tonne_cents_usd', + 'remaining_mass_g': 'remaining_mass_g', + 'standard': 'standard' + } + + def __init__(self, id=None, production=None, name=None, description=None, type=None, country=None, developer=None, photos=None, average_price_per_tonne_cents_usd=None, remaining_mass_g=None, standard=None, local_vars_configuration=None): # noqa: E501 + """Project - 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._id = None + self._production = None + self._name = None + self._description = None + self._type = None + self._country = None + self._developer = None + self._photos = None + self._average_price_per_tonne_cents_usd = None + self._remaining_mass_g = None + self._standard = None + self.discriminator = None + + self.id = id + self.production = production + self.name = name + self.description = description + if type is not None: + self.type = type + self.country = country + 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 + + @property + def id(self): + """Gets the id of this Project. # noqa: E501 + + A unique uid for the record. UIDs will be prepended by pro_prod or pro_test depending on the mode it was created in. # noqa: E501 + + :return: The id of this Project. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Project. + + A unique uid for the record. UIDs will be prepended by pro_prod or pro_test depending on the mode it was created in. # noqa: E501 + + :param id: The id of this Project. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def production(self): + """Gets the production of this Project. # noqa: E501 + + A boolean indicating if this project is a production or test mode project. # noqa: E501 + + :return: The production of this Project. # noqa: E501 + :rtype: bool + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this Project. + + A boolean indicating if this project is a production or test mode project. # noqa: E501 + + :param production: The production of this Project. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 + raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + + self._production = production + + @property + def name(self): + """Gets the name of this Project. # noqa: E501 + + The name of the project. # noqa: E501 + + :return: The name of this Project. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Project. + + The name of the project. # noqa: E501 + + :param name: The name of this Project. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def description(self): + """Gets the description of this Project. # noqa: E501 + + The description of the project. # noqa: E501 + + :return: The description of this Project. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Project. + + The description of the project. # noqa: E501 + + :param description: The description of this Project. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + + self._description = description + + @property + def type(self): + """Gets the type of this Project. # noqa: E501 + + The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil. # noqa: E501 + + :return: The type of this Project. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Project. + + The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil. # noqa: E501 + + :param type: The type of this Project. # noqa: E501 + :type: str + """ + allowed_values = ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def country(self): + """Gets the country of this Project. # noqa: E501 + + The country of origin of the project. # noqa: E501 + + :return: The country of this Project. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Project. + + The country of origin of the project. # noqa: E501 + + :param country: The country of this Project. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and country is None: # noqa: E501 + raise ValueError("Invalid value for `country`, must not be `None`") # noqa: E501 + + self._country = country + + @property + def developer(self): + """Gets the developer of this Project. # noqa: E501 + + The name of the project developer. # noqa: E501 + + :return: The developer of this Project. # noqa: E501 + :rtype: str + """ + return self._developer + + @developer.setter + def developer(self, developer): + """Sets the developer of this Project. + + The name of the project developer. # noqa: E501 + + :param developer: The developer of this Project. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and developer is None: # noqa: E501 + raise ValueError("Invalid value for `developer`, must not be `None`") # noqa: E501 + + self._developer = developer + + @property + def photos(self): + """Gets the photos of this Project. # noqa: E501 + + An array of URLs for photos of the project. # noqa: E501 + + :return: The photos of this Project. # noqa: E501 + :rtype: list[Photo] + """ + return self._photos + + @photos.setter + def photos(self, photos): + """Sets the photos of this Project. + + An array of URLs for photos of the project. # noqa: E501 + + :param photos: The photos of this Project. # noqa: E501 + :type: list[Photo] + """ + + self._photos = photos + + @property + def average_price_per_tonne_cents_usd(self): + """Gets the average_price_per_tonne_cents_usd of this Project. # noqa: E501 + + The average price per tonne in USD cents for carbon offsets supplied by this project. # noqa: E501 + + :return: The average_price_per_tonne_cents_usd of this Project. # noqa: E501 + :rtype: int + """ + return self._average_price_per_tonne_cents_usd + + @average_price_per_tonne_cents_usd.setter + def average_price_per_tonne_cents_usd(self, average_price_per_tonne_cents_usd): + """Sets the average_price_per_tonne_cents_usd of this Project. + + The average price per tonne in USD cents for carbon offsets supplied by this project. # noqa: E501 + + :param average_price_per_tonne_cents_usd: The average_price_per_tonne_cents_usd of this Project. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and average_price_per_tonne_cents_usd is None: # noqa: E501 + raise ValueError("Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`") # noqa: E501 + + self._average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd + + @property + def remaining_mass_g(self): + """Gets the remaining_mass_g of this Project. # noqa: E501 + + The remaining mass in grams available for purchase for this project. # noqa: E501 + + :return: The remaining_mass_g of this Project. # noqa: E501 + :rtype: int + """ + return self._remaining_mass_g + + @remaining_mass_g.setter + def remaining_mass_g(self, remaining_mass_g): + """Sets the remaining_mass_g of this Project. + + The remaining mass in grams available for purchase for this project. # noqa: E501 + + :param remaining_mass_g: The remaining_mass_g of this Project. # noqa: E501 + :type: int + """ + if self.local_vars_configuration.client_side_validation and remaining_mass_g is None: # noqa: E501 + raise ValueError("Invalid value for `remaining_mass_g`, must not be `None`") # noqa: E501 + + self._remaining_mass_g = remaining_mass_g + + @property + def standard(self): + """Gets the standard of this Project. # noqa: E501 + + An object returning the Standard associated with this project. # noqa: E501 + + :return: The standard of this Project. # noqa: E501 + :rtype: Standard + """ + return self._standard + + @standard.setter + def standard(self, standard): + """Sets the standard of this Project. + + An object returning the Standard associated with this project. # noqa: E501 + + :param standard: The standard of this Project. # noqa: E501 + :type: Standard + """ + + self._standard = standard + + 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, Project): + 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, Project): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project_list_response.py b/patch_api/models/project_list_response.py new file mode 100644 index 0000000..7b627cd --- /dev/null +++ b/patch_api/models/project_list_response.py @@ -0,0 +1,201 @@ +# 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 ProjectListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Project]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """ProjectListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this ProjectListResponse. # noqa: E501 + + + :return: The success of this ProjectListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this ProjectListResponse. + + + :param success: The success of this ProjectListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this ProjectListResponse. # noqa: E501 + + + :return: The error of this ProjectListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this ProjectListResponse. + + + :param error: The error of this ProjectListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this ProjectListResponse. # noqa: E501 + + + :return: The data of this ProjectListResponse. # noqa: E501 + :rtype: list[Project] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this ProjectListResponse. + + + :param data: The data of this ProjectListResponse. # noqa: E501 + :type: list[Project] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this ProjectListResponse. # noqa: E501 + + + :return: The meta of this ProjectListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this ProjectListResponse. + + + :param meta: The meta of this ProjectListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, ProjectListResponse): + 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, ProjectListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project_response.py b/patch_api/models/project_response.py new file mode 100644 index 0000000..25a1b93 --- /dev/null +++ b/patch_api/models/project_response.py @@ -0,0 +1,174 @@ +# 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 ProjectResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'Project' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data' + } + + def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + """ProjectResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this ProjectResponse. # noqa: E501 + + + :return: The success of this ProjectResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this ProjectResponse. + + + :param success: The success of this ProjectResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this ProjectResponse. # noqa: E501 + + + :return: The error of this ProjectResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this ProjectResponse. + + + :param error: The error of this ProjectResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this ProjectResponse. # noqa: E501 + + + :return: The data of this ProjectResponse. # noqa: E501 + :rtype: Project + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this ProjectResponse. + + + :param data: The data of this ProjectResponse. # noqa: E501 + :type: Project + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + 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, ProjectResponse): + 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, ProjectResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project_type_list_response.py b/patch_api/models/project_type_list_response.py new file mode 100644 index 0000000..87d1ac2 --- /dev/null +++ b/patch_api/models/project_type_list_response.py @@ -0,0 +1,201 @@ +# 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 ProjectTypeListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[str]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """ProjectTypeListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this ProjectTypeListResponse. # noqa: E501 + + + :return: The success of this ProjectTypeListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this ProjectTypeListResponse. + + + :param success: The success of this ProjectTypeListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this ProjectTypeListResponse. # noqa: E501 + + + :return: The error of this ProjectTypeListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this ProjectTypeListResponse. + + + :param error: The error of this ProjectTypeListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this ProjectTypeListResponse. # noqa: E501 + + + :return: The data of this ProjectTypeListResponse. # noqa: E501 + :rtype: list[str] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this ProjectTypeListResponse. + + + :param data: The data of this ProjectTypeListResponse. # noqa: E501 + :type: list[str] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this ProjectTypeListResponse. # noqa: E501 + + + :return: The meta of this ProjectTypeListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this ProjectTypeListResponse. + + + :param meta: The meta of this ProjectTypeListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, ProjectTypeListResponse): + 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, ProjectTypeListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/standard.py b/patch_api/models/standard.py new file mode 100644 index 0000000..42c874d --- /dev/null +++ b/patch_api/models/standard.py @@ -0,0 +1,182 @@ +# 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 Standard(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 = { + 'type': 'str', + 'acronym': 'str', + 'description': 'str' + } + + attribute_map = { + 'type': 'type', + 'acronym': 'acronym', + 'description': 'description' + } + + def __init__(self, type=None, acronym=None, description=None, local_vars_configuration=None): # noqa: E501 + """Standard - 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._type = None + self._acronym = None + self._description = None + self.discriminator = None + + self.type = type + self.acronym = acronym + self.description = description + + @property + def type(self): + """Gets the type of this Standard. # noqa: E501 + + The standard type. # noqa: E501 + + :return: The type of this Standard. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Standard. + + The standard type. # noqa: E501 + + :param type: The type of this Standard. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def acronym(self): + """Gets the acronym of this Standard. # noqa: E501 + + The acronym for the standard. # noqa: E501 + + :return: The acronym of this Standard. # noqa: E501 + :rtype: str + """ + return self._acronym + + @acronym.setter + def acronym(self, acronym): + """Sets the acronym of this Standard. + + The acronym for the standard. # noqa: E501 + + :param acronym: The acronym of this Standard. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and acronym is None: # noqa: E501 + raise ValueError("Invalid value for `acronym`, must not be `None`") # noqa: E501 + + self._acronym = acronym + + @property + def description(self): + """Gets the description of this Standard. # noqa: E501 + + The description of the standard. # noqa: E501 + + :return: The description of this Standard. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Standard. + + The description of the standard. # noqa: E501 + + :param description: The description of this Standard. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + + self._description = description + + 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, Standard): + 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, Standard): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/standard_list_response.py b/patch_api/models/standard_list_response.py new file mode 100644 index 0000000..8102ccf --- /dev/null +++ b/patch_api/models/standard_list_response.py @@ -0,0 +1,201 @@ +# 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 StandardListResponse(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 = { + 'success': 'bool', + 'error': 'object', + 'data': 'list[Standard]', + 'meta': 'MetaIndexObject' + } + + attribute_map = { + 'success': 'success', + 'error': 'error', + 'data': 'data', + 'meta': 'meta' + } + + def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + """StandardListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this StandardListResponse. # noqa: E501 + + + :return: The success of this StandardListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this StandardListResponse. + + + :param success: The success of this StandardListResponse. # noqa: E501 + :type: bool + """ + if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 + raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this StandardListResponse. # noqa: E501 + + + :return: The error of this StandardListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this StandardListResponse. + + + :param error: The error of this StandardListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this StandardListResponse. # noqa: E501 + + + :return: The data of this StandardListResponse. # noqa: E501 + :rtype: list[Standard] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this StandardListResponse. + + + :param data: The data of this StandardListResponse. # noqa: E501 + :type: list[Standard] + """ + if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 + raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this StandardListResponse. # noqa: E501 + + + :return: The meta of this StandardListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this StandardListResponse. + + + :param meta: The meta of this StandardListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 + raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + + self._meta = meta + + 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, StandardListResponse): + 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, StandardListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/update_offset_request.py b/patch_api/models/update_offset_request.py new file mode 100644 index 0000000..53a75a5 --- /dev/null +++ b/patch_api/models/update_offset_request.py @@ -0,0 +1,207 @@ +# 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 UpdateOffsetRequest(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 = { + 'mass_g': 'int', + 'price_cents_usd': 'int', + 'vintage_year': 'int', + 'serial_number': 'str' + } + + attribute_map = { + 'mass_g': 'mass_g', + 'price_cents_usd': 'price_cents_usd', + 'vintage_year': 'vintage_year', + 'serial_number': 'serial_number' + } + + def __init__(self, mass_g=None, price_cents_usd=None, vintage_year=None, serial_number=None, local_vars_configuration=None): # noqa: E501 + """UpdateOffsetRequest - 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._mass_g = None + self._price_cents_usd = None + self._vintage_year = None + self._serial_number = None + self.discriminator = None + + if mass_g is not None: + self.mass_g = mass_g + if price_cents_usd is not None: + self.price_cents_usd = price_cents_usd + if vintage_year is not None: + self.vintage_year = vintage_year + self.serial_number = serial_number + + @property + def mass_g(self): + """Gets the mass_g of this UpdateOffsetRequest. # noqa: E501 + + + :return: The mass_g of this UpdateOffsetRequest. # noqa: E501 + :rtype: int + """ + return self._mass_g + + @mass_g.setter + def mass_g(self, mass_g): + """Sets the mass_g of this UpdateOffsetRequest. + + + :param mass_g: The mass_g of this UpdateOffsetRequest. # noqa: E501 + :type: int + """ + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g > 1000000000): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 + if (self.local_vars_configuration.client_side_validation and + mass_g is not None and mass_g < 1): # noqa: E501 + raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + + self._mass_g = mass_g + + @property + def price_cents_usd(self): + """Gets the price_cents_usd of this UpdateOffsetRequest. # noqa: E501 + + + :return: The price_cents_usd of this UpdateOffsetRequest. # noqa: E501 + :rtype: int + """ + return self._price_cents_usd + + @price_cents_usd.setter + def price_cents_usd(self, price_cents_usd): + """Sets the price_cents_usd of this UpdateOffsetRequest. + + + :param price_cents_usd: The price_cents_usd of this UpdateOffsetRequest. # noqa: E501 + :type: int + """ + if (self.local_vars_configuration.client_side_validation and + price_cents_usd is not None and price_cents_usd < 1): # noqa: E501 + raise ValueError("Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + + self._price_cents_usd = price_cents_usd + + @property + def vintage_year(self): + """Gets the vintage_year of this UpdateOffsetRequest. # noqa: E501 + + + :return: The vintage_year of this UpdateOffsetRequest. # noqa: E501 + :rtype: int + """ + return self._vintage_year + + @vintage_year.setter + def vintage_year(self, vintage_year): + """Sets the vintage_year of this UpdateOffsetRequest. + + + :param vintage_year: The vintage_year of this UpdateOffsetRequest. # noqa: E501 + :type: int + """ + + self._vintage_year = vintage_year + + @property + def serial_number(self): + """Gets the serial_number of this UpdateOffsetRequest. # noqa: E501 + + + :return: The serial_number of this UpdateOffsetRequest. # noqa: E501 + :rtype: str + """ + return self._serial_number + + @serial_number.setter + def serial_number(self, serial_number): + """Sets the serial_number of this UpdateOffsetRequest. + + + :param serial_number: The serial_number of this UpdateOffsetRequest. # noqa: E501 + :type: str + """ + + self._serial_number = serial_number + + 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, UpdateOffsetRequest): + 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, UpdateOffsetRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/update_project_request.py b/patch_api/models/update_project_request.py new file mode 100644 index 0000000..da2a8a6 --- /dev/null +++ b/patch_api/models/update_project_request.py @@ -0,0 +1,398 @@ +# 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 UpdateProjectRequest(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 = { + 'name': 'str', + 'description': 'str', + 'country': 'str', + 'state': 'str', + 'verifier': 'str', + 'type': 'str', + 'standard_type': 'str', + 'longitude': 'str', + 'latitude': 'str', + 'production': 'str', + 'organization_id': 'str' + } + + attribute_map = { + 'name': 'name', + 'description': 'description', + 'country': 'country', + 'state': 'state', + 'verifier': 'verifier', + 'type': 'type', + 'standard_type': 'standard_type', + 'longitude': 'longitude', + 'latitude': 'latitude', + 'production': 'production', + 'organization_id': 'organization_id' + } + + def __init__(self, name=None, description=None, country=None, state=None, verifier=None, type=None, standard_type=None, longitude=None, latitude=None, production=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + """UpdateProjectRequest - 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._name = None + self._description = None + self._country = None + self._state = None + self._verifier = None + self._type = None + self._standard_type = None + self._longitude = None + self._latitude = None + self._production = None + self._organization_id = None + self.discriminator = None + + if name is not None: + self.name = name + if description is not None: + self.description = description + if country is not None: + self.country = country + if state is not None: + self.state = state + if verifier is not None: + self.verifier = verifier + if type is not None: + self.type = type + if standard_type is not None: + self.standard_type = standard_type + if longitude is not None: + self.longitude = longitude + if latitude is not None: + self.latitude = latitude + self.production = production + if organization_id is not None: + self.organization_id = organization_id + + @property + def name(self): + """Gets the name of this UpdateProjectRequest. # noqa: E501 + + + :return: The name of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this UpdateProjectRequest. + + + :param name: The name of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this UpdateProjectRequest. # noqa: E501 + + + :return: The description of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this UpdateProjectRequest. + + + :param description: The description of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def country(self): + """Gets the country of this UpdateProjectRequest. # noqa: E501 + + + :return: The country of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this UpdateProjectRequest. + + + :param country: The country of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + allowed_values = ["TJ", "JM", "HT", "ST", "MS", "AE", "PK", "NL", "LU", "BZ", "IR", "BO", "UY", "GH", "SA", "CI", "MF", "TF", "AI", "QA", "SX", "LY", "BV", "PG", "KG", "GQ", "EH", "NU", "PR", "GD", "KR", "HM", "SM", "SL", "CD", "MK", "TR", "DZ", "GE", "PS", "BB", "UA", "GP", "PF", "NA", "BW", "SY", "TG", "DO", "AQ", "CH", "MG", "FO", "VG", "GI", "BN", "LA", "IS", "EE", "UM", "LT", "RS", "MR", "AD", "HU", "TK", "MY", "AO", "CV", "NF", "PA", "GW", "BE", "PT", "GB", "IM", "US", "YE", "HK", "AZ", "CC", "ML", "SK", "VU", "TL", "HR", "SR", "MU", "CZ", "PM", "LS", "WS", "KM", "IT", "BI", "WF", "GN", "SG", "CO", "CN", "AW", "MA", "FI", "VA", "ZW", "KY", "BH", "PY", "EC", "LR", "RU", "PL", "OM", "MT", "SS", "DE", "TM", "SJ", "MM", "TT", "IL", "BD", "NR", "LK", "UG", "NG", "BQ", "MX", "CW", "SI", "MN", "CA", "AX", "VN", "TW", "JP", "IO", "RO", "BG", "GU", "BR", "AM", "ZM", "DJ", "JE", "AT", "CM", "SE", "FJ", "KZ", "GL", "GY", "CX", "MW", "TN", "ZA", "TO", "CY", "MV", "PN", "RW", "NI", "KN", "BJ", "ET", "GM", "TZ", "VC", "FK", "SD", "MC", "AU", "CL", "DK", "FR", "TC", "CU", "AL", "MZ", "BS", "NE", "GT", "LI", "NP", "BF", "PW", "KW", "IN", "GA", "TV", "MO", "SH", "MD", "CK", "AR", "SC", "IE", "ES", "LB", "BM", "RE", "KI", "AG", "MQ", "SV", "JO", "TH", "SO", "MH", "CG", "KP", "GF", "BA", "YT", "GS", "KE", "PE", "BT", "SZ", "CR", "TD", "DM", "NC", "GR", "GG", "HN", "VI", "CF", "SN", "AF", "MP", "PH", "BY", "LV", "NO", "EG", "KH", "IQ", "LC", "NZ", "BL", "UZ", "ID", "ER", "VE", "FM", "SB", "ME", "AS"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and country not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `country` ({0}), must be one of {1}" # noqa: E501 + .format(country, allowed_values) + ) + + self._country = country + + @property + def state(self): + """Gets the state of this UpdateProjectRequest. # noqa: E501 + + + :return: The state of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this UpdateProjectRequest. + + + :param state: The state of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def verifier(self): + """Gets the verifier of this UpdateProjectRequest. # noqa: E501 + + + :return: The verifier of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._verifier + + @verifier.setter + def verifier(self, verifier): + """Sets the verifier of this UpdateProjectRequest. + + + :param verifier: The verifier of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._verifier = verifier + + @property + def type(self): + """Gets the type of this UpdateProjectRequest. # noqa: E501 + + + :return: The type of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this UpdateProjectRequest. + + + :param type: The type of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + allowed_values = ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def standard_type(self): + """Gets the standard_type of this UpdateProjectRequest. # noqa: E501 + + + :return: The standard_type of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._standard_type + + @standard_type.setter + def standard_type(self, standard_type): + """Sets the standard_type of this UpdateProjectRequest. + + + :param standard_type: The standard_type of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + allowed_values = ["american_carbon_registry", "climate_action_reserve", "verified_carbon_standard", "european_biochar_certificate"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and standard_type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `standard_type` ({0}), must be one of {1}" # noqa: E501 + .format(standard_type, allowed_values) + ) + + self._standard_type = standard_type + + @property + def longitude(self): + """Gets the longitude of this UpdateProjectRequest. # noqa: E501 + + + :return: The longitude of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._longitude + + @longitude.setter + def longitude(self, longitude): + """Sets the longitude of this UpdateProjectRequest. + + + :param longitude: The longitude of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._longitude = longitude + + @property + def latitude(self): + """Gets the latitude of this UpdateProjectRequest. # noqa: E501 + + + :return: The latitude of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._latitude + + @latitude.setter + def latitude(self, latitude): + """Sets the latitude of this UpdateProjectRequest. + + + :param latitude: The latitude of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._latitude = latitude + + @property + def production(self): + """Gets the production of this UpdateProjectRequest. # noqa: E501 + + + :return: The production of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this UpdateProjectRequest. + + + :param production: The production of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._production = production + + @property + def organization_id(self): + """Gets the organization_id of this UpdateProjectRequest. # noqa: E501 + + + :return: The organization_id of this UpdateProjectRequest. # noqa: E501 + :rtype: str + """ + return self._organization_id + + @organization_id.setter + def organization_id(self, organization_id): + """Sets the organization_id of this UpdateProjectRequest. + + + :param organization_id: The organization_id of this UpdateProjectRequest. # noqa: E501 + :type: str + """ + + self._organization_id = organization_id + + 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, UpdateProjectRequest): + 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, UpdateProjectRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/rest.py b/patch_api/rest.py new file mode 100644 index 0000000..fd2b5e9 --- /dev/null +++ b/patch_api/rest.py @@ -0,0 +1,296 @@ +# 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 +""" + + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode +import urllib3 + +from patch_api.exceptions import ApiException, ApiValueError + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + self.configuration = configuration + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + if 'Authorization' not in headers: + headers['Authorization'] = 'Bearer ' + self.configuration.api_key + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if query_params: + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..eb358ef --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +certifi >= 14.05.14 +future; python_version<="2.7" +six >= 1.10 +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.15.1 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..11433ee --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0335c2e --- /dev/null +++ b/setup.py @@ -0,0 +1,41 @@ +# 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 +""" + + +from setuptools import setup, find_packages # noqa: H301 + +NAME = "patch_api" +VERSION = "1.0.0" +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] + +setup( + name=NAME, + version=VERSION, + description="Patch API V1", + author="Developer Support", + author_email="developers@usepatch.com", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", "Patch API V1"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + long_description="""\ + The core API used to integrate with Patch's service # noqa: E501 + """ +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..6e21bfd --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,4 @@ +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 +factory_boy>=2.12.0 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/factories.py b/test/factories.py new file mode 100644 index 0000000..323d20e --- /dev/null +++ b/test/factories.py @@ -0,0 +1,114 @@ +import factory +from patch_api.models.order import Order # noqa: E501 +from patch_api.models.offset import Offset # noqa: E501 +from patch_api.models.standard import Standard # noqa: E501 +from patch_api.models.estimate import Estimate # noqa: E501 +from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 +from patch_api.models.allocation import Allocation # noqa: E501 +from patch_api.models.project import Project # noqa: E501 +from patch_api.models.photo import Photo # noqa: E501 +from patch_api.models.preference import Preference # noqa: E501 +from patch_api.models.membership import Membership + +class OrderFactory(factory.Factory): + class Meta: + model = Order + + id = '0' + mass_g = 1 + production = True + state = 'draft' + allocation_state = 'pending' + price_cents_usd = '0' + patch_fee_cents_usd = '0' + allocations = [] + metadata = {} + +class StandardFactory(factory.Factory): + class Meta: + model = Standard + + type = '0' + acronym = '0' + description = '0' + +class MetaIndexObjectFactory(factory.Factory): + class Meta: + model = MetaIndexObject + + prev_page = 56 + next_page = 56 + +class AllocationFactory(factory.Factory): + class Meta: + model = Allocation + + id = '0' + production = True + mass_g = 56 + +class EstimateFactory(factory.Factory): + class Meta: + model = Estimate + + id = '0', + production = True, + type = '0', + order = OrderFactory() + +class PhotoFactory(factory.Factory): + class Meta: + model = Photo + + id = '0' + url = 'https://photo.com' + +class ProjectFactory(factory.Factory): + class Meta: + model = Project + + id = '0' + production = True + name = '0' + description = '0' + type = 'biomass' + country = '0' + developer = '0' + photos = [ + PhotoFactory() + ], + average_price_per_tonne_cents_usd = 56 + remaining_mass_g = 56 + standard = StandardFactory() + +class PreferenceFactory(factory.Factory): + class Meta: + model = Preference + + id = '0' + allocation_percentage = 56 + project = ProjectFactory() + +class OffsetFactory(factory.Factory): + class Meta: + model = Offset + + id = '0' + allocated_mass_g = 0 + fulfilled_at = '0' + fulfillment_state = 'pending' + mass_g = 1 + price_cents_usd = '0' + production = True + retired = True + serial_number = '0' + vintage_year = 56 + project_id = '0' + +class MembershipFactory(factory.Factory): + class Meta: + model = Membership + + email = '0' + role = 'admin' + organization_id = '0' diff --git a/test/test_allocation.py b/test/test_allocation.py new file mode 100644 index 0000000..ef63471 --- /dev/null +++ b/test/test_allocation.py @@ -0,0 +1,54 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.allocation import Allocation # noqa: E501 +from factories import AllocationFactory +from patch_api.rest import ApiException + +class TestAllocation(unittest.TestCase): + """Allocation unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Allocation + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.allocation.Allocation() # noqa: E501 + if include_optional : + return AllocationFactory() + else : + return AllocationFactory() + + def testAllocation(self): + """Test Allocation""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_mass_estimate_request.py b/test/test_create_mass_estimate_request.py new file mode 100644 index 0000000..c810ecf --- /dev/null +++ b/test/test_create_mass_estimate_request.py @@ -0,0 +1,58 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreateMassEstimateRequest(unittest.TestCase): + """CreateMassEstimateRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreateMassEstimateRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_mass_estimate_request.CreateMassEstimateRequest() # noqa: E501 + if include_optional : + return CreateMassEstimateRequest( + mass_g = 1, + project_id = '0' + ) + else : + return CreateMassEstimateRequest( + mass_g = 1, + ) + + def testCreateMassEstimateRequest(self): + """Test CreateMassEstimateRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_membership_request.py b/test/test_create_membership_request.py new file mode 100644 index 0000000..1524ed0 --- /dev/null +++ b/test/test_create_membership_request.py @@ -0,0 +1,58 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_membership_request import CreateMembershipRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreateMembershipRequest(unittest.TestCase): + """CreateMembershipRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreateMembershipRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_membership_request.CreateMembershipRequest() # noqa: E501 + if include_optional : + return CreateMembershipRequest( + email = '0', + role = 'admin', + organization_id = '0' + ) + else : + return CreateMembershipRequest( + ) + + def testCreateMembershipRequest(self): + """Test CreateMembershipRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_offset_request.py b/test/test_create_offset_request.py new file mode 100644 index 0000000..e2107b9 --- /dev/null +++ b/test/test_create_offset_request.py @@ -0,0 +1,60 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_offset_request import CreateOffsetRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreateOffsetRequest(unittest.TestCase): + """CreateOffsetRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreateOffsetRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_offset_request.CreateOffsetRequest() # noqa: E501 + if include_optional : + return CreateOffsetRequest( + mass_g = 1, + price_cents_usd = 1, + project_id = '0', + vintage_year = 56, + serial_number = '0' + ) + else : + return CreateOffsetRequest( + ) + + def testCreateOffsetRequest(self): + """Test CreateOffsetRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_order_request.py b/test/test_create_order_request.py new file mode 100644 index 0000000..621b1a9 --- /dev/null +++ b/test/test_create_order_request.py @@ -0,0 +1,59 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_order_request import CreateOrderRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreateOrderRequest(unittest.TestCase): + """CreateOrderRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreateOrderRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_order_request.CreateOrderRequest() # noqa: E501 + if include_optional : + return CreateOrderRequest( + mass_g = 1, + total_price_cents_usd = 1, + project_id = '0', + metadata = None + ) + else : + return CreateOrderRequest( + ) + + def testCreateOrderRequest(self): + """Test CreateOrderRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_organization_request.py b/test/test_create_organization_request.py new file mode 100644 index 0000000..29dada3 --- /dev/null +++ b/test/test_create_organization_request.py @@ -0,0 +1,59 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_organization_request import CreateOrganizationRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreateOrganizationRequest(unittest.TestCase): + """CreateOrganizationRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreateOrganizationRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_organization_request.CreateOrganizationRequest() # noqa: E501 + if include_optional : + return CreateOrganizationRequest( + name = '0', + type = 'consumer' + ) + else : + return CreateOrganizationRequest( + name = '0', + type = 'consumer', + ) + + def testCreateOrganizationRequest(self): + """Test CreateOrganizationRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_photo_request.py b/test/test_create_photo_request.py new file mode 100644 index 0000000..9f7d40a --- /dev/null +++ b/test/test_create_photo_request.py @@ -0,0 +1,60 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_photo_request import CreatePhotoRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreatePhotoRequest(unittest.TestCase): + """CreatePhotoRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreatePhotoRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_photo_request.CreatePhotoRequest() # noqa: E501 + if include_optional : + return CreatePhotoRequest( + project_id = '0', + url = '0', + sort_order = 56 + ) + else : + return CreatePhotoRequest( + project_id = '0', + url = '0', + ) + + def testCreatePhotoRequest(self): + """Test CreatePhotoRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_preference_request.py b/test/test_create_preference_request.py new file mode 100644 index 0000000..a52097d --- /dev/null +++ b/test/test_create_preference_request.py @@ -0,0 +1,57 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_preference_request import CreatePreferenceRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreatePreferenceRequest(unittest.TestCase): + """CreatePreferenceRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreatePreferenceRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_preference_request.CreatePreferenceRequest() # noqa: E501 + if include_optional : + return CreatePreferenceRequest( + project_id = '0' + ) + else : + return CreatePreferenceRequest( + project_id = '0', + ) + + def testCreatePreferenceRequest(self): + """Test CreatePreferenceRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_create_project_request.py b/test/test_create_project_request.py new file mode 100644 index 0000000..5450e66 --- /dev/null +++ b/test/test_create_project_request.py @@ -0,0 +1,65 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.create_project_request import CreateProjectRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestCreateProjectRequest(unittest.TestCase): + """CreateProjectRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test CreateProjectRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.create_project_request.CreateProjectRequest() # noqa: E501 + if include_optional : + return CreateProjectRequest( + name = '0', + description = '0', + country = 'TJ', + state = '0', + verifier = '0', + type = 'biomass', + standard_type = 'american_carbon_registry', + longitude = '0', + latitude = '0', + production = '0', + organization_id = '0' + ) + else : + return CreateProjectRequest( + ) + + def testCreateProjectRequest(self): + """Test CreateProjectRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_error_response.py b/test/test_error_response.py new file mode 100644 index 0000000..e4826c6 --- /dev/null +++ b/test/test_error_response.py @@ -0,0 +1,60 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.error_response import ErrorResponse # noqa: E501 +from patch_api.rest import ApiException + +class TestErrorResponse(unittest.TestCase): + """ErrorResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test ErrorResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.error_response.ErrorResponse() # noqa: E501 + if include_optional : + return ErrorResponse( + success = True, + error = {}, + data = None + ) + else : + return ErrorResponse( + success = True, + error = {}, + data = None, + ) + + def testErrorResponse(self): + """Test ErrorResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_estimate.py b/test/test_estimate.py new file mode 100644 index 0000000..ab71239 --- /dev/null +++ b/test/test_estimate.py @@ -0,0 +1,57 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.estimate import Estimate # noqa: E501 +from factories import EstimateFactory, OrderFactory +from patch_api.rest import ApiException + +class TestEstimate(unittest.TestCase): + """Estimate unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Estimate + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.estimate.Estimate() # noqa: E501 + if include_optional : + return EstimateFactory( + order = OrderFactory() + ) + else : + return EstimateFactory( + order = None + ) + + def testEstimate(self): + """Test Estimate""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_estimate_list_response.py b/test/test_estimate_list_response.py new file mode 100644 index 0000000..033cce3 --- /dev/null +++ b/test/test_estimate_list_response.py @@ -0,0 +1,67 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.estimate_list_response import EstimateListResponse # noqa: E501 +from factories import EstimateFactory, MetaIndexObjectFactory +from patch_api.rest import ApiException + +class TestEstimateListResponse(unittest.TestCase): + """EstimateListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test EstimateListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.estimate_list_response.EstimateListResponse() # noqa: E501 + if include_optional : + return EstimateListResponse( + success = True, + error = None, + data = [ + EstimateFactory() + ], + meta = MetaIndexObjectFactory() + ) + else : + return EstimateListResponse( + success = True, + error = None, + data = [ + EstimateFactory() + ], + meta = MetaIndexObjectFactory(), + ) + + def testEstimateListResponse(self): + """Test EstimateListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_estimate_response.py b/test/test_estimate_response.py new file mode 100644 index 0000000..393afaf --- /dev/null +++ b/test/test_estimate_response.py @@ -0,0 +1,61 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.estimate_response import EstimateResponse # noqa: E501 +from factories import EstimateFactory +from patch_api.rest import ApiException + +class TestEstimateResponse(unittest.TestCase): + """EstimateResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test EstimateResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.estimate_response.EstimateResponse() # noqa: E501 + if include_optional : + return EstimateResponse( + success = True, + error = None, + data = EstimateFactory() + ) + else : + return EstimateResponse( + success = True, + error = None, + data = EstimateFactory(), + ) + + def testEstimateResponse(self): + """Test EstimateResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py new file mode 100644 index 0000000..dbb04e6 --- /dev/null +++ b/test/test_estimates_api.py @@ -0,0 +1,55 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import os + +import patch_api +from patch_api.api.estimates_api import EstimatesApi # noqa: E501 +from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest +from patch_api.rest import ApiException + + +class TestEstimatesApi(unittest.TestCase): + """EstimatesApi unit test stubs""" + + def setUp(self): + configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + api_client = patch_api.ApiClient(configuration) + self.api = EstimatesApi(api_client=api_client) # noqa: E501 + + def tearDown(self): + pass + + def test_create_and_retrieve_mass_estimate(self): + """Test case for create_mass_estimate + + Create an estimate based on mass of CO2 # noqa: E501 + """ + mass_g = 100 + project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" + mass_estimate_request = CreateMassEstimateRequest(mass_g=mass_g,project_id=project_id) + estimate = self.api.create_mass_estimate(mass_estimate_request) + + self.assertTrue(estimate) + self.assertEqual(estimate.data.order.mass_g, mass_g) + + retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id) + self.assertTrue(retrieved_estimate) + self.assertEqual(estimate.data.id, estimate.data.id) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_fulfill_offset_request.py b/test/test_fulfill_offset_request.py new file mode 100644 index 0000000..9b0ad8c --- /dev/null +++ b/test/test_fulfill_offset_request.py @@ -0,0 +1,57 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest + +import datetime + +import patch_api +from patch_api.models.fulfill_offset_request import FulfillOffsetRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestFulfillOffsetRequest(unittest.TestCase): + """FulfillOffsetRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test FulfillOffsetRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.fulfill_offset_request.FulfillOffsetRequest() # noqa: E501 + if include_optional : + return FulfillOffsetRequest( + serial_number = '0' + ) + else : + return FulfillOffsetRequest( + ) + + def testFulfillOffsetRequest(self): + """Test FulfillOffsetRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_membership.py b/test/test_membership.py new file mode 100644 index 0000000..c70d4a1 --- /dev/null +++ b/test/test_membership.py @@ -0,0 +1,61 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.membership import Membership # noqa: E501 +from patch_api.rest import ApiException + +class TestMembership(unittest.TestCase): + """Membership unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Membership + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.membership.Membership() # noqa: E501 + if include_optional : + return Membership( + email = '0', + role = 'admin', + organization_id = '0' + ) + else : + return Membership( + email = '0', + role = 'admin', + organization_id = '0', + ) + + def testMembership(self): + """Test Membership""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_membership_response.py b/test/test_membership_response.py new file mode 100644 index 0000000..527331e --- /dev/null +++ b/test/test_membership_response.py @@ -0,0 +1,66 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.membership_response import MembershipResponse # noqa: E501 +from factories import MembershipFactory +from patch_api.rest import ApiException + +class TestMembershipResponse(unittest.TestCase): + """MembershipResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test MembershipResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.membership_response.MembershipResponse() # noqa: E501 + if include_optional : + return MembershipResponse( + success = True, + error = None, + data = [ + MembershipFactory() + ] + ) + else : + return MembershipResponse( + success = True, + error = None, + data = [ + MembershipFactory() + ], + ) + + def testMembershipResponse(self): + """Test MembershipResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_meta_index_object.py b/test/test_meta_index_object.py new file mode 100644 index 0000000..3f96f20 --- /dev/null +++ b/test/test_meta_index_object.py @@ -0,0 +1,57 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 +from patch_api.rest import ApiException + +class TestMetaIndexObject(unittest.TestCase): + """MetaIndexObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test MetaIndexObject + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.meta_index_object.MetaIndexObject() # noqa: E501 + if include_optional : + return MetaIndexObject( + prev_page = 56, + next_page = 56 + ) + else : + return MetaIndexObject( + ) + + def testMetaIndexObject(self): + """Test MetaIndexObject""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_offset.py b/test/test_offset.py new file mode 100644 index 0000000..b6a2cca --- /dev/null +++ b/test/test_offset.py @@ -0,0 +1,76 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.offset import Offset # noqa: E501 +from patch_api.rest import ApiException + +class TestOffset(unittest.TestCase): + """Offset unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Offset + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.offset.Offset() # noqa: E501 + if include_optional : + return Offset( + id = '0', + allocated_mass_g = 0, + fulfilled_at = '0', + fulfillment_state = 'pending', + mass_g = 1, + price_cents_usd = '0', + production = True, + retired = True, + serial_number = '0', + vintage_year = 56, + project_id = '0' + ) + else : + return Offset( + id = '0', + allocated_mass_g = 0, + fulfillment_state = 'pending', + mass_g = 1, + price_cents_usd = '0', + production = True, + retired = True, + serial_number = '0', + vintage_year = 56, + project_id = '0', + ) + + def testOffset(self): + """Test Offset""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_offset_list_response.py b/test/test_offset_list_response.py new file mode 100644 index 0000000..f2a9424 --- /dev/null +++ b/test/test_offset_list_response.py @@ -0,0 +1,68 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.offset_list_response import OffsetListResponse # noqa: E501 +from factories import OffsetFactory, MetaIndexObjectFactory +from patch_api.rest import ApiException + +class TestOffsetListResponse(unittest.TestCase): + """OffsetListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test OffsetListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.offset_list_response.OffsetListResponse() # noqa: E501 + if include_optional : + return OffsetListResponse( + success = True, + error = None, + data = [ + OffsetFactory() + ], + meta = MetaIndexObjectFactory() + ) + else : + return OffsetListResponse( + success = True, + error = None, + data = [ + OffsetFactory() + ], + meta = MetaIndexObjectFactory(), + ) + + def testOffsetListResponse(self): + """Test OffsetListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_offset_response.py b/test/test_offset_response.py new file mode 100644 index 0000000..c258043 --- /dev/null +++ b/test/test_offset_response.py @@ -0,0 +1,62 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.offset_response import OffsetResponse # noqa: E501 +from factories import OffsetFactory +from patch_api.rest import ApiException + +class TestOffsetResponse(unittest.TestCase): + """OffsetResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test OffsetResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.offset_response.OffsetResponse() # noqa: E501 + if include_optional : + return OffsetResponse( + success = True, + error = None, + data = OffsetFactory() + ) + else : + return OffsetResponse( + success = True, + error = None, + data = OffsetFactory(), + ) + + def testOffsetResponse(self): + """Test OffsetResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_order.py b/test/test_order.py new file mode 100644 index 0000000..8dc8e5b --- /dev/null +++ b/test/test_order.py @@ -0,0 +1,78 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.order import Order # noqa: E501 +from patch_api.rest import ApiException +from factories import AllocationFactory + +class TestOrder(unittest.TestCase): + """Order unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Order + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.order.Order() # noqa: E501 + if include_optional : + return Order( + id = '0', + mass_g = 1, + production = True, + state = 'draft', + allocation_state = 'pending', + price_cents_usd = '0', + patch_fee_cents_usd = '0', + allocations = [ + AllocationFactory() + ], + metadata = {}, + ) + else : + return Order( + id = '0', + mass_g = 1, + production = True, + state = 'draft', + allocation_state = 'pending', + price_cents_usd = '0', + patch_fee_cents_usd = '0', + allocations = [ + AllocationFactory() + ], + metadata = {}, + ) + + def testOrder(self): + """Test Order""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_order_list_response.py b/test/test_order_list_response.py new file mode 100644 index 0000000..8a00d30 --- /dev/null +++ b/test/test_order_list_response.py @@ -0,0 +1,68 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.order_list_response import OrderListResponse # noqa: E501 +from factories import OrderFactory, MetaIndexObjectFactory +from patch_api.rest import ApiException + +class TestOrderListResponse(unittest.TestCase): + """OrderListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test OrderListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.order_list_response.OrderListResponse() # noqa: E501 + if include_optional : + return OrderListResponse( + success = True, + error = None, + data = [ + OrderFactory() + ], + meta = MetaIndexObjectFactory() + ) + else : + return OrderListResponse( + success = True, + error = None, + data = [ + OrderFactory() + ], + meta = MetaIndexObjectFactory(), + ) + + def testOrderListResponse(self): + """Test OrderListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_order_response.py b/test/test_order_response.py new file mode 100644 index 0000000..27e4bbb --- /dev/null +++ b/test/test_order_response.py @@ -0,0 +1,62 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.order_response import OrderResponse # noqa: E501 +from factories import OrderFactory +from patch_api.rest import ApiException + +class TestOrderResponse(unittest.TestCase): + """OrderResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test OrderResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.order_response.OrderResponse() # noqa: E501 + if include_optional : + return OrderResponse( + success = True, + error = None, + data = OrderFactory() + ) + else : + return OrderResponse( + success = True, + error = None, + data = OrderFactory(), + ) + + def testOrderResponse(self): + """Test OrderResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_orders_api.py b/test/test_orders_api.py new file mode 100644 index 0000000..6f82ada --- /dev/null +++ b/test/test_orders_api.py @@ -0,0 +1,69 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest + +import patch_api +from patch_api.api.orders_api import OrdersApi # noqa: E501 +from patch_api.rest import ApiException + + +class TestOrdersApi(unittest.TestCase): + """OrdersApi unit test stubs""" + + def setUp(self): + self.api = patch_api.api.orders_api.OrdersApi() # noqa: E501 + + def tearDown(self): + pass + + def test_cancel_order(self): + """Test case for cancel_order + + Cancel an order # noqa: E501 + """ + pass + + def test_create_order(self): + """Test case for create_order + + Creates an order # noqa: E501 + """ + pass + + def test_place_order(self): + """Test case for place_order + + Place an order # noqa: E501 + """ + pass + + def test_retrieve_order(self): + """Test case for retrieve_order + + Retrieves an order # noqa: E501 + """ + pass + + def test_retrieve_orders(self): + """Test case for retrieve_orders + + Retrieves a list of orders # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_photo.py b/test/test_photo.py new file mode 100644 index 0000000..aaa05dc --- /dev/null +++ b/test/test_photo.py @@ -0,0 +1,59 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.photo import Photo # noqa: E501 +from patch_api.rest import ApiException + +class TestPhoto(unittest.TestCase): + """Photo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Photo + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.photo.Photo() # noqa: E501 + if include_optional : + return Photo( + url = '0', + id = '0' + ) + else : + return Photo( + url = '0', + id = '0', + ) + + def testPhoto(self): + """Test Photo""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_photo_response.py b/test/test_photo_response.py new file mode 100644 index 0000000..9e5ce4a --- /dev/null +++ b/test/test_photo_response.py @@ -0,0 +1,62 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.photo_response import PhotoResponse # noqa: E501 +from factories import PhotoFactory # noqa: E501 +from patch_api.rest import ApiException + +class TestPhotoResponse(unittest.TestCase): + """PhotoResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test PhotoResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.photo_response.PhotoResponse() # noqa: E501 + if include_optional : + return PhotoResponse( + success = True, + error = None, + data = PhotoFactory() + ) + else : + return PhotoResponse( + success = True, + error = None, + data = PhotoFactory(), + ) + + def testPhotoResponse(self): + """Test PhotoResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_photos_api.py b/test/test_photos_api.py new file mode 100644 index 0000000..e399b14 --- /dev/null +++ b/test/test_photos_api.py @@ -0,0 +1,41 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest + +import patch_api +from patch_api.api.photos_api import PhotosApi # noqa: E501 +from patch_api.rest import ApiException + + +class TestPhotosApi(unittest.TestCase): + """PhotosApi unit test stubs""" + + def setUp(self): + self.api = patch_api.api.photos_api.PhotosApi() # noqa: E501 + + def tearDown(self): + pass + + def test_delete_photo(self): + """Test case for delete_photo + + Deletes a photo for the project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_preference.py b/test/test_preference.py new file mode 100644 index 0000000..1d40b76 --- /dev/null +++ b/test/test_preference.py @@ -0,0 +1,54 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.preference import Preference # noqa: E501 +from factories import PreferenceFactory +from patch_api.rest import ApiException + +class TestPreference(unittest.TestCase): + """Preference unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Preference + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.preference.Preference() # noqa: E501 + if include_optional : + return PreferenceFactory() + else : + return PreferenceFactory() + + def testPreference(self): + """Test Preference""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_preference_list_response.py b/test/test_preference_list_response.py new file mode 100644 index 0000000..230b70f --- /dev/null +++ b/test/test_preference_list_response.py @@ -0,0 +1,68 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.preference_list_response import PreferenceListResponse # noqa: E501 +from factories import MetaIndexObjectFactory, PreferenceFactory +from patch_api.rest import ApiException + +class TestPreferenceListResponse(unittest.TestCase): + """PreferenceListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test PreferenceListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.preference_list_response.PreferenceListResponse() # noqa: E501 + if include_optional : + return PreferenceListResponse( + success = True, + error = None, + data = [ + PreferenceFactory() + ], + meta = MetaIndexObjectFactory() + ) + else : + return PreferenceListResponse( + success = True, + error = None, + data = [ + PreferenceFactory() + ], + meta = MetaIndexObjectFactory(), + ) + + def testPreferenceListResponse(self): + """Test PreferenceListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_preference_response.py b/test/test_preference_response.py new file mode 100644 index 0000000..6dbb6c8 --- /dev/null +++ b/test/test_preference_response.py @@ -0,0 +1,62 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.preference_response import PreferenceResponse # noqa: E501 +from factories import PreferenceFactory +from patch_api.rest import ApiException + +class TestPreferenceResponse(unittest.TestCase): + """PreferenceResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test PreferenceResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.preference_response.PreferenceResponse() # noqa: E501 + if include_optional : + return PreferenceResponse( + success = True, + error = None, + data = PreferenceFactory() + ) + else : + return PreferenceResponse( + success = True, + error = None, + data = PreferenceFactory() + ) + + def testPreferenceResponse(self): + """Test PreferenceResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py new file mode 100644 index 0000000..c7bac2c --- /dev/null +++ b/test/test_preferences_api.py @@ -0,0 +1,81 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import os +from urllib.error import HTTPError + +import patch_api +from patch_api.api.preferences_api import PreferencesApi # noqa: E501 +from patch_api.models.create_preference_request import CreatePreferenceRequest +from patch_api.rest import ApiException + + +class TestPreferencesApi(unittest.TestCase): + """PreferencesApi unit test stubs""" + + def setUp(self): + configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + api_client = patch_api.ApiClient(configuration) + self.api = PreferencesApi(api_client=api_client) # noqa: E501 + + def tearDown(self): + pass + + # def test_delete_and_create_preference(self): + # """Test case for create_preference + + # creates a project preference # noqa: E501 + # """ + # # Try to create the preference + # try: + # project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" + + # create_preference_request = CreatePreferenceRequest(project_id=project_id) + # preference = self.api.create_preference(create_preference_request) + + # # Delete it if it exists + # except ApiException as err: + # print('err---------------->', err) + # deleted_preference = self.api.delete_preference(id=project_id) + # self.assertTrue(deleted_preference) + + # self.assertTrue(preference) + # self.assertEqual(preference.data.project_id, project_id) + + + # def test_retrieve_preference(self): + # """Test case for retrieve_preference + + # Retrieve the preference # noqa: E501 + # """ + # project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" + + # create_preference_request = CreatePreferenceRequest(project_id=project_id) + # preference = self.api.create_preference(create_preference_request) + + # preference = self.api.retrieve_preference() + + + def test_retrieve_preferences(self): + """Test case for retrieve_preferences + + Retrieves a list of preferences # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project.py b/test/test_project.py new file mode 100644 index 0000000..b8c01a9 --- /dev/null +++ b/test/test_project.py @@ -0,0 +1,57 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.project import Project # noqa: E501 +from patch_api.rest import ApiException +from factories import ProjectFactory + +class TestProject(unittest.TestCase): + """Project unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Project + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.project.Project() # noqa: E501 + if include_optional : + return ProjectFactory() + else : + return ProjectFactory( + photos = None, + standard = None, + type = None) + + def testProject(self): + """Test Project""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_list_response.py b/test/test_project_list_response.py new file mode 100644 index 0000000..2755930 --- /dev/null +++ b/test/test_project_list_response.py @@ -0,0 +1,67 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.project_list_response import ProjectListResponse # noqa: E501 +from factories import ProjectFactory, MetaIndexObjectFactory +from patch_api.rest import ApiException + +class TestProjectListResponse(unittest.TestCase): + """ProjectListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test ProjectListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.project_list_response.ProjectListResponse() # noqa: E501 + if include_optional : + return ProjectListResponse( + success = True, + error = None, + data = [ + ProjectFactory() + ], + meta = MetaIndexObjectFactory() + ) + else : + return ProjectListResponse( + success = True, + error = None, + data = [ + ProjectFactory() + ], + meta = MetaIndexObjectFactory(), + ) + + def testProjectListResponse(self): + """Test ProjectListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_response.py b/test/test_project_response.py new file mode 100644 index 0000000..e10c69a --- /dev/null +++ b/test/test_project_response.py @@ -0,0 +1,62 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.project_response import ProjectResponse # noqa: E501 +from factories import ProjectFactory +from patch_api.rest import ApiException + +class TestProjectResponse(unittest.TestCase): + """ProjectResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test ProjectResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.project_response.ProjectResponse() # noqa: E501 + if include_optional : + return ProjectResponse( + success = True, + error = None, + data = ProjectFactory() + ) + else : + return ProjectResponse( + success = True, + error = None, + data = ProjectFactory() + ) + + def testProjectResponse(self): + """Test ProjectResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_type_list_response.py b/test/test_project_type_list_response.py new file mode 100644 index 0000000..7acc0a0 --- /dev/null +++ b/test/test_project_type_list_response.py @@ -0,0 +1,68 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch_api +from patch_api.models.project_type_list_response import ProjectTypeListResponse # noqa: E501 +from factories import MetaIndexObjectFactory +from patch_api.rest import ApiException + +class TestProjectTypeListResponse(unittest.TestCase): + """ProjectTypeListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test ProjectTypeListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.project_type_list_response.ProjectTypeListResponse() # noqa: E501 + if include_optional : + return ProjectTypeListResponse( + success = True, + error = None, + data = [ + '0' + ], + meta = MetaIndexObjectFactory() + ) + else : + return ProjectTypeListResponse( + success = True, + error = None, + data = [ + '0' + ], + meta = MetaIndexObjectFactory(), + ) + + def testProjectTypeListResponse(self): + """Test ProjectTypeListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_projects_api.py b/test/test_projects_api.py new file mode 100644 index 0000000..32d71ed --- /dev/null +++ b/test/test_projects_api.py @@ -0,0 +1,55 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import os + +import patch_api +from patch_api.api.projects_api import ProjectsApi # noqa: E501 +from patch_api.rest import ApiException + + +class TestProjectsApi(unittest.TestCase): + """ProjectsApi unit test stubs""" + + def setUp(self): + configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + api_client = patch_api.ApiClient(configuration) + self.api = ProjectsApi(api_client=api_client) # noqa: E501 + + def tearDown(self): + pass + + def test_retrieve_project(self): + """Test case for retrieve_project + + Retrieves a project # noqa: E501 + """ + project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" + project = self.api.retrieve_project(id=project_id) + self.assertTrue(project) + + def test_retrieve_projects(self): + """Test case for retrieve_projects + + Retrieves a list of projects # noqa: E501 + """ + projects = self.api.retrieve_projects() + self.assertTrue(isinstance(projects.data, list)) + + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_standard.py b/test/test_standard.py new file mode 100644 index 0000000..3e409c7 --- /dev/null +++ b/test/test_standard.py @@ -0,0 +1,61 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch +from patch_api.models.standard import Standard # noqa: E501 +from patch_api.rest import ApiException + +class TestStandard(unittest.TestCase): + """Standard unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Standard + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.standard.Standard() # noqa: E501 + if include_optional : + return Standard( + type = '0', + acronym = '0', + description = '0' + ) + else : + return Standard( + type = '0', + acronym = '0', + description = '0', + ) + + def testStandard(self): + """Test Standard""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_standard_list_response.py b/test/test_standard_list_response.py new file mode 100644 index 0000000..18b3c94 --- /dev/null +++ b/test/test_standard_list_response.py @@ -0,0 +1,68 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch +from patch_api.models.standard_list_response import StandardListResponse # noqa: E501 +from factories import StandardFactory, MetaIndexObjectFactory +from patch_api.rest import ApiException + +class TestStandardListResponse(unittest.TestCase): + """StandardListResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test StandardListResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.standard_list_response.StandardListResponse() # noqa: E501 + if include_optional : + return StandardListResponse( + success = True, + error = None, + data = [ + StandardFactory(), + ], + meta = MetaIndexObjectFactory(), + ) + else : + return StandardListResponse( + success = True, + error = None, + data = [ + StandardFactory(), + ], + meta = MetaIndexObjectFactory(), + ) + + def testStandardListResponse(self): + """Test StandardListResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_update_offset_request.py b/test/test_update_offset_request.py new file mode 100644 index 0000000..8d1c92a --- /dev/null +++ b/test/test_update_offset_request.py @@ -0,0 +1,59 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch +from patch_api.models.update_offset_request import UpdateOffsetRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestUpdateOffsetRequest(unittest.TestCase): + """UpdateOffsetRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test UpdateOffsetRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.update_offset_request.UpdateOffsetRequest() # noqa: E501 + if include_optional : + return UpdateOffsetRequest( + mass_g = 1, + price_cents_usd = 1, + vintage_year = 56, + serial_number = '0' + ) + else : + return UpdateOffsetRequest( + ) + + def testUpdateOffsetRequest(self): + """Test UpdateOffsetRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_update_project_request.py b/test/test_update_project_request.py new file mode 100644 index 0000000..dd7a80f --- /dev/null +++ b/test/test_update_project_request.py @@ -0,0 +1,66 @@ +# 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 +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import patch +from patch_api.models.update_project_request import UpdateProjectRequest # noqa: E501 +from patch_api.rest import ApiException + +class TestUpdateProjectRequest(unittest.TestCase): + """UpdateProjectRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test UpdateProjectRequest + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = patch_api.models.update_project_request.UpdateProjectRequest() # noqa: E501 + if include_optional : + return UpdateProjectRequest( + name = '0', + description = '0', + country = 'TJ', + state = '0', + verifier = '0', + type = 'biomass', + standard_type = 'american_carbon_registry', + longitude = '0', + latitude = '0', + production = '0', + organization_id = '0' + ) + else : + return UpdateProjectRequest( + ) + + def testUpdateProjectRequest(self): + """Test UpdateProjectRequest""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + self.assertTrue(inst_req_only) + self.assertTrue(inst_req_and_optional) + + +if __name__ == '__main__': + unittest.main() From e21867ea5739de989afc0a1c41e5f2a65b09850a Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 22 Jan 2021 15:54:42 +0100 Subject: [PATCH 03/23] Add Orders integration tests --- test/test_orders_api.py | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 6f82ada..e3c85b0 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -14,9 +14,11 @@ from __future__ import absolute_import import unittest +import os import patch_api from patch_api.api.orders_api import OrdersApi # noqa: E501 +from patch_api.models.create_order_request import CreateOrderRequest from patch_api.rest import ApiException @@ -24,45 +26,46 @@ class TestOrdersApi(unittest.TestCase): """OrdersApi unit test stubs""" def setUp(self): - self.api = patch_api.api.orders_api.OrdersApi() # noqa: E501 + configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + api_client = patch_api.ApiClient(configuration) + self.api = OrdersApi(api_client=api_client) # noqa: E501 def tearDown(self): pass - def test_cancel_order(self): - """Test case for cancel_order + def test_interactions_with_an_order(self): + """Test case for create_order, retrieve_order, cancel_order + """ - Cancel an order # noqa: E501 + """Create an order """ - pass + create_order_request = CreateOrderRequest(mass_g=100) + order = self.api.create_order(create_order_request) - def test_create_order(self): - """Test case for create_order + self.assertTrue(order) - Creates an order # noqa: E501 + """Retrieve an order """ - pass + create_order_request = CreateOrderRequest(mass_g=100) + order = self.api.create_order(create_order_request=create_order_request) + retrieved_order = self.api.retrieve_order(id=order.data.id) - def test_place_order(self): - """Test case for place_order + self.assertTrue(retrieved_order) - Place an order # noqa: E501 + """Cancel an order """ - pass + cancelled_order = self.api.retrieve_order(id=order.data.id) - def test_retrieve_order(self): - """Test case for retrieve_order + self.assertTrue(cancelled_order) - Retrieves an order # noqa: E501 - """ - pass def test_retrieve_orders(self): """Test case for retrieve_orders Retrieves a list of orders # noqa: E501 """ - pass + orders = self.api.retrieve_orders() + self.assertTrue(isinstance(orders.data, list)) if __name__ == '__main__': From 6b5d25a263506c1a76843ad74ef6274924ec2766 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 22 Jan 2021 16:42:11 +0100 Subject: [PATCH 04/23] Preferences specs --- patch_api/rest.py | 10 +++++-- setup.py | 2 +- test-requirements.txt | 8 ++++-- test/test_preferences_api.py | 54 +++++++++++++----------------------- 4 files changed, 34 insertions(+), 40 deletions(-) diff --git a/patch_api/rest.py b/patch_api/rest.py index fd2b5e9..d2665d6 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -57,14 +57,14 @@ def __init__(self, configuration, pools_size=4, maxsize=None): # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 - self.configuration = configuration - # cert_reqs if configuration.verify_ssl: cert_reqs = ssl.CERT_REQUIRED else: cert_reqs = ssl.CERT_NONE + self.configuration = configuration + # ca_certs if configuration.ssl_ca_cert: ca_certs = configuration.ssl_ca_cert @@ -141,6 +141,7 @@ def request(self, method, url, query_params=None, headers=None, post_params = post_params or {} headers = headers or {} + timeout = None if _request_timeout: if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 @@ -222,6 +223,11 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) + # In the python 3, the response.data is bytes. + # we need to decode it to string. + if six.PY3: + r.data = r.data.decode('utf8') + # log response body logger.debug("response body: %s", r.data) diff --git a/setup.py b/setup.py index 0335c2e..a2c2fbe 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 -NAME = "patch_api" +NAME = "patch-api" VERSION = "1.0.0" # To install the library, run the following # diff --git a/test-requirements.txt b/test-requirements.txt index 6e21bfd..76f42de 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,6 @@ -pytest~=4.6.7 # needed for python 2.7+3.4 -pytest-cov>=2.8.1 -pytest-randomly==1.2.3 # needed for python 2.7+3.4 +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 factory_boy>=2.12.0 diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index c7bac2c..9a93833 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -34,47 +34,33 @@ def setUp(self): def tearDown(self): pass - # def test_delete_and_create_preference(self): - # """Test case for create_preference + def test_retrieve_preferences_and_preference(self): + """Test case for retrieve_preferences and retrieve_preference - # creates a project preference # noqa: E501 - # """ - # # Try to create the preference - # try: - # project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" - - # create_preference_request = CreatePreferenceRequest(project_id=project_id) - # preference = self.api.create_preference(create_preference_request) - - # # Delete it if it exists - # except ApiException as err: - # print('err---------------->', err) - # deleted_preference = self.api.delete_preference(id=project_id) - # self.assertTrue(deleted_preference) - - # self.assertTrue(preference) - # self.assertEqual(preference.data.project_id, project_id) - - - # def test_retrieve_preference(self): - # """Test case for retrieve_preference + creates a project preference # noqa: E501 + """ + preferences = self.api.retrieve_preferences() + self.assertTrue(isinstance(preferences.data, list)) - # Retrieve the preference # noqa: E501 - # """ - # project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" + preference_id = preferences.data[0].id + preference = self.api.retrieve_preference(id=preference_id) + self.assertTrue(preference) - # create_preference_request = CreatePreferenceRequest(project_id=project_id) - # preference = self.api.create_preference(create_preference_request) + def test_delete_and_create_preferences(self): + """Test case for create_preference and delete_preference + """ + project_id = "pro_test_0de1a59eed9ff8474e09077ddb3714b2" + preferences = self.api.retrieve_preferences() + preference_id = preferences.data[0].id - # preference = self.api.retrieve_preference() + deleted_preference = self.api.delete_preference(id=preference_id) + self.assertTrue(deleted_preference) - def test_retrieve_preferences(self): - """Test case for retrieve_preferences + create_preference_request = CreatePreferenceRequest(project_id=project_id) + preference = self.api.create_preference(create_preference_request) - Retrieves a list of preferences # noqa: E501 - """ - pass + self.assertTrue(preference) if __name__ == '__main__': From a5d89abe137ba26f5a07ce13503822aae19ce19a Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Mon, 25 Jan 2021 12:57:48 +0100 Subject: [PATCH 05/23] Do not include photos --- patch_api/api/photos_api.py | 161 ------------------------------------ 1 file changed, 161 deletions(-) delete mode 100644 patch_api/api/photos_api.py diff --git a/patch_api/api/photos_api.py b/patch_api/api/photos_api.py deleted file mode 100644 index bffd597..0000000 --- a/patch_api/api/photos_api.py +++ /dev/null @@ -1,161 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from patch_api.api_client import ApiClient -from patch_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class PhotosApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def delete_photo(self, photo_id, uid, **kwargs): # noqa: E501 - """Deletes a photo for the project # noqa: E501 - - Deletes the given `photo` for the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_photo(photo_id, uid, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str photo_id: (required) - :param str uid: (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: PhotoResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.delete_photo_with_http_info(photo_id, uid, **kwargs) # noqa: E501 - - def delete_photo_with_http_info(self, photo_id, uid, **kwargs): # noqa: E501 - """Deletes a photo for the project # noqa: E501 - - Deletes the given `photo` for the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_photo_with_http_info(photo_id, uid, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str photo_id: (required) - :param str uid: (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(PhotoResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = [ - 'photo_id', - 'uid' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_photo" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'photo_id' is set - if self.api_client.client_side_validation and ('photo_id' not in local_var_params or # noqa: E501 - local_var_params['photo_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `photo_id` when calling `delete_photo`") # noqa: E501 - # verify the required parameter 'uid' is set - if self.api_client.client_side_validation and ('uid' not in local_var_params or # noqa: E501 - local_var_params['uid'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `uid` when calling `delete_photo`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'photo_id' in local_var_params: - path_params['photo_id'] = local_var_params['photo_id'] # noqa: E501 - if 'uid' in local_var_params: - path_params['uid'] = local_var_params['uid'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 - - return self.api_client.call_api( - '/v1/projects/{uid}/photos/{photo_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PhotoResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) From e538a90b3bae0acf3334e20e136178ae6c6ec726 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Mon, 25 Jan 2021 17:02:31 +0100 Subject: [PATCH 06/23] Add pre-commit hook --- .pre-commit-config.yaml | 5 + patch_api/__init__.py | 5 +- patch_api/api/estimates_api.py | 188 ++++---- patch_api/api/orders_api.py | 290 ++++++------ patch_api/api/photos_api.py | 168 +++++++ patch_api/api/preferences_api.py | 240 +++++----- patch_api/api/projects_api.py | 110 ++--- patch_api/api_client.py | 414 +++++++++++------- patch_api/configuration.py | 81 ++-- patch_api/exceptions.py | 10 +- patch_api/models/__init__.py | 3 + patch_api/models/allocation.py | 60 +-- .../models/create_mass_estimate_request.py | 64 +-- patch_api/models/create_membership_request.py | 46 +- patch_api/models/create_offset_request.py | 83 ++-- patch_api/models/create_order_request.py | 78 ++-- .../models/create_organization_request.py | 60 +-- patch_api/models/create_photo_request.py | 52 ++- patch_api/models/create_preference_request.py | 36 +- patch_api/models/create_project_request.py | 378 ++++++++++++++-- patch_api/models/error_response.py | 56 +-- patch_api/models/estimate.py | 64 +-- patch_api/models/estimate_list_response.py | 69 ++- patch_api/models/estimate_response.py | 56 +-- patch_api/models/fulfill_offset_request.py | 28 +- patch_api/models/membership.py | 71 +-- patch_api/models/membership_response.py | 56 +-- patch_api/models/meta_index_object.py | 34 +- patch_api/models/offset.py | 206 ++++++--- patch_api/models/offset_list_response.py | 69 ++- patch_api/models/offset_response.py | 56 +-- patch_api/models/order.py | 165 ++++--- patch_api/models/order_list_response.py | 69 ++- patch_api/models/order_response.py | 56 +-- patch_api/models/organization.py | 218 +++++++++ .../models/organization_list_response.py | 222 ++++++++++ patch_api/models/organization_response.py | 178 ++++++++ patch_api/models/photo.py | 42 +- patch_api/models/photo_response.py | 56 +-- patch_api/models/preference.py | 61 ++- patch_api/models/preference_list_response.py | 69 ++- patch_api/models/preference_response.py | 56 +-- patch_api/models/project.py | 161 ++++--- patch_api/models/project_list_response.py | 69 ++- patch_api/models/project_response.py | 56 +-- .../models/project_type_list_response.py | 69 ++- patch_api/models/standard.py | 64 +-- patch_api/models/standard_list_response.py | 69 ++- patch_api/models/update_offset_request.py | 78 ++-- patch_api/models/update_project_request.py | 378 ++++++++++++++-- patch_api/rest.py | 297 ++++++++----- requirements.txt | 3 +- setup.py | 2 +- test/factories.py | 90 ++-- test/test_allocation.py | 7 +- test/test_create_mass_estimate_request.py | 20 +- test/test_create_membership_request.py | 20 +- test/test_create_offset_request.py | 20 +- test/test_create_order_request.py | 15 +- test/test_create_organization_request.py | 21 +- test/test_create_photo_request.py | 18 +- test/test_create_preference_request.py | 19 +- test/test_create_project_request.py | 33 +- test/test_error_response.py | 20 +- test/test_estimate.py | 16 +- test/test_estimate_list_response.py | 30 +- test/test_estimate_response.py | 20 +- test/test_estimates_api.py | 10 +- test/test_fulfill_offset_request.py | 14 +- test/test_membership.py | 19 +- test/test_membership_response.py | 21 +- test/test_meta_index_object.py | 15 +- test/test_offset.py | 51 +-- test/test_offset_list_response.py | 29 +- test/test_offset_response.py | 19 +- test/test_order.py | 49 +-- test/test_order_list_response.py | 29 +- test/test_order_response.py | 19 +- test/test_orders_api.py | 7 +- test/test_photo.py | 17 +- test/test_photo_response.py | 19 +- test/test_photos_api.py | 2 +- test/test_preference.py | 7 +- test/test_preference_list_response.py | 33 +- test/test_preference_response.py | 17 +- test/test_preferences_api.py | 6 +- test/test_project.py | 12 +- test/test_project_list_response.py | 30 +- test/test_project_response.py | 19 +- test/test_project_type_list_response.py | 27 +- test/test_projects_api.py | 7 +- test/test_standard.py | 19 +- test/test_standard_list_response.py | 29 +- test/test_update_offset_request.py | 15 +- test/test_update_project_request.py | 32 +- 95 files changed, 4290 insertions(+), 2206 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 patch_api/api/photos_api.py create mode 100644 patch_api/models/organization.py create mode 100644 patch_api/models/organization_list_response.py create mode 100644 patch_api/models/organization_response.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6ebd6ff --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/psf/black + rev: 19.3b0 + hooks: + - id: black diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 19ebc85..197c1f7 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -32,6 +32,7 @@ from patch_api.exceptions import ApiValueError from patch_api.exceptions import ApiKeyError from patch_api.exceptions import ApiException + # import models into sdk package from patch_api.models.allocation import Allocation from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest @@ -56,6 +57,9 @@ 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.organization import Organization +from patch_api.models.organization_list_response import OrganizationListResponse +from patch_api.models.organization_response import OrganizationResponse from patch_api.models.photo import Photo from patch_api.models.photo_response import PhotoResponse from patch_api.models.preference import Preference @@ -69,4 +73,3 @@ from patch_api.models.standard_list_response import StandardListResponse from patch_api.models.update_offset_request import UpdateOffsetRequest from patch_api.models.update_project_request import UpdateProjectRequest - diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 7659ec7..5385d51 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -19,10 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class EstimatesApi(object): @@ -37,7 +34,9 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create_mass_estimate(self, create_mass_estimate_request, **kwargs): # noqa: E501 + def create_mass_estimate( + self, create_mass_estimate_request, **kwargs + ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 @@ -59,10 +58,14 @@ def create_mass_estimate(self, create_mass_estimate_request, **kwargs): # noqa: If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_mass_estimate_with_http_info(create_mass_estimate_request, **kwargs) # noqa: E501 - - def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_mass_estimate_with_http_info( + create_mass_estimate_request, **kwargs + ) # noqa: E501 + + def create_mass_estimate_with_http_info( + self, create_mass_estimate_request, **kwargs + ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. # noqa: E501 @@ -89,30 +92,32 @@ def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kw local_var_params = locals() - all_params = [ - 'create_mass_estimate_request' - ] + all_params = ["create_mass_estimate_request"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_mass_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_mass_estimate_request' is set - if self.api_client.client_side_validation and ('create_mass_estimate_request' not in local_var_params or # noqa: E501 - local_var_params['create_mass_estimate_request'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`") # noqa: E501 + if self.api_client.client_side_validation and ( + "create_mass_estimate_request" not in local_var_params + or local_var_params["create_mass_estimate_request"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`" + ) # noqa: E501 collection_formats = {} @@ -126,34 +131,42 @@ def create_mass_estimate_with_http_info(self, create_mass_estimate_request, **kw local_var_files = {} body_params = None - if 'create_mass_estimate_request' in local_var_params: - body_params = local_var_params['create_mass_estimate_request'] + if "create_mass_estimate_request" in local_var_params: + body_params = local_var_params["create_mass_estimate_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/mass', 'POST', + "/v1/estimates/mass", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + response_type="EstimateResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_estimate(self, id, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 @@ -177,7 +190,7 @@ def retrieve_estimate(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501 def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 @@ -207,36 +220,37 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_estimate" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_estimate`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_estimate`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -247,27 +261,32 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates/{id}', 'GET', + "/v1/estimates/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateResponse', # noqa: E501 + response_type="EstimateResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_estimates(self, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 @@ -291,7 +310,7 @@ def retrieve_estimates(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501 def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 @@ -321,34 +340,34 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'page' - ] + all_params = ["page"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_estimates" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 - query_params.append(('page', local_var_params['page'])) # noqa: E501 + if ( + "page" in local_var_params and local_var_params["page"] is not None + ): # noqa: E501 + query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} @@ -357,24 +376,29 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/estimates', 'GET', + "/v1/estimates", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='EstimateListResponse', # noqa: E501 + response_type="EstimateListResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 2116924..8a1bc8a 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -19,10 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class OrdersApi(object): @@ -59,7 +56,7 @@ def cancel_order(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.cancel_order_with_http_info(id, **kwargs) # noqa: E501 def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -89,36 +86,37 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `cancel_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `cancel_order`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -129,27 +127,32 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders/{id}/cancel', 'PATCH', + "/v1/orders/{id}/cancel", + "PATCH", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def create_order(self, create_order_request, **kwargs): # noqa: E501 """Creates an order # noqa: E501 @@ -173,8 +176,10 @@ def create_order(self, create_order_request, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_order_with_http_info(create_order_request, **kwargs) # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_order_with_http_info( + create_order_request, **kwargs + ) # noqa: E501 def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 """Creates an order # noqa: E501 @@ -203,30 +208,32 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_params = locals() - all_params = [ - 'create_order_request' - ] + all_params = ["create_order_request"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_order_request' is set - if self.api_client.client_side_validation and ('create_order_request' not in local_var_params or # noqa: E501 - local_var_params['create_order_request'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `create_order_request` when calling `create_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + "create_order_request" not in local_var_params + or local_var_params["create_order_request"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `create_order_request` when calling `create_order`" + ) # noqa: E501 collection_formats = {} @@ -240,34 +247,42 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_files = {} body_params = None - if 'create_order_request' in local_var_params: - body_params = local_var_params['create_order_request'] + if "create_order_request" in local_var_params: + body_params = local_var_params["create_order_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders', 'POST', + "/v1/orders", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def place_order(self, id, **kwargs): # noqa: E501 """Place an order # noqa: E501 @@ -291,7 +306,7 @@ def place_order(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.place_order_with_http_info(id, **kwargs) # noqa: E501 def place_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -321,36 +336,37 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method place_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `place_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `place_order`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -361,27 +377,32 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders/{id}/place', 'PATCH', + "/v1/orders/{id}/place", + "PATCH", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_order(self, id, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 @@ -405,7 +426,7 @@ def retrieve_order(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_order_with_http_info(id, **kwargs) # noqa: E501 def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 @@ -435,36 +456,37 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_order" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_order`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -475,27 +497,32 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders/{id}', 'GET', + "/v1/orders/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderResponse', # noqa: E501 + response_type="OrderResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_orders(self, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 @@ -519,7 +546,7 @@ def retrieve_orders(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_orders_with_http_info(**kwargs) # noqa: E501 def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 @@ -549,34 +576,34 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'page' - ] + all_params = ["page"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_orders" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 - query_params.append(('page', local_var_params['page'])) # noqa: E501 + if ( + "page" in local_var_params and local_var_params["page"] is not None + ): # noqa: E501 + query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} @@ -585,24 +612,29 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/orders', 'GET', + "/v1/orders", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderListResponse', # noqa: E501 + response_type="OrderListResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/patch_api/api/photos_api.py b/patch_api/api/photos_api.py new file mode 100644 index 0000000..ca90ce9 --- /dev/null +++ b/patch_api/api/photos_api.py @@ -0,0 +1,168 @@ +# 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 +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from patch_api.api_client import ApiClient +from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 + + +class PhotosApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_photo(self, photo_id, uid, **kwargs): # noqa: E501 + """Deletes a photo for the project # noqa: E501 + + Deletes the given `photo` for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_photo(photo_id, uid, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str photo_id: (required) + :param str uid: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + return self.delete_photo_with_http_info(photo_id, uid, **kwargs) # noqa: E501 + + def delete_photo_with_http_info(self, photo_id, uid, **kwargs): # noqa: E501 + """Deletes a photo for the project # noqa: E501 + + Deletes the given `photo` for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_photo_with_http_info(photo_id, uid, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str photo_id: (required) + :param str uid: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ["photo_id", "uid"] + all_params.extend( + [ + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", + ] + ) + + for key, val in six.iteritems(local_var_params["kwargs"]): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_photo" % key + ) + local_var_params[key] = val + del local_var_params["kwargs"] + # verify the required parameter 'photo_id' is set + if self.api_client.client_side_validation and ( + "photo_id" not in local_var_params + or local_var_params["photo_id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `photo_id` when calling `delete_photo`" + ) # noqa: E501 + # verify the required parameter 'uid' is set + if self.api_client.client_side_validation and ( + "uid" not in local_var_params + or local_var_params["uid"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `uid` when calling `delete_photo`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "photo_id" in local_var_params: + path_params["photo_id"] = local_var_params["photo_id"] # noqa: E501 + if "uid" in local_var_params: + path_params["uid"] = local_var_params["uid"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 + + # Authentication setting + auth_settings = ["bearer_auth"] # noqa: E501 + + return self.api_client.call_api( + "/v1/projects/{uid}/photos/{photo_id}", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index fd713d1..06d75b7 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -19,10 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class PreferencesApi(object): @@ -59,10 +56,14 @@ def create_preference(self, create_preference_request, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True - return self.create_preference_with_http_info(create_preference_request, **kwargs) # noqa: E501 - - def create_preference_with_http_info(self, create_preference_request, **kwargs): # noqa: E501 + kwargs["_return_http_data_only"] = True + return self.create_preference_with_http_info( + create_preference_request, **kwargs + ) # noqa: E501 + + def create_preference_with_http_info( + self, create_preference_request, **kwargs + ): # noqa: E501 """creates a project preference # noqa: E501 Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 @@ -89,30 +90,32 @@ def create_preference_with_http_info(self, create_preference_request, **kwargs): local_var_params = locals() - all_params = [ - 'create_preference_request' - ] + all_params = ["create_preference_request"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_preference" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'create_preference_request' is set - if self.api_client.client_side_validation and ('create_preference_request' not in local_var_params or # noqa: E501 - local_var_params['create_preference_request'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `create_preference_request` when calling `create_preference`") # noqa: E501 + if self.api_client.client_side_validation and ( + "create_preference_request" not in local_var_params + or local_var_params["create_preference_request"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `create_preference_request` when calling `create_preference`" + ) # noqa: E501 collection_formats = {} @@ -126,34 +129,42 @@ def create_preference_with_http_info(self, create_preference_request, **kwargs): local_var_files = {} body_params = None - if 'create_preference_request' in local_var_params: - body_params = local_var_params['create_preference_request'] + if "create_preference_request" in local_var_params: + body_params = local_var_params["create_preference_request"] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences', 'POST', + "/v1/preferences", + "POST", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceResponse', # noqa: E501 + response_type="PreferenceResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def delete_preference(self, id, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 @@ -177,7 +188,7 @@ def delete_preference(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.delete_preference_with_http_info(id, **kwargs) # noqa: E501 def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 @@ -207,36 +218,37 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method delete_preference" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `delete_preference`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `delete_preference`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -247,27 +259,32 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences/{id}', 'DELETE', + "/v1/preferences/{id}", + "DELETE", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceResponse', # noqa: E501 + response_type="PreferenceResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_preference(self, id, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 @@ -291,7 +308,7 @@ def retrieve_preference(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_preference_with_http_info(id, **kwargs) # noqa: E501 def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 @@ -321,36 +338,37 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_preference" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_preference`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_preference`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -361,27 +379,32 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences/{id}', 'GET', + "/v1/preferences/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceResponse', # noqa: E501 + response_type="PreferenceResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_preferences(self, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 @@ -405,7 +428,7 @@ def retrieve_preferences(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_preferences_with_http_info(**kwargs) # noqa: E501 def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 @@ -435,34 +458,34 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'page' - ] + all_params = ["page"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_preferences" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 - query_params.append(('page', local_var_params['page'])) # noqa: E501 + if ( + "page" in local_var_params and local_var_params["page"] is not None + ): # noqa: E501 + query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} @@ -471,24 +494,29 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/preferences', 'GET', + "/v1/preferences", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='PreferenceListResponse', # noqa: E501 + response_type="PreferenceListResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 9da709f..ad2a73c 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -19,10 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class ProjectsApi(object): @@ -59,7 +56,7 @@ def retrieve_project(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_project_with_http_info(id, **kwargs) # noqa: E501 def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 @@ -89,36 +86,37 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'id' - ] + all_params = ["id"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_project" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 - local_var_params['id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `id` when calling `retrieve_project`") # noqa: E501 + if self.api_client.client_side_validation and ( + "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `id` when calling `retrieve_project`" + ) # noqa: E501 collection_formats = {} path_params = {} - if 'id' in local_var_params: - path_params['id'] = local_var_params['id'] # noqa: E501 + if "id" in local_var_params: + path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] @@ -129,27 +127,32 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/projects/{id}', 'GET', + "/v1/projects/{id}", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ProjectResponse', # noqa: E501 + response_type="ProjectResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) def retrieve_projects(self, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 @@ -173,7 +176,7 @@ def retrieve_projects(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs['_return_http_data_only'] = True + kwargs["_return_http_data_only"] = True return self.retrieve_projects_with_http_info(**kwargs) # noqa: E501 def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 @@ -203,34 +206,34 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = [ - 'page' - ] + all_params = ["page"] all_params.extend( [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' + "async_req", + "_return_http_data_only", + "_preload_content", + "_request_timeout", ] ) - for key, val in six.iteritems(local_var_params['kwargs']): + for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method retrieve_projects" % key ) local_var_params[key] = val - del local_var_params['kwargs'] + del local_var_params["kwargs"] collection_formats = {} path_params = {} query_params = [] - if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 - query_params.append(('page', local_var_params['page'])) # noqa: E501 + if ( + "page" in local_var_params and local_var_params["page"] is not None + ): # noqa: E501 + query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} @@ -239,24 +242,29 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 # Authentication setting - auth_settings = ['bearer_auth'] # noqa: E501 + auth_settings = ["bearer_auth"] # noqa: E501 return self.api_client.call_api( - '/v1/projects', 'GET', + "/v1/projects", + "GET", path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='ProjectListResponse', # noqa: E501 + response_type="ProjectListResponse", # noqa: E501 auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + async_req=local_var_params.get("async_req"), + _return_http_data_only=local_var_params.get( + "_return_http_data_only" + ), # noqa: E501 + _preload_content=local_var_params.get("_preload_content", True), + _request_timeout=local_var_params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 54fcc67..8b2f58b 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -55,19 +55,25 @@ class ApiClient(object): PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int if six.PY3 else long, # noqa: F821 - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, + "int": int, + "long": int if six.PY3 else long, # noqa: F821 + "float": float, + "str": str, + "bool": bool, + "date": datetime.date, + "datetime": datetime.datetime, + "object": object, } _pool = None - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=1): + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None, + pool_threads=1, + ): if configuration is None: configuration = Configuration.get_default_copy() self.configuration = configuration @@ -79,7 +85,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.user_agent = "OpenAPI-Generator/1.0.0/python" self.client_side_validation = configuration.client_side_validation def __enter__(self): @@ -93,7 +99,7 @@ def close(self): self._pool.close() self._pool.join() self._pool = None - if hasattr(atexit, 'unregister'): + if hasattr(atexit, "unregister"): atexit.unregister(self.close) @property @@ -109,21 +115,33 @@ def pool(self): @property def user_agent(self): """User agent for this API client""" - return self.default_headers['User-Agent'] + return self.default_headers["User-Agent"] @user_agent.setter def user_agent(self, value): - self.default_headers['User-Agent'] = value + self.default_headers["User-Agent"] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + _host=None, + ): config = self.configuration @@ -131,36 +149,33 @@ def __call_api( header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params['Cookie'] = self.cookie + header_params["Cookie"] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params, collection_formats) + ) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples(path_params, collection_formats) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) + "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) ) # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) + query_params = self.parameters_to_tuples(query_params, collection_formats) # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) + post_params = self.parameters_to_tuples(post_params, collection_formats) post_params.extend(self.files_parameters(files)) # auth setting @@ -180,15 +195,20 @@ def __call_api( try: # perform request and return response response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, + method, + url, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout) + _request_timeout=_request_timeout, + ) except ApiException as e: - e.body = e.body.decode('utf-8') if six.PY3 else e.body + e.body = e.body.decode("utf-8") if six.PY3 else e.body raise e - content_type = response_data.getheader('content-type') + content_type = response_data.getheader("content-type") self.last_response = response_data @@ -211,10 +231,9 @@ def __call_api( return_data = None if _return_http_data_only: - return (return_data) + return return_data else: - return (return_data, response_data.status, - response_data.getheaders()) + return (return_data, response_data.status, response_data.getheaders()) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -235,11 +254,9 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] + return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) + return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -251,12 +268,16 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.openapi_types) - if getattr(obj, attr) is not None} + obj_dict = { + obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None + } - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} + return { + key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict) + } def deserialize(self, response, response_type): """Deserializes response into an object. @@ -292,15 +313,15 @@ def __deserialize(self, data, klass): return None if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match(r'list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] + if klass.startswith("list["): + sub_kls = re.match(r"list\[(.*)\]", klass).group(1) + return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - if klass.startswith('dict('): - sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} + if klass.startswith("dict("): + sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2) + return { + k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data) + } # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -319,12 +340,25 @@ def __deserialize(self, data, klass): else: return self.__deserialize_model(data, klass) - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + def call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + async_req=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + _host=None, + ): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -362,79 +396,120 @@ def call_api(self, resource_path, method, then the method will return the response directly. """ if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) - - return self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, - query_params, - header_params, body, - post_params, files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host)) - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): + return self.__call_api( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ) + + return self.pool.apply_async( + self.__call_api, + ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ), + ) + + def request( + self, + method, + url, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.GET( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.HEAD( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + return self.rest_client.OPTIONS( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + ) elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.POST( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PUT( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PATCH( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.DELETE( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) else: raise ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," @@ -451,22 +526,23 @@ def parameters_to_tuples(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + for k, v in ( + six.iteritems(params) if isinstance(params, dict) else params + ): # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] - if collection_format == 'multi': + if collection_format == "multi": new_params.extend((k, value) for value in v) else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' + if collection_format == "ssv": + delimiter = " " + elif collection_format == "tsv": + delimiter = "\t" + elif collection_format == "pipes": + delimiter = "|" else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) + delimiter = "," + new_params.append((k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -485,13 +561,14 @@ def files_parameters(self, files=None): continue file_names = v if type(v) is list else [v] for n in file_names: - with open(n, 'rb') as f: + with open(n, "rb") as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = ( + mimetypes.guess_type(filename)[0] + or "application/octet-stream" + ) + params.append(tuple([k, tuple([filename, filedata, mimetype])])) return params @@ -506,10 +583,10 @@ def select_header_accept(self, accepts): accepts = [x.lower() for x in accepts] - if 'application/json' in accepts: - return 'application/json' + if "application/json" in accepts: + return "application/json" else: - return ', '.join(accepts) + return ", ".join(accepts) def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -518,12 +595,12 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return 'application/json' + return "application/json" content_types = [x.lower() for x in content_types] - if 'application/json' in content_types or '*/*' in content_types: - return 'application/json' + if "application/json" in content_types or "*/*" in content_types: + return "application/json" else: return content_types[0] @@ -540,15 +617,15 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) + if auth_setting["in"] == "cookie": + headers["Cookie"] = auth_setting["value"] + elif auth_setting["in"] == "header": + headers[auth_setting["key"]] = auth_setting["value"] + elif auth_setting["in"] == "query": + querys.append((auth_setting["key"], auth_setting["value"])) else: raise ApiValueError( - 'Authentication token must be in `query` or `header`' + "Authentication token must be in `query` or `header`" ) def __deserialize_file(self, response): @@ -566,8 +643,9 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) + filename = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition + ).group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -609,8 +687,7 @@ def __deserialize_date(self, string): return string except ValueError: raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) + status=0, reason="Failed to parse `{0}` as date object".format(string) ) def __deserialize_datetime(self, string): @@ -628,10 +705,7 @@ def __deserialize_datetime(self, string): except ValueError: raise rest.ApiException( status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) + reason=("Failed to parse `{0}` as datetime object".format(string)), ) def __deserialize_model(self, data, klass): @@ -642,17 +716,21 @@ def __deserialize_model(self, data, klass): :return: model object. """ has_discriminator = False - if (hasattr(klass, 'get_real_child_model') - and klass.discriminator_value_class_map): + if ( + hasattr(klass, "get_real_child_model") + and klass.discriminator_value_class_map + ): has_discriminator = True if not klass.openapi_types and has_discriminator is False: return data kwargs = {} - if (data is not None and - klass.openapi_types is not None and - isinstance(data, (list, dict))): + if ( + data is not None + and klass.openapi_types is not None + and isinstance(data, (list, dict)) + ): for attr, attr_type in six.iteritems(klass.openapi_types): if klass.attribute_map[attr] in data: value = data[klass.attribute_map[attr]] diff --git a/patch_api/configuration.py b/patch_api/configuration.py index 036f1bb..ce2baf4 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -56,11 +56,15 @@ class Configuration(object): _default = None - def __init__(self, host="https://api.usepatch.com", - api_key=None, api_key_prefix=None, - username=None, password=None, - discard_unknown_keys=False, - ): + def __init__( + self, + host="https://api.usepatch.com", + api_key=None, + api_key_prefix=None, + username=None, + password=None, + discard_unknown_keys=False, + ): """Constructor """ self.host = host @@ -98,7 +102,7 @@ def __init__(self, host="https://api.usepatch.com", """ self.logger["package_logger"] = logging.getLogger("patch_api") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' + self.logger_format = "%(asctime)s %(levelname)s %(message)s" """Log format """ self.logger_stream_handler = None @@ -146,7 +150,7 @@ def __init__(self, host="https://api.usepatch.com", self.proxy_headers = None """Proxy headers """ - self.safe_chars_for_path_param = '' + self.safe_chars_for_path_param = "" """Safe chars for path_param """ self.retries = None @@ -160,7 +164,7 @@ def __deepcopy__(self, memo): result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): + if k not in ("logger", "logger_file_handler"): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) @@ -309,9 +313,9 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') + return urllib3.util.make_headers(basic_auth=username + ":" + password).get( + "authorization" + ) def auth_settings(self): """Gets Auth Settings dict for api client. @@ -320,11 +324,11 @@ def auth_settings(self): """ auth = {} if self.access_token is not None: - auth['bearer_auth'] = { - 'type': 'bearer', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token + auth["bearer_auth"] = { + "type": "bearer", + "in": "header", + "key": "Authorization", + "value": "Bearer " + self.access_token, } return auth @@ -333,12 +337,13 @@ def to_debug_report(self): :return: The report for debugging. """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: v1\n"\ - "SDK Package Version: 1.0.0".\ - format(env=sys.platform, pyversion=sys.version) + return ( + "Python SDK Debug Report:\n" + "OS: {env}\n" + "Python Version: {pyversion}\n" + "Version of the API: v1\n" + "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) + ) def get_host_settings(self): """Gets an array of host settings @@ -347,14 +352,14 @@ def get_host_settings(self): """ return [ { - 'url': "https://{defaultHost}", - 'description': "No description provided", - 'variables': { - 'defaultHost': { - 'description': "No description provided", - 'default_value': "api.usepatch.com", - } + "url": "https://{defaultHost}", + "description": "No description provided", + "variables": { + "defaultHost": { + "description": "No description provided", + "default_value": "api.usepatch.com", } + }, } ] @@ -372,22 +377,22 @@ def get_host_from_settings(self, index, variables=None): except IndexError: raise ValueError( "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) + "Must be less than {1}".format(index, len(servers)) + ) - url = server['url'] + url = server["url"] # go through variables and replace placeholders - for variable_name, variable in server['variables'].items(): - used_value = variables.get( - variable_name, variable['default_value']) + for variable_name, variable in server["variables"].items(): + used_value = variables.get(variable_name, variable["default_value"]) - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: + if "enum_values" in variable and used_value not in variable["enum_values"]: raise ValueError( "The variable `{0}` in the host URL has invalid value " "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) + variable_name, variables[variable_name], variable["enum_values"] + ) + ) url = url.replace("{" + variable_name + "}", used_value) diff --git a/patch_api/exceptions.py b/patch_api/exceptions.py index e2bd822..fc75982 100644 --- a/patch_api/exceptions.py +++ b/patch_api/exceptions.py @@ -19,8 +19,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): + def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): """ Raises an exception for TypeErrors Args: @@ -83,7 +82,6 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status @@ -98,11 +96,9 @@ def __init__(self, status=None, reason=None, http_resp=None): def __str__(self): """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) + error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) + error_message += "HTTP response headers: {0}\n".format(self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index e6eccd2..1c6e8de 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -38,6 +38,9 @@ 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.organization import Organization +from patch_api.models.organization_list_response import OrganizationListResponse +from patch_api.models.organization_response import OrganizationResponse from patch_api.models.photo import Photo from patch_api.models.photo_response import PhotoResponse from patch_api.models.preference import Preference diff --git a/patch_api/models/allocation.py b/patch_api/models/allocation.py index e37d829..b6629ae 100644 --- a/patch_api/models/allocation.py +++ b/patch_api/models/allocation.py @@ -33,19 +33,13 @@ class Allocation(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'str', - 'production': 'bool', - 'mass_g': 'int' - } - - attribute_map = { - 'id': 'id', - 'production': 'production', - 'mass_g': 'mass_g' - } - - def __init__(self, id=None, production=None, mass_g=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"id": "str", "production": "bool", "mass_g": "int"} + + attribute_map = {"id": "id", "production": "production", "mass_g": "mass_g"} + + def __init__( + self, id=None, production=None, mass_g=None, local_vars_configuration=None + ): # noqa: E501 """Allocation - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -80,7 +74,9 @@ def id(self, id): :param id: The id of this Allocation. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -105,8 +101,12 @@ def production(self, production): :param production: The production of this Allocation. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -130,8 +130,12 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Allocation. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 self._mass_g = mass_g @@ -142,18 +146,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_mass_estimate_request.py b/patch_api/models/create_mass_estimate_request.py index 06ccc2f..20da476 100644 --- a/patch_api/models/create_mass_estimate_request.py +++ b/patch_api/models/create_mass_estimate_request.py @@ -33,17 +33,13 @@ class CreateMassEstimateRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'mass_g': 'int', - 'project_id': 'str' - } + openapi_types = {"mass_g": "int", "project_id": "str"} - attribute_map = { - 'mass_g': 'mass_g', - 'project_id': 'project_id' - } + attribute_map = {"mass_g": "mass_g", "project_id": "project_id"} - def __init__(self, mass_g=None, project_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, mass_g=None, project_id=None, local_vars_configuration=None + ): # noqa: E501 """CreateMassEstimateRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -75,14 +71,28 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateMassEstimateRequest. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 1): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._mass_g = mass_g @@ -114,18 +124,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_membership_request.py b/patch_api/models/create_membership_request.py index 23f36ae..4c340d1 100644 --- a/patch_api/models/create_membership_request.py +++ b/patch_api/models/create_membership_request.py @@ -33,19 +33,17 @@ class CreateMembershipRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'email': 'str', - 'role': 'str', - 'organization_id': 'str' - } + openapi_types = {"email": "str", "role": "str", "organization_id": "str"} attribute_map = { - 'email': 'email', - 'role': 'role', - 'organization_id': 'organization_id' + "email": "email", + "role": "role", + "organization_id": "organization_id", } - def __init__(self, email=None, role=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, email=None, role=None, organization_id=None, local_vars_configuration=None + ): # noqa: E501 """CreateMembershipRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -103,10 +101,14 @@ def role(self, role): :type: str """ allowed_values = ["admin", "developer", "member"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and role not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 - .format(role, allowed_values) + "Invalid value for `role` ({0}), must be one of {1}".format( # noqa: E501 + role, allowed_values + ) ) self._role = role @@ -139,18 +141,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_offset_request.py b/patch_api/models/create_offset_request.py index dd77842..add2d21 100644 --- a/patch_api/models/create_offset_request.py +++ b/patch_api/models/create_offset_request.py @@ -34,22 +34,30 @@ class CreateOffsetRequest(object): and the value is json key in definition. """ openapi_types = { - 'mass_g': 'int', - 'price_cents_usd': 'int', - 'project_id': 'str', - 'vintage_year': 'int', - 'serial_number': 'str' + "mass_g": "int", + "price_cents_usd": "int", + "project_id": "str", + "vintage_year": "int", + "serial_number": "str", } attribute_map = { - 'mass_g': 'mass_g', - 'price_cents_usd': 'price_cents_usd', - 'project_id': 'project_id', - 'vintage_year': 'vintage_year', - 'serial_number': 'serial_number' + "mass_g": "mass_g", + "price_cents_usd": "price_cents_usd", + "project_id": "project_id", + "vintage_year": "vintage_year", + "serial_number": "serial_number", } - def __init__(self, mass_g=None, price_cents_usd=None, project_id=None, vintage_year=None, serial_number=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + mass_g=None, + price_cents_usd=None, + project_id=None, + vintage_year=None, + serial_number=None, + local_vars_configuration=None, + ): # noqa: E501 """CreateOffsetRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -90,12 +98,22 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateOffsetRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 1000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 1): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 1000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `1000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._mass_g = mass_g @@ -117,9 +135,14 @@ def price_cents_usd(self, price_cents_usd): :param price_cents_usd: The price_cents_usd of this CreateOffsetRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - price_cents_usd is not None and price_cents_usd < 1): # noqa: E501 - raise ValueError("Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and price_cents_usd is not None + and price_cents_usd < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._price_cents_usd = price_cents_usd @@ -193,18 +216,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py index 794ff86..07eb92e 100644 --- a/patch_api/models/create_order_request.py +++ b/patch_api/models/create_order_request.py @@ -34,20 +34,27 @@ class CreateOrderRequest(object): and the value is json key in definition. """ openapi_types = { - 'mass_g': 'int', - 'total_price_cents_usd': 'int', - 'project_id': 'str', - 'metadata': 'object' + "mass_g": "int", + "total_price_cents_usd": "int", + "project_id": "str", + "metadata": "object", } attribute_map = { - 'mass_g': 'mass_g', - 'total_price_cents_usd': 'total_price_cents_usd', - 'project_id': 'project_id', - 'metadata': 'metadata' + "mass_g": "mass_g", + "total_price_cents_usd": "total_price_cents_usd", + "project_id": "project_id", + "metadata": "metadata", } - def __init__(self, mass_g=None, total_price_cents_usd=None, project_id=None, metadata=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + mass_g=None, + total_price_cents_usd=None, + project_id=None, + metadata=None, + local_vars_configuration=None, + ): # noqa: E501 """CreateOrderRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -86,12 +93,22 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this CreateOrderRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 1): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._mass_g = mass_g @@ -113,9 +130,14 @@ def total_price_cents_usd(self, total_price_cents_usd): :param total_price_cents_usd: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - total_price_cents_usd is not None and total_price_cents_usd < 1): # noqa: E501 - raise ValueError("Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and total_price_cents_usd is not None + and total_price_cents_usd < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._total_price_cents_usd = total_price_cents_usd @@ -168,18 +190,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_organization_request.py b/patch_api/models/create_organization_request.py index 316dc30..a58e4f4 100644 --- a/patch_api/models/create_organization_request.py +++ b/patch_api/models/create_organization_request.py @@ -33,17 +33,13 @@ class CreateOrganizationRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'name': 'str', - 'type': 'str' - } + openapi_types = {"name": "str", "type": "str"} - attribute_map = { - 'name': 'name', - 'type': 'type' - } + attribute_map = {"name": "name", "type": "type"} - def __init__(self, name=None, type=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, name=None, type=None, local_vars_configuration=None + ): # noqa: E501 """CreateOrganizationRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -74,8 +70,12 @@ def name(self, name): :param name: The name of this CreateOrganizationRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and name is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 self._name = name @@ -97,13 +97,21 @@ def type(self, type): :param type: The type of this CreateOrganizationRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `type`, must not be `None`" + ) # noqa: E501 allowed_values = ["consumer", "supplier"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and type not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 + type, allowed_values + ) ) self._type = type @@ -115,18 +123,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_photo_request.py b/patch_api/models/create_photo_request.py index cf256ca..290ca1d 100644 --- a/patch_api/models/create_photo_request.py +++ b/patch_api/models/create_photo_request.py @@ -33,19 +33,17 @@ class CreatePhotoRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'project_id': 'str', - 'url': 'str', - 'sort_order': 'int' - } + openapi_types = {"project_id": "str", "url": "str", "sort_order": "int"} attribute_map = { - 'project_id': 'project_id', - 'url': 'url', - 'sort_order': 'sort_order' + "project_id": "project_id", + "url": "url", + "sort_order": "sort_order", } - def __init__(self, project_id=None, url=None, sort_order=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, project_id=None, url=None, sort_order=None, local_vars_configuration=None + ): # noqa: E501 """CreatePhotoRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -79,8 +77,12 @@ def project_id(self, project_id): :param project_id: The project_id of this CreatePhotoRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 - raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and project_id is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `project_id`, must not be `None`" + ) # noqa: E501 self._project_id = project_id @@ -102,8 +104,12 @@ def url(self, url): :param url: The url of this CreatePhotoRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 - raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and url is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `url`, must not be `None`" + ) # noqa: E501 self._url = url @@ -135,18 +141,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_preference_request.py b/patch_api/models/create_preference_request.py index 8abb43d..d5e14a4 100644 --- a/patch_api/models/create_preference_request.py +++ b/patch_api/models/create_preference_request.py @@ -33,13 +33,9 @@ class CreatePreferenceRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'project_id': 'str' - } + openapi_types = {"project_id": "str"} - attribute_map = { - 'project_id': 'project_id' - } + attribute_map = {"project_id": "project_id"} def __init__(self, project_id=None, local_vars_configuration=None): # noqa: E501 """CreatePreferenceRequest - a model defined in OpenAPI""" # noqa: E501 @@ -70,8 +66,12 @@ def project_id(self, project_id): :param project_id: The project_id of this CreatePreferenceRequest. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 - raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and project_id is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `project_id`, must not be `None`" + ) # noqa: E501 self._project_id = project_id @@ -82,18 +82,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/create_project_request.py b/patch_api/models/create_project_request.py index 39fe7ba..0fc59bc 100644 --- a/patch_api/models/create_project_request.py +++ b/patch_api/models/create_project_request.py @@ -34,34 +34,48 @@ class CreateProjectRequest(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str', - 'description': 'str', - 'country': 'str', - 'state': 'str', - 'verifier': 'str', - 'type': 'str', - 'standard_type': 'str', - 'longitude': 'str', - 'latitude': 'str', - 'production': 'str', - 'organization_id': 'str' + "name": "str", + "description": "str", + "country": "str", + "state": "str", + "verifier": "str", + "type": "str", + "standard_type": "str", + "longitude": "str", + "latitude": "str", + "production": "str", + "organization_id": "str", } attribute_map = { - 'name': 'name', - 'description': 'description', - 'country': 'country', - 'state': 'state', - 'verifier': 'verifier', - 'type': 'type', - 'standard_type': 'standard_type', - 'longitude': 'longitude', - 'latitude': 'latitude', - 'production': 'production', - 'organization_id': 'organization_id' + "name": "name", + "description": "description", + "country": "country", + "state": "state", + "verifier": "verifier", + "type": "type", + "standard_type": "standard_type", + "longitude": "longitude", + "latitude": "latitude", + "production": "production", + "organization_id": "organization_id", } - def __init__(self, name=None, description=None, country=None, state=None, verifier=None, type=None, standard_type=None, longitude=None, latitude=None, production=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + name=None, + description=None, + country=None, + state=None, + verifier=None, + type=None, + standard_type=None, + longitude=None, + latitude=None, + production=None, + organization_id=None, + local_vars_configuration=None, + ): # noqa: E501 """CreateProjectRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -162,11 +176,265 @@ def country(self, country): :param country: The country of this CreateProjectRequest. # noqa: E501 :type: str """ - allowed_values = ["TJ", "JM", "HT", "ST", "MS", "AE", "PK", "NL", "LU", "BZ", "IR", "BO", "UY", "GH", "SA", "CI", "MF", "TF", "AI", "QA", "SX", "LY", "BV", "PG", "KG", "GQ", "EH", "NU", "PR", "GD", "KR", "HM", "SM", "SL", "CD", "MK", "TR", "DZ", "GE", "PS", "BB", "UA", "GP", "PF", "NA", "BW", "SY", "TG", "DO", "AQ", "CH", "MG", "FO", "VG", "GI", "BN", "LA", "IS", "EE", "UM", "LT", "RS", "MR", "AD", "HU", "TK", "MY", "AO", "CV", "NF", "PA", "GW", "BE", "PT", "GB", "IM", "US", "YE", "HK", "AZ", "CC", "ML", "SK", "VU", "TL", "HR", "SR", "MU", "CZ", "PM", "LS", "WS", "KM", "IT", "BI", "WF", "GN", "SG", "CO", "CN", "AW", "MA", "FI", "VA", "ZW", "KY", "BH", "PY", "EC", "LR", "RU", "PL", "OM", "MT", "SS", "DE", "TM", "SJ", "MM", "TT", "IL", "BD", "NR", "LK", "UG", "NG", "BQ", "MX", "CW", "SI", "MN", "CA", "AX", "VN", "TW", "JP", "IO", "RO", "BG", "GU", "BR", "AM", "ZM", "DJ", "JE", "AT", "CM", "SE", "FJ", "KZ", "GL", "GY", "CX", "MW", "TN", "ZA", "TO", "CY", "MV", "PN", "RW", "NI", "KN", "BJ", "ET", "GM", "TZ", "VC", "FK", "SD", "MC", "AU", "CL", "DK", "FR", "TC", "CU", "AL", "MZ", "BS", "NE", "GT", "LI", "NP", "BF", "PW", "KW", "IN", "GA", "TV", "MO", "SH", "MD", "CK", "AR", "SC", "IE", "ES", "LB", "BM", "RE", "KI", "AG", "MQ", "SV", "JO", "TH", "SO", "MH", "CG", "KP", "GF", "BA", "YT", "GS", "KE", "PE", "BT", "SZ", "CR", "TD", "DM", "NC", "GR", "GG", "HN", "VI", "CF", "SN", "AF", "MP", "PH", "BY", "LV", "NO", "EG", "KH", "IQ", "LC", "NZ", "BL", "UZ", "ID", "ER", "VE", "FM", "SB", "ME", "AS"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and country not in allowed_values: # noqa: E501 + allowed_values = [ + "TJ", + "JM", + "HT", + "ST", + "MS", + "AE", + "PK", + "NL", + "LU", + "BZ", + "IR", + "BO", + "UY", + "GH", + "SA", + "CI", + "MF", + "TF", + "AI", + "QA", + "SX", + "LY", + "BV", + "PG", + "KG", + "GQ", + "EH", + "NU", + "PR", + "GD", + "KR", + "HM", + "SM", + "SL", + "CD", + "MK", + "TR", + "DZ", + "GE", + "PS", + "BB", + "UA", + "GP", + "PF", + "NA", + "BW", + "SY", + "TG", + "DO", + "AQ", + "CH", + "MG", + "FO", + "VG", + "GI", + "BN", + "LA", + "IS", + "EE", + "UM", + "LT", + "RS", + "MR", + "AD", + "HU", + "TK", + "MY", + "AO", + "CV", + "NF", + "PA", + "GW", + "BE", + "PT", + "GB", + "IM", + "US", + "YE", + "HK", + "AZ", + "CC", + "ML", + "SK", + "VU", + "TL", + "HR", + "SR", + "MU", + "CZ", + "PM", + "LS", + "WS", + "KM", + "IT", + "BI", + "WF", + "GN", + "SG", + "CO", + "CN", + "AW", + "MA", + "FI", + "VA", + "ZW", + "KY", + "BH", + "PY", + "EC", + "LR", + "RU", + "PL", + "OM", + "MT", + "SS", + "DE", + "TM", + "SJ", + "MM", + "TT", + "IL", + "BD", + "NR", + "LK", + "UG", + "NG", + "BQ", + "MX", + "CW", + "SI", + "MN", + "CA", + "AX", + "VN", + "TW", + "JP", + "IO", + "RO", + "BG", + "GU", + "BR", + "AM", + "ZM", + "DJ", + "JE", + "AT", + "CM", + "SE", + "FJ", + "KZ", + "GL", + "GY", + "CX", + "MW", + "TN", + "ZA", + "TO", + "CY", + "MV", + "PN", + "RW", + "NI", + "KN", + "BJ", + "ET", + "GM", + "TZ", + "VC", + "FK", + "SD", + "MC", + "AU", + "CL", + "DK", + "FR", + "TC", + "CU", + "AL", + "MZ", + "BS", + "NE", + "GT", + "LI", + "NP", + "BF", + "PW", + "KW", + "IN", + "GA", + "TV", + "MO", + "SH", + "MD", + "CK", + "AR", + "SC", + "IE", + "ES", + "LB", + "BM", + "RE", + "KI", + "AG", + "MQ", + "SV", + "JO", + "TH", + "SO", + "MH", + "CG", + "KP", + "GF", + "BA", + "YT", + "GS", + "KE", + "PE", + "BT", + "SZ", + "CR", + "TD", + "DM", + "NC", + "GR", + "GG", + "HN", + "VI", + "CF", + "SN", + "AF", + "MP", + "PH", + "BY", + "LV", + "NO", + "EG", + "KH", + "IQ", + "LC", + "NZ", + "BL", + "UZ", + "ID", + "ER", + "VE", + "FM", + "SB", + "ME", + "AS", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and country not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `country` ({0}), must be one of {1}" # noqa: E501 - .format(country, allowed_values) + "Invalid value for `country` ({0}), must be one of {1}".format( # noqa: E501 + country, allowed_values + ) ) self._country = country @@ -231,11 +499,22 @@ def type(self, type): :param type: The type of this CreateProjectRequest. # noqa: E501 :type: str """ - allowed_values = ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + allowed_values = [ + "biomass", + "dac", + "forestry", + "mineralization", + "ocean", + "soil", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and type not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 + type, allowed_values + ) ) self._type = type @@ -258,11 +537,20 @@ def standard_type(self, standard_type): :param standard_type: The standard_type of this CreateProjectRequest. # noqa: E501 :type: str """ - allowed_values = ["american_carbon_registry", "climate_action_reserve", "verified_carbon_standard", "european_biochar_certificate"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and standard_type not in allowed_values: # noqa: E501 + allowed_values = [ + "american_carbon_registry", + "climate_action_reserve", + "verified_carbon_standard", + "european_biochar_certificate", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and standard_type not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `standard_type` ({0}), must be one of {1}" # noqa: E501 - .format(standard_type, allowed_values) + "Invalid value for `standard_type` ({0}), must be one of {1}".format( # noqa: E501 + standard_type, allowed_values + ) ) self._standard_type = standard_type @@ -358,18 +646,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/error_response.py b/patch_api/models/error_response.py index efb6ee8..8303054 100644 --- a/patch_api/models/error_response.py +++ b/patch_api/models/error_response.py @@ -33,19 +33,13 @@ class ErrorResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'object' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "object"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """ErrorResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this ErrorResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -101,8 +99,12 @@ def error(self, error): :param error: The error of this ErrorResponse. # noqa: E501 :type: object """ - if self.local_vars_configuration.client_side_validation and error is None: # noqa: E501 - raise ValueError("Invalid value for `error`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and error is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `error`, must not be `None`" + ) # noqa: E501 self._error = error @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/estimate.py b/patch_api/models/estimate.py index 6acc285..b64185f 100644 --- a/patch_api/models/estimate.py +++ b/patch_api/models/estimate.py @@ -33,21 +33,23 @@ class Estimate(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'str', - 'production': 'bool', - 'type': 'str', - 'order': 'Order' - } + openapi_types = {"id": "str", "production": "bool", "type": "str", "order": "Order"} attribute_map = { - 'id': 'id', - 'production': 'production', - 'type': 'type', - 'order': 'order' + "id": "id", + "production": "production", + "type": "type", + "order": "order", } - def __init__(self, id=None, production=None, type=None, order=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + production=None, + type=None, + order=None, + local_vars_configuration=None, + ): # noqa: E501 """Estimate - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -84,7 +86,9 @@ def id(self, id): :param id: The id of this Estimate. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -109,8 +113,12 @@ def production(self, production): :param production: The production of this Estimate. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -134,8 +142,12 @@ def type(self, type): :param type: The type of this Estimate. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `type`, must not be `None`" + ) # noqa: E501 self._type = type @@ -169,18 +181,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/estimate_list_response.py b/patch_api/models/estimate_list_response.py index 1b42b43..ccb0a68 100644 --- a/patch_api/models/estimate_list_response.py +++ b/patch_api/models/estimate_list_response.py @@ -34,20 +34,27 @@ class EstimateListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Estimate]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Estimate]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """EstimateListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this EstimateListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this EstimateListResponse. # noqa: E501 :type: list[Estimate] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this EstimateListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/estimate_response.py b/patch_api/models/estimate_response.py index bee841e..f15ac7c 100644 --- a/patch_api/models/estimate_response.py +++ b/patch_api/models/estimate_response.py @@ -33,19 +33,13 @@ class EstimateResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Estimate' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Estimate"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """EstimateResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this EstimateResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this EstimateResponse. # noqa: E501 :type: Estimate """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/fulfill_offset_request.py b/patch_api/models/fulfill_offset_request.py index e3a3933..5348347 100644 --- a/patch_api/models/fulfill_offset_request.py +++ b/patch_api/models/fulfill_offset_request.py @@ -33,13 +33,9 @@ class FulfillOffsetRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'serial_number': 'str' - } + openapi_types = {"serial_number": "str"} - attribute_map = { - 'serial_number': 'serial_number' - } + attribute_map = {"serial_number": "serial_number"} def __init__(self, serial_number=None, local_vars_configuration=None): # noqa: E501 """FulfillOffsetRequest - a model defined in OpenAPI""" # noqa: E501 @@ -80,18 +76,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/membership.py b/patch_api/models/membership.py index 43669f2..16d18ca 100644 --- a/patch_api/models/membership.py +++ b/patch_api/models/membership.py @@ -33,19 +33,17 @@ class Membership(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'email': 'str', - 'role': 'str', - 'organization_id': 'str' - } + openapi_types = {"email": "str", "role": "str", "organization_id": "str"} attribute_map = { - 'email': 'email', - 'role': 'role', - 'organization_id': 'organization_id' + "email": "email", + "role": "role", + "organization_id": "organization_id", } - def __init__(self, email=None, role=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, email=None, role=None, organization_id=None, local_vars_configuration=None + ): # noqa: E501 """Membership - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +76,12 @@ def email(self, email): :param email: The email of this Membership. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501 - raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and email is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `email`, must not be `None`" + ) # noqa: E501 self._email = email @@ -101,13 +103,21 @@ def role(self, role): :param role: The role of this Membership. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and role is None: # noqa: E501 - raise ValueError("Invalid value for `role`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and role is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `role`, must not be `None`" + ) # noqa: E501 allowed_values = ["admin", "developer", "member"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and role not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 - .format(role, allowed_values) + "Invalid value for `role` ({0}), must be one of {1}".format( # noqa: E501 + role, allowed_values + ) ) self._role = role @@ -130,8 +140,13 @@ def organization_id(self, organization_id): :param organization_id: The organization_id of this Membership. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and organization_id is None: # noqa: E501 - raise ValueError("Invalid value for `organization_id`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and organization_id is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `organization_id`, must not be `None`" + ) # noqa: E501 self._organization_id = organization_id @@ -142,18 +157,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/membership_response.py b/patch_api/models/membership_response.py index 912c499..acc380c 100644 --- a/patch_api/models/membership_response.py +++ b/patch_api/models/membership_response.py @@ -33,19 +33,13 @@ class MembershipResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Membership]' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "list[Membership]"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """MembershipResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this MembershipResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this MembershipResponse. # noqa: E501 :type: list[Membership] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/meta_index_object.py b/patch_api/models/meta_index_object.py index 5de83d5..cbc5313 100644 --- a/patch_api/models/meta_index_object.py +++ b/patch_api/models/meta_index_object.py @@ -33,17 +33,13 @@ class MetaIndexObject(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'prev_page': 'int', - 'next_page': 'int' - } + openapi_types = {"prev_page": "int", "next_page": "int"} - attribute_map = { - 'prev_page': 'prev_page', - 'next_page': 'next_page' - } + attribute_map = {"prev_page": "prev_page", "next_page": "next_page"} - def __init__(self, prev_page=None, next_page=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, prev_page=None, next_page=None, local_vars_configuration=None + ): # noqa: E501 """MetaIndexObject - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -105,18 +101,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/offset.py b/patch_api/models/offset.py index a7381a2..b01630f 100644 --- a/patch_api/models/offset.py +++ b/patch_api/models/offset.py @@ -34,34 +34,48 @@ class Offset(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'allocated_mass_g': 'int', - 'fulfilled_at': 'str', - 'fulfillment_state': 'str', - 'mass_g': 'int', - 'price_cents_usd': 'str', - 'production': 'bool', - 'retired': 'bool', - 'serial_number': 'str', - 'vintage_year': 'int', - 'project_id': 'str' + "id": "str", + "allocated_mass_g": "int", + "fulfilled_at": "str", + "fulfillment_state": "str", + "mass_g": "int", + "price_cents_usd": "str", + "production": "bool", + "retired": "bool", + "serial_number": "str", + "vintage_year": "int", + "project_id": "str", } attribute_map = { - 'id': 'id', - 'allocated_mass_g': 'allocated_mass_g', - 'fulfilled_at': 'fulfilled_at', - 'fulfillment_state': 'fulfillment_state', - 'mass_g': 'mass_g', - 'price_cents_usd': 'price_cents_usd', - 'production': 'production', - 'retired': 'retired', - 'serial_number': 'serial_number', - 'vintage_year': 'vintage_year', - 'project_id': 'project_id' + "id": "id", + "allocated_mass_g": "allocated_mass_g", + "fulfilled_at": "fulfilled_at", + "fulfillment_state": "fulfillment_state", + "mass_g": "mass_g", + "price_cents_usd": "price_cents_usd", + "production": "production", + "retired": "retired", + "serial_number": "serial_number", + "vintage_year": "vintage_year", + "project_id": "project_id", } - def __init__(self, id=None, allocated_mass_g=None, fulfilled_at=None, fulfillment_state=None, mass_g=None, price_cents_usd=None, production=None, retired=None, serial_number=None, vintage_year=None, project_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + allocated_mass_g=None, + fulfilled_at=None, + fulfillment_state=None, + mass_g=None, + price_cents_usd=None, + production=None, + retired=None, + serial_number=None, + vintage_year=None, + project_id=None, + local_vars_configuration=None, + ): # noqa: E501 """Offset - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -112,7 +126,9 @@ def id(self, id): :param id: The id of this Offset. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -137,14 +153,29 @@ def allocated_mass_g(self, allocated_mass_g): :param allocated_mass_g: The allocated_mass_g of this Offset. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and allocated_mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `allocated_mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - allocated_mass_g is not None and allocated_mass_g > 1000000000): # noqa: E501 - raise ValueError("Invalid value for `allocated_mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - allocated_mass_g is not None and allocated_mass_g < 0): # noqa: E501 - raise ValueError("Invalid value for `allocated_mass_g`, must be a value greater than or equal to `0`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocated_mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocated_mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocated_mass_g is not None + and allocated_mass_g > 1000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocated_mass_g`, must be a value less than or equal to `1000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocated_mass_g is not None + and allocated_mass_g < 0 + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocated_mass_g`, must be a value greater than or equal to `0`" + ) # noqa: E501 self._allocated_mass_g = allocated_mass_g @@ -191,13 +222,22 @@ def fulfillment_state(self, fulfillment_state): :param fulfillment_state: The fulfillment_state of this Offset. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and fulfillment_state is None: # noqa: E501 - raise ValueError("Invalid value for `fulfillment_state`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and fulfillment_state is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `fulfillment_state`, must not be `None`" + ) # noqa: E501 allowed_values = ["pending", "fulfilled"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and fulfillment_state not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and fulfillment_state not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `fulfillment_state` ({0}), must be one of {1}" # noqa: E501 - .format(fulfillment_state, allowed_values) + "Invalid value for `fulfillment_state` ({0}), must be one of {1}".format( # noqa: E501 + fulfillment_state, allowed_values + ) ) self._fulfillment_state = fulfillment_state @@ -222,14 +262,28 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Offset. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 1000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 1): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 1000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `1000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._mass_g = mass_g @@ -253,8 +307,13 @@ def price_cents_usd(self, price_cents_usd): :param price_cents_usd: The price_cents_usd of this Offset. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and price_cents_usd is None: # noqa: E501 - raise ValueError("Invalid value for `price_cents_usd`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and price_cents_usd is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `price_cents_usd`, must not be `None`" + ) # noqa: E501 self._price_cents_usd = price_cents_usd @@ -278,8 +337,12 @@ def production(self, production): :param production: The production of this Offset. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -301,8 +364,12 @@ def retired(self, retired): :param retired: The retired of this Offset. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and retired is None: # noqa: E501 - raise ValueError("Invalid value for `retired`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and retired is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `retired`, must not be `None`" + ) # noqa: E501 self._retired = retired @@ -347,8 +414,13 @@ def vintage_year(self, vintage_year): :param vintage_year: The vintage_year of this Offset. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and vintage_year is None: # noqa: E501 - raise ValueError("Invalid value for `vintage_year`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and vintage_year is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `vintage_year`, must not be `None`" + ) # noqa: E501 self._vintage_year = vintage_year @@ -370,8 +442,12 @@ def project_id(self, project_id): :param project_id: The project_id of this Offset. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and project_id is None: # noqa: E501 - raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and project_id is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `project_id`, must not be `None`" + ) # noqa: E501 self._project_id = project_id @@ -382,18 +458,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/offset_list_response.py b/patch_api/models/offset_list_response.py index 2b52d96..38b0da2 100644 --- a/patch_api/models/offset_list_response.py +++ b/patch_api/models/offset_list_response.py @@ -34,20 +34,27 @@ class OffsetListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Offset]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Offset]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """OffsetListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this OffsetListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this OffsetListResponse. # noqa: E501 :type: list[Offset] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this OffsetListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/offset_response.py b/patch_api/models/offset_response.py index 553dd6b..6fb7d69 100644 --- a/patch_api/models/offset_response.py +++ b/patch_api/models/offset_response.py @@ -33,19 +33,13 @@ class OffsetResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Offset' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Offset"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """OffsetResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this OffsetResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this OffsetResponse. # noqa: E501 :type: Offset """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/order.py b/patch_api/models/order.py index 32d052f..b27261c 100644 --- a/patch_api/models/order.py +++ b/patch_api/models/order.py @@ -34,30 +34,42 @@ class Order(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'mass_g': 'int', - 'production': 'bool', - 'state': 'str', - 'allocation_state': 'str', - 'price_cents_usd': 'str', - 'patch_fee_cents_usd': 'str', - 'allocations': 'list[Allocation]', - 'metadata': 'object' + "id": "str", + "mass_g": "int", + "production": "bool", + "state": "str", + "allocation_state": "str", + "price_cents_usd": "str", + "patch_fee_cents_usd": "str", + "allocations": "list[Allocation]", + "metadata": "object", } attribute_map = { - 'id': 'id', - 'mass_g': 'mass_g', - 'production': 'production', - 'state': 'state', - 'allocation_state': 'allocation_state', - 'price_cents_usd': 'price_cents_usd', - 'patch_fee_cents_usd': 'patch_fee_cents_usd', - 'allocations': 'allocations', - 'metadata': 'metadata' + "id": "id", + "mass_g": "mass_g", + "production": "production", + "state": "state", + "allocation_state": "allocation_state", + "price_cents_usd": "price_cents_usd", + "patch_fee_cents_usd": "patch_fee_cents_usd", + "allocations": "allocations", + "metadata": "metadata", } - def __init__(self, id=None, mass_g=None, production=None, state=None, allocation_state=None, price_cents_usd=None, patch_fee_cents_usd=None, allocations=None, metadata=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + mass_g=None, + production=None, + state=None, + allocation_state=None, + price_cents_usd=None, + patch_fee_cents_usd=None, + allocations=None, + metadata=None, + local_vars_configuration=None, + ): # noqa: E501 """Order - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -104,7 +116,9 @@ def id(self, id): :param id: The id of this Order. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -129,14 +143,28 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this Order. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must not be `None`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 2000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `2000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 1): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must not be `None`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 2000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._mass_g = mass_g @@ -160,8 +188,12 @@ def production(self, production): :param production: The production of this Order. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -185,13 +217,21 @@ def state(self, state): :param state: The state of this Order. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and state is None: # noqa: E501 - raise ValueError("Invalid value for `state`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and state is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `state`, must not be `None`" + ) # noqa: E501 allowed_values = ["draft", "placed", "complete", "cancelled"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and state not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and state not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 - .format(state, allowed_values) + "Invalid value for `state` ({0}), must be one of {1}".format( # noqa: E501 + state, allowed_values + ) ) self._state = state @@ -216,13 +256,22 @@ def allocation_state(self, allocation_state): :param allocation_state: The allocation_state of this Order. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and allocation_state is None: # noqa: E501 - raise ValueError("Invalid value for `allocation_state`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocation_state is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocation_state`, must not be `None`" + ) # noqa: E501 allowed_values = ["pending", "partially_allocated", "allocated"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and allocation_state not in allowed_values: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocation_state not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `allocation_state` ({0}), must be one of {1}" # noqa: E501 - .format(allocation_state, allowed_values) + "Invalid value for `allocation_state` ({0}), must be one of {1}".format( # noqa: E501 + allocation_state, allowed_values + ) ) self._allocation_state = allocation_state @@ -293,8 +342,12 @@ def allocations(self, allocations): :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 + 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 @@ -318,8 +371,12 @@ def metadata(self, metadata): :param metadata: The metadata of this Order. # noqa: E501 :type: object """ - if self.local_vars_configuration.client_side_validation and metadata is None: # noqa: E501 - raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and metadata is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `metadata`, must not be `None`" + ) # noqa: E501 self._metadata = metadata @@ -330,18 +387,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/order_list_response.py b/patch_api/models/order_list_response.py index d9c6b4c..a558841 100644 --- a/patch_api/models/order_list_response.py +++ b/patch_api/models/order_list_response.py @@ -34,20 +34,27 @@ class OrderListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Order]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Order]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """OrderListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this OrderListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this OrderListResponse. # noqa: E501 :type: list[Order] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this OrderListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/order_response.py b/patch_api/models/order_response.py index ffc9f94..971e9a1 100644 --- a/patch_api/models/order_response.py +++ b/patch_api/models/order_response.py @@ -33,19 +33,13 @@ class OrderResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Order' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Order"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """OrderResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this OrderResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this OrderResponse. # noqa: E501 :type: Order """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/organization.py b/patch_api/models/organization.py new file mode 100644 index 0000000..190ed70 --- /dev/null +++ b/patch_api/models/organization.py @@ -0,0 +1,218 @@ +# 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 Organization(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 = {"id": "str", "name": "str", "type": "str", "production": "bool"} + + attribute_map = { + "id": "id", + "name": "name", + "type": "type", + "production": "production", + } + + def __init__( + self, + id=None, + name=None, + type=None, + production=None, + local_vars_configuration=None, + ): # noqa: E501 + """Organization - 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._id = None + self._name = None + self._type = None + self._production = None + self.discriminator = None + + if id is not None: + self.id = id + self.name = name + self.type = type + self.production = production + + @property + def id(self): + """Gets the id of this Organization. # noqa: E501 + + + :return: The id of this Organization. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Organization. + + + :param id: The id of this Organization. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Organization. # noqa: E501 + + + :return: The name of this Organization. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Organization. + + + :param name: The name of this Organization. # noqa: E501 + :type: str + """ + if ( + self.local_vars_configuration.client_side_validation and name is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Organization. # noqa: E501 + + + :return: The type of this Organization. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Organization. + + + :param type: The type of this Organization. # noqa: E501 + :type: str + """ + if ( + self.local_vars_configuration.client_side_validation and type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `type`, must not be `None`" + ) # noqa: E501 + + self._type = type + + @property + def production(self): + """Gets the production of this Organization. # noqa: E501 + + + :return: The production of this Organization. # noqa: E501 + :rtype: bool + """ + return self._production + + @production.setter + def production(self, production): + """Sets the production of this Organization. + + + :param production: The production of this Organization. # noqa: E501 + :type: bool + """ + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 + + self._production = production + + 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, Organization): + 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, Organization): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/organization_list_response.py b/patch_api/models/organization_list_response.py new file mode 100644 index 0000000..a10e114 --- /dev/null +++ b/patch_api/models/organization_list_response.py @@ -0,0 +1,222 @@ +# 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 OrganizationListResponse(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 = { + "success": "bool", + "error": "object", + "data": "list[Organization]", + "meta": "MetaIndexObject", + } + + attribute_map = { + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", + } + + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 + """OrganizationListResponse - 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._success = None + self._error = None + self._data = None + self._meta = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + self.meta = meta + + @property + def success(self): + """Gets the success of this OrganizationListResponse. # noqa: E501 + + + :return: The success of this OrganizationListResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this OrganizationListResponse. + + + :param success: The success of this OrganizationListResponse. # noqa: E501 + :type: bool + """ + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this OrganizationListResponse. # noqa: E501 + + + :return: The error of this OrganizationListResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this OrganizationListResponse. + + + :param error: The error of this OrganizationListResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this OrganizationListResponse. # noqa: E501 + + + :return: The data of this OrganizationListResponse. # noqa: E501 + :rtype: list[Organization] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OrganizationListResponse. + + + :param data: The data of this OrganizationListResponse. # noqa: E501 + :type: list[Organization] + """ + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 + + self._data = data + + @property + def meta(self): + """Gets the meta of this OrganizationListResponse. # noqa: E501 + + + :return: The meta of this OrganizationListResponse. # noqa: E501 + :rtype: MetaIndexObject + """ + return self._meta + + @meta.setter + def meta(self, meta): + """Sets the meta of this OrganizationListResponse. + + + :param meta: The meta of this OrganizationListResponse. # noqa: E501 + :type: MetaIndexObject + """ + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 + + self._meta = meta + + 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, OrganizationListResponse): + 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, OrganizationListResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/organization_response.py b/patch_api/models/organization_response.py new file mode 100644 index 0000000..7676a77 --- /dev/null +++ b/patch_api/models/organization_response.py @@ -0,0 +1,178 @@ +# 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 OrganizationResponse(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 = {"success": "bool", "error": "object", "data": "Organization"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 + """OrganizationResponse - 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._success = None + self._error = None + self._data = None + self.discriminator = None + + self.success = success + self.error = error + self.data = data + + @property + def success(self): + """Gets the success of this OrganizationResponse. # noqa: E501 + + + :return: The success of this OrganizationResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this OrganizationResponse. + + + :param success: The success of this OrganizationResponse. # noqa: E501 + :type: bool + """ + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 + + self._success = success + + @property + def error(self): + """Gets the error of this OrganizationResponse. # noqa: E501 + + + :return: The error of this OrganizationResponse. # noqa: E501 + :rtype: object + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this OrganizationResponse. + + + :param error: The error of this OrganizationResponse. # noqa: E501 + :type: object + """ + + self._error = error + + @property + def data(self): + """Gets the data of this OrganizationResponse. # noqa: E501 + + + :return: The data of this OrganizationResponse. # noqa: E501 + :rtype: Organization + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OrganizationResponse. + + + :param data: The data of this OrganizationResponse. # noqa: E501 + :type: Organization + """ + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 + + self._data = data + + 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, OrganizationResponse): + 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, OrganizationResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/patch_api/models/photo.py b/patch_api/models/photo.py index 7716e55..65be8bc 100644 --- a/patch_api/models/photo.py +++ b/patch_api/models/photo.py @@ -33,15 +33,9 @@ class Photo(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'url': 'str', - 'id': 'str' - } + openapi_types = {"url": "str", "id": "str"} - attribute_map = { - 'url': 'url', - 'id': 'id' - } + attribute_map = {"url": "url", "id": "id"} def __init__(self, url=None, id=None, local_vars_configuration=None): # noqa: E501 """Photo - a model defined in OpenAPI""" # noqa: E501 @@ -74,8 +68,12 @@ def url(self, url): :param url: The url of this Photo. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and url is None: # noqa: E501 - raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and url is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `url`, must not be `None`" + ) # noqa: E501 self._url = url @@ -97,7 +95,9 @@ def id(self, id): :param id: The id of this Photo. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -109,18 +109,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/photo_response.py b/patch_api/models/photo_response.py index 3f27026..c482477 100644 --- a/patch_api/models/photo_response.py +++ b/patch_api/models/photo_response.py @@ -33,19 +33,13 @@ class PhotoResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Photo' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Photo"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """PhotoResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this PhotoResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this PhotoResponse. # noqa: E501 :type: Photo """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/preference.py b/patch_api/models/preference.py index ff30fc6..ad87aa0 100644 --- a/patch_api/models/preference.py +++ b/patch_api/models/preference.py @@ -33,19 +33,21 @@ class Preference(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'str', - 'allocation_percentage': 'int', - 'project': 'Project' - } + openapi_types = {"id": "str", "allocation_percentage": "int", "project": "Project"} attribute_map = { - 'id': 'id', - 'allocation_percentage': 'allocation_percentage', - 'project': 'project' + "id": "id", + "allocation_percentage": "allocation_percentage", + "project": "project", } - def __init__(self, id=None, allocation_percentage=None, project=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + allocation_percentage=None, + project=None, + local_vars_configuration=None, + ): # noqa: E501 """Preference - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -80,7 +82,9 @@ def id(self, id): :param id: The id of this Preference. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -105,8 +109,13 @@ def allocation_percentage(self, allocation_percentage): :param allocation_percentage: The allocation_percentage of this Preference. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and allocation_percentage is None: # noqa: E501 - raise ValueError("Invalid value for `allocation_percentage`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and allocation_percentage is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `allocation_percentage`, must not be `None`" + ) # noqa: E501 self._allocation_percentage = allocation_percentage @@ -130,8 +139,12 @@ def project(self, project): :param project: The project of this Preference. # noqa: E501 :type: Project """ - if self.local_vars_configuration.client_side_validation and project is None: # noqa: E501 - raise ValueError("Invalid value for `project`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and project is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `project`, must not be `None`" + ) # noqa: E501 self._project = project @@ -142,18 +155,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/preference_list_response.py b/patch_api/models/preference_list_response.py index 7ed2d12..0e06bef 100644 --- a/patch_api/models/preference_list_response.py +++ b/patch_api/models/preference_list_response.py @@ -34,20 +34,27 @@ class PreferenceListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Preference]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Preference]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """PreferenceListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this PreferenceListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this PreferenceListResponse. # noqa: E501 :type: list[Preference] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this PreferenceListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/preference_response.py b/patch_api/models/preference_response.py index 4fa0965..73d5fc4 100644 --- a/patch_api/models/preference_response.py +++ b/patch_api/models/preference_response.py @@ -33,19 +33,13 @@ class PreferenceResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Preference' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Preference"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """PreferenceResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this PreferenceResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this PreferenceResponse. # noqa: E501 :type: Preference """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/project.py b/patch_api/models/project.py index 452969c..cc59a6f 100644 --- a/patch_api/models/project.py +++ b/patch_api/models/project.py @@ -34,34 +34,48 @@ class Project(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'production': 'bool', - 'name': 'str', - 'description': 'str', - 'type': 'str', - 'country': 'str', - 'developer': 'str', - 'photos': 'list[Photo]', - 'average_price_per_tonne_cents_usd': 'int', - 'remaining_mass_g': 'int', - 'standard': 'Standard' + "id": "str", + "production": "bool", + "name": "str", + "description": "str", + "type": "str", + "country": "str", + "developer": "str", + "photos": "list[Photo]", + "average_price_per_tonne_cents_usd": "int", + "remaining_mass_g": "int", + "standard": "Standard", } attribute_map = { - 'id': 'id', - 'production': 'production', - 'name': 'name', - 'description': 'description', - 'type': 'type', - 'country': 'country', - 'developer': 'developer', - 'photos': 'photos', - 'average_price_per_tonne_cents_usd': 'average_price_per_tonne_cents_usd', - 'remaining_mass_g': 'remaining_mass_g', - 'standard': 'standard' + "id": "id", + "production": "production", + "name": "name", + "description": "description", + "type": "type", + "country": "country", + "developer": "developer", + "photos": "photos", + "average_price_per_tonne_cents_usd": "average_price_per_tonne_cents_usd", + "remaining_mass_g": "remaining_mass_g", + "standard": "standard", } - def __init__(self, id=None, production=None, name=None, description=None, type=None, country=None, developer=None, photos=None, average_price_per_tonne_cents_usd=None, remaining_mass_g=None, standard=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + production=None, + name=None, + description=None, + type=None, + country=None, + developer=None, + photos=None, + average_price_per_tonne_cents_usd=None, + remaining_mass_g=None, + standard=None, + local_vars_configuration=None, + ): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -113,7 +127,9 @@ def id(self, id): :param id: The id of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and id is None + ): # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -138,8 +154,12 @@ def production(self, production): :param production: The production of this Project. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and production is None: # noqa: E501 - raise ValueError("Invalid value for `production`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and production is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `production`, must not be `None`" + ) # noqa: E501 self._production = production @@ -163,8 +183,12 @@ def name(self, name): :param name: The name of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and name is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 self._name = name @@ -188,8 +212,12 @@ def description(self, description): :param description: The description of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and description is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `description`, must not be `None`" + ) # noqa: E501 self._description = description @@ -213,11 +241,22 @@ def type(self, type): :param type: The type of this Project. # noqa: E501 :type: str """ - allowed_values = ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + allowed_values = [ + "biomass", + "dac", + "forestry", + "mineralization", + "ocean", + "soil", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and type not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 + type, allowed_values + ) ) self._type = type @@ -242,8 +281,12 @@ def country(self, country): :param country: The country of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and country is None: # noqa: E501 - raise ValueError("Invalid value for `country`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and country is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `country`, must not be `None`" + ) # noqa: E501 self._country = country @@ -267,8 +310,12 @@ def developer(self, developer): :param developer: The developer of this Project. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and developer is None: # noqa: E501 - raise ValueError("Invalid value for `developer`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and developer is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `developer`, must not be `None`" + ) # noqa: E501 self._developer = developer @@ -315,8 +362,13 @@ def average_price_per_tonne_cents_usd(self, average_price_per_tonne_cents_usd): :param average_price_per_tonne_cents_usd: The average_price_per_tonne_cents_usd of this Project. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and average_price_per_tonne_cents_usd is None: # noqa: E501 - raise ValueError("Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and average_price_per_tonne_cents_usd is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `average_price_per_tonne_cents_usd`, must not be `None`" + ) # noqa: E501 self._average_price_per_tonne_cents_usd = average_price_per_tonne_cents_usd @@ -340,8 +392,13 @@ def remaining_mass_g(self, remaining_mass_g): :param remaining_mass_g: The remaining_mass_g of this Project. # noqa: E501 :type: int """ - if self.local_vars_configuration.client_side_validation and remaining_mass_g is None: # noqa: E501 - raise ValueError("Invalid value for `remaining_mass_g`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and remaining_mass_g is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `remaining_mass_g`, must not be `None`" + ) # noqa: E501 self._remaining_mass_g = remaining_mass_g @@ -375,18 +432,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/project_list_response.py b/patch_api/models/project_list_response.py index 7b627cd..466d482 100644 --- a/patch_api/models/project_list_response.py +++ b/patch_api/models/project_list_response.py @@ -34,20 +34,27 @@ class ProjectListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Project]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Project]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """ProjectListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this ProjectListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this ProjectListResponse. # noqa: E501 :type: list[Project] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this ProjectListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/project_response.py b/patch_api/models/project_response.py index 25a1b93..3de074c 100644 --- a/patch_api/models/project_response.py +++ b/patch_api/models/project_response.py @@ -33,19 +33,13 @@ class ProjectResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'Project' - } - - attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data' - } - - def __init__(self, success=None, error=None, data=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"success": "bool", "error": "object", "data": "Project"} + + attribute_map = {"success": "success", "error": "error", "data": "data"} + + def __init__( + self, success=None, error=None, data=None, local_vars_configuration=None + ): # noqa: E501 """ProjectResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -78,8 +72,12 @@ def success(self, success): :param success: The success of this ProjectResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -122,8 +120,12 @@ def data(self, data): :param data: The data of this ProjectResponse. # noqa: E501 :type: Project """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -134,18 +136,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/project_type_list_response.py b/patch_api/models/project_type_list_response.py index 87d1ac2..29d4716 100644 --- a/patch_api/models/project_type_list_response.py +++ b/patch_api/models/project_type_list_response.py @@ -34,20 +34,27 @@ class ProjectTypeListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[str]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[str]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """ProjectTypeListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this ProjectTypeListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this ProjectTypeListResponse. # noqa: E501 :type: list[str] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this ProjectTypeListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/standard.py b/patch_api/models/standard.py index 42c874d..40f18a1 100644 --- a/patch_api/models/standard.py +++ b/patch_api/models/standard.py @@ -33,19 +33,13 @@ class Standard(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'type': 'str', - 'acronym': 'str', - 'description': 'str' - } - - attribute_map = { - 'type': 'type', - 'acronym': 'acronym', - 'description': 'description' - } - - def __init__(self, type=None, acronym=None, description=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {"type": "str", "acronym": "str", "description": "str"} + + attribute_map = {"type": "type", "acronym": "acronym", "description": "description"} + + def __init__( + self, type=None, acronym=None, description=None, local_vars_configuration=None + ): # noqa: E501 """Standard - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -80,8 +74,12 @@ def type(self, type): :param type: The type of this Standard. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and type is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `type`, must not be `None`" + ) # noqa: E501 self._type = type @@ -105,8 +103,12 @@ def acronym(self, acronym): :param acronym: The acronym of this Standard. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and acronym is None: # noqa: E501 - raise ValueError("Invalid value for `acronym`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and acronym is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `acronym`, must not be `None`" + ) # noqa: E501 self._acronym = acronym @@ -130,8 +132,12 @@ def description(self, description): :param description: The description of this Standard. # noqa: E501 :type: str """ - if self.local_vars_configuration.client_side_validation and description is None: # noqa: E501 - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and description is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `description`, must not be `None`" + ) # noqa: E501 self._description = description @@ -142,18 +148,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/standard_list_response.py b/patch_api/models/standard_list_response.py index 8102ccf..356f7eb 100644 --- a/patch_api/models/standard_list_response.py +++ b/patch_api/models/standard_list_response.py @@ -34,20 +34,27 @@ class StandardListResponse(object): and the value is json key in definition. """ openapi_types = { - 'success': 'bool', - 'error': 'object', - 'data': 'list[Standard]', - 'meta': 'MetaIndexObject' + "success": "bool", + "error": "object", + "data": "list[Standard]", + "meta": "MetaIndexObject", } attribute_map = { - 'success': 'success', - 'error': 'error', - 'data': 'data', - 'meta': 'meta' + "success": "success", + "error": "error", + "data": "data", + "meta": "meta", } - def __init__(self, success=None, error=None, data=None, meta=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + success=None, + error=None, + data=None, + meta=None, + local_vars_configuration=None, + ): # noqa: E501 """StandardListResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,8 +89,12 @@ def success(self, success): :param success: The success of this StandardListResponse. # noqa: E501 :type: bool """ - if self.local_vars_configuration.client_side_validation and success is None: # noqa: E501 - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and success is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `success`, must not be `None`" + ) # noqa: E501 self._success = success @@ -126,8 +137,12 @@ def data(self, data): :param data: The data of this StandardListResponse. # noqa: E501 :type: list[Standard] """ - if self.local_vars_configuration.client_side_validation and data is None: # noqa: E501 - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and data is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `data`, must not be `None`" + ) # noqa: E501 self._data = data @@ -149,8 +164,12 @@ def meta(self, meta): :param meta: The meta of this StandardListResponse. # noqa: E501 :type: MetaIndexObject """ - if self.local_vars_configuration.client_side_validation and meta is None: # noqa: E501 - raise ValueError("Invalid value for `meta`, must not be `None`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation and meta is None + ): # noqa: E501 + raise ValueError( + "Invalid value for `meta`, must not be `None`" + ) # noqa: E501 self._meta = meta @@ -161,18 +180,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/update_offset_request.py b/patch_api/models/update_offset_request.py index 53a75a5..5511de0 100644 --- a/patch_api/models/update_offset_request.py +++ b/patch_api/models/update_offset_request.py @@ -34,20 +34,27 @@ class UpdateOffsetRequest(object): and the value is json key in definition. """ openapi_types = { - 'mass_g': 'int', - 'price_cents_usd': 'int', - 'vintage_year': 'int', - 'serial_number': 'str' + "mass_g": "int", + "price_cents_usd": "int", + "vintage_year": "int", + "serial_number": "str", } attribute_map = { - 'mass_g': 'mass_g', - 'price_cents_usd': 'price_cents_usd', - 'vintage_year': 'vintage_year', - 'serial_number': 'serial_number' + "mass_g": "mass_g", + "price_cents_usd": "price_cents_usd", + "vintage_year": "vintage_year", + "serial_number": "serial_number", } - def __init__(self, mass_g=None, price_cents_usd=None, vintage_year=None, serial_number=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + mass_g=None, + price_cents_usd=None, + vintage_year=None, + serial_number=None, + local_vars_configuration=None, + ): # noqa: E501 """UpdateOffsetRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -85,12 +92,22 @@ def mass_g(self, mass_g): :param mass_g: The mass_g of this UpdateOffsetRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g > 1000000000): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value less than or equal to `1000000000`") # noqa: E501 - if (self.local_vars_configuration.client_side_validation and - mass_g is not None and mass_g < 1): # noqa: E501 - raise ValueError("Invalid value for `mass_g`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g > 1000000000 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value less than or equal to `1000000000`" + ) # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and mass_g is not None + and mass_g < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `mass_g`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._mass_g = mass_g @@ -112,9 +129,14 @@ def price_cents_usd(self, price_cents_usd): :param price_cents_usd: The price_cents_usd of this UpdateOffsetRequest. # noqa: E501 :type: int """ - if (self.local_vars_configuration.client_side_validation and - price_cents_usd is not None and price_cents_usd < 1): # noqa: E501 - raise ValueError("Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and price_cents_usd is not None + and price_cents_usd < 1 + ): # noqa: E501 + raise ValueError( + "Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`" + ) # noqa: E501 self._price_cents_usd = price_cents_usd @@ -167,18 +189,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/models/update_project_request.py b/patch_api/models/update_project_request.py index da2a8a6..7c54dc3 100644 --- a/patch_api/models/update_project_request.py +++ b/patch_api/models/update_project_request.py @@ -34,34 +34,48 @@ class UpdateProjectRequest(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str', - 'description': 'str', - 'country': 'str', - 'state': 'str', - 'verifier': 'str', - 'type': 'str', - 'standard_type': 'str', - 'longitude': 'str', - 'latitude': 'str', - 'production': 'str', - 'organization_id': 'str' + "name": "str", + "description": "str", + "country": "str", + "state": "str", + "verifier": "str", + "type": "str", + "standard_type": "str", + "longitude": "str", + "latitude": "str", + "production": "str", + "organization_id": "str", } attribute_map = { - 'name': 'name', - 'description': 'description', - 'country': 'country', - 'state': 'state', - 'verifier': 'verifier', - 'type': 'type', - 'standard_type': 'standard_type', - 'longitude': 'longitude', - 'latitude': 'latitude', - 'production': 'production', - 'organization_id': 'organization_id' + "name": "name", + "description": "description", + "country": "country", + "state": "state", + "verifier": "verifier", + "type": "type", + "standard_type": "standard_type", + "longitude": "longitude", + "latitude": "latitude", + "production": "production", + "organization_id": "organization_id", } - def __init__(self, name=None, description=None, country=None, state=None, verifier=None, type=None, standard_type=None, longitude=None, latitude=None, production=None, organization_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + name=None, + description=None, + country=None, + state=None, + verifier=None, + type=None, + standard_type=None, + longitude=None, + latitude=None, + production=None, + organization_id=None, + local_vars_configuration=None, + ): # noqa: E501 """UpdateProjectRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -162,11 +176,265 @@ def country(self, country): :param country: The country of this UpdateProjectRequest. # noqa: E501 :type: str """ - allowed_values = ["TJ", "JM", "HT", "ST", "MS", "AE", "PK", "NL", "LU", "BZ", "IR", "BO", "UY", "GH", "SA", "CI", "MF", "TF", "AI", "QA", "SX", "LY", "BV", "PG", "KG", "GQ", "EH", "NU", "PR", "GD", "KR", "HM", "SM", "SL", "CD", "MK", "TR", "DZ", "GE", "PS", "BB", "UA", "GP", "PF", "NA", "BW", "SY", "TG", "DO", "AQ", "CH", "MG", "FO", "VG", "GI", "BN", "LA", "IS", "EE", "UM", "LT", "RS", "MR", "AD", "HU", "TK", "MY", "AO", "CV", "NF", "PA", "GW", "BE", "PT", "GB", "IM", "US", "YE", "HK", "AZ", "CC", "ML", "SK", "VU", "TL", "HR", "SR", "MU", "CZ", "PM", "LS", "WS", "KM", "IT", "BI", "WF", "GN", "SG", "CO", "CN", "AW", "MA", "FI", "VA", "ZW", "KY", "BH", "PY", "EC", "LR", "RU", "PL", "OM", "MT", "SS", "DE", "TM", "SJ", "MM", "TT", "IL", "BD", "NR", "LK", "UG", "NG", "BQ", "MX", "CW", "SI", "MN", "CA", "AX", "VN", "TW", "JP", "IO", "RO", "BG", "GU", "BR", "AM", "ZM", "DJ", "JE", "AT", "CM", "SE", "FJ", "KZ", "GL", "GY", "CX", "MW", "TN", "ZA", "TO", "CY", "MV", "PN", "RW", "NI", "KN", "BJ", "ET", "GM", "TZ", "VC", "FK", "SD", "MC", "AU", "CL", "DK", "FR", "TC", "CU", "AL", "MZ", "BS", "NE", "GT", "LI", "NP", "BF", "PW", "KW", "IN", "GA", "TV", "MO", "SH", "MD", "CK", "AR", "SC", "IE", "ES", "LB", "BM", "RE", "KI", "AG", "MQ", "SV", "JO", "TH", "SO", "MH", "CG", "KP", "GF", "BA", "YT", "GS", "KE", "PE", "BT", "SZ", "CR", "TD", "DM", "NC", "GR", "GG", "HN", "VI", "CF", "SN", "AF", "MP", "PH", "BY", "LV", "NO", "EG", "KH", "IQ", "LC", "NZ", "BL", "UZ", "ID", "ER", "VE", "FM", "SB", "ME", "AS"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and country not in allowed_values: # noqa: E501 + allowed_values = [ + "TJ", + "JM", + "HT", + "ST", + "MS", + "AE", + "PK", + "NL", + "LU", + "BZ", + "IR", + "BO", + "UY", + "GH", + "SA", + "CI", + "MF", + "TF", + "AI", + "QA", + "SX", + "LY", + "BV", + "PG", + "KG", + "GQ", + "EH", + "NU", + "PR", + "GD", + "KR", + "HM", + "SM", + "SL", + "CD", + "MK", + "TR", + "DZ", + "GE", + "PS", + "BB", + "UA", + "GP", + "PF", + "NA", + "BW", + "SY", + "TG", + "DO", + "AQ", + "CH", + "MG", + "FO", + "VG", + "GI", + "BN", + "LA", + "IS", + "EE", + "UM", + "LT", + "RS", + "MR", + "AD", + "HU", + "TK", + "MY", + "AO", + "CV", + "NF", + "PA", + "GW", + "BE", + "PT", + "GB", + "IM", + "US", + "YE", + "HK", + "AZ", + "CC", + "ML", + "SK", + "VU", + "TL", + "HR", + "SR", + "MU", + "CZ", + "PM", + "LS", + "WS", + "KM", + "IT", + "BI", + "WF", + "GN", + "SG", + "CO", + "CN", + "AW", + "MA", + "FI", + "VA", + "ZW", + "KY", + "BH", + "PY", + "EC", + "LR", + "RU", + "PL", + "OM", + "MT", + "SS", + "DE", + "TM", + "SJ", + "MM", + "TT", + "IL", + "BD", + "NR", + "LK", + "UG", + "NG", + "BQ", + "MX", + "CW", + "SI", + "MN", + "CA", + "AX", + "VN", + "TW", + "JP", + "IO", + "RO", + "BG", + "GU", + "BR", + "AM", + "ZM", + "DJ", + "JE", + "AT", + "CM", + "SE", + "FJ", + "KZ", + "GL", + "GY", + "CX", + "MW", + "TN", + "ZA", + "TO", + "CY", + "MV", + "PN", + "RW", + "NI", + "KN", + "BJ", + "ET", + "GM", + "TZ", + "VC", + "FK", + "SD", + "MC", + "AU", + "CL", + "DK", + "FR", + "TC", + "CU", + "AL", + "MZ", + "BS", + "NE", + "GT", + "LI", + "NP", + "BF", + "PW", + "KW", + "IN", + "GA", + "TV", + "MO", + "SH", + "MD", + "CK", + "AR", + "SC", + "IE", + "ES", + "LB", + "BM", + "RE", + "KI", + "AG", + "MQ", + "SV", + "JO", + "TH", + "SO", + "MH", + "CG", + "KP", + "GF", + "BA", + "YT", + "GS", + "KE", + "PE", + "BT", + "SZ", + "CR", + "TD", + "DM", + "NC", + "GR", + "GG", + "HN", + "VI", + "CF", + "SN", + "AF", + "MP", + "PH", + "BY", + "LV", + "NO", + "EG", + "KH", + "IQ", + "LC", + "NZ", + "BL", + "UZ", + "ID", + "ER", + "VE", + "FM", + "SB", + "ME", + "AS", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and country not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `country` ({0}), must be one of {1}" # noqa: E501 - .format(country, allowed_values) + "Invalid value for `country` ({0}), must be one of {1}".format( # noqa: E501 + country, allowed_values + ) ) self._country = country @@ -231,11 +499,22 @@ def type(self, type): :param type: The type of this UpdateProjectRequest. # noqa: E501 :type: str """ - allowed_values = ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + allowed_values = [ + "biomass", + "dac", + "forestry", + "mineralization", + "ocean", + "soil", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and type not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 + type, allowed_values + ) ) self._type = type @@ -258,11 +537,20 @@ def standard_type(self, standard_type): :param standard_type: The standard_type of this UpdateProjectRequest. # noqa: E501 :type: str """ - allowed_values = ["american_carbon_registry", "climate_action_reserve", "verified_carbon_standard", "european_biochar_certificate"] # noqa: E501 - if self.local_vars_configuration.client_side_validation and standard_type not in allowed_values: # noqa: E501 + allowed_values = [ + "american_carbon_registry", + "climate_action_reserve", + "verified_carbon_standard", + "european_biochar_certificate", + ] # noqa: E501 + if ( + self.local_vars_configuration.client_side_validation + and standard_type not in allowed_values + ): # noqa: E501 raise ValueError( - "Invalid value for `standard_type` ({0}), must be one of {1}" # noqa: E501 - .format(standard_type, allowed_values) + "Invalid value for `standard_type` ({0}), must be one of {1}".format( # noqa: E501 + standard_type, allowed_values + ) ) self._standard_type = standard_type @@ -358,18 +646,20 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/patch_api/rest.py b/patch_api/rest.py index d2665d6..87eda9c 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -20,6 +20,7 @@ import ssl import certifi + # python 2 and python 3 compatibility library import six from six.moves.urllib.parse import urlencode @@ -32,7 +33,6 @@ class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -49,7 +49,6 @@ def getheader(self, name, default=None): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -74,10 +73,12 @@ def __init__(self, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + addition_pool_args[ + "assert_hostname" + ] = configuration.assert_hostname # noqa: E501 if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + addition_pool_args["retries"] = configuration.retries if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -109,9 +110,17 @@ def __init__(self, configuration, pools_size=4, maxsize=None): **addition_pool_args ) - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): + def request( + self, + method, + url, + query_params=None, + headers=None, + body=None, + post_params=None, + _preload_content=True, + _request_timeout=None, + ): """Perform requests. :param method: http request method @@ -131,8 +140,7 @@ def request(self, method, url, query_params=None, headers=None, (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] if post_params and body: raise ApiValueError( @@ -144,65 +152,77 @@ def request(self, method, url, query_params=None, headers=None, timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + if isinstance( + _request_timeout, (int,) if six.PY3 else (int, long) + ): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): + elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1]) + connect=_request_timeout[0], read=_request_timeout[1] + ) - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' + if "Content-Type" not in headers: + headers["Content-Type"] = "application/json" - if 'Authorization' not in headers: - headers['Authorization'] = 'Bearer ' + self.configuration.api_key + if "Authorization" not in headers: + headers["Authorization"] = "Bearer " + self.configuration.api_key try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: if query_params: - url += '?' + urlencode(query_params) - if re.search('json', headers['Content-Type'], re.IGNORECASE): + url += "?" + urlencode(query_params) + if re.search("json", headers["Content-Type"], re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + headers=headers, + ) + elif ( + headers["Content-Type"] == "application/x-www-form-urlencoded" + ): # noqa: E501 r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, - headers=headers) - elif headers['Content-Type'] == 'multipart/form-data': + headers=headers, + ) + elif headers["Content-Type"] == "multipart/form-data": # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. - del headers['Content-Type'] + del headers["Content-Type"] r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -211,11 +231,14 @@ def request(self, method, url, query_params=None, headers=None, raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request(method, url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request( + method, + url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -226,7 +249,7 @@ def request(self, method, url, query_params=None, headers=None, # In the python 3, the response.data is bytes. # we need to decode it to string. if six.PY3: - r.data = r.data.decode('utf8') + r.data = r.data.decode("utf8") # log response body logger.debug("response body: %s", r.data) @@ -236,67 +259,139 @@ def request(self, method, url, query_params=None, headers=None, return r - def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + def GET( + self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "GET", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def HEAD( + self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "HEAD", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def OPTIONS( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "OPTIONS", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def DELETE( + self, + url, + headers=None, + query_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "DELETE", + url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def POST( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "POST", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PUT( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PUT", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PATCH( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PATCH", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) diff --git a/requirements.txt b/requirements.txt index eb358ef..2f0b40b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ certifi >= 14.05.14 -future; python_version<="2.7" six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 +pre-commit >= 2.9.3 +autopep8 >= 1.5.4 diff --git a/setup.py b/setup.py index a2c2fbe..6759d91 100644 --- a/setup.py +++ b/setup.py @@ -37,5 +37,5 @@ include_package_data=True, long_description="""\ The core API used to integrate with Patch's service # noqa: E501 - """ + """, ) diff --git a/test/factories.py b/test/factories.py index 323d20e..d9c0075 100644 --- a/test/factories.py +++ b/test/factories.py @@ -10,105 +10,113 @@ from patch_api.models.preference import Preference # noqa: E501 from patch_api.models.membership import Membership + class OrderFactory(factory.Factory): class Meta: model = Order - id = '0' + id = "0" mass_g = 1 production = True - state = 'draft' - allocation_state = 'pending' - price_cents_usd = '0' - patch_fee_cents_usd = '0' + state = "draft" + allocation_state = "pending" + price_cents_usd = "0" + patch_fee_cents_usd = "0" allocations = [] metadata = {} + class StandardFactory(factory.Factory): class Meta: - model = Standard + model = Standard + + type = "0" + acronym = "0" + description = "0" - type = '0' - acronym = '0' - description = '0' class MetaIndexObjectFactory(factory.Factory): class Meta: - model = MetaIndexObject + model = MetaIndexObject prev_page = 56 next_page = 56 + class AllocationFactory(factory.Factory): class Meta: - model = Allocation + model = Allocation - id = '0' + id = "0" production = True mass_g = 56 + class EstimateFactory(factory.Factory): class Meta: - model = Estimate + model = Estimate - id = '0', - production = True, - type = '0', + id = ("0",) + production = (True,) + type = ("0",) order = OrderFactory() + class PhotoFactory(factory.Factory): class Meta: - model = Photo + model = Photo + + id = "0" + url = "https://photo.com" - id = '0' - url = 'https://photo.com' class ProjectFactory(factory.Factory): class Meta: - model = Project + model = Project - id = '0' + id = "0" production = True - name = '0' - description = '0' - type = 'biomass' - country = '0' - developer = '0' - photos = [ - PhotoFactory() - ], + name = "0" + description = "0" + type = "biomass" + country = "0" + developer = "0" + photos = ([PhotoFactory()],) average_price_per_tonne_cents_usd = 56 remaining_mass_g = 56 standard = StandardFactory() + class PreferenceFactory(factory.Factory): class Meta: - model = Preference + model = Preference - id = '0' + id = "0" allocation_percentage = 56 project = ProjectFactory() + class OffsetFactory(factory.Factory): class Meta: - model = Offset + model = Offset - id = '0' + id = "0" allocated_mass_g = 0 - fulfilled_at = '0' - fulfillment_state = 'pending' + fulfilled_at = "0" + fulfillment_state = "pending" mass_g = 1 - price_cents_usd = '0' + price_cents_usd = "0" production = True retired = True - serial_number = '0' + serial_number = "0" vintage_year = 56 - project_id = '0' + project_id = "0" + class MembershipFactory(factory.Factory): class Meta: model = Membership - email = '0' - role = 'admin' - organization_id = '0' + email = "0" + role = "admin" + organization_id = "0" diff --git a/test/test_allocation.py b/test/test_allocation.py index ef63471..694ea31 100644 --- a/test/test_allocation.py +++ b/test/test_allocation.py @@ -21,6 +21,7 @@ from factories import AllocationFactory from patch_api.rest import ApiException + class TestAllocation(unittest.TestCase): """Allocation unit test stubs""" @@ -36,9 +37,9 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.allocation.Allocation() # noqa: E501 - if include_optional : + if include_optional: return AllocationFactory() - else : + else: return AllocationFactory() def testAllocation(self): @@ -50,5 +51,5 @@ def testAllocation(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_mass_estimate_request.py b/test/test_create_mass_estimate_request.py index c810ecf..df228cd 100644 --- a/test/test_create_mass_estimate_request.py +++ b/test/test_create_mass_estimate_request.py @@ -17,9 +17,12 @@ import datetime import patch_api -from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest # noqa: E501 +from patch_api.models.create_mass_estimate_request import ( + CreateMassEstimateRequest, +) # noqa: E501 from patch_api.rest import ApiException + class TestCreateMassEstimateRequest(unittest.TestCase): """CreateMassEstimateRequest unit test stubs""" @@ -35,15 +38,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_mass_estimate_request.CreateMassEstimateRequest() # noqa: E501 - if include_optional : - return CreateMassEstimateRequest( - mass_g = 1, - project_id = '0' - ) - else : - return CreateMassEstimateRequest( - mass_g = 1, - ) + if include_optional: + return CreateMassEstimateRequest(mass_g=1, project_id="0") + else: + return CreateMassEstimateRequest(mass_g=1) def testCreateMassEstimateRequest(self): """Test CreateMassEstimateRequest""" @@ -54,5 +52,5 @@ def testCreateMassEstimateRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_membership_request.py b/test/test_create_membership_request.py index 1524ed0..e7b207e 100644 --- a/test/test_create_membership_request.py +++ b/test/test_create_membership_request.py @@ -17,9 +17,12 @@ import datetime import patch_api -from patch_api.models.create_membership_request import CreateMembershipRequest # noqa: E501 +from patch_api.models.create_membership_request import ( + CreateMembershipRequest, +) # noqa: E501 from patch_api.rest import ApiException + class TestCreateMembershipRequest(unittest.TestCase): """CreateMembershipRequest unit test stubs""" @@ -35,15 +38,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_membership_request.CreateMembershipRequest() # noqa: E501 - if include_optional : - return CreateMembershipRequest( - email = '0', - role = 'admin', - organization_id = '0' - ) - else : - return CreateMembershipRequest( - ) + if include_optional: + return CreateMembershipRequest(email="0", role="admin", organization_id="0") + else: + return CreateMembershipRequest() def testCreateMembershipRequest(self): """Test CreateMembershipRequest""" @@ -54,5 +52,5 @@ def testCreateMembershipRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_offset_request.py b/test/test_create_offset_request.py index e2107b9..eac7324 100644 --- a/test/test_create_offset_request.py +++ b/test/test_create_offset_request.py @@ -20,6 +20,7 @@ from patch_api.models.create_offset_request import CreateOffsetRequest # noqa: E501 from patch_api.rest import ApiException + class TestCreateOffsetRequest(unittest.TestCase): """CreateOffsetRequest unit test stubs""" @@ -35,17 +36,16 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_offset_request.CreateOffsetRequest() # noqa: E501 - if include_optional : + if include_optional: return CreateOffsetRequest( - mass_g = 1, - price_cents_usd = 1, - project_id = '0', - vintage_year = 56, - serial_number = '0' + mass_g=1, + price_cents_usd=1, + project_id="0", + vintage_year=56, + serial_number="0", ) - else : - return CreateOffsetRequest( - ) + else: + return CreateOffsetRequest() def testCreateOffsetRequest(self): """Test CreateOffsetRequest""" @@ -56,5 +56,5 @@ def testCreateOffsetRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_order_request.py b/test/test_create_order_request.py index 621b1a9..c3d20a2 100644 --- a/test/test_create_order_request.py +++ b/test/test_create_order_request.py @@ -20,6 +20,7 @@ from patch_api.models.create_order_request import CreateOrderRequest # noqa: E501 from patch_api.rest import ApiException + class TestCreateOrderRequest(unittest.TestCase): """CreateOrderRequest unit test stubs""" @@ -35,16 +36,12 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_order_request.CreateOrderRequest() # noqa: E501 - if include_optional : + if include_optional: return CreateOrderRequest( - mass_g = 1, - total_price_cents_usd = 1, - project_id = '0', - metadata = None + mass_g=1, total_price_cents_usd=1, project_id="0", metadata=None ) - else : - return CreateOrderRequest( - ) + else: + return CreateOrderRequest() def testCreateOrderRequest(self): """Test CreateOrderRequest""" @@ -55,5 +52,5 @@ def testCreateOrderRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_organization_request.py b/test/test_create_organization_request.py index 29dada3..dc7c8c3 100644 --- a/test/test_create_organization_request.py +++ b/test/test_create_organization_request.py @@ -17,9 +17,12 @@ import datetime import patch_api -from patch_api.models.create_organization_request import CreateOrganizationRequest # noqa: E501 +from patch_api.models.create_organization_request import ( + CreateOrganizationRequest, +) # noqa: E501 from patch_api.rest import ApiException + class TestCreateOrganizationRequest(unittest.TestCase): """CreateOrganizationRequest unit test stubs""" @@ -35,16 +38,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_organization_request.CreateOrganizationRequest() # noqa: E501 - if include_optional : - return CreateOrganizationRequest( - name = '0', - type = 'consumer' - ) - else : - return CreateOrganizationRequest( - name = '0', - type = 'consumer', - ) + if include_optional: + return CreateOrganizationRequest(name="0", type="consumer") + else: + return CreateOrganizationRequest(name="0", type="consumer") def testCreateOrganizationRequest(self): """Test CreateOrganizationRequest""" @@ -55,5 +52,5 @@ def testCreateOrganizationRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_photo_request.py b/test/test_create_photo_request.py index 9f7d40a..0dc76bb 100644 --- a/test/test_create_photo_request.py +++ b/test/test_create_photo_request.py @@ -20,6 +20,7 @@ from patch_api.models.create_photo_request import CreatePhotoRequest # noqa: E501 from patch_api.rest import ApiException + class TestCreatePhotoRequest(unittest.TestCase): """CreatePhotoRequest unit test stubs""" @@ -35,17 +36,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_photo_request.CreatePhotoRequest() # noqa: E501 - if include_optional : - return CreatePhotoRequest( - project_id = '0', - url = '0', - sort_order = 56 - ) - else : - return CreatePhotoRequest( - project_id = '0', - url = '0', - ) + if include_optional: + return CreatePhotoRequest(project_id="0", url="0", sort_order=56) + else: + return CreatePhotoRequest(project_id="0", url="0") def testCreatePhotoRequest(self): """Test CreatePhotoRequest""" @@ -56,5 +50,5 @@ def testCreatePhotoRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_preference_request.py b/test/test_create_preference_request.py index a52097d..734acc1 100644 --- a/test/test_create_preference_request.py +++ b/test/test_create_preference_request.py @@ -17,9 +17,12 @@ import datetime import patch_api -from patch_api.models.create_preference_request import CreatePreferenceRequest # noqa: E501 +from patch_api.models.create_preference_request import ( + CreatePreferenceRequest, +) # noqa: E501 from patch_api.rest import ApiException + class TestCreatePreferenceRequest(unittest.TestCase): """CreatePreferenceRequest unit test stubs""" @@ -35,14 +38,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_preference_request.CreatePreferenceRequest() # noqa: E501 - if include_optional : - return CreatePreferenceRequest( - project_id = '0' - ) - else : - return CreatePreferenceRequest( - project_id = '0', - ) + if include_optional: + return CreatePreferenceRequest(project_id="0") + else: + return CreatePreferenceRequest(project_id="0") def testCreatePreferenceRequest(self): """Test CreatePreferenceRequest""" @@ -53,5 +52,5 @@ def testCreatePreferenceRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_create_project_request.py b/test/test_create_project_request.py index 5450e66..7176c55 100644 --- a/test/test_create_project_request.py +++ b/test/test_create_project_request.py @@ -20,6 +20,7 @@ from patch_api.models.create_project_request import CreateProjectRequest # noqa: E501 from patch_api.rest import ApiException + class TestCreateProjectRequest(unittest.TestCase): """CreateProjectRequest unit test stubs""" @@ -35,23 +36,22 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.create_project_request.CreateProjectRequest() # noqa: E501 - if include_optional : + if include_optional: return CreateProjectRequest( - name = '0', - description = '0', - country = 'TJ', - state = '0', - verifier = '0', - type = 'biomass', - standard_type = 'american_carbon_registry', - longitude = '0', - latitude = '0', - production = '0', - organization_id = '0' + name="0", + description="0", + country="TJ", + state="0", + verifier="0", + type="biomass", + standard_type="american_carbon_registry", + longitude="0", + latitude="0", + production="0", + organization_id="0", ) - else : - return CreateProjectRequest( - ) + else: + return CreateProjectRequest() def testCreateProjectRequest(self): """Test CreateProjectRequest""" @@ -61,5 +61,6 @@ def testCreateProjectRequest(self): self.assertTrue(inst_req_only) self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/test/test_error_response.py b/test/test_error_response.py index e4826c6..46f54be 100644 --- a/test/test_error_response.py +++ b/test/test_error_response.py @@ -20,6 +20,7 @@ from patch_api.models.error_response import ErrorResponse # noqa: E501 from patch_api.rest import ApiException + class TestErrorResponse(unittest.TestCase): """ErrorResponse unit test stubs""" @@ -35,18 +36,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.error_response.ErrorResponse() # noqa: E501 - if include_optional : - return ErrorResponse( - success = True, - error = {}, - data = None - ) - else : - return ErrorResponse( - success = True, - error = {}, - data = None, - ) + if include_optional: + return ErrorResponse(success=True, error={}, data=None) + else: + return ErrorResponse(success=True, error={}, data=None) def testErrorResponse(self): """Test ErrorResponse""" @@ -56,5 +49,6 @@ def testErrorResponse(self): self.assertTrue(inst_req_only) self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/test/test_estimate.py b/test/test_estimate.py index ab71239..21d97b9 100644 --- a/test/test_estimate.py +++ b/test/test_estimate.py @@ -21,6 +21,7 @@ from factories import EstimateFactory, OrderFactory from patch_api.rest import ApiException + class TestEstimate(unittest.TestCase): """Estimate unit test stubs""" @@ -36,14 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.estimate.Estimate() # noqa: E501 - if include_optional : - return EstimateFactory( - order = OrderFactory() - ) - else : - return EstimateFactory( - order = None - ) + if include_optional: + return EstimateFactory(order=OrderFactory()) + else: + return EstimateFactory(order=None) def testEstimate(self): """Test Estimate""" @@ -53,5 +50,6 @@ def testEstimate(self): self.assertTrue(inst_req_only) self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/test/test_estimate_list_response.py b/test/test_estimate_list_response.py index 033cce3..9efdd05 100644 --- a/test/test_estimate_list_response.py +++ b/test/test_estimate_list_response.py @@ -21,6 +21,7 @@ from factories import EstimateFactory, MetaIndexObjectFactory from patch_api.rest import ApiException + class TestEstimateListResponse(unittest.TestCase): """EstimateListResponse unit test stubs""" @@ -36,24 +37,20 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.estimate_list_response.EstimateListResponse() # noqa: E501 - if include_optional : + if include_optional: return EstimateListResponse( - success = True, - error = None, - data = [ - EstimateFactory() - ], - meta = MetaIndexObjectFactory() + success=True, + error=None, + data=[EstimateFactory()], + meta=MetaIndexObjectFactory(), ) - else : + else: return EstimateListResponse( - success = True, - error = None, - data = [ - EstimateFactory() - ], - meta = MetaIndexObjectFactory(), - ) + success=True, + error=None, + data=[EstimateFactory()], + meta=MetaIndexObjectFactory(), + ) def testEstimateListResponse(self): """Test EstimateListResponse""" @@ -63,5 +60,6 @@ def testEstimateListResponse(self): self.assertTrue(inst_req_only) self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/test/test_estimate_response.py b/test/test_estimate_response.py index 393afaf..8538481 100644 --- a/test/test_estimate_response.py +++ b/test/test_estimate_response.py @@ -21,6 +21,7 @@ from factories import EstimateFactory from patch_api.rest import ApiException + class TestEstimateResponse(unittest.TestCase): """EstimateResponse unit test stubs""" @@ -36,18 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.estimate_response.EstimateResponse() # noqa: E501 - if include_optional : - return EstimateResponse( - success = True, - error = None, - data = EstimateFactory() - ) - else : - return EstimateResponse( - success = True, - error = None, - data = EstimateFactory(), - ) + if include_optional: + return EstimateResponse(success=True, error=None, data=EstimateFactory()) + else: + return EstimateResponse(success=True, error=None, data=EstimateFactory()) def testEstimateResponse(self): """Test EstimateResponse""" @@ -57,5 +50,6 @@ def testEstimateResponse(self): self.assertTrue(inst_req_only) self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index dbb04e6..509ec9d 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -26,7 +26,9 @@ class TestEstimatesApi(unittest.TestCase): """EstimatesApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + configuration = patch_api.Configuration( + api_key=os.environ.get("SANDBOX_API_KEY") + ) api_client = patch_api.ApiClient(configuration) self.api = EstimatesApi(api_client=api_client) # noqa: E501 @@ -40,7 +42,9 @@ def test_create_and_retrieve_mass_estimate(self): """ mass_g = 100 project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" - mass_estimate_request = CreateMassEstimateRequest(mass_g=mass_g,project_id=project_id) + mass_estimate_request = CreateMassEstimateRequest( + mass_g=mass_g, project_id=project_id + ) estimate = self.api.create_mass_estimate(mass_estimate_request) self.assertTrue(estimate) @@ -51,5 +55,5 @@ def test_create_and_retrieve_mass_estimate(self): self.assertEqual(estimate.data.id, estimate.data.id) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_fulfill_offset_request.py b/test/test_fulfill_offset_request.py index 9b0ad8c..e822b13 100644 --- a/test/test_fulfill_offset_request.py +++ b/test/test_fulfill_offset_request.py @@ -21,6 +21,7 @@ from patch_api.models.fulfill_offset_request import FulfillOffsetRequest # noqa: E501 from patch_api.rest import ApiException + class TestFulfillOffsetRequest(unittest.TestCase): """FulfillOffsetRequest unit test stubs""" @@ -36,13 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.fulfill_offset_request.FulfillOffsetRequest() # noqa: E501 - if include_optional : - return FulfillOffsetRequest( - serial_number = '0' - ) - else : - return FulfillOffsetRequest( - ) + if include_optional: + return FulfillOffsetRequest(serial_number="0") + else: + return FulfillOffsetRequest() def testFulfillOffsetRequest(self): """Test FulfillOffsetRequest""" @@ -53,5 +51,5 @@ def testFulfillOffsetRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_membership.py b/test/test_membership.py index c70d4a1..3a45d27 100644 --- a/test/test_membership.py +++ b/test/test_membership.py @@ -20,6 +20,7 @@ from patch_api.models.membership import Membership # noqa: E501 from patch_api.rest import ApiException + class TestMembership(unittest.TestCase): """Membership unit test stubs""" @@ -35,18 +36,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.membership.Membership() # noqa: E501 - if include_optional : - return Membership( - email = '0', - role = 'admin', - organization_id = '0' - ) - else : - return Membership( - email = '0', - role = 'admin', - organization_id = '0', - ) + if include_optional: + return Membership(email="0", role="admin", organization_id="0") + else: + return Membership(email="0", role="admin", organization_id="0") def testMembership(self): """Test Membership""" @@ -57,5 +50,5 @@ def testMembership(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_membership_response.py b/test/test_membership_response.py index 527331e..af705f2 100644 --- a/test/test_membership_response.py +++ b/test/test_membership_response.py @@ -21,6 +21,7 @@ from factories import MembershipFactory from patch_api.rest import ApiException + class TestMembershipResponse(unittest.TestCase): """MembershipResponse unit test stubs""" @@ -36,22 +37,14 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.membership_response.MembershipResponse() # noqa: E501 - if include_optional : + if include_optional: return MembershipResponse( - success = True, - error = None, - data = [ - MembershipFactory() - ] + success=True, error=None, data=[MembershipFactory()] ) - else : + else: return MembershipResponse( - success = True, - error = None, - data = [ - MembershipFactory() - ], - ) + success=True, error=None, data=[MembershipFactory()] + ) def testMembershipResponse(self): """Test MembershipResponse""" @@ -62,5 +55,5 @@ def testMembershipResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_meta_index_object.py b/test/test_meta_index_object.py index 3f96f20..c046bb2 100644 --- a/test/test_meta_index_object.py +++ b/test/test_meta_index_object.py @@ -20,6 +20,7 @@ from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 from patch_api.rest import ApiException + class TestMetaIndexObject(unittest.TestCase): """MetaIndexObject unit test stubs""" @@ -35,14 +36,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.meta_index_object.MetaIndexObject() # noqa: E501 - if include_optional : - return MetaIndexObject( - prev_page = 56, - next_page = 56 - ) - else : - return MetaIndexObject( - ) + if include_optional: + return MetaIndexObject(prev_page=56, next_page=56) + else: + return MetaIndexObject() def testMetaIndexObject(self): """Test MetaIndexObject""" @@ -53,5 +50,5 @@ def testMetaIndexObject(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_offset.py b/test/test_offset.py index b6a2cca..0d16c62 100644 --- a/test/test_offset.py +++ b/test/test_offset.py @@ -20,6 +20,7 @@ from patch_api.models.offset import Offset # noqa: E501 from patch_api.rest import ApiException + class TestOffset(unittest.TestCase): """Offset unit test stubs""" @@ -35,33 +36,33 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.offset.Offset() # noqa: E501 - if include_optional : + if include_optional: return Offset( - id = '0', - allocated_mass_g = 0, - fulfilled_at = '0', - fulfillment_state = 'pending', - mass_g = 1, - price_cents_usd = '0', - production = True, - retired = True, - serial_number = '0', - vintage_year = 56, - project_id = '0' + id="0", + allocated_mass_g=0, + fulfilled_at="0", + fulfillment_state="pending", + mass_g=1, + price_cents_usd="0", + production=True, + retired=True, + serial_number="0", + vintage_year=56, + project_id="0", ) - else : + else: return Offset( - id = '0', - allocated_mass_g = 0, - fulfillment_state = 'pending', - mass_g = 1, - price_cents_usd = '0', - production = True, - retired = True, - serial_number = '0', - vintage_year = 56, - project_id = '0', - ) + id="0", + allocated_mass_g=0, + fulfillment_state="pending", + mass_g=1, + price_cents_usd="0", + production=True, + retired=True, + serial_number="0", + vintage_year=56, + project_id="0", + ) def testOffset(self): """Test Offset""" @@ -72,5 +73,5 @@ def testOffset(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_offset_list_response.py b/test/test_offset_list_response.py index f2a9424..6c40d1d 100644 --- a/test/test_offset_list_response.py +++ b/test/test_offset_list_response.py @@ -21,6 +21,7 @@ from factories import OffsetFactory, MetaIndexObjectFactory from patch_api.rest import ApiException + class TestOffsetListResponse(unittest.TestCase): """OffsetListResponse unit test stubs""" @@ -36,24 +37,20 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.offset_list_response.OffsetListResponse() # noqa: E501 - if include_optional : + if include_optional: return OffsetListResponse( - success = True, - error = None, - data = [ - OffsetFactory() - ], - meta = MetaIndexObjectFactory() + success=True, + error=None, + data=[OffsetFactory()], + meta=MetaIndexObjectFactory(), ) - else : + else: return OffsetListResponse( - success = True, - error = None, - data = [ - OffsetFactory() - ], - meta = MetaIndexObjectFactory(), - ) + success=True, + error=None, + data=[OffsetFactory()], + meta=MetaIndexObjectFactory(), + ) def testOffsetListResponse(self): """Test OffsetListResponse""" @@ -64,5 +61,5 @@ def testOffsetListResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_offset_response.py b/test/test_offset_response.py index c258043..f5b02a4 100644 --- a/test/test_offset_response.py +++ b/test/test_offset_response.py @@ -21,6 +21,7 @@ from factories import OffsetFactory from patch_api.rest import ApiException + class TestOffsetResponse(unittest.TestCase): """OffsetResponse unit test stubs""" @@ -36,18 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.offset_response.OffsetResponse() # noqa: E501 - if include_optional : - return OffsetResponse( - success = True, - error = None, - data = OffsetFactory() - ) - else : - return OffsetResponse( - success = True, - error = None, - data = OffsetFactory(), - ) + if include_optional: + return OffsetResponse(success=True, error=None, data=OffsetFactory()) + else: + return OffsetResponse(success=True, error=None, data=OffsetFactory()) def testOffsetResponse(self): """Test OffsetResponse""" @@ -58,5 +51,5 @@ def testOffsetResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_order.py b/test/test_order.py index 8dc8e5b..93c92fc 100644 --- a/test/test_order.py +++ b/test/test_order.py @@ -21,6 +21,7 @@ from patch_api.rest import ApiException from factories import AllocationFactory + class TestOrder(unittest.TestCase): """Order unit test stubs""" @@ -36,34 +37,30 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.order.Order() # noqa: E501 - if include_optional : + if include_optional: return Order( - id = '0', - mass_g = 1, - production = True, - state = 'draft', - allocation_state = 'pending', - price_cents_usd = '0', - patch_fee_cents_usd = '0', - allocations = [ - AllocationFactory() - ], - metadata = {}, + id="0", + mass_g=1, + production=True, + state="draft", + allocation_state="pending", + price_cents_usd="0", + patch_fee_cents_usd="0", + allocations=[AllocationFactory()], + metadata={}, ) - else : + else: return Order( - id = '0', - mass_g = 1, - production = True, - state = 'draft', - allocation_state = 'pending', - price_cents_usd = '0', - patch_fee_cents_usd = '0', - allocations = [ - AllocationFactory() - ], - metadata = {}, - ) + id="0", + mass_g=1, + production=True, + state="draft", + allocation_state="pending", + price_cents_usd="0", + patch_fee_cents_usd="0", + allocations=[AllocationFactory()], + metadata={}, + ) def testOrder(self): """Test Order""" @@ -74,5 +71,5 @@ def testOrder(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_order_list_response.py b/test/test_order_list_response.py index 8a00d30..ff1adf5 100644 --- a/test/test_order_list_response.py +++ b/test/test_order_list_response.py @@ -21,6 +21,7 @@ from factories import OrderFactory, MetaIndexObjectFactory from patch_api.rest import ApiException + class TestOrderListResponse(unittest.TestCase): """OrderListResponse unit test stubs""" @@ -36,24 +37,20 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.order_list_response.OrderListResponse() # noqa: E501 - if include_optional : + if include_optional: return OrderListResponse( - success = True, - error = None, - data = [ - OrderFactory() - ], - meta = MetaIndexObjectFactory() + success=True, + error=None, + data=[OrderFactory()], + meta=MetaIndexObjectFactory(), ) - else : + else: return OrderListResponse( - success = True, - error = None, - data = [ - OrderFactory() - ], - meta = MetaIndexObjectFactory(), - ) + success=True, + error=None, + data=[OrderFactory()], + meta=MetaIndexObjectFactory(), + ) def testOrderListResponse(self): """Test OrderListResponse""" @@ -64,5 +61,5 @@ def testOrderListResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_order_response.py b/test/test_order_response.py index 27e4bbb..1c3e9c3 100644 --- a/test/test_order_response.py +++ b/test/test_order_response.py @@ -21,6 +21,7 @@ from factories import OrderFactory from patch_api.rest import ApiException + class TestOrderResponse(unittest.TestCase): """OrderResponse unit test stubs""" @@ -36,18 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.order_response.OrderResponse() # noqa: E501 - if include_optional : - return OrderResponse( - success = True, - error = None, - data = OrderFactory() - ) - else : - return OrderResponse( - success = True, - error = None, - data = OrderFactory(), - ) + if include_optional: + return OrderResponse(success=True, error=None, data=OrderFactory()) + else: + return OrderResponse(success=True, error=None, data=OrderFactory()) def testOrderResponse(self): """Test OrderResponse""" @@ -58,5 +51,5 @@ def testOrderResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_orders_api.py b/test/test_orders_api.py index e3c85b0..80afe3d 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -26,7 +26,9 @@ class TestOrdersApi(unittest.TestCase): """OrdersApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + configuration = patch_api.Configuration( + api_key=os.environ.get("SANDBOX_API_KEY") + ) api_client = patch_api.ApiClient(configuration) self.api = OrdersApi(api_client=api_client) # noqa: E501 @@ -58,7 +60,6 @@ def test_interactions_with_an_order(self): self.assertTrue(cancelled_order) - def test_retrieve_orders(self): """Test case for retrieve_orders @@ -68,5 +69,5 @@ def test_retrieve_orders(self): self.assertTrue(isinstance(orders.data, list)) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_photo.py b/test/test_photo.py index aaa05dc..21218b4 100644 --- a/test/test_photo.py +++ b/test/test_photo.py @@ -20,6 +20,7 @@ from patch_api.models.photo import Photo # noqa: E501 from patch_api.rest import ApiException + class TestPhoto(unittest.TestCase): """Photo unit test stubs""" @@ -35,16 +36,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.photo.Photo() # noqa: E501 - if include_optional : - return Photo( - url = '0', - id = '0' - ) - else : - return Photo( - url = '0', - id = '0', - ) + if include_optional: + return Photo(url="0", id="0") + else: + return Photo(url="0", id="0") def testPhoto(self): """Test Photo""" @@ -55,5 +50,5 @@ def testPhoto(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_photo_response.py b/test/test_photo_response.py index 9e5ce4a..f510c8d 100644 --- a/test/test_photo_response.py +++ b/test/test_photo_response.py @@ -21,6 +21,7 @@ from factories import PhotoFactory # noqa: E501 from patch_api.rest import ApiException + class TestPhotoResponse(unittest.TestCase): """PhotoResponse unit test stubs""" @@ -36,18 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.photo_response.PhotoResponse() # noqa: E501 - if include_optional : - return PhotoResponse( - success = True, - error = None, - data = PhotoFactory() - ) - else : - return PhotoResponse( - success = True, - error = None, - data = PhotoFactory(), - ) + if include_optional: + return PhotoResponse(success=True, error=None, data=PhotoFactory()) + else: + return PhotoResponse(success=True, error=None, data=PhotoFactory()) def testPhotoResponse(self): """Test PhotoResponse""" @@ -58,5 +51,5 @@ def testPhotoResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_photos_api.py b/test/test_photos_api.py index e399b14..4ad41c6 100644 --- a/test/test_photos_api.py +++ b/test/test_photos_api.py @@ -37,5 +37,5 @@ def test_delete_photo(self): pass -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_preference.py b/test/test_preference.py index 1d40b76..a120a3b 100644 --- a/test/test_preference.py +++ b/test/test_preference.py @@ -21,6 +21,7 @@ from factories import PreferenceFactory from patch_api.rest import ApiException + class TestPreference(unittest.TestCase): """Preference unit test stubs""" @@ -36,9 +37,9 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.preference.Preference() # noqa: E501 - if include_optional : + if include_optional: return PreferenceFactory() - else : + else: return PreferenceFactory() def testPreference(self): @@ -50,5 +51,5 @@ def testPreference(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_preference_list_response.py b/test/test_preference_list_response.py index 230b70f..fcc6e5d 100644 --- a/test/test_preference_list_response.py +++ b/test/test_preference_list_response.py @@ -17,10 +17,13 @@ import datetime import patch_api -from patch_api.models.preference_list_response import PreferenceListResponse # noqa: E501 +from patch_api.models.preference_list_response import ( + PreferenceListResponse, +) # noqa: E501 from factories import MetaIndexObjectFactory, PreferenceFactory from patch_api.rest import ApiException + class TestPreferenceListResponse(unittest.TestCase): """PreferenceListResponse unit test stubs""" @@ -36,24 +39,20 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.preference_list_response.PreferenceListResponse() # noqa: E501 - if include_optional : + if include_optional: return PreferenceListResponse( - success = True, - error = None, - data = [ - PreferenceFactory() - ], - meta = MetaIndexObjectFactory() + success=True, + error=None, + data=[PreferenceFactory()], + meta=MetaIndexObjectFactory(), ) - else : + else: return PreferenceListResponse( - success = True, - error = None, - data = [ - PreferenceFactory() - ], - meta = MetaIndexObjectFactory(), - ) + success=True, + error=None, + data=[PreferenceFactory()], + meta=MetaIndexObjectFactory(), + ) def testPreferenceListResponse(self): """Test PreferenceListResponse""" @@ -64,5 +63,5 @@ def testPreferenceListResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_preference_response.py b/test/test_preference_response.py index 6dbb6c8..f69d3fc 100644 --- a/test/test_preference_response.py +++ b/test/test_preference_response.py @@ -21,6 +21,7 @@ from factories import PreferenceFactory from patch_api.rest import ApiException + class TestPreferenceResponse(unittest.TestCase): """PreferenceResponse unit test stubs""" @@ -36,18 +37,14 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.preference_response.PreferenceResponse() # noqa: E501 - if include_optional : + if include_optional: return PreferenceResponse( - success = True, - error = None, - data = PreferenceFactory() + success=True, error=None, data=PreferenceFactory() ) - else : + else: return PreferenceResponse( - success = True, - error = None, - data = PreferenceFactory() - ) + success=True, error=None, data=PreferenceFactory() + ) def testPreferenceResponse(self): """Test PreferenceResponse""" @@ -58,5 +55,5 @@ def testPreferenceResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index 9a93833..20dd71a 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -27,7 +27,9 @@ class TestPreferencesApi(unittest.TestCase): """PreferencesApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + configuration = patch_api.Configuration( + api_key=os.environ.get("SANDBOX_API_KEY") + ) api_client = patch_api.ApiClient(configuration) self.api = PreferencesApi(api_client=api_client) # noqa: E501 @@ -63,5 +65,5 @@ def test_delete_and_create_preferences(self): self.assertTrue(preference) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_project.py b/test/test_project.py index b8c01a9..cac1450 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -21,6 +21,7 @@ from patch_api.rest import ApiException from factories import ProjectFactory + class TestProject(unittest.TestCase): """Project unit test stubs""" @@ -36,13 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.project.Project() # noqa: E501 - if include_optional : + if include_optional: return ProjectFactory() - else : - return ProjectFactory( - photos = None, - standard = None, - type = None) + else: + return ProjectFactory(photos=None, standard=None, type=None) def testProject(self): """Test Project""" @@ -53,5 +51,5 @@ def testProject(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_project_list_response.py b/test/test_project_list_response.py index 2755930..03a6b1e 100644 --- a/test/test_project_list_response.py +++ b/test/test_project_list_response.py @@ -21,6 +21,7 @@ from factories import ProjectFactory, MetaIndexObjectFactory from patch_api.rest import ApiException + class TestProjectListResponse(unittest.TestCase): """ProjectListResponse unit test stubs""" @@ -36,24 +37,20 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.project_list_response.ProjectListResponse() # noqa: E501 - if include_optional : + if include_optional: return ProjectListResponse( - success = True, - error = None, - data = [ - ProjectFactory() - ], - meta = MetaIndexObjectFactory() + success=True, + error=None, + data=[ProjectFactory()], + meta=MetaIndexObjectFactory(), ) - else : + else: return ProjectListResponse( - success = True, - error = None, - data = [ - ProjectFactory() - ], - meta = MetaIndexObjectFactory(), - ) + success=True, + error=None, + data=[ProjectFactory()], + meta=MetaIndexObjectFactory(), + ) def testProjectListResponse(self): """Test ProjectListResponse""" @@ -63,5 +60,6 @@ def testProjectListResponse(self): self.assertTrue(inst_req_only) self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/test/test_project_response.py b/test/test_project_response.py index e10c69a..662b928 100644 --- a/test/test_project_response.py +++ b/test/test_project_response.py @@ -21,6 +21,7 @@ from factories import ProjectFactory from patch_api.rest import ApiException + class TestProjectResponse(unittest.TestCase): """ProjectResponse unit test stubs""" @@ -36,18 +37,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.project_response.ProjectResponse() # noqa: E501 - if include_optional : - return ProjectResponse( - success = True, - error = None, - data = ProjectFactory() - ) - else : - return ProjectResponse( - success = True, - error = None, - data = ProjectFactory() - ) + if include_optional: + return ProjectResponse(success=True, error=None, data=ProjectFactory()) + else: + return ProjectResponse(success=True, error=None, data=ProjectFactory()) def testProjectResponse(self): """Test ProjectResponse""" @@ -58,5 +51,5 @@ def testProjectResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_project_type_list_response.py b/test/test_project_type_list_response.py index 7acc0a0..8a6073f 100644 --- a/test/test_project_type_list_response.py +++ b/test/test_project_type_list_response.py @@ -17,10 +17,13 @@ import datetime import patch_api -from patch_api.models.project_type_list_response import ProjectTypeListResponse # noqa: E501 +from patch_api.models.project_type_list_response import ( + ProjectTypeListResponse, +) # noqa: E501 from factories import MetaIndexObjectFactory from patch_api.rest import ApiException + class TestProjectTypeListResponse(unittest.TestCase): """ProjectTypeListResponse unit test stubs""" @@ -36,24 +39,14 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.project_type_list_response.ProjectTypeListResponse() # noqa: E501 - if include_optional : + if include_optional: return ProjectTypeListResponse( - success = True, - error = None, - data = [ - '0' - ], - meta = MetaIndexObjectFactory() + success=True, error=None, data=["0"], meta=MetaIndexObjectFactory() ) - else : + else: return ProjectTypeListResponse( - success = True, - error = None, - data = [ - '0' - ], - meta = MetaIndexObjectFactory(), - ) + success=True, error=None, data=["0"], meta=MetaIndexObjectFactory() + ) def testProjectTypeListResponse(self): """Test ProjectTypeListResponse""" @@ -64,5 +57,5 @@ def testProjectTypeListResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_projects_api.py b/test/test_projects_api.py index 32d71ed..6e82a4b 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -25,7 +25,9 @@ class TestProjectsApi(unittest.TestCase): """ProjectsApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) + configuration = patch_api.Configuration( + api_key=os.environ.get("SANDBOX_API_KEY") + ) api_client = patch_api.ApiClient(configuration) self.api = ProjectsApi(api_client=api_client) # noqa: E501 @@ -50,6 +52,5 @@ def test_retrieve_projects(self): self.assertTrue(isinstance(projects.data, list)) - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_standard.py b/test/test_standard.py index 3e409c7..ae52416 100644 --- a/test/test_standard.py +++ b/test/test_standard.py @@ -20,6 +20,7 @@ from patch_api.models.standard import Standard # noqa: E501 from patch_api.rest import ApiException + class TestStandard(unittest.TestCase): """Standard unit test stubs""" @@ -35,18 +36,10 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.standard.Standard() # noqa: E501 - if include_optional : - return Standard( - type = '0', - acronym = '0', - description = '0' - ) - else : - return Standard( - type = '0', - acronym = '0', - description = '0', - ) + if include_optional: + return Standard(type="0", acronym="0", description="0") + else: + return Standard(type="0", acronym="0", description="0") def testStandard(self): """Test Standard""" @@ -57,5 +50,5 @@ def testStandard(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_standard_list_response.py b/test/test_standard_list_response.py index 18b3c94..cc5f529 100644 --- a/test/test_standard_list_response.py +++ b/test/test_standard_list_response.py @@ -21,6 +21,7 @@ from factories import StandardFactory, MetaIndexObjectFactory from patch_api.rest import ApiException + class TestStandardListResponse(unittest.TestCase): """StandardListResponse unit test stubs""" @@ -36,24 +37,20 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.standard_list_response.StandardListResponse() # noqa: E501 - if include_optional : + if include_optional: return StandardListResponse( - success = True, - error = None, - data = [ - StandardFactory(), - ], - meta = MetaIndexObjectFactory(), + success=True, + error=None, + data=[StandardFactory()], + meta=MetaIndexObjectFactory(), ) - else : + else: return StandardListResponse( - success = True, - error = None, - data = [ - StandardFactory(), - ], - meta = MetaIndexObjectFactory(), - ) + success=True, + error=None, + data=[StandardFactory()], + meta=MetaIndexObjectFactory(), + ) def testStandardListResponse(self): """Test StandardListResponse""" @@ -64,5 +61,5 @@ def testStandardListResponse(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_update_offset_request.py b/test/test_update_offset_request.py index 8d1c92a..6f0a4e5 100644 --- a/test/test_update_offset_request.py +++ b/test/test_update_offset_request.py @@ -20,6 +20,7 @@ from patch_api.models.update_offset_request import UpdateOffsetRequest # noqa: E501 from patch_api.rest import ApiException + class TestUpdateOffsetRequest(unittest.TestCase): """UpdateOffsetRequest unit test stubs""" @@ -35,16 +36,12 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.update_offset_request.UpdateOffsetRequest() # noqa: E501 - if include_optional : + if include_optional: return UpdateOffsetRequest( - mass_g = 1, - price_cents_usd = 1, - vintage_year = 56, - serial_number = '0' + mass_g=1, price_cents_usd=1, vintage_year=56, serial_number="0" ) - else : - return UpdateOffsetRequest( - ) + else: + return UpdateOffsetRequest() def testUpdateOffsetRequest(self): """Test UpdateOffsetRequest""" @@ -55,5 +52,5 @@ def testUpdateOffsetRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/test/test_update_project_request.py b/test/test_update_project_request.py index dd7a80f..0fe025a 100644 --- a/test/test_update_project_request.py +++ b/test/test_update_project_request.py @@ -20,6 +20,7 @@ from patch_api.models.update_project_request import UpdateProjectRequest # noqa: E501 from patch_api.rest import ApiException + class TestUpdateProjectRequest(unittest.TestCase): """UpdateProjectRequest unit test stubs""" @@ -35,23 +36,22 @@ def make_instance(self, include_optional): params are included, when True both required and optional params are included """ # model = patch_api.models.update_project_request.UpdateProjectRequest() # noqa: E501 - if include_optional : + if include_optional: return UpdateProjectRequest( - name = '0', - description = '0', - country = 'TJ', - state = '0', - verifier = '0', - type = 'biomass', - standard_type = 'american_carbon_registry', - longitude = '0', - latitude = '0', - production = '0', - organization_id = '0' + name="0", + description="0", + country="TJ", + state="0", + verifier="0", + type="biomass", + standard_type="american_carbon_registry", + longitude="0", + latitude="0", + production="0", + organization_id="0", ) - else : - return UpdateProjectRequest( - ) + else: + return UpdateProjectRequest() def testUpdateProjectRequest(self): """Test UpdateProjectRequest""" @@ -62,5 +62,5 @@ def testUpdateProjectRequest(self): self.assertTrue(inst_req_and_optional) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() From 01c9dc240331865cd973c9100915a358db76a494 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Mon, 25 Jan 2021 17:27:13 +0100 Subject: [PATCH 07/23] more unwanted model files --- patch_api/models/create_membership_request.py | 183 ----- patch_api/models/create_offset_request.py | 258 ------- .../models/create_organization_request.py | 165 ----- patch_api/models/create_photo_request.py | 183 ----- patch_api/models/create_project_request.py | 688 ------------------ patch_api/models/fulfill_offset_request.py | 118 --- patch_api/models/membership.py | 199 ----- patch_api/models/membership_response.py | 178 ----- patch_api/models/offset.py | 500 ------------- patch_api/models/offset_list_response.py | 222 ------ patch_api/models/offset_response.py | 178 ----- patch_api/models/organization.py | 218 ------ .../models/organization_list_response.py | 222 ------ patch_api/models/organization_response.py | 178 ----- patch_api/models/photo_response.py | 178 ----- .../models/project_type_list_response.py | 222 ------ patch_api/models/standard_list_response.py | 222 ------ patch_api/models/update_offset_request.py | 231 ------ patch_api/models/update_project_request.py | 688 ------------------ 19 files changed, 5031 deletions(-) delete mode 100644 patch_api/models/create_membership_request.py delete mode 100644 patch_api/models/create_offset_request.py delete mode 100644 patch_api/models/create_organization_request.py delete mode 100644 patch_api/models/create_photo_request.py delete mode 100644 patch_api/models/create_project_request.py delete mode 100644 patch_api/models/fulfill_offset_request.py delete mode 100644 patch_api/models/membership.py delete mode 100644 patch_api/models/membership_response.py delete mode 100644 patch_api/models/offset.py delete mode 100644 patch_api/models/offset_list_response.py delete mode 100644 patch_api/models/offset_response.py delete mode 100644 patch_api/models/organization.py delete mode 100644 patch_api/models/organization_list_response.py delete mode 100644 patch_api/models/organization_response.py delete mode 100644 patch_api/models/photo_response.py delete mode 100644 patch_api/models/project_type_list_response.py delete mode 100644 patch_api/models/standard_list_response.py delete mode 100644 patch_api/models/update_offset_request.py delete mode 100644 patch_api/models/update_project_request.py diff --git a/patch_api/models/create_membership_request.py b/patch_api/models/create_membership_request.py deleted file mode 100644 index 4c340d1..0000000 --- a/patch_api/models/create_membership_request.py +++ /dev/null @@ -1,183 +0,0 @@ -# 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 CreateMembershipRequest(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 = {"email": "str", "role": "str", "organization_id": "str"} - - attribute_map = { - "email": "email", - "role": "role", - "organization_id": "organization_id", - } - - def __init__( - self, email=None, role=None, organization_id=None, local_vars_configuration=None - ): # noqa: E501 - """CreateMembershipRequest - 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._email = None - self._role = None - self._organization_id = None - self.discriminator = None - - if email is not None: - self.email = email - if role is not None: - self.role = role - if organization_id is not None: - self.organization_id = organization_id - - @property - def email(self): - """Gets the email of this CreateMembershipRequest. # noqa: E501 - - - :return: The email of this CreateMembershipRequest. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this CreateMembershipRequest. - - - :param email: The email of this CreateMembershipRequest. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def role(self): - """Gets the role of this CreateMembershipRequest. # noqa: E501 - - - :return: The role of this CreateMembershipRequest. # noqa: E501 - :rtype: str - """ - return self._role - - @role.setter - def role(self, role): - """Sets the role of this CreateMembershipRequest. - - - :param role: The role of this CreateMembershipRequest. # noqa: E501 - :type: str - """ - allowed_values = ["admin", "developer", "member"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and role not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `role` ({0}), must be one of {1}".format( # noqa: E501 - role, allowed_values - ) - ) - - self._role = role - - @property - def organization_id(self): - """Gets the organization_id of this CreateMembershipRequest. # noqa: E501 - - - :return: The organization_id of this CreateMembershipRequest. # noqa: E501 - :rtype: str - """ - return self._organization_id - - @organization_id.setter - def organization_id(self, organization_id): - """Sets the organization_id of this CreateMembershipRequest. - - - :param organization_id: The organization_id of this CreateMembershipRequest. # noqa: E501 - :type: str - """ - - self._organization_id = organization_id - - 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, CreateMembershipRequest): - 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, CreateMembershipRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_offset_request.py b/patch_api/models/create_offset_request.py deleted file mode 100644 index add2d21..0000000 --- a/patch_api/models/create_offset_request.py +++ /dev/null @@ -1,258 +0,0 @@ -# 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 CreateOffsetRequest(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 = { - "mass_g": "int", - "price_cents_usd": "int", - "project_id": "str", - "vintage_year": "int", - "serial_number": "str", - } - - attribute_map = { - "mass_g": "mass_g", - "price_cents_usd": "price_cents_usd", - "project_id": "project_id", - "vintage_year": "vintage_year", - "serial_number": "serial_number", - } - - def __init__( - self, - mass_g=None, - price_cents_usd=None, - project_id=None, - vintage_year=None, - serial_number=None, - local_vars_configuration=None, - ): # noqa: E501 - """CreateOffsetRequest - 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._mass_g = None - self._price_cents_usd = None - self._project_id = None - self._vintage_year = None - self._serial_number = None - self.discriminator = None - - if mass_g is not None: - self.mass_g = mass_g - if price_cents_usd is not None: - self.price_cents_usd = price_cents_usd - if project_id is not None: - self.project_id = project_id - if vintage_year is not None: - self.vintage_year = vintage_year - self.serial_number = serial_number - - @property - def mass_g(self): - """Gets the mass_g of this CreateOffsetRequest. # noqa: E501 - - - :return: The mass_g of this CreateOffsetRequest. # noqa: E501 - :rtype: int - """ - return self._mass_g - - @mass_g.setter - def mass_g(self, mass_g): - """Sets the mass_g of this CreateOffsetRequest. - - - :param mass_g: The mass_g of this CreateOffsetRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 1000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `1000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._mass_g = mass_g - - @property - def price_cents_usd(self): - """Gets the price_cents_usd of this CreateOffsetRequest. # noqa: E501 - - - :return: The price_cents_usd of this CreateOffsetRequest. # noqa: E501 - :rtype: int - """ - return self._price_cents_usd - - @price_cents_usd.setter - def price_cents_usd(self, price_cents_usd): - """Sets the price_cents_usd of this CreateOffsetRequest. - - - :param price_cents_usd: The price_cents_usd of this CreateOffsetRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and price_cents_usd is not None - and price_cents_usd < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._price_cents_usd = price_cents_usd - - @property - def project_id(self): - """Gets the project_id of this CreateOffsetRequest. # noqa: E501 - - - :return: The project_id of this CreateOffsetRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateOffsetRequest. - - - :param project_id: The project_id of this CreateOffsetRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def vintage_year(self): - """Gets the vintage_year of this CreateOffsetRequest. # noqa: E501 - - - :return: The vintage_year of this CreateOffsetRequest. # noqa: E501 - :rtype: int - """ - return self._vintage_year - - @vintage_year.setter - def vintage_year(self, vintage_year): - """Sets the vintage_year of this CreateOffsetRequest. - - - :param vintage_year: The vintage_year of this CreateOffsetRequest. # noqa: E501 - :type: int - """ - - self._vintage_year = vintage_year - - @property - def serial_number(self): - """Gets the serial_number of this CreateOffsetRequest. # noqa: E501 - - - :return: The serial_number of this CreateOffsetRequest. # noqa: E501 - :rtype: str - """ - return self._serial_number - - @serial_number.setter - def serial_number(self, serial_number): - """Sets the serial_number of this CreateOffsetRequest. - - - :param serial_number: The serial_number of this CreateOffsetRequest. # noqa: E501 - :type: str - """ - - self._serial_number = serial_number - - 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, CreateOffsetRequest): - 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, CreateOffsetRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_organization_request.py b/patch_api/models/create_organization_request.py deleted file mode 100644 index a58e4f4..0000000 --- a/patch_api/models/create_organization_request.py +++ /dev/null @@ -1,165 +0,0 @@ -# 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 CreateOrganizationRequest(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 = {"name": "str", "type": "str"} - - attribute_map = {"name": "name", "type": "type"} - - def __init__( - self, name=None, type=None, local_vars_configuration=None - ): # noqa: E501 - """CreateOrganizationRequest - 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._name = None - self._type = None - self.discriminator = None - - self.name = name - self.type = type - - @property - def name(self): - """Gets the name of this CreateOrganizationRequest. # noqa: E501 - - - :return: The name of this CreateOrganizationRequest. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this CreateOrganizationRequest. - - - :param name: The name of this CreateOrganizationRequest. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and name is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def type(self): - """Gets the type of this CreateOrganizationRequest. # noqa: E501 - - - :return: The type of this CreateOrganizationRequest. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this CreateOrganizationRequest. - - - :param type: The type of this CreateOrganizationRequest. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and type is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `type`, must not be `None`" - ) # noqa: E501 - allowed_values = ["consumer", "supplier"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and type not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 - type, allowed_values - ) - ) - - self._type = 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, CreateOrganizationRequest): - 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, CreateOrganizationRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_photo_request.py b/patch_api/models/create_photo_request.py deleted file mode 100644 index 290ca1d..0000000 --- a/patch_api/models/create_photo_request.py +++ /dev/null @@ -1,183 +0,0 @@ -# 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 CreatePhotoRequest(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 = {"project_id": "str", "url": "str", "sort_order": "int"} - - attribute_map = { - "project_id": "project_id", - "url": "url", - "sort_order": "sort_order", - } - - def __init__( - self, project_id=None, url=None, sort_order=None, local_vars_configuration=None - ): # noqa: E501 - """CreatePhotoRequest - 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._project_id = None - self._url = None - self._sort_order = None - self.discriminator = None - - self.project_id = project_id - self.url = url - if sort_order is not None: - self.sort_order = sort_order - - @property - def project_id(self): - """Gets the project_id of this CreatePhotoRequest. # noqa: E501 - - - :return: The project_id of this CreatePhotoRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreatePhotoRequest. - - - :param project_id: The project_id of this CreatePhotoRequest. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and project_id is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `project_id`, must not be `None`" - ) # noqa: E501 - - self._project_id = project_id - - @property - def url(self): - """Gets the url of this CreatePhotoRequest. # noqa: E501 - - - :return: The url of this CreatePhotoRequest. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this CreatePhotoRequest. - - - :param url: The url of this CreatePhotoRequest. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and url is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) # noqa: E501 - - self._url = url - - @property - def sort_order(self): - """Gets the sort_order of this CreatePhotoRequest. # noqa: E501 - - - :return: The sort_order of this CreatePhotoRequest. # noqa: E501 - :rtype: int - """ - return self._sort_order - - @sort_order.setter - def sort_order(self, sort_order): - """Sets the sort_order of this CreatePhotoRequest. - - - :param sort_order: The sort_order of this CreatePhotoRequest. # noqa: E501 - :type: int - """ - - self._sort_order = sort_order - - 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, CreatePhotoRequest): - 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, CreatePhotoRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_project_request.py b/patch_api/models/create_project_request.py deleted file mode 100644 index 0fc59bc..0000000 --- a/patch_api/models/create_project_request.py +++ /dev/null @@ -1,688 +0,0 @@ -# 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 CreateProjectRequest(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 = { - "name": "str", - "description": "str", - "country": "str", - "state": "str", - "verifier": "str", - "type": "str", - "standard_type": "str", - "longitude": "str", - "latitude": "str", - "production": "str", - "organization_id": "str", - } - - attribute_map = { - "name": "name", - "description": "description", - "country": "country", - "state": "state", - "verifier": "verifier", - "type": "type", - "standard_type": "standard_type", - "longitude": "longitude", - "latitude": "latitude", - "production": "production", - "organization_id": "organization_id", - } - - def __init__( - self, - name=None, - description=None, - country=None, - state=None, - verifier=None, - type=None, - standard_type=None, - longitude=None, - latitude=None, - production=None, - organization_id=None, - local_vars_configuration=None, - ): # noqa: E501 - """CreateProjectRequest - 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._name = None - self._description = None - self._country = None - self._state = None - self._verifier = None - self._type = None - self._standard_type = None - self._longitude = None - self._latitude = None - self._production = None - self._organization_id = None - self.discriminator = None - - if name is not None: - self.name = name - if description is not None: - self.description = description - if country is not None: - self.country = country - if state is not None: - self.state = state - if verifier is not None: - self.verifier = verifier - if type is not None: - self.type = type - if standard_type is not None: - self.standard_type = standard_type - if longitude is not None: - self.longitude = longitude - if latitude is not None: - self.latitude = latitude - self.production = production - if organization_id is not None: - self.organization_id = organization_id - - @property - def name(self): - """Gets the name of this CreateProjectRequest. # noqa: E501 - - - :return: The name of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this CreateProjectRequest. - - - :param name: The name of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def description(self): - """Gets the description of this CreateProjectRequest. # noqa: E501 - - - :return: The description of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this CreateProjectRequest. - - - :param description: The description of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def country(self): - """Gets the country of this CreateProjectRequest. # noqa: E501 - - - :return: The country of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._country - - @country.setter - def country(self, country): - """Sets the country of this CreateProjectRequest. - - - :param country: The country of this CreateProjectRequest. # noqa: E501 - :type: str - """ - allowed_values = [ - "TJ", - "JM", - "HT", - "ST", - "MS", - "AE", - "PK", - "NL", - "LU", - "BZ", - "IR", - "BO", - "UY", - "GH", - "SA", - "CI", - "MF", - "TF", - "AI", - "QA", - "SX", - "LY", - "BV", - "PG", - "KG", - "GQ", - "EH", - "NU", - "PR", - "GD", - "KR", - "HM", - "SM", - "SL", - "CD", - "MK", - "TR", - "DZ", - "GE", - "PS", - "BB", - "UA", - "GP", - "PF", - "NA", - "BW", - "SY", - "TG", - "DO", - "AQ", - "CH", - "MG", - "FO", - "VG", - "GI", - "BN", - "LA", - "IS", - "EE", - "UM", - "LT", - "RS", - "MR", - "AD", - "HU", - "TK", - "MY", - "AO", - "CV", - "NF", - "PA", - "GW", - "BE", - "PT", - "GB", - "IM", - "US", - "YE", - "HK", - "AZ", - "CC", - "ML", - "SK", - "VU", - "TL", - "HR", - "SR", - "MU", - "CZ", - "PM", - "LS", - "WS", - "KM", - "IT", - "BI", - "WF", - "GN", - "SG", - "CO", - "CN", - "AW", - "MA", - "FI", - "VA", - "ZW", - "KY", - "BH", - "PY", - "EC", - "LR", - "RU", - "PL", - "OM", - "MT", - "SS", - "DE", - "TM", - "SJ", - "MM", - "TT", - "IL", - "BD", - "NR", - "LK", - "UG", - "NG", - "BQ", - "MX", - "CW", - "SI", - "MN", - "CA", - "AX", - "VN", - "TW", - "JP", - "IO", - "RO", - "BG", - "GU", - "BR", - "AM", - "ZM", - "DJ", - "JE", - "AT", - "CM", - "SE", - "FJ", - "KZ", - "GL", - "GY", - "CX", - "MW", - "TN", - "ZA", - "TO", - "CY", - "MV", - "PN", - "RW", - "NI", - "KN", - "BJ", - "ET", - "GM", - "TZ", - "VC", - "FK", - "SD", - "MC", - "AU", - "CL", - "DK", - "FR", - "TC", - "CU", - "AL", - "MZ", - "BS", - "NE", - "GT", - "LI", - "NP", - "BF", - "PW", - "KW", - "IN", - "GA", - "TV", - "MO", - "SH", - "MD", - "CK", - "AR", - "SC", - "IE", - "ES", - "LB", - "BM", - "RE", - "KI", - "AG", - "MQ", - "SV", - "JO", - "TH", - "SO", - "MH", - "CG", - "KP", - "GF", - "BA", - "YT", - "GS", - "KE", - "PE", - "BT", - "SZ", - "CR", - "TD", - "DM", - "NC", - "GR", - "GG", - "HN", - "VI", - "CF", - "SN", - "AF", - "MP", - "PH", - "BY", - "LV", - "NO", - "EG", - "KH", - "IQ", - "LC", - "NZ", - "BL", - "UZ", - "ID", - "ER", - "VE", - "FM", - "SB", - "ME", - "AS", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and country not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `country` ({0}), must be one of {1}".format( # noqa: E501 - country, allowed_values - ) - ) - - self._country = country - - @property - def state(self): - """Gets the state of this CreateProjectRequest. # noqa: E501 - - - :return: The state of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this CreateProjectRequest. - - - :param state: The state of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._state = state - - @property - def verifier(self): - """Gets the verifier of this CreateProjectRequest. # noqa: E501 - - - :return: The verifier of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._verifier - - @verifier.setter - def verifier(self, verifier): - """Sets the verifier of this CreateProjectRequest. - - - :param verifier: The verifier of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._verifier = verifier - - @property - def type(self): - """Gets the type of this CreateProjectRequest. # noqa: E501 - - - :return: The type of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this CreateProjectRequest. - - - :param type: The type of this CreateProjectRequest. # noqa: E501 - :type: str - """ - allowed_values = [ - "biomass", - "dac", - "forestry", - "mineralization", - "ocean", - "soil", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and type not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 - type, allowed_values - ) - ) - - self._type = type - - @property - def standard_type(self): - """Gets the standard_type of this CreateProjectRequest. # noqa: E501 - - - :return: The standard_type of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._standard_type - - @standard_type.setter - def standard_type(self, standard_type): - """Sets the standard_type of this CreateProjectRequest. - - - :param standard_type: The standard_type of this CreateProjectRequest. # noqa: E501 - :type: str - """ - allowed_values = [ - "american_carbon_registry", - "climate_action_reserve", - "verified_carbon_standard", - "european_biochar_certificate", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and standard_type not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `standard_type` ({0}), must be one of {1}".format( # noqa: E501 - standard_type, allowed_values - ) - ) - - self._standard_type = standard_type - - @property - def longitude(self): - """Gets the longitude of this CreateProjectRequest. # noqa: E501 - - - :return: The longitude of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._longitude - - @longitude.setter - def longitude(self, longitude): - """Sets the longitude of this CreateProjectRequest. - - - :param longitude: The longitude of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._longitude = longitude - - @property - def latitude(self): - """Gets the latitude of this CreateProjectRequest. # noqa: E501 - - - :return: The latitude of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._latitude - - @latitude.setter - def latitude(self, latitude): - """Sets the latitude of this CreateProjectRequest. - - - :param latitude: The latitude of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._latitude = latitude - - @property - def production(self): - """Gets the production of this CreateProjectRequest. # noqa: E501 - - - :return: The production of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._production - - @production.setter - def production(self, production): - """Sets the production of this CreateProjectRequest. - - - :param production: The production of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._production = production - - @property - def organization_id(self): - """Gets the organization_id of this CreateProjectRequest. # noqa: E501 - - - :return: The organization_id of this CreateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._organization_id - - @organization_id.setter - def organization_id(self, organization_id): - """Sets the organization_id of this CreateProjectRequest. - - - :param organization_id: The organization_id of this CreateProjectRequest. # noqa: E501 - :type: str - """ - - self._organization_id = organization_id - - 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, CreateProjectRequest): - 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, CreateProjectRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/fulfill_offset_request.py b/patch_api/models/fulfill_offset_request.py deleted file mode 100644 index 5348347..0000000 --- a/patch_api/models/fulfill_offset_request.py +++ /dev/null @@ -1,118 +0,0 @@ -# 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 FulfillOffsetRequest(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 = {"serial_number": "str"} - - attribute_map = {"serial_number": "serial_number"} - - def __init__(self, serial_number=None, local_vars_configuration=None): # noqa: E501 - """FulfillOffsetRequest - 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._serial_number = None - self.discriminator = None - - self.serial_number = serial_number - - @property - def serial_number(self): - """Gets the serial_number of this FulfillOffsetRequest. # noqa: E501 - - - :return: The serial_number of this FulfillOffsetRequest. # noqa: E501 - :rtype: str - """ - return self._serial_number - - @serial_number.setter - def serial_number(self, serial_number): - """Sets the serial_number of this FulfillOffsetRequest. - - - :param serial_number: The serial_number of this FulfillOffsetRequest. # noqa: E501 - :type: str - """ - - self._serial_number = serial_number - - 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, FulfillOffsetRequest): - 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, FulfillOffsetRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/membership.py b/patch_api/models/membership.py deleted file mode 100644 index 16d18ca..0000000 --- a/patch_api/models/membership.py +++ /dev/null @@ -1,199 +0,0 @@ -# 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 Membership(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 = {"email": "str", "role": "str", "organization_id": "str"} - - attribute_map = { - "email": "email", - "role": "role", - "organization_id": "organization_id", - } - - def __init__( - self, email=None, role=None, organization_id=None, local_vars_configuration=None - ): # noqa: E501 - """Membership - 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._email = None - self._role = None - self._organization_id = None - self.discriminator = None - - self.email = email - self.role = role - self.organization_id = organization_id - - @property - def email(self): - """Gets the email of this Membership. # noqa: E501 - - - :return: The email of this Membership. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this Membership. - - - :param email: The email of this Membership. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and email is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `email`, must not be `None`" - ) # noqa: E501 - - self._email = email - - @property - def role(self): - """Gets the role of this Membership. # noqa: E501 - - - :return: The role of this Membership. # noqa: E501 - :rtype: str - """ - return self._role - - @role.setter - def role(self, role): - """Sets the role of this Membership. - - - :param role: The role of this Membership. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and role is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `role`, must not be `None`" - ) # noqa: E501 - allowed_values = ["admin", "developer", "member"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and role not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `role` ({0}), must be one of {1}".format( # noqa: E501 - role, allowed_values - ) - ) - - self._role = role - - @property - def organization_id(self): - """Gets the organization_id of this Membership. # noqa: E501 - - - :return: The organization_id of this Membership. # noqa: E501 - :rtype: str - """ - return self._organization_id - - @organization_id.setter - def organization_id(self, organization_id): - """Sets the organization_id of this Membership. - - - :param organization_id: The organization_id of this Membership. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation - and organization_id is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `organization_id`, must not be `None`" - ) # noqa: E501 - - self._organization_id = organization_id - - 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, Membership): - 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, Membership): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/membership_response.py b/patch_api/models/membership_response.py deleted file mode 100644 index acc380c..0000000 --- a/patch_api/models/membership_response.py +++ /dev/null @@ -1,178 +0,0 @@ -# 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 MembershipResponse(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 = {"success": "bool", "error": "object", "data": "list[Membership]"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 - """MembershipResponse - 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._success = None - self._error = None - self._data = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - - @property - def success(self): - """Gets the success of this MembershipResponse. # noqa: E501 - - - :return: The success of this MembershipResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this MembershipResponse. - - - :param success: The success of this MembershipResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this MembershipResponse. # noqa: E501 - - - :return: The error of this MembershipResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this MembershipResponse. - - - :param error: The error of this MembershipResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this MembershipResponse. # noqa: E501 - - - :return: The data of this MembershipResponse. # noqa: E501 - :rtype: list[Membership] - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MembershipResponse. - - - :param data: The data of this MembershipResponse. # noqa: E501 - :type: list[Membership] - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - 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, MembershipResponse): - 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, MembershipResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/offset.py b/patch_api/models/offset.py deleted file mode 100644 index b01630f..0000000 --- a/patch_api/models/offset.py +++ /dev/null @@ -1,500 +0,0 @@ -# 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 Offset(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 = { - "id": "str", - "allocated_mass_g": "int", - "fulfilled_at": "str", - "fulfillment_state": "str", - "mass_g": "int", - "price_cents_usd": "str", - "production": "bool", - "retired": "bool", - "serial_number": "str", - "vintage_year": "int", - "project_id": "str", - } - - attribute_map = { - "id": "id", - "allocated_mass_g": "allocated_mass_g", - "fulfilled_at": "fulfilled_at", - "fulfillment_state": "fulfillment_state", - "mass_g": "mass_g", - "price_cents_usd": "price_cents_usd", - "production": "production", - "retired": "retired", - "serial_number": "serial_number", - "vintage_year": "vintage_year", - "project_id": "project_id", - } - - def __init__( - self, - id=None, - allocated_mass_g=None, - fulfilled_at=None, - fulfillment_state=None, - mass_g=None, - price_cents_usd=None, - production=None, - retired=None, - serial_number=None, - vintage_year=None, - project_id=None, - local_vars_configuration=None, - ): # noqa: E501 - """Offset - 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._id = None - self._allocated_mass_g = None - self._fulfilled_at = None - self._fulfillment_state = None - self._mass_g = None - self._price_cents_usd = None - self._production = None - self._retired = None - self._serial_number = None - self._vintage_year = None - self._project_id = None - self.discriminator = None - - self.id = id - self.allocated_mass_g = allocated_mass_g - self.fulfilled_at = fulfilled_at - self.fulfillment_state = fulfillment_state - self.mass_g = mass_g - self.price_cents_usd = price_cents_usd - self.production = production - self.retired = retired - self.serial_number = serial_number - self.vintage_year = vintage_year - self.project_id = project_id - - @property - def id(self): - """Gets the id of this Offset. # noqa: E501 - - A unique uid for the record. UIDs will be prepended by off_prod or off_test depending on the mode it was created in. # noqa: E501 - - :return: The id of this Offset. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Offset. - - A unique uid for the record. UIDs will be prepended by off_prod or off_test depending on the mode it was created in. # noqa: E501 - - :param id: The id of this Offset. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and id is None - ): # noqa: E501 - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def allocated_mass_g(self): - """Gets the allocated_mass_g of this Offset. # noqa: E501 - - The amount of carbon offset mass in grams already allocated from this offset. # noqa: E501 - - :return: The allocated_mass_g of this Offset. # noqa: E501 - :rtype: int - """ - return self._allocated_mass_g - - @allocated_mass_g.setter - def allocated_mass_g(self, allocated_mass_g): - """Sets the allocated_mass_g of this Offset. - - The amount of carbon offset mass in grams already allocated from this offset. # noqa: E501 - - :param allocated_mass_g: The allocated_mass_g of this Offset. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and allocated_mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocated_mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and allocated_mass_g is not None - and allocated_mass_g > 1000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocated_mass_g`, must be a value less than or equal to `1000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and allocated_mass_g is not None - and allocated_mass_g < 0 - ): # noqa: E501 - raise ValueError( - "Invalid value for `allocated_mass_g`, must be a value greater than or equal to `0`" - ) # noqa: E501 - - self._allocated_mass_g = allocated_mass_g - - @property - def fulfilled_at(self): - """Gets the fulfilled_at of this Offset. # noqa: E501 - - The date in which the orders allocated to this offset were fulfilled. # noqa: E501 - - :return: The fulfilled_at of this Offset. # noqa: E501 - :rtype: str - """ - return self._fulfilled_at - - @fulfilled_at.setter - def fulfilled_at(self, fulfilled_at): - """Sets the fulfilled_at of this Offset. - - The date in which the orders allocated to this offset were fulfilled. # noqa: E501 - - :param fulfilled_at: The fulfilled_at of this Offset. # noqa: E501 - :type: str - """ - - self._fulfilled_at = fulfilled_at - - @property - def fulfillment_state(self): - """Gets the fulfillment_state of this Offset. # noqa: E501 - - The current fulfillment state of the offset. # noqa: E501 - - :return: The fulfillment_state of this Offset. # noqa: E501 - :rtype: str - """ - return self._fulfillment_state - - @fulfillment_state.setter - def fulfillment_state(self, fulfillment_state): - """Sets the fulfillment_state of this Offset. - - The current fulfillment state of the offset. # noqa: E501 - - :param fulfillment_state: The fulfillment_state of this Offset. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation - and fulfillment_state is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `fulfillment_state`, must not be `None`" - ) # noqa: E501 - allowed_values = ["pending", "fulfilled"] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and fulfillment_state not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `fulfillment_state` ({0}), must be one of {1}".format( # noqa: E501 - fulfillment_state, allowed_values - ) - ) - - self._fulfillment_state = fulfillment_state - - @property - def mass_g(self): - """Gets the mass_g of this Offset. # noqa: E501 - - The amount of carbon offsets in grams for this offset. # noqa: E501 - - :return: The mass_g of this Offset. # noqa: E501 - :rtype: int - """ - return self._mass_g - - @mass_g.setter - def mass_g(self, mass_g): - """Sets the mass_g of this Offset. - - The amount of carbon offsets in grams for this offset. # noqa: E501 - - :param mass_g: The mass_g of this Offset. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation and mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 1000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `1000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._mass_g = mass_g - - @property - def price_cents_usd(self): - """Gets the price_cents_usd of this Offset. # noqa: E501 - - The total price in cents USD of this carbon offset. # noqa: E501 - - :return: The price_cents_usd of this Offset. # noqa: E501 - :rtype: str - """ - return self._price_cents_usd - - @price_cents_usd.setter - def price_cents_usd(self, price_cents_usd): - """Sets the price_cents_usd of this Offset. - - The total price in cents USD of this carbon offset. # noqa: E501 - - :param price_cents_usd: The price_cents_usd of this Offset. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation - and price_cents_usd is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `price_cents_usd`, must not be `None`" - ) # noqa: E501 - - self._price_cents_usd = price_cents_usd - - @property - def production(self): - """Gets the production of this Offset. # noqa: E501 - - A boolean indicating if this offset is a production or test mode offset. # noqa: E501 - - :return: The production of this Offset. # noqa: E501 - :rtype: bool - """ - return self._production - - @production.setter - def production(self, production): - """Sets the production of this Offset. - - A boolean indicating if this offset is a production or test mode offset. # noqa: E501 - - :param production: The production of this Offset. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and production is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `production`, must not be `None`" - ) # noqa: E501 - - self._production = production - - @property - def retired(self): - """Gets the retired of this Offset. # noqa: E501 - - - :return: The retired of this Offset. # noqa: E501 - :rtype: bool - """ - return self._retired - - @retired.setter - def retired(self, retired): - """Sets the retired of this Offset. - - - :param retired: The retired of this Offset. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and retired is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `retired`, must not be `None`" - ) # noqa: E501 - - self._retired = retired - - @property - def serial_number(self): - """Gets the serial_number of this Offset. # noqa: E501 - - The serial number for this offset. # noqa: E501 - - :return: The serial_number of this Offset. # noqa: E501 - :rtype: str - """ - return self._serial_number - - @serial_number.setter - def serial_number(self, serial_number): - """Sets the serial_number of this Offset. - - The serial number for this offset. # noqa: E501 - - :param serial_number: The serial_number of this Offset. # noqa: E501 - :type: str - """ - - self._serial_number = serial_number - - @property - def vintage_year(self): - """Gets the vintage_year of this Offset. # noqa: E501 - - - :return: The vintage_year of this Offset. # noqa: E501 - :rtype: int - """ - return self._vintage_year - - @vintage_year.setter - def vintage_year(self, vintage_year): - """Sets the vintage_year of this Offset. - - - :param vintage_year: The vintage_year of this Offset. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and vintage_year is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `vintage_year`, must not be `None`" - ) # noqa: E501 - - self._vintage_year = vintage_year - - @property - def project_id(self): - """Gets the project_id of this Offset. # noqa: E501 - - - :return: The project_id of this Offset. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this Offset. - - - :param project_id: The project_id of this Offset. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and project_id is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `project_id`, must not be `None`" - ) # noqa: E501 - - self._project_id = project_id - - 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, Offset): - 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, Offset): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/offset_list_response.py b/patch_api/models/offset_list_response.py deleted file mode 100644 index 38b0da2..0000000 --- a/patch_api/models/offset_list_response.py +++ /dev/null @@ -1,222 +0,0 @@ -# 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 OffsetListResponse(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 = { - "success": "bool", - "error": "object", - "data": "list[Offset]", - "meta": "MetaIndexObject", - } - - attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", - } - - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 - """OffsetListResponse - 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._success = None - self._error = None - self._data = None - self._meta = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - self.meta = meta - - @property - def success(self): - """Gets the success of this OffsetListResponse. # noqa: E501 - - - :return: The success of this OffsetListResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this OffsetListResponse. - - - :param success: The success of this OffsetListResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this OffsetListResponse. # noqa: E501 - - - :return: The error of this OffsetListResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this OffsetListResponse. - - - :param error: The error of this OffsetListResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this OffsetListResponse. # noqa: E501 - - - :return: The data of this OffsetListResponse. # noqa: E501 - :rtype: list[Offset] - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this OffsetListResponse. - - - :param data: The data of this OffsetListResponse. # noqa: E501 - :type: list[Offset] - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - @property - def meta(self): - """Gets the meta of this OffsetListResponse. # noqa: E501 - - - :return: The meta of this OffsetListResponse. # noqa: E501 - :rtype: MetaIndexObject - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this OffsetListResponse. - - - :param meta: The meta of this OffsetListResponse. # noqa: E501 - :type: MetaIndexObject - """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 - - self._meta = meta - - 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, OffsetListResponse): - 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, OffsetListResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/offset_response.py b/patch_api/models/offset_response.py deleted file mode 100644 index 6fb7d69..0000000 --- a/patch_api/models/offset_response.py +++ /dev/null @@ -1,178 +0,0 @@ -# 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 OffsetResponse(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 = {"success": "bool", "error": "object", "data": "Offset"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 - """OffsetResponse - 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._success = None - self._error = None - self._data = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - - @property - def success(self): - """Gets the success of this OffsetResponse. # noqa: E501 - - - :return: The success of this OffsetResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this OffsetResponse. - - - :param success: The success of this OffsetResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this OffsetResponse. # noqa: E501 - - - :return: The error of this OffsetResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this OffsetResponse. - - - :param error: The error of this OffsetResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this OffsetResponse. # noqa: E501 - - - :return: The data of this OffsetResponse. # noqa: E501 - :rtype: Offset - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this OffsetResponse. - - - :param data: The data of this OffsetResponse. # noqa: E501 - :type: Offset - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - 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, OffsetResponse): - 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, OffsetResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/organization.py b/patch_api/models/organization.py deleted file mode 100644 index 190ed70..0000000 --- a/patch_api/models/organization.py +++ /dev/null @@ -1,218 +0,0 @@ -# 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 Organization(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 = {"id": "str", "name": "str", "type": "str", "production": "bool"} - - attribute_map = { - "id": "id", - "name": "name", - "type": "type", - "production": "production", - } - - def __init__( - self, - id=None, - name=None, - type=None, - production=None, - local_vars_configuration=None, - ): # noqa: E501 - """Organization - 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._id = None - self._name = None - self._type = None - self._production = None - self.discriminator = None - - if id is not None: - self.id = id - self.name = name - self.type = type - self.production = production - - @property - def id(self): - """Gets the id of this Organization. # noqa: E501 - - - :return: The id of this Organization. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Organization. - - - :param id: The id of this Organization. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def name(self): - """Gets the name of this Organization. # noqa: E501 - - - :return: The name of this Organization. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Organization. - - - :param name: The name of this Organization. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and name is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def type(self): - """Gets the type of this Organization. # noqa: E501 - - - :return: The type of this Organization. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this Organization. - - - :param type: The type of this Organization. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and type is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `type`, must not be `None`" - ) # noqa: E501 - - self._type = type - - @property - def production(self): - """Gets the production of this Organization. # noqa: E501 - - - :return: The production of this Organization. # noqa: E501 - :rtype: bool - """ - return self._production - - @production.setter - def production(self, production): - """Sets the production of this Organization. - - - :param production: The production of this Organization. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and production is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `production`, must not be `None`" - ) # noqa: E501 - - self._production = production - - 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, Organization): - 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, Organization): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/organization_list_response.py b/patch_api/models/organization_list_response.py deleted file mode 100644 index a10e114..0000000 --- a/patch_api/models/organization_list_response.py +++ /dev/null @@ -1,222 +0,0 @@ -# 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 OrganizationListResponse(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 = { - "success": "bool", - "error": "object", - "data": "list[Organization]", - "meta": "MetaIndexObject", - } - - attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", - } - - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 - """OrganizationListResponse - 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._success = None - self._error = None - self._data = None - self._meta = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - self.meta = meta - - @property - def success(self): - """Gets the success of this OrganizationListResponse. # noqa: E501 - - - :return: The success of this OrganizationListResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this OrganizationListResponse. - - - :param success: The success of this OrganizationListResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this OrganizationListResponse. # noqa: E501 - - - :return: The error of this OrganizationListResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this OrganizationListResponse. - - - :param error: The error of this OrganizationListResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this OrganizationListResponse. # noqa: E501 - - - :return: The data of this OrganizationListResponse. # noqa: E501 - :rtype: list[Organization] - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this OrganizationListResponse. - - - :param data: The data of this OrganizationListResponse. # noqa: E501 - :type: list[Organization] - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - @property - def meta(self): - """Gets the meta of this OrganizationListResponse. # noqa: E501 - - - :return: The meta of this OrganizationListResponse. # noqa: E501 - :rtype: MetaIndexObject - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this OrganizationListResponse. - - - :param meta: The meta of this OrganizationListResponse. # noqa: E501 - :type: MetaIndexObject - """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 - - self._meta = meta - - 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, OrganizationListResponse): - 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, OrganizationListResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/organization_response.py b/patch_api/models/organization_response.py deleted file mode 100644 index 7676a77..0000000 --- a/patch_api/models/organization_response.py +++ /dev/null @@ -1,178 +0,0 @@ -# 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 OrganizationResponse(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 = {"success": "bool", "error": "object", "data": "Organization"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 - """OrganizationResponse - 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._success = None - self._error = None - self._data = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - - @property - def success(self): - """Gets the success of this OrganizationResponse. # noqa: E501 - - - :return: The success of this OrganizationResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this OrganizationResponse. - - - :param success: The success of this OrganizationResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this OrganizationResponse. # noqa: E501 - - - :return: The error of this OrganizationResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this OrganizationResponse. - - - :param error: The error of this OrganizationResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this OrganizationResponse. # noqa: E501 - - - :return: The data of this OrganizationResponse. # noqa: E501 - :rtype: Organization - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this OrganizationResponse. - - - :param data: The data of this OrganizationResponse. # noqa: E501 - :type: Organization - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - 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, OrganizationResponse): - 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, OrganizationResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/photo_response.py b/patch_api/models/photo_response.py deleted file mode 100644 index c482477..0000000 --- a/patch_api/models/photo_response.py +++ /dev/null @@ -1,178 +0,0 @@ -# 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 PhotoResponse(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 = {"success": "bool", "error": "object", "data": "Photo"} - - attribute_map = {"success": "success", "error": "error", "data": "data"} - - def __init__( - self, success=None, error=None, data=None, local_vars_configuration=None - ): # noqa: E501 - """PhotoResponse - 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._success = None - self._error = None - self._data = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - - @property - def success(self): - """Gets the success of this PhotoResponse. # noqa: E501 - - - :return: The success of this PhotoResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this PhotoResponse. - - - :param success: The success of this PhotoResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this PhotoResponse. # noqa: E501 - - - :return: The error of this PhotoResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this PhotoResponse. - - - :param error: The error of this PhotoResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this PhotoResponse. # noqa: E501 - - - :return: The data of this PhotoResponse. # noqa: E501 - :rtype: Photo - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this PhotoResponse. - - - :param data: The data of this PhotoResponse. # noqa: E501 - :type: Photo - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - 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, PhotoResponse): - 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, PhotoResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/project_type_list_response.py b/patch_api/models/project_type_list_response.py deleted file mode 100644 index 29d4716..0000000 --- a/patch_api/models/project_type_list_response.py +++ /dev/null @@ -1,222 +0,0 @@ -# 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 ProjectTypeListResponse(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 = { - "success": "bool", - "error": "object", - "data": "list[str]", - "meta": "MetaIndexObject", - } - - attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", - } - - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 - """ProjectTypeListResponse - 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._success = None - self._error = None - self._data = None - self._meta = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - self.meta = meta - - @property - def success(self): - """Gets the success of this ProjectTypeListResponse. # noqa: E501 - - - :return: The success of this ProjectTypeListResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this ProjectTypeListResponse. - - - :param success: The success of this ProjectTypeListResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this ProjectTypeListResponse. # noqa: E501 - - - :return: The error of this ProjectTypeListResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this ProjectTypeListResponse. - - - :param error: The error of this ProjectTypeListResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this ProjectTypeListResponse. # noqa: E501 - - - :return: The data of this ProjectTypeListResponse. # noqa: E501 - :rtype: list[str] - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ProjectTypeListResponse. - - - :param data: The data of this ProjectTypeListResponse. # noqa: E501 - :type: list[str] - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - @property - def meta(self): - """Gets the meta of this ProjectTypeListResponse. # noqa: E501 - - - :return: The meta of this ProjectTypeListResponse. # noqa: E501 - :rtype: MetaIndexObject - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this ProjectTypeListResponse. - - - :param meta: The meta of this ProjectTypeListResponse. # noqa: E501 - :type: MetaIndexObject - """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 - - self._meta = meta - - 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, ProjectTypeListResponse): - 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, ProjectTypeListResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/standard_list_response.py b/patch_api/models/standard_list_response.py deleted file mode 100644 index 356f7eb..0000000 --- a/patch_api/models/standard_list_response.py +++ /dev/null @@ -1,222 +0,0 @@ -# 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 StandardListResponse(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 = { - "success": "bool", - "error": "object", - "data": "list[Standard]", - "meta": "MetaIndexObject", - } - - attribute_map = { - "success": "success", - "error": "error", - "data": "data", - "meta": "meta", - } - - def __init__( - self, - success=None, - error=None, - data=None, - meta=None, - local_vars_configuration=None, - ): # noqa: E501 - """StandardListResponse - 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._success = None - self._error = None - self._data = None - self._meta = None - self.discriminator = None - - self.success = success - self.error = error - self.data = data - self.meta = meta - - @property - def success(self): - """Gets the success of this StandardListResponse. # noqa: E501 - - - :return: The success of this StandardListResponse. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this StandardListResponse. - - - :param success: The success of this StandardListResponse. # noqa: E501 - :type: bool - """ - if ( - self.local_vars_configuration.client_side_validation and success is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `success`, must not be `None`" - ) # noqa: E501 - - self._success = success - - @property - def error(self): - """Gets the error of this StandardListResponse. # noqa: E501 - - - :return: The error of this StandardListResponse. # noqa: E501 - :rtype: object - """ - return self._error - - @error.setter - def error(self, error): - """Sets the error of this StandardListResponse. - - - :param error: The error of this StandardListResponse. # noqa: E501 - :type: object - """ - - self._error = error - - @property - def data(self): - """Gets the data of this StandardListResponse. # noqa: E501 - - - :return: The data of this StandardListResponse. # noqa: E501 - :rtype: list[Standard] - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this StandardListResponse. - - - :param data: The data of this StandardListResponse. # noqa: E501 - :type: list[Standard] - """ - if ( - self.local_vars_configuration.client_side_validation and data is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `data`, must not be `None`" - ) # noqa: E501 - - self._data = data - - @property - def meta(self): - """Gets the meta of this StandardListResponse. # noqa: E501 - - - :return: The meta of this StandardListResponse. # noqa: E501 - :rtype: MetaIndexObject - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this StandardListResponse. - - - :param meta: The meta of this StandardListResponse. # noqa: E501 - :type: MetaIndexObject - """ - if ( - self.local_vars_configuration.client_side_validation and meta is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `meta`, must not be `None`" - ) # noqa: E501 - - self._meta = meta - - 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, StandardListResponse): - 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, StandardListResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/update_offset_request.py b/patch_api/models/update_offset_request.py deleted file mode 100644 index 5511de0..0000000 --- a/patch_api/models/update_offset_request.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 UpdateOffsetRequest(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 = { - "mass_g": "int", - "price_cents_usd": "int", - "vintage_year": "int", - "serial_number": "str", - } - - attribute_map = { - "mass_g": "mass_g", - "price_cents_usd": "price_cents_usd", - "vintage_year": "vintage_year", - "serial_number": "serial_number", - } - - def __init__( - self, - mass_g=None, - price_cents_usd=None, - vintage_year=None, - serial_number=None, - local_vars_configuration=None, - ): # noqa: E501 - """UpdateOffsetRequest - 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._mass_g = None - self._price_cents_usd = None - self._vintage_year = None - self._serial_number = None - self.discriminator = None - - if mass_g is not None: - self.mass_g = mass_g - if price_cents_usd is not None: - self.price_cents_usd = price_cents_usd - if vintage_year is not None: - self.vintage_year = vintage_year - self.serial_number = serial_number - - @property - def mass_g(self): - """Gets the mass_g of this UpdateOffsetRequest. # noqa: E501 - - - :return: The mass_g of this UpdateOffsetRequest. # noqa: E501 - :rtype: int - """ - return self._mass_g - - @mass_g.setter - def mass_g(self, mass_g): - """Sets the mass_g of this UpdateOffsetRequest. - - - :param mass_g: The mass_g of this UpdateOffsetRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 1000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `1000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._mass_g = mass_g - - @property - def price_cents_usd(self): - """Gets the price_cents_usd of this UpdateOffsetRequest. # noqa: E501 - - - :return: The price_cents_usd of this UpdateOffsetRequest. # noqa: E501 - :rtype: int - """ - return self._price_cents_usd - - @price_cents_usd.setter - def price_cents_usd(self, price_cents_usd): - """Sets the price_cents_usd of this UpdateOffsetRequest. - - - :param price_cents_usd: The price_cents_usd of this UpdateOffsetRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and price_cents_usd is not None - and price_cents_usd < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `price_cents_usd`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._price_cents_usd = price_cents_usd - - @property - def vintage_year(self): - """Gets the vintage_year of this UpdateOffsetRequest. # noqa: E501 - - - :return: The vintage_year of this UpdateOffsetRequest. # noqa: E501 - :rtype: int - """ - return self._vintage_year - - @vintage_year.setter - def vintage_year(self, vintage_year): - """Sets the vintage_year of this UpdateOffsetRequest. - - - :param vintage_year: The vintage_year of this UpdateOffsetRequest. # noqa: E501 - :type: int - """ - - self._vintage_year = vintage_year - - @property - def serial_number(self): - """Gets the serial_number of this UpdateOffsetRequest. # noqa: E501 - - - :return: The serial_number of this UpdateOffsetRequest. # noqa: E501 - :rtype: str - """ - return self._serial_number - - @serial_number.setter - def serial_number(self, serial_number): - """Sets the serial_number of this UpdateOffsetRequest. - - - :param serial_number: The serial_number of this UpdateOffsetRequest. # noqa: E501 - :type: str - """ - - self._serial_number = serial_number - - 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, UpdateOffsetRequest): - 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, UpdateOffsetRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/update_project_request.py b/patch_api/models/update_project_request.py deleted file mode 100644 index 7c54dc3..0000000 --- a/patch_api/models/update_project_request.py +++ /dev/null @@ -1,688 +0,0 @@ -# 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 UpdateProjectRequest(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 = { - "name": "str", - "description": "str", - "country": "str", - "state": "str", - "verifier": "str", - "type": "str", - "standard_type": "str", - "longitude": "str", - "latitude": "str", - "production": "str", - "organization_id": "str", - } - - attribute_map = { - "name": "name", - "description": "description", - "country": "country", - "state": "state", - "verifier": "verifier", - "type": "type", - "standard_type": "standard_type", - "longitude": "longitude", - "latitude": "latitude", - "production": "production", - "organization_id": "organization_id", - } - - def __init__( - self, - name=None, - description=None, - country=None, - state=None, - verifier=None, - type=None, - standard_type=None, - longitude=None, - latitude=None, - production=None, - organization_id=None, - local_vars_configuration=None, - ): # noqa: E501 - """UpdateProjectRequest - 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._name = None - self._description = None - self._country = None - self._state = None - self._verifier = None - self._type = None - self._standard_type = None - self._longitude = None - self._latitude = None - self._production = None - self._organization_id = None - self.discriminator = None - - if name is not None: - self.name = name - if description is not None: - self.description = description - if country is not None: - self.country = country - if state is not None: - self.state = state - if verifier is not None: - self.verifier = verifier - if type is not None: - self.type = type - if standard_type is not None: - self.standard_type = standard_type - if longitude is not None: - self.longitude = longitude - if latitude is not None: - self.latitude = latitude - self.production = production - if organization_id is not None: - self.organization_id = organization_id - - @property - def name(self): - """Gets the name of this UpdateProjectRequest. # noqa: E501 - - - :return: The name of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this UpdateProjectRequest. - - - :param name: The name of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def description(self): - """Gets the description of this UpdateProjectRequest. # noqa: E501 - - - :return: The description of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this UpdateProjectRequest. - - - :param description: The description of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def country(self): - """Gets the country of this UpdateProjectRequest. # noqa: E501 - - - :return: The country of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._country - - @country.setter - def country(self, country): - """Sets the country of this UpdateProjectRequest. - - - :param country: The country of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - allowed_values = [ - "TJ", - "JM", - "HT", - "ST", - "MS", - "AE", - "PK", - "NL", - "LU", - "BZ", - "IR", - "BO", - "UY", - "GH", - "SA", - "CI", - "MF", - "TF", - "AI", - "QA", - "SX", - "LY", - "BV", - "PG", - "KG", - "GQ", - "EH", - "NU", - "PR", - "GD", - "KR", - "HM", - "SM", - "SL", - "CD", - "MK", - "TR", - "DZ", - "GE", - "PS", - "BB", - "UA", - "GP", - "PF", - "NA", - "BW", - "SY", - "TG", - "DO", - "AQ", - "CH", - "MG", - "FO", - "VG", - "GI", - "BN", - "LA", - "IS", - "EE", - "UM", - "LT", - "RS", - "MR", - "AD", - "HU", - "TK", - "MY", - "AO", - "CV", - "NF", - "PA", - "GW", - "BE", - "PT", - "GB", - "IM", - "US", - "YE", - "HK", - "AZ", - "CC", - "ML", - "SK", - "VU", - "TL", - "HR", - "SR", - "MU", - "CZ", - "PM", - "LS", - "WS", - "KM", - "IT", - "BI", - "WF", - "GN", - "SG", - "CO", - "CN", - "AW", - "MA", - "FI", - "VA", - "ZW", - "KY", - "BH", - "PY", - "EC", - "LR", - "RU", - "PL", - "OM", - "MT", - "SS", - "DE", - "TM", - "SJ", - "MM", - "TT", - "IL", - "BD", - "NR", - "LK", - "UG", - "NG", - "BQ", - "MX", - "CW", - "SI", - "MN", - "CA", - "AX", - "VN", - "TW", - "JP", - "IO", - "RO", - "BG", - "GU", - "BR", - "AM", - "ZM", - "DJ", - "JE", - "AT", - "CM", - "SE", - "FJ", - "KZ", - "GL", - "GY", - "CX", - "MW", - "TN", - "ZA", - "TO", - "CY", - "MV", - "PN", - "RW", - "NI", - "KN", - "BJ", - "ET", - "GM", - "TZ", - "VC", - "FK", - "SD", - "MC", - "AU", - "CL", - "DK", - "FR", - "TC", - "CU", - "AL", - "MZ", - "BS", - "NE", - "GT", - "LI", - "NP", - "BF", - "PW", - "KW", - "IN", - "GA", - "TV", - "MO", - "SH", - "MD", - "CK", - "AR", - "SC", - "IE", - "ES", - "LB", - "BM", - "RE", - "KI", - "AG", - "MQ", - "SV", - "JO", - "TH", - "SO", - "MH", - "CG", - "KP", - "GF", - "BA", - "YT", - "GS", - "KE", - "PE", - "BT", - "SZ", - "CR", - "TD", - "DM", - "NC", - "GR", - "GG", - "HN", - "VI", - "CF", - "SN", - "AF", - "MP", - "PH", - "BY", - "LV", - "NO", - "EG", - "KH", - "IQ", - "LC", - "NZ", - "BL", - "UZ", - "ID", - "ER", - "VE", - "FM", - "SB", - "ME", - "AS", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and country not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `country` ({0}), must be one of {1}".format( # noqa: E501 - country, allowed_values - ) - ) - - self._country = country - - @property - def state(self): - """Gets the state of this UpdateProjectRequest. # noqa: E501 - - - :return: The state of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this UpdateProjectRequest. - - - :param state: The state of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._state = state - - @property - def verifier(self): - """Gets the verifier of this UpdateProjectRequest. # noqa: E501 - - - :return: The verifier of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._verifier - - @verifier.setter - def verifier(self, verifier): - """Sets the verifier of this UpdateProjectRequest. - - - :param verifier: The verifier of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._verifier = verifier - - @property - def type(self): - """Gets the type of this UpdateProjectRequest. # noqa: E501 - - - :return: The type of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this UpdateProjectRequest. - - - :param type: The type of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - allowed_values = [ - "biomass", - "dac", - "forestry", - "mineralization", - "ocean", - "soil", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and type not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501 - type, allowed_values - ) - ) - - self._type = type - - @property - def standard_type(self): - """Gets the standard_type of this UpdateProjectRequest. # noqa: E501 - - - :return: The standard_type of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._standard_type - - @standard_type.setter - def standard_type(self, standard_type): - """Sets the standard_type of this UpdateProjectRequest. - - - :param standard_type: The standard_type of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - allowed_values = [ - "american_carbon_registry", - "climate_action_reserve", - "verified_carbon_standard", - "european_biochar_certificate", - ] # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and standard_type not in allowed_values - ): # noqa: E501 - raise ValueError( - "Invalid value for `standard_type` ({0}), must be one of {1}".format( # noqa: E501 - standard_type, allowed_values - ) - ) - - self._standard_type = standard_type - - @property - def longitude(self): - """Gets the longitude of this UpdateProjectRequest. # noqa: E501 - - - :return: The longitude of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._longitude - - @longitude.setter - def longitude(self, longitude): - """Sets the longitude of this UpdateProjectRequest. - - - :param longitude: The longitude of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._longitude = longitude - - @property - def latitude(self): - """Gets the latitude of this UpdateProjectRequest. # noqa: E501 - - - :return: The latitude of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._latitude - - @latitude.setter - def latitude(self, latitude): - """Sets the latitude of this UpdateProjectRequest. - - - :param latitude: The latitude of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._latitude = latitude - - @property - def production(self): - """Gets the production of this UpdateProjectRequest. # noqa: E501 - - - :return: The production of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._production - - @production.setter - def production(self, production): - """Sets the production of this UpdateProjectRequest. - - - :param production: The production of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._production = production - - @property - def organization_id(self): - """Gets the organization_id of this UpdateProjectRequest. # noqa: E501 - - - :return: The organization_id of this UpdateProjectRequest. # noqa: E501 - :rtype: str - """ - return self._organization_id - - @organization_id.setter - def organization_id(self, organization_id): - """Sets the organization_id of this UpdateProjectRequest. - - - :param organization_id: The organization_id of this UpdateProjectRequest. # noqa: E501 - :type: str - """ - - self._organization_id = organization_id - - 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, UpdateProjectRequest): - 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, UpdateProjectRequest): - return True - - return self.to_dict() != other.to_dict() From f7679cf61e372b296681cd8693b65d9b594b59ed Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Wed, 27 Jan 2021 07:16:01 -0700 Subject: [PATCH 08/23] Do not require Configuration object for init ApiClient with api_key --- patch_api/api/estimates_api.py | 58 ++++------- patch_api/api/orders_api.py | 94 ++++++----------- patch_api/api/photos_api.py | 168 ------------------------------- patch_api/api/preferences_api.py | 76 +++++--------- patch_api/api/projects_api.py | 38 +++---- patch_api/api_client.py | 154 ++++++++++++---------------- patch_api/rest.py | 6 +- 7 files changed, 163 insertions(+), 431 deletions(-) delete mode 100644 patch_api/api/photos_api.py diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 5385d51..685f19e 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -19,7 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from patch_api.exceptions import ApiTypeError, ApiValueError class EstimatesApi(object): @@ -92,15 +92,11 @@ def create_mass_estimate_with_http_info( local_var_params = locals() - all_params = ["create_mass_estimate_request"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["create_mass_estimate_request"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -111,10 +107,10 @@ def create_mass_estimate_with_http_info( local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'create_mass_estimate_request' is set - if self.api_client.client_side_validation and ( + if ( "create_mass_estimate_request" not in local_var_params - or local_var_params["create_mass_estimate_request"] is None # noqa: E501 - ): # noqa: E501 + or local_var_params["create_mass_estimate_request"] is None + ): raise ApiValueError( "Missing the required parameter `create_mass_estimate_request` when calling `create_mass_estimate`" ) # noqa: E501 @@ -220,15 +216,11 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -239,9 +231,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `retrieve_estimate`" ) # noqa: E501 @@ -340,15 +330,11 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["page"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -364,9 +350,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if ( - "page" in local_var_params and local_var_params["page"] is not None - ): # noqa: E501 + if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 8a1bc8a..1a7c4a4 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -19,7 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from patch_api.exceptions import ApiTypeError, ApiValueError class OrdersApi(object): @@ -86,15 +86,11 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -105,9 +101,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `cancel_order`" ) # noqa: E501 @@ -208,15 +202,11 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_params = locals() - all_params = ["create_order_request"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["create_order_request"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -227,10 +217,10 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'create_order_request' is set - if self.api_client.client_side_validation and ( + if ( "create_order_request" not in local_var_params - or local_var_params["create_order_request"] is None # noqa: E501 - ): # noqa: E501 + or local_var_params["create_order_request"] is None + ): raise ApiValueError( "Missing the required parameter `create_order_request` when calling `create_order`" ) # noqa: E501 @@ -336,15 +326,11 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -355,9 +341,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `place_order`" ) # noqa: E501 @@ -456,15 +440,11 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -475,9 +455,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `retrieve_order`" ) # noqa: E501 @@ -576,15 +554,11 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["page"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -600,9 +574,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if ( - "page" in local_var_params and local_var_params["page"] is not None - ): # noqa: E501 + if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} diff --git a/patch_api/api/photos_api.py b/patch_api/api/photos_api.py deleted file mode 100644 index ca90ce9..0000000 --- a/patch_api/api/photos_api.py +++ /dev/null @@ -1,168 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from patch_api.api_client import ApiClient -from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 - - -class PhotosApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def delete_photo(self, photo_id, uid, **kwargs): # noqa: E501 - """Deletes a photo for the project # noqa: E501 - - Deletes the given `photo` for the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_photo(photo_id, uid, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str photo_id: (required) - :param str uid: (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - return self.delete_photo_with_http_info(photo_id, uid, **kwargs) # noqa: E501 - - def delete_photo_with_http_info(self, photo_id, uid, **kwargs): # noqa: E501 - """Deletes a photo for the project # noqa: E501 - - Deletes the given `photo` for the project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_photo_with_http_info(photo_id, uid, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str photo_id: (required) - :param str uid: (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ["photo_id", "uid"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) - - for key, val in six.iteritems(local_var_params["kwargs"]): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_photo" % key - ) - local_var_params[key] = val - del local_var_params["kwargs"] - # verify the required parameter 'photo_id' is set - if self.api_client.client_side_validation and ( - "photo_id" not in local_var_params - or local_var_params["photo_id"] is None # noqa: E501 - ): # noqa: E501 - raise ApiValueError( - "Missing the required parameter `photo_id` when calling `delete_photo`" - ) # noqa: E501 - # verify the required parameter 'uid' is set - if self.api_client.client_side_validation and ( - "uid" not in local_var_params - or local_var_params["uid"] is None # noqa: E501 - ): # noqa: E501 - raise ApiValueError( - "Missing the required parameter `uid` when calling `delete_photo`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "photo_id" in local_var_params: - path_params["photo_id"] = local_var_params["photo_id"] # noqa: E501 - if "uid" in local_var_params: - path_params["uid"] = local_var_params["uid"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = ["bearer_auth"] # noqa: E501 - - return self.api_client.call_api( - "/v1/projects/{uid}/photos/{photo_id}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get("async_req"), - _return_http_data_only=local_var_params.get( - "_return_http_data_only" - ), # noqa: E501 - _preload_content=local_var_params.get("_preload_content", True), - _request_timeout=local_var_params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index 06d75b7..c42880a 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -19,7 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from patch_api.exceptions import ApiTypeError, ApiValueError class PreferencesApi(object): @@ -90,15 +90,11 @@ def create_preference_with_http_info( local_var_params = locals() - all_params = ["create_preference_request"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["create_preference_request"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -109,10 +105,10 @@ def create_preference_with_http_info( local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'create_preference_request' is set - if self.api_client.client_side_validation and ( + if ( "create_preference_request" not in local_var_params - or local_var_params["create_preference_request"] is None # noqa: E501 - ): # noqa: E501 + or local_var_params["create_preference_request"] is None + ): raise ApiValueError( "Missing the required parameter `create_preference_request` when calling `create_preference`" ) # noqa: E501 @@ -218,15 +214,11 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -237,9 +229,7 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `delete_preference`" ) # noqa: E501 @@ -338,15 +328,11 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -357,9 +343,7 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `retrieve_preference`" ) # noqa: E501 @@ -458,15 +442,11 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["page"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -482,9 +462,7 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if ( - "page" in local_var_params and local_var_params["page"] is not None - ): # noqa: E501 + if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index ad2a73c..1a01caf 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -19,7 +19,7 @@ import six from patch_api.api_client import ApiClient -from patch_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from patch_api.exceptions import ApiTypeError, ApiValueError class ProjectsApi(object): @@ -86,15 +86,11 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["id"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -105,9 +101,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 local_var_params[key] = val del local_var_params["kwargs"] # verify the required parameter 'id' is set - if self.api_client.client_side_validation and ( - "id" not in local_var_params or local_var_params["id"] is None # noqa: E501 - ): # noqa: E501 + if "id" not in local_var_params or local_var_params["id"] is None: raise ApiValueError( "Missing the required parameter `id` when calling `retrieve_project`" ) # noqa: E501 @@ -206,15 +200,11 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ["page"] - all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - ] - ) + all_params = ["page"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -230,9 +220,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if ( - "page" in local_var_params and local_var_params["page"] is not None - ): # noqa: E501 + if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 header_params = {} diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 8b2f58b..f4e8be6 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -11,9 +11,7 @@ from __future__ import absolute_import -import atexit import datetime -from dateutil.parser import parse import json import mimetypes from multiprocessing.pool import ThreadPool @@ -28,7 +26,7 @@ from patch_api.configuration import Configuration import patch_api.models from patch_api import rest -from patch_api.exceptions import ApiValueError, ApiException +from patch_api.exceptions import ApiValueError class ApiClient(object): @@ -68,39 +66,33 @@ class ApiClient(object): def __init__( self, + api_key=None, configuration=None, header_name=None, header_value=None, cookie=None, pool_threads=1, ): + if api_key is None: + raise ValueError("ApiClient must be initialized with an api_key") if configuration is None: - configuration = Configuration.get_default_copy() + configuration = Configuration() self.configuration = configuration self.pool_threads = pool_threads - self.rest_client = rest.RESTClientObject(configuration) + self.rest_client = rest.RESTClientObject(api_key, configuration) self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. self.user_agent = "OpenAPI-Generator/1.0.0/python" - self.client_side_validation = configuration.client_side_validation - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - self.close() - - def close(self): + def __del__(self): if self._pool: self._pool.close() self._pool.join() self._pool = None - if hasattr(atexit, "unregister"): - atexit.unregister(self.close) @property def pool(self): @@ -108,7 +100,6 @@ def pool(self): avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: - atexit.register(self.close) self._pool = ThreadPool(self.pool_threads) return self._pool @@ -192,43 +183,27 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - try: - # perform request and return response - response_data = self.request( - method, - url, - query_params=query_params, - headers=header_params, - post_params=post_params, - body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) - except ApiException as e: - e.body = e.body.decode("utf-8") if six.PY3 else e.body - raise e - - content_type = response_data.getheader("content-type") + # perform request and return response + response_data = self.request( + method, + url, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + ) self.last_response = response_data return_data = response_data - - if not _preload_content: - return return_data - - if six.PY3 and response_type not in ["file", "bytes"]: - match = None - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: return return_data @@ -336,7 +311,7 @@ def __deserialize(self, data, klass): elif klass == datetime.date: return self.__deserialize_date(data) elif klass == datetime.datetime: - return self.__deserialize_datetime(data) + return self.__deserialize_datatime(data) else: return self.__deserialize_model(data, klass) @@ -413,27 +388,28 @@ def call_api( _request_timeout, _host, ) - - return self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - ), - ) + else: + thread = self.pool.apply_async( + self.__call_api, + ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ), + ) + return thread def request( self, @@ -468,8 +444,10 @@ def request( url, query_params=query_params, headers=headers, + post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, + body=body, ) elif method == "POST": return self.rest_client.POST( @@ -617,7 +595,9 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting["in"] == "cookie": + if not auth_setting["value"]: + continue + elif auth_setting["in"] == "cookie": headers["Cookie"] = auth_setting["value"] elif auth_setting["in"] == "header": headers[auth_setting["key"]] = auth_setting["value"] @@ -682,6 +662,8 @@ def __deserialize_date(self, string): :return: date. """ try: + from dateutil.parser import parse + return parse(string).date() except ImportError: return string @@ -690,7 +672,7 @@ def __deserialize_date(self, string): status=0, reason="Failed to parse `{0}` as date object".format(string) ) - def __deserialize_datetime(self, string): + def __deserialize_datatime(self, string): """Deserializes string to datetime. The string should be in iso8601 datetime format. @@ -699,6 +681,8 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: + from dateutil.parser import parse + return parse(string) except ImportError: return string @@ -715,30 +699,24 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ - has_discriminator = False - if ( - hasattr(klass, "get_real_child_model") - and klass.discriminator_value_class_map - ): - has_discriminator = True - - if not klass.openapi_types and has_discriminator is False: + + if not klass.openapi_types and not hasattr(klass, "get_real_child_model"): return data kwargs = {} - if ( - data is not None - and klass.openapi_types is not None - and isinstance(data, (list, dict)) - ): + if klass.openapi_types is not None: for attr, attr_type in six.iteritems(klass.openapi_types): - if klass.attribute_map[attr] in data: + if ( + data is not None + and klass.attribute_map[attr] in data + and isinstance(data, (list, dict)) + ): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) instance = klass(**kwargs) - if has_discriminator: + if hasattr(instance, "get_real_child_model"): klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/patch_api/rest.py b/patch_api/rest.py index 87eda9c..f67e65f 100644 --- a/patch_api/rest.py +++ b/patch_api/rest.py @@ -49,7 +49,7 @@ def getheader(self, name, default=None): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): + def __init__(self, api_key, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 @@ -62,7 +62,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None): else: cert_reqs = ssl.CERT_NONE - self.configuration = configuration + self.api_key = api_key # ca_certs if configuration.ssl_ca_cert: @@ -165,7 +165,7 @@ def request( headers["Content-Type"] = "application/json" if "Authorization" not in headers: - headers["Authorization"] = "Bearer " + self.configuration.api_key + headers["Authorization"] = "Bearer " + self.api_key try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` From 672df0c2b005070970ca2e291f5f90f9d6a56a84 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Wed, 27 Jan 2021 15:48:57 -0700 Subject: [PATCH 09/23] wip --- README.md | 67 +++++++++------------ patch_api/__init__.py | 48 --------------- patch_api/api/__init__.py | 10 --- patch_api/api/estimates_api.py | 30 ++++++--- patch_api/api/orders_api.py | 52 +++++++++++----- patch_api/api/preferences_api.py | 42 +++++++++---- patch_api/api/projects_api.py | 20 ++++-- patch_api/models/__init__.py | 19 ------ test/factories.py | 28 --------- test/test_create_membership_request.py | 56 ----------------- test/test_create_offset_request.py | 60 ------------------ test/test_create_organization_request.py | 56 ----------------- test/test_create_photo_request.py | 54 ----------------- test/test_create_project_request.py | 66 -------------------- test/test_estimates_api.py | 14 ++--- test/test_fulfill_offset_request.py | 55 ----------------- test/test_membership.py | 54 ----------------- test/test_membership_response.py | 59 ------------------ test/test_offset.py | 77 ------------------------ test/test_offset_list_response.py | 65 -------------------- test/test_offset_response.py | 55 ----------------- test/test_orders_api.py | 12 +--- test/test_photo.py | 54 ----------------- test/test_photo_response.py | 55 ----------------- test/test_photos_api.py | 41 ------------- test/test_preferences_api.py | 24 +++----- test/test_project_type_list_response.py | 61 ------------------- test/test_projects_api.py | 5 +- test/test_standard.py | 54 ----------------- test/test_standard_list_response.py | 65 -------------------- test/test_update_offset_request.py | 56 ----------------- test/test_update_project_request.py | 66 -------------------- 32 files changed, 148 insertions(+), 1332 deletions(-) delete mode 100644 test/test_create_membership_request.py delete mode 100644 test/test_create_offset_request.py delete mode 100644 test/test_create_organization_request.py delete mode 100644 test/test_create_photo_request.py delete mode 100644 test/test_create_project_request.py delete mode 100644 test/test_fulfill_offset_request.py delete mode 100644 test/test_membership.py delete mode 100644 test/test_membership_response.py delete mode 100644 test/test_offset.py delete mode 100644 test/test_offset_list_response.py delete mode 100644 test/test_offset_response.py delete mode 100644 test/test_photo.py delete mode 100644 test/test_photo_response.py delete mode 100644 test/test_photos_api.py delete mode 100644 test/test_project_type_list_response.py delete mode 100644 test/test_standard.py delete mode 100644 test/test_standard_list_response.py delete mode 100644 test/test_update_offset_request.py delete mode 100644 test/test_update_project_request.py diff --git a/README.md b/README.md index 9a88f6c..ebb592d 100644 --- a/README.md +++ b/README.md @@ -32,27 +32,24 @@ pip install patch ### Configuration -After installing the gem, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard: +After installing the gem, you'll have to initialize it with your API key which is available from the API key page in the Patch dashboard: ```python import patch_api -configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) -api_client = patch_api.ApiClient(configuration) +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) ``` The `api_client` will be used to instantiate other API objects for Patch resources, for example the `OrdersApi`: ``` import patch_api -from patch_api.api.orders_api import OrdersApi +from patch_api.api.orders_api import OrdersApi as Orders -configuration = patch_api.Configuration(api_key=os.environ.get('SANDBOX_API_KEY')) -api_client = patch_api.ApiClient(configuration) -orders_api = OrdersApi(api_client=api_client) +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +orders_api = Orders(api_client=api_client) ``` - ### Orders In Patch, orders represent a purchase of carbon offsets or negative emissions by mass. Place orders directly if you know the amount of carbon dioxide you would like to sequester. If you do not know how much to purchase, use an estimate. @@ -69,45 +66,38 @@ fulfill the order for you. # Create an order - you can create an order # providing either mass_g or total_price_cents_usd, but not both -from patch_api.models.create_order_request import CreateOrderRequest +from patch_api.api.orders_api import OrdersApi as Orders # Create order with mass -mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne) -create_order_request = CreateOrderRequest(mass_g=mass_g) -OrdersApi.create_order(create_order_request) +Orders.create_order(opts={'mass_g': 1_000_000}) # Pass in the mass in grams (i.e. 1 metric tonne) # Create an order with maximum total price total_price_cents_usd = 5_00 # Pass in the total price in cents (i.e. 5 dollars) -create_order_request = CreateOrderRequest(total_price_cents_usd=total_price_cents_usd) -OrdersApi.create_order(create_order_request) +Orders.create_order(opts={'total_price_cents_usd': total_price_cents_usd}) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -create_order_request = CreateOrderRequest(project_id=project_id, mass_g=mass_g) -OrdersApi.create_order(create_order_request) - +Orders.create_order(opts={'project_id': project_id, 'mass_g': mass_g}) ## Orders also accept a metadata field (optional) metadata = {user: "john doe"} -create_order_request = CreateOrderRequest(metadata=metadata, mass_g=mass_g) -OrdersApi.create_order(create_order_request) - +Orders.create_order(opts={'metadata': metadata, 'mass_g': mass_g}) # Retrieve an order order_id = 'ord_test_1234' # Pass in the order's id -OrdersApi.retrieve_order(id=order_id) +Orders.retrieve_order(id=order_id) # Place an order order_id = 'ord_test_1234' # Pass in the order's id -OrdersApi.place_order(id=order_id) +Orders.place_order(id=order_id) # Cancel an order order_id = 'ord_test_1234' # Pass in the order's id -OrdersApi.cancel_order(id=order_id) +Orders.cancel_order(id=order_id) # Retrieve a list of orders page = 1 # Pass in which page of orders you'd like -OrdersApi.retrieve_orders(page=page) +Orders.retrieve_orders(page=page) ``` ### Estimates @@ -118,24 +108,22 @@ Estimates allow API users to get a quote for the cost of compensating a certain #### Examples ```python # Create an estimate -from patch_api.models.create_estimate_request import CreateEstimateRequest +from patch_api.api.estimates_api import EstimatesApi as Estimates mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne) -create_estimate_request = CreateEstimateRequest(mass_g=mass_g) -EstimatesApi.create_estimate(create_estimate_request) +Estimates.create_estimate(opts={'mass_g': mass_g}) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -create_estimate_request = CreateEstimateRequest(mass_g=mass_g, project_id=project_id) -EstimatesApi.create_estimate(create_estimate_request) +Estimates.create_estimate(opts={'mass_g': mass_g, 'project_id': project_id}) # Retrieve an estimate estimate_id = 'est_test_1234' -EstimatesApi.retrieve_estimate(id=estimate_id) +Estimates.retrieve_estimate(id=estimate_id) # Retrieve a list of estimates page = 1 # Pass in which page of estimates you'd like -EstimatesApi.retrieve_estimates(page=page) +Estimates.retrieve_estimates(page=page) ``` ### Projects @@ -145,13 +133,15 @@ Projects are the ways Patch takes CO2 out of the air. They can represent refores #### Examples ```python +from patch_api.api.projects_api import ProjectsApi as Projects + # Retrieve a project project_id = 'pro_test_1234' # Pass in the project's ID -ProjectsApi.retrieve_project(id=project_id) +Projects.retrieve_project(id=project_id) # Retrieve a list of projects page = 1 # Pass in which page of projects you'd like -ProjectsApi.retrieve_projects(page=page) +Projects.retrieve_projects(page=page) ``` ### Preferences @@ -162,23 +152,22 @@ Preferences are how you route your orders in Patch. If you don't have a preferen #### Examples ```python # Create a preference -from patch_api.models.create_preference_request import CreatePreferenceRequest +from patch_api.api.preferences_api import PreferencesApi as Preferences project_id = 'pro_test_1234' # Pass in the project_id for your preference -create_preference_request = CreatePreferenceRequest(project_id=project_id) -PreferencesApi.create_preference(create_preference_request) +Preferences.create_preference(opts={'project_id': project_id}) # Retrieve a preference preference_id = 'pre_test_1234' # Pass in the preferences's id -PreferencesApi.retrieve_preference(preference_id=preference_id) +Preferences.retrieve_preference(preference_id=preference_id) # Delete a preference preference_id = 'pre_test_1234' # Pass in the preferences's id -PreferencesApi.delete_preference(preference_id=preference_id) +Preferences.delete_preference(preference_id=preference_id) # Retrieve a list of preferences page = 1 # Pass in which page of preferences you'd like -PreferencesApi.retrieve_preferences(page=page) +Preferences.retrieve_preferences(page=page) ``` ## Development diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 197c1f7..21bea00 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -17,13 +17,6 @@ __version__ = "1.0.0" -# import apis into sdk package -from patch_api.api.estimates_api import EstimatesApi -from patch_api.api.orders_api import OrdersApi -from patch_api.api.photos_api import PhotosApi -from patch_api.api.preferences_api import PreferencesApi -from patch_api.api.projects_api import ProjectsApi - # import ApiClient from patch_api.api_client import ApiClient from patch_api.configuration import Configuration @@ -32,44 +25,3 @@ from patch_api.exceptions import ApiValueError from patch_api.exceptions import ApiKeyError from patch_api.exceptions import ApiException - -# import models into sdk package -from patch_api.models.allocation import Allocation -from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest -from patch_api.models.create_membership_request import CreateMembershipRequest -from patch_api.models.create_offset_request import CreateOffsetRequest -from patch_api.models.create_order_request import CreateOrderRequest -from patch_api.models.create_organization_request import CreateOrganizationRequest -from patch_api.models.create_photo_request import CreatePhotoRequest -from patch_api.models.create_preference_request import CreatePreferenceRequest -from patch_api.models.create_project_request import CreateProjectRequest -from patch_api.models.error_response import ErrorResponse -from patch_api.models.estimate import Estimate -from patch_api.models.estimate_list_response import EstimateListResponse -from patch_api.models.estimate_response import EstimateResponse -from patch_api.models.fulfill_offset_request import FulfillOffsetRequest -from patch_api.models.membership import Membership -from patch_api.models.membership_response import MembershipResponse -from patch_api.models.meta_index_object import MetaIndexObject -from patch_api.models.offset import Offset -from patch_api.models.offset_list_response import OffsetListResponse -from patch_api.models.offset_response import OffsetResponse -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.organization import Organization -from patch_api.models.organization_list_response import OrganizationListResponse -from patch_api.models.organization_response import OrganizationResponse -from patch_api.models.photo import Photo -from patch_api.models.photo_response import PhotoResponse -from patch_api.models.preference import Preference -from patch_api.models.preference_list_response import PreferenceListResponse -from patch_api.models.preference_response import PreferenceResponse -from patch_api.models.project import Project -from patch_api.models.project_list_response import ProjectListResponse -from patch_api.models.project_response import ProjectResponse -from patch_api.models.project_type_list_response import ProjectTypeListResponse -from patch_api.models.standard import Standard -from patch_api.models.standard_list_response import StandardListResponse -from patch_api.models.update_offset_request import UpdateOffsetRequest -from patch_api.models.update_project_request import UpdateProjectRequest diff --git a/patch_api/api/__init__.py b/patch_api/api/__init__.py index ee00ace..e69de29 100644 --- a/patch_api/api/__init__.py +++ b/patch_api/api/__init__.py @@ -1,10 +0,0 @@ -from __future__ import absolute_import - -# flake8: noqa - -# import apis into api package -from patch_api.api.estimates_api import EstimatesApi -from patch_api.api.orders_api import OrdersApi -from patch_api.api.photos_api import PhotosApi -from patch_api.api.preferences_api import PreferencesApi -from patch_api.api.projects_api import ProjectsApi diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 685f19e..1e80cdf 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -35,7 +35,7 @@ def __init__(self, api_client=None): self.api_client = api_client def create_mass_estimate( - self, create_mass_estimate_request, **kwargs + self, opts={}, create_mass_estimate_request={}, **kwargs ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 @@ -47,6 +47,7 @@ def create_mass_estimate( :param async_req bool: execute request asynchronously :param CreateMassEstimateRequest create_mass_estimate_request: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -60,11 +61,11 @@ def create_mass_estimate( """ kwargs["_return_http_data_only"] = True return self.create_mass_estimate_with_http_info( - create_mass_estimate_request, **kwargs + opts, create_mass_estimate_request, **kwargs ) # noqa: E501 def create_mass_estimate_with_http_info( - self, create_mass_estimate_request, **kwargs + self, opts, create_mass_estimate_request, **kwargs ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 @@ -76,6 +77,7 @@ def create_mass_estimate_with_http_info( :param async_req bool: execute request asynchronously :param CreateMassEstimateRequest create_mass_estimate_request: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -120,6 +122,8 @@ def create_mass_estimate_with_http_info( path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -164,7 +168,7 @@ def create_mass_estimate_with_http_info( collection_formats=collection_formats, ) - def retrieve_estimate(self, id, **kwargs): # noqa: E501 + def retrieve_estimate(self, opts={}, id={}, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -175,6 +179,7 @@ def retrieve_estimate(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -187,9 +192,9 @@ def retrieve_estimate(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501 + return self.retrieve_estimate_with_http_info(opts, id, **kwargs) # noqa: E501 - def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 + def retrieve_estimate_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -200,6 +205,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -243,6 +249,8 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -278,7 +286,7 @@ def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_estimates(self, **kwargs): # noqa: E501 + def retrieve_estimates(self, opts={}, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -289,6 +297,7 @@ def retrieve_estimates(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -301,9 +310,9 @@ def retrieve_estimates(self, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501 + return self.retrieve_estimates_with_http_info(opts, **kwargs) # noqa: E501 - def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 + def retrieve_estimates_with_http_info(self, opts, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -314,6 +323,7 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -350,6 +360,8 @@ def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 1a7c4a4..950ad6b 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -34,7 +34,7 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def cancel_order(self, id, **kwargs): # noqa: E501 + def cancel_order(self, opts={}, id={}, **kwargs): # noqa: E501 """Cancel an order # noqa: E501 Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled. # noqa: E501 @@ -45,6 +45,7 @@ def cancel_order(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -57,9 +58,9 @@ def cancel_order(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.cancel_order_with_http_info(id, **kwargs) # noqa: E501 + return self.cancel_order_with_http_info(opts, id, **kwargs) # noqa: E501 - def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 + def cancel_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Cancel an order # noqa: E501 Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled. # noqa: E501 @@ -70,6 +71,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -113,6 +115,8 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -148,7 +152,7 @@ def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def create_order(self, create_order_request, **kwargs): # noqa: E501 + def create_order(self, opts={}, create_order_request={}, **kwargs): # noqa: E501 """Creates an order # noqa: E501 Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 @@ -159,6 +163,7 @@ def create_order(self, create_order_request, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param CreateOrderRequest create_order_request: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -172,10 +177,12 @@ def create_order(self, create_order_request, **kwargs): # noqa: E501 """ kwargs["_return_http_data_only"] = True return self.create_order_with_http_info( - create_order_request, **kwargs + opts, create_order_request, **kwargs ) # noqa: E501 - def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 + def create_order_with_http_info( + self, opts, create_order_request, **kwargs + ): # noqa: E501 """Creates an order # noqa: E501 Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 @@ -186,6 +193,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: :param async_req bool: execute request asynchronously :param CreateOrderRequest create_order_request: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -230,6 +238,8 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -274,7 +284,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: collection_formats=collection_formats, ) - def place_order(self, id, **kwargs): # noqa: E501 + def place_order(self, opts={}, id={}, **kwargs): # noqa: E501 """Place an order # noqa: E501 Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed # noqa: E501 @@ -285,6 +295,7 @@ def place_order(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -297,9 +308,9 @@ def place_order(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.place_order_with_http_info(id, **kwargs) # noqa: E501 + return self.place_order_with_http_info(opts, id, **kwargs) # noqa: E501 - def place_order_with_http_info(self, id, **kwargs): # noqa: E501 + def place_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Place an order # noqa: E501 Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed # noqa: E501 @@ -310,6 +321,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -353,6 +365,8 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -388,7 +402,7 @@ def place_order_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_order(self, id, **kwargs): # noqa: E501 + def retrieve_order(self, opts={}, id={}, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -399,6 +413,7 @@ def retrieve_order(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -411,9 +426,9 @@ def retrieve_order(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_order_with_http_info(id, **kwargs) # noqa: E501 + return self.retrieve_order_with_http_info(opts, id, **kwargs) # noqa: E501 - def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 + def retrieve_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -424,6 +439,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -467,6 +483,8 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -502,7 +520,7 @@ def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_orders(self, **kwargs): # noqa: E501 + def retrieve_orders(self, opts={}, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -513,6 +531,7 @@ def retrieve_orders(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -525,9 +544,9 @@ def retrieve_orders(self, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_orders_with_http_info(**kwargs) # noqa: E501 + return self.retrieve_orders_with_http_info(opts, **kwargs) # noqa: E501 - def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 + def retrieve_orders_with_http_info(self, opts, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -538,6 +557,7 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -574,6 +594,8 @@ def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index c42880a..79778c0 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -34,7 +34,9 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create_preference(self, create_preference_request, **kwargs): # noqa: E501 + def create_preference( + self, opts={}, create_preference_request={}, **kwargs + ): # noqa: E501 """creates a project preference # noqa: E501 Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 @@ -45,6 +47,7 @@ def create_preference(self, create_preference_request, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param CreatePreferenceRequest create_preference_request: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -58,11 +61,11 @@ def create_preference(self, create_preference_request, **kwargs): # noqa: E501 """ kwargs["_return_http_data_only"] = True return self.create_preference_with_http_info( - create_preference_request, **kwargs + opts, create_preference_request, **kwargs ) # noqa: E501 def create_preference_with_http_info( - self, create_preference_request, **kwargs + self, opts, create_preference_request, **kwargs ): # noqa: E501 """creates a project preference # noqa: E501 @@ -74,6 +77,7 @@ def create_preference_with_http_info( :param async_req bool: execute request asynchronously :param CreatePreferenceRequest create_preference_request: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -118,6 +122,8 @@ def create_preference_with_http_info( path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -162,7 +168,7 @@ def create_preference_with_http_info( collection_formats=collection_formats, ) - def delete_preference(self, id, **kwargs): # noqa: E501 + def delete_preference(self, opts={}, id={}, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. # noqa: E501 @@ -173,6 +179,7 @@ def delete_preference(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -185,9 +192,9 @@ def delete_preference(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.delete_preference_with_http_info(id, **kwargs) # noqa: E501 + return self.delete_preference_with_http_info(opts, id, **kwargs) # noqa: E501 - def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 + def delete_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. # noqa: E501 @@ -198,6 +205,7 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -241,6 +249,8 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -276,7 +286,7 @@ def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_preference(self, id, **kwargs): # noqa: E501 + def retrieve_preference(self, opts={}, id={}, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -287,6 +297,7 @@ def retrieve_preference(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -299,9 +310,9 @@ def retrieve_preference(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_preference_with_http_info(id, **kwargs) # noqa: E501 + return self.retrieve_preference_with_http_info(opts, id, **kwargs) # noqa: E501 - def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 + def retrieve_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -312,6 +323,7 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -355,6 +367,8 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -390,7 +404,7 @@ def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_preferences(self, **kwargs): # noqa: E501 + def retrieve_preferences(self, opts={}, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -401,6 +415,7 @@ def retrieve_preferences(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -413,9 +428,9 @@ def retrieve_preferences(self, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_preferences_with_http_info(**kwargs) # noqa: E501 + return self.retrieve_preferences_with_http_info(opts, **kwargs) # noqa: E501 - def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 + def retrieve_preferences_with_http_info(self, opts, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -426,6 +441,7 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -462,6 +478,8 @@ def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 1a01caf..d89d6dd 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -34,7 +34,7 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def retrieve_project(self, id, **kwargs): # noqa: E501 + def retrieve_project(self, opts={}, id={}, **kwargs): # noqa: E501 """Retrieves a project # noqa: E501 Retrieves a project available on Patch's platform. # noqa: E501 @@ -45,6 +45,7 @@ def retrieve_project(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -57,9 +58,9 @@ def retrieve_project(self, id, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_project_with_http_info(id, **kwargs) # noqa: E501 + return self.retrieve_project_with_http_info(opts, id, **kwargs) # noqa: E501 - def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 + def retrieve_project_with_http_info(self, opts, id, **kwargs): # noqa: E501 """Retrieves a project # noqa: E501 Retrieves a project available on Patch's platform. # noqa: E501 @@ -70,6 +71,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -113,6 +115,8 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) header_params = {} @@ -148,7 +152,7 @@ def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_projects(self, **kwargs): # noqa: E501 + def retrieve_projects(self, opts={}, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 Retrieves a list of projects available for purchase on Patch's platform. # noqa: E501 @@ -159,6 +163,7 @@ def retrieve_projects(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -171,9 +176,9 @@ def retrieve_projects(self, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_projects_with_http_info(**kwargs) # noqa: E501 + return self.retrieve_projects_with_http_info(opts, **kwargs) # noqa: E501 - def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 + def retrieve_projects_with_http_info(self, opts, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 Retrieves a list of projects available for purchase on Patch's platform. # noqa: E501 @@ -184,6 +189,7 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: + :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -220,6 +226,8 @@ def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] + for key in opts: + query_params.append([key, opts.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 1c6e8de..9d7eea4 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -17,40 +17,21 @@ # import models into model package from patch_api.models.allocation import Allocation from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest -from patch_api.models.create_membership_request import CreateMembershipRequest -from patch_api.models.create_offset_request import CreateOffsetRequest from patch_api.models.create_order_request import CreateOrderRequest -from patch_api.models.create_organization_request import CreateOrganizationRequest -from patch_api.models.create_photo_request import CreatePhotoRequest from patch_api.models.create_preference_request import CreatePreferenceRequest -from patch_api.models.create_project_request import CreateProjectRequest from patch_api.models.error_response import ErrorResponse from patch_api.models.estimate import Estimate from patch_api.models.estimate_list_response import EstimateListResponse from patch_api.models.estimate_response import EstimateResponse -from patch_api.models.fulfill_offset_request import FulfillOffsetRequest -from patch_api.models.membership import Membership -from patch_api.models.membership_response import MembershipResponse from patch_api.models.meta_index_object import MetaIndexObject -from patch_api.models.offset import Offset -from patch_api.models.offset_list_response import OffsetListResponse -from patch_api.models.offset_response import OffsetResponse 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.organization import Organization -from patch_api.models.organization_list_response import OrganizationListResponse -from patch_api.models.organization_response import OrganizationResponse from patch_api.models.photo import Photo -from patch_api.models.photo_response import PhotoResponse from patch_api.models.preference import Preference from patch_api.models.preference_list_response import PreferenceListResponse from patch_api.models.preference_response import PreferenceResponse from patch_api.models.project import Project from patch_api.models.project_list_response import ProjectListResponse from patch_api.models.project_response import ProjectResponse -from patch_api.models.project_type_list_response import ProjectTypeListResponse from patch_api.models.standard import Standard -from patch_api.models.standard_list_response import StandardListResponse -from patch_api.models.update_offset_request import UpdateOffsetRequest -from patch_api.models.update_project_request import UpdateProjectRequest diff --git a/test/factories.py b/test/factories.py index d9c0075..8618eba 100644 --- a/test/factories.py +++ b/test/factories.py @@ -1,6 +1,5 @@ import factory from patch_api.models.order import Order # noqa: E501 -from patch_api.models.offset import Offset # noqa: E501 from patch_api.models.standard import Standard # noqa: E501 from patch_api.models.estimate import Estimate # noqa: E501 from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 @@ -8,7 +7,6 @@ from patch_api.models.project import Project # noqa: E501 from patch_api.models.photo import Photo # noqa: E501 from patch_api.models.preference import Preference # noqa: E501 -from patch_api.models.membership import Membership class OrderFactory(factory.Factory): @@ -94,29 +92,3 @@ class Meta: id = "0" allocation_percentage = 56 project = ProjectFactory() - - -class OffsetFactory(factory.Factory): - class Meta: - model = Offset - - id = "0" - allocated_mass_g = 0 - fulfilled_at = "0" - fulfillment_state = "pending" - mass_g = 1 - price_cents_usd = "0" - production = True - retired = True - serial_number = "0" - vintage_year = 56 - project_id = "0" - - -class MembershipFactory(factory.Factory): - class Meta: - model = Membership - - email = "0" - role = "admin" - organization_id = "0" diff --git a/test/test_create_membership_request.py b/test/test_create_membership_request.py deleted file mode 100644 index e7b207e..0000000 --- a/test/test_create_membership_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_membership_request import ( - CreateMembershipRequest, -) # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreateMembershipRequest(unittest.TestCase): - """CreateMembershipRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreateMembershipRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_membership_request.CreateMembershipRequest() # noqa: E501 - if include_optional: - return CreateMembershipRequest(email="0", role="admin", organization_id="0") - else: - return CreateMembershipRequest() - - def testCreateMembershipRequest(self): - """Test CreateMembershipRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_create_offset_request.py b/test/test_create_offset_request.py deleted file mode 100644 index eac7324..0000000 --- a/test/test_create_offset_request.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_offset_request import CreateOffsetRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreateOffsetRequest(unittest.TestCase): - """CreateOffsetRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreateOffsetRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_offset_request.CreateOffsetRequest() # noqa: E501 - if include_optional: - return CreateOffsetRequest( - mass_g=1, - price_cents_usd=1, - project_id="0", - vintage_year=56, - serial_number="0", - ) - else: - return CreateOffsetRequest() - - def testCreateOffsetRequest(self): - """Test CreateOffsetRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_create_organization_request.py b/test/test_create_organization_request.py deleted file mode 100644 index dc7c8c3..0000000 --- a/test/test_create_organization_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_organization_request import ( - CreateOrganizationRequest, -) # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreateOrganizationRequest(unittest.TestCase): - """CreateOrganizationRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreateOrganizationRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_organization_request.CreateOrganizationRequest() # noqa: E501 - if include_optional: - return CreateOrganizationRequest(name="0", type="consumer") - else: - return CreateOrganizationRequest(name="0", type="consumer") - - def testCreateOrganizationRequest(self): - """Test CreateOrganizationRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_create_photo_request.py b/test/test_create_photo_request.py deleted file mode 100644 index 0dc76bb..0000000 --- a/test/test_create_photo_request.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_photo_request import CreatePhotoRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreatePhotoRequest(unittest.TestCase): - """CreatePhotoRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreatePhotoRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_photo_request.CreatePhotoRequest() # noqa: E501 - if include_optional: - return CreatePhotoRequest(project_id="0", url="0", sort_order=56) - else: - return CreatePhotoRequest(project_id="0", url="0") - - def testCreatePhotoRequest(self): - """Test CreatePhotoRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_create_project_request.py b/test/test_create_project_request.py deleted file mode 100644 index 7176c55..0000000 --- a/test/test_create_project_request.py +++ /dev/null @@ -1,66 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_project_request import CreateProjectRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreateProjectRequest(unittest.TestCase): - """CreateProjectRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreateProjectRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_project_request.CreateProjectRequest() # noqa: E501 - if include_optional: - return CreateProjectRequest( - name="0", - description="0", - country="TJ", - state="0", - verifier="0", - type="biomass", - standard_type="american_carbon_registry", - longitude="0", - latitude="0", - production="0", - organization_id="0", - ) - else: - return CreateProjectRequest() - - def testCreateProjectRequest(self): - """Test CreateProjectRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 509ec9d..7413234 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -18,7 +18,6 @@ import patch_api from patch_api.api.estimates_api import EstimatesApi # noqa: E501 -from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest from patch_api.rest import ApiException @@ -26,14 +25,11 @@ class TestEstimatesApi(unittest.TestCase): """EstimatesApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration( - api_key=os.environ.get("SANDBOX_API_KEY") - ) - api_client = patch_api.ApiClient(configuration) + api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) self.api = EstimatesApi(api_client=api_client) # noqa: E501 def tearDown(self): - pass + self.api = None def test_create_and_retrieve_mass_estimate(self): """Test case for create_mass_estimate @@ -42,11 +38,9 @@ def test_create_and_retrieve_mass_estimate(self): """ mass_g = 100 project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" - mass_estimate_request = CreateMassEstimateRequest( - mass_g=mass_g, project_id=project_id + estimate = self.api.create_mass_estimate( + opts={"mass_g": mass_g, "project_id": project_id} ) - estimate = self.api.create_mass_estimate(mass_estimate_request) - self.assertTrue(estimate) self.assertEqual(estimate.data.order.mass_g, mass_g) diff --git a/test/test_fulfill_offset_request.py b/test/test_fulfill_offset_request.py deleted file mode 100644 index e822b13..0000000 --- a/test/test_fulfill_offset_request.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest - -import datetime - -import patch_api -from patch_api.models.fulfill_offset_request import FulfillOffsetRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestFulfillOffsetRequest(unittest.TestCase): - """FulfillOffsetRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test FulfillOffsetRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.fulfill_offset_request.FulfillOffsetRequest() # noqa: E501 - if include_optional: - return FulfillOffsetRequest(serial_number="0") - else: - return FulfillOffsetRequest() - - def testFulfillOffsetRequest(self): - """Test FulfillOffsetRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_membership.py b/test/test_membership.py deleted file mode 100644 index 3a45d27..0000000 --- a/test/test_membership.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.membership import Membership # noqa: E501 -from patch_api.rest import ApiException - - -class TestMembership(unittest.TestCase): - """Membership unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Membership - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.membership.Membership() # noqa: E501 - if include_optional: - return Membership(email="0", role="admin", organization_id="0") - else: - return Membership(email="0", role="admin", organization_id="0") - - def testMembership(self): - """Test Membership""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_membership_response.py b/test/test_membership_response.py deleted file mode 100644 index af705f2..0000000 --- a/test/test_membership_response.py +++ /dev/null @@ -1,59 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.membership_response import MembershipResponse # noqa: E501 -from factories import MembershipFactory -from patch_api.rest import ApiException - - -class TestMembershipResponse(unittest.TestCase): - """MembershipResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test MembershipResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.membership_response.MembershipResponse() # noqa: E501 - if include_optional: - return MembershipResponse( - success=True, error=None, data=[MembershipFactory()] - ) - else: - return MembershipResponse( - success=True, error=None, data=[MembershipFactory()] - ) - - def testMembershipResponse(self): - """Test MembershipResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_offset.py b/test/test_offset.py deleted file mode 100644 index 0d16c62..0000000 --- a/test/test_offset.py +++ /dev/null @@ -1,77 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.offset import Offset # noqa: E501 -from patch_api.rest import ApiException - - -class TestOffset(unittest.TestCase): - """Offset unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Offset - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.offset.Offset() # noqa: E501 - if include_optional: - return Offset( - id="0", - allocated_mass_g=0, - fulfilled_at="0", - fulfillment_state="pending", - mass_g=1, - price_cents_usd="0", - production=True, - retired=True, - serial_number="0", - vintage_year=56, - project_id="0", - ) - else: - return Offset( - id="0", - allocated_mass_g=0, - fulfillment_state="pending", - mass_g=1, - price_cents_usd="0", - production=True, - retired=True, - serial_number="0", - vintage_year=56, - project_id="0", - ) - - def testOffset(self): - """Test Offset""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_offset_list_response.py b/test/test_offset_list_response.py deleted file mode 100644 index 6c40d1d..0000000 --- a/test/test_offset_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.offset_list_response import OffsetListResponse # noqa: E501 -from factories import OffsetFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestOffsetListResponse(unittest.TestCase): - """OffsetListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test OffsetListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.offset_list_response.OffsetListResponse() # noqa: E501 - if include_optional: - return OffsetListResponse( - success=True, - error=None, - data=[OffsetFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return OffsetListResponse( - success=True, - error=None, - data=[OffsetFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testOffsetListResponse(self): - """Test OffsetListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_offset_response.py b/test/test_offset_response.py deleted file mode 100644 index f5b02a4..0000000 --- a/test/test_offset_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.offset_response import OffsetResponse # noqa: E501 -from factories import OffsetFactory -from patch_api.rest import ApiException - - -class TestOffsetResponse(unittest.TestCase): - """OffsetResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test OffsetResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.offset_response.OffsetResponse() # noqa: E501 - if include_optional: - return OffsetResponse(success=True, error=None, data=OffsetFactory()) - else: - return OffsetResponse(success=True, error=None, data=OffsetFactory()) - - def testOffsetResponse(self): - """Test OffsetResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 80afe3d..d9eb83c 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -18,7 +18,6 @@ import patch_api from patch_api.api.orders_api import OrdersApi # noqa: E501 -from patch_api.models.create_order_request import CreateOrderRequest from patch_api.rest import ApiException @@ -26,10 +25,7 @@ class TestOrdersApi(unittest.TestCase): """OrdersApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration( - api_key=os.environ.get("SANDBOX_API_KEY") - ) - api_client = patch_api.ApiClient(configuration) + api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) self.api = OrdersApi(api_client=api_client) # noqa: E501 def tearDown(self): @@ -41,15 +37,13 @@ def test_interactions_with_an_order(self): """Create an order """ - create_order_request = CreateOrderRequest(mass_g=100) - order = self.api.create_order(create_order_request) + order = self.api.create_order(opts={"mass_g": 100}) self.assertTrue(order) """Retrieve an order """ - create_order_request = CreateOrderRequest(mass_g=100) - order = self.api.create_order(create_order_request=create_order_request) + order = self.api.create_order(opts={"mass_g": 100}) retrieved_order = self.api.retrieve_order(id=order.data.id) self.assertTrue(retrieved_order) diff --git a/test/test_photo.py b/test/test_photo.py deleted file mode 100644 index 21218b4..0000000 --- a/test/test_photo.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.photo import Photo # noqa: E501 -from patch_api.rest import ApiException - - -class TestPhoto(unittest.TestCase): - """Photo unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Photo - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.photo.Photo() # noqa: E501 - if include_optional: - return Photo(url="0", id="0") - else: - return Photo(url="0", id="0") - - def testPhoto(self): - """Test Photo""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_photo_response.py b/test/test_photo_response.py deleted file mode 100644 index f510c8d..0000000 --- a/test/test_photo_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.photo_response import PhotoResponse # noqa: E501 -from factories import PhotoFactory # noqa: E501 -from patch_api.rest import ApiException - - -class TestPhotoResponse(unittest.TestCase): - """PhotoResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test PhotoResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.photo_response.PhotoResponse() # noqa: E501 - if include_optional: - return PhotoResponse(success=True, error=None, data=PhotoFactory()) - else: - return PhotoResponse(success=True, error=None, data=PhotoFactory()) - - def testPhotoResponse(self): - """Test PhotoResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_photos_api.py b/test/test_photos_api.py deleted file mode 100644 index 4ad41c6..0000000 --- a/test/test_photos_api.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest - -import patch_api -from patch_api.api.photos_api import PhotosApi # noqa: E501 -from patch_api.rest import ApiException - - -class TestPhotosApi(unittest.TestCase): - """PhotosApi unit test stubs""" - - def setUp(self): - self.api = patch_api.api.photos_api.PhotosApi() # noqa: E501 - - def tearDown(self): - pass - - def test_delete_photo(self): - """Test case for delete_photo - - Deletes a photo for the project # noqa: E501 - """ - pass - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index 20dd71a..c320a97 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -27,10 +27,7 @@ class TestPreferencesApi(unittest.TestCase): """PreferencesApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration( - api_key=os.environ.get("SANDBOX_API_KEY") - ) - api_client = patch_api.ApiClient(configuration) + api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) self.api = PreferencesApi(api_client=api_client) # noqa: E501 def tearDown(self): @@ -44,23 +41,22 @@ def test_retrieve_preferences_and_preference(self): preferences = self.api.retrieve_preferences() self.assertTrue(isinstance(preferences.data, list)) - preference_id = preferences.data[0].id - preference = self.api.retrieve_preference(id=preference_id) - self.assertTrue(preference) + if len(preferences.data) > 0: + preference_id = preferences.data[0].id + preference = self.api.retrieve_preference(id=preference_id) + self.assertTrue(preference) def test_delete_and_create_preferences(self): """Test case for create_preference and delete_preference """ project_id = "pro_test_0de1a59eed9ff8474e09077ddb3714b2" preferences = self.api.retrieve_preferences() - preference_id = preferences.data[0].id - - deleted_preference = self.api.delete_preference(id=preference_id) - - self.assertTrue(deleted_preference) + if len(preferences.data) > 0: + preference_id = preferences.data[0].id + deleted_preference = self.api.delete_preference(id=preference_id) + self.assertTrue(deleted_preference) - create_preference_request = CreatePreferenceRequest(project_id=project_id) - preference = self.api.create_preference(create_preference_request) + preference = self.api.create_preference(opts={"project_id": project_id}) self.assertTrue(preference) diff --git a/test/test_project_type_list_response.py b/test/test_project_type_list_response.py deleted file mode 100644 index 8a6073f..0000000 --- a/test/test_project_type_list_response.py +++ /dev/null @@ -1,61 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project_type_list_response import ( - ProjectTypeListResponse, -) # noqa: E501 -from factories import MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestProjectTypeListResponse(unittest.TestCase): - """ProjectTypeListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ProjectTypeListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project_type_list_response.ProjectTypeListResponse() # noqa: E501 - if include_optional: - return ProjectTypeListResponse( - success=True, error=None, data=["0"], meta=MetaIndexObjectFactory() - ) - else: - return ProjectTypeListResponse( - success=True, error=None, data=["0"], meta=MetaIndexObjectFactory() - ) - - def testProjectTypeListResponse(self): - """Test ProjectTypeListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_projects_api.py b/test/test_projects_api.py index 6e82a4b..ce35ee3 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -25,10 +25,7 @@ class TestProjectsApi(unittest.TestCase): """ProjectsApi unit test stubs""" def setUp(self): - configuration = patch_api.Configuration( - api_key=os.environ.get("SANDBOX_API_KEY") - ) - api_client = patch_api.ApiClient(configuration) + api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) self.api = ProjectsApi(api_client=api_client) # noqa: E501 def tearDown(self): diff --git a/test/test_standard.py b/test/test_standard.py deleted file mode 100644 index ae52416..0000000 --- a/test/test_standard.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch -from patch_api.models.standard import Standard # noqa: E501 -from patch_api.rest import ApiException - - -class TestStandard(unittest.TestCase): - """Standard unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Standard - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.standard.Standard() # noqa: E501 - if include_optional: - return Standard(type="0", acronym="0", description="0") - else: - return Standard(type="0", acronym="0", description="0") - - def testStandard(self): - """Test Standard""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_standard_list_response.py b/test/test_standard_list_response.py deleted file mode 100644 index cc5f529..0000000 --- a/test/test_standard_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch -from patch_api.models.standard_list_response import StandardListResponse # noqa: E501 -from factories import StandardFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestStandardListResponse(unittest.TestCase): - """StandardListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test StandardListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.standard_list_response.StandardListResponse() # noqa: E501 - if include_optional: - return StandardListResponse( - success=True, - error=None, - data=[StandardFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return StandardListResponse( - success=True, - error=None, - data=[StandardFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testStandardListResponse(self): - """Test StandardListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_update_offset_request.py b/test/test_update_offset_request.py deleted file mode 100644 index 6f0a4e5..0000000 --- a/test/test_update_offset_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch -from patch_api.models.update_offset_request import UpdateOffsetRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestUpdateOffsetRequest(unittest.TestCase): - """UpdateOffsetRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test UpdateOffsetRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.update_offset_request.UpdateOffsetRequest() # noqa: E501 - if include_optional: - return UpdateOffsetRequest( - mass_g=1, price_cents_usd=1, vintage_year=56, serial_number="0" - ) - else: - return UpdateOffsetRequest() - - def testUpdateOffsetRequest(self): - """Test UpdateOffsetRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_update_project_request.py b/test/test_update_project_request.py deleted file mode 100644 index 0fe025a..0000000 --- a/test/test_update_project_request.py +++ /dev/null @@ -1,66 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch -from patch_api.models.update_project_request import UpdateProjectRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestUpdateProjectRequest(unittest.TestCase): - """UpdateProjectRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test UpdateProjectRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.update_project_request.UpdateProjectRequest() # noqa: E501 - if include_optional: - return UpdateProjectRequest( - name="0", - description="0", - country="TJ", - state="0", - verifier="0", - type="biomass", - standard_type="american_carbon_registry", - longitude="0", - latitude="0", - production="0", - organization_id="0", - ) - else: - return UpdateProjectRequest() - - def testUpdateProjectRequest(self): - """Test UpdateProjectRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() From 7fbf49ffa864254987a3fd88a6710de551ccedd3 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Wed, 27 Jan 2021 17:20:42 -0700 Subject: [PATCH 10/23] Update makefile and readme examples --- Makefile | 3 +- README.md | 115 +++++++++++++++++++++++++++++++++-------------- requirements.txt | 1 - 3 files changed, 83 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index c7b8c6b..ce4ada5 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ SHELL = /bin/bash build: - pip install -r requirements.txt + pip install -r requirements.txt \ + python setup.py install test: pip install -r test-requirements.txt && \ diff --git a/README.md b/README.md index ebb592d..c29e0c9 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ pip install Or install it directly with ```shell -pip install patch +pip install patch_api ``` ### Requirements @@ -63,41 +63,45 @@ fulfill the order for you. #### Examples ```python +import patch_api +from patch_api.api.orders_api import OrdersApi as Orders + +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +orders_api = Orders(api_client=api_client) + # Create an order - you can create an order # providing either mass_g or total_price_cents_usd, but not both -from patch_api.api.orders_api import OrdersApi as Orders - # Create order with mass -Orders.create_order(opts={'mass_g': 1_000_000}) # Pass in the mass in grams (i.e. 1 metric tonne) +orders_api.create_order(opts={'mass_g': 1_000_000}) # Pass in the mass in grams (i.e. 1 metric tonne) # Create an order with maximum total price total_price_cents_usd = 5_00 # Pass in the total price in cents (i.e. 5 dollars) -Orders.create_order(opts={'total_price_cents_usd': total_price_cents_usd}) +orders_api.create_order(opts={'total_price_cents_usd': total_price_cents_usd}) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -Orders.create_order(opts={'project_id': project_id, 'mass_g': mass_g}) +orders_api.create_order(opts={'project_id': project_id, 'mass_g': mass_g}) ## Orders also accept a metadata field (optional) metadata = {user: "john doe"} -Orders.create_order(opts={'metadata': metadata, 'mass_g': mass_g}) +orders_api.create_order(opts={'metadata': metadata, 'mass_g': mass_g}) # Retrieve an order order_id = 'ord_test_1234' # Pass in the order's id -Orders.retrieve_order(id=order_id) +orders_api.retrieve_order(id=order_id) # Place an order order_id = 'ord_test_1234' # Pass in the order's id -Orders.place_order(id=order_id) +orders_api.place_order(id=order_id) # Cancel an order order_id = 'ord_test_1234' # Pass in the order's id -Orders.cancel_order(id=order_id) +orders_api.cancel_order(id=order_id) # Retrieve a list of orders page = 1 # Pass in which page of orders you'd like -Orders.retrieve_orders(page=page) +orders_api.retrieve_orders(page=page) ``` ### Estimates @@ -107,23 +111,28 @@ Estimates allow API users to get a quote for the cost of compensating a certain #### Examples ```python -# Create an estimate +import patch_api from patch_api.api.estimates_api import EstimatesApi as Estimates +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +estimates_api = Estimates(api_client=api_client) + +# Create an estimate + mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne) -Estimates.create_estimate(opts={'mass_g': mass_g}) +estimates_api.create_estimate(opts={'mass_g': mass_g}) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -Estimates.create_estimate(opts={'mass_g': mass_g, 'project_id': project_id}) +estimates_api.create_estimate(opts={'mass_g': mass_g, 'project_id': project_id}) # Retrieve an estimate estimate_id = 'est_test_1234' -Estimates.retrieve_estimate(id=estimate_id) +estimates_api.retrieve_estimate(id=estimate_id) # Retrieve a list of estimates page = 1 # Pass in which page of estimates you'd like -Estimates.retrieve_estimates(page=page) +estimates_api.retrieve_estimates(page=page) ``` ### Projects @@ -133,15 +142,19 @@ Projects are the ways Patch takes CO2 out of the air. They can represent refores #### Examples ```python +import patch_api from patch_api.api.projects_api import ProjectsApi as Projects +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +projects_api = Projects(api_client=api_client) + # Retrieve a project project_id = 'pro_test_1234' # Pass in the project's ID -Projects.retrieve_project(id=project_id) +projects_api.retrieve_project(id=project_id) # Retrieve a list of projects page = 1 # Pass in which page of projects you'd like -Projects.retrieve_projects(page=page) +projects_api.retrieve_projects(page=page) ``` ### Preferences @@ -151,48 +164,82 @@ Preferences are how you route your orders in Patch. If you don't have a preferen #### Examples ```python -# Create a preference +import patch_api from patch_api.api.preferences_api import PreferencesApi as Preferences +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +preferences_api = Preferences(api_client=api_client) + +# Create a preference + project_id = 'pro_test_1234' # Pass in the project_id for your preference -Preferences.create_preference(opts={'project_id': project_id}) +preferences_api.create_preference(opts={'project_id': project_id}) # Retrieve a preference preference_id = 'pre_test_1234' # Pass in the preferences's id -Preferences.retrieve_preference(preference_id=preference_id) +preferences_api.retrieve_preference(preference_id=preference_id) # Delete a preference preference_id = 'pre_test_1234' # Pass in the preferences's id -Preferences.delete_preference(preference_id=preference_id) +preferences_api.delete_preference(preference_id=preference_id) # Retrieve a list of preferences page = 1 # Pass in which page of preferences you'd like -Preferences.retrieve_preferences(page=page) +preferences_api.retrieve_preferences(page=page) ``` ## Development +### Running tests + +Set up the required environment variable: +``` +$ export SANDBOX_API_KEY= +``` + +Run tests: +``` +$ make test +``` + +To run an individual test: +``` +$ python -m unittest +``` + +### Testing the built package locally + To build the library locally, run: ``` $ make build ``` -To test the library locally, create a python file in a sibling directory and add the following: -```python -import sys -sys.path.append("../patch-python") - -import patch_api +In another directory, create a file called `patch.py` and install the local package in this directory: -# ..... your Patch API code goes here +``` +$ touch patch.py +$ pip install ../patch-python ``` -Set up required environment variables: +Set up the required environment variable: ``` $ export SANDBOX_API_KEY= ``` -Run tests: -``` -$ make test +To test the package locally, create a python file in a sibling directory and add the following: +```python +import os +import patch_api + +# ..... your Patch API code goes here. See example below: + +from patch_api.api.orders_api import OrdersApi as Orders + +api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +orders = Orders(api_client=api_client) + +list_orders = orders.retrieve_orders(opts={'page': 1}) + +# Prints your organization's orders +print(list_orders) ``` diff --git a/requirements.txt b/requirements.txt index 2f0b40b..26e1a7b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,3 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 pre-commit >= 2.9.3 -autopep8 >= 1.5.4 From f6967dbf037226580b3dbe6cf241a0bbb6558281 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 11:58:48 -0700 Subject: [PATCH 11/23] strengthen tests --- test/test_create_mass_estimate_request.py | 56 ----------------------- test/test_create_order_request.py | 56 ----------------------- test/test_create_preference_request.py | 56 ----------------------- test/test_estimates_api.py | 1 - test/test_meta_index_object.py | 2 +- test/test_orders_api.py | 17 ++++++- test/test_preferences_api.py | 15 ++++-- test/test_projects_api.py | 20 ++++++-- 8 files changed, 43 insertions(+), 180 deletions(-) delete mode 100644 test/test_create_mass_estimate_request.py delete mode 100644 test/test_create_order_request.py delete mode 100644 test/test_create_preference_request.py diff --git a/test/test_create_mass_estimate_request.py b/test/test_create_mass_estimate_request.py deleted file mode 100644 index df228cd..0000000 --- a/test/test_create_mass_estimate_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_mass_estimate_request import ( - CreateMassEstimateRequest, -) # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreateMassEstimateRequest(unittest.TestCase): - """CreateMassEstimateRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreateMassEstimateRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_mass_estimate_request.CreateMassEstimateRequest() # noqa: E501 - if include_optional: - return CreateMassEstimateRequest(mass_g=1, project_id="0") - else: - return CreateMassEstimateRequest(mass_g=1) - - def testCreateMassEstimateRequest(self): - """Test CreateMassEstimateRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_create_order_request.py b/test/test_create_order_request.py deleted file mode 100644 index c3d20a2..0000000 --- a/test/test_create_order_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_order_request import CreateOrderRequest # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreateOrderRequest(unittest.TestCase): - """CreateOrderRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreateOrderRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_order_request.CreateOrderRequest() # noqa: E501 - if include_optional: - return CreateOrderRequest( - mass_g=1, total_price_cents_usd=1, project_id="0", metadata=None - ) - else: - return CreateOrderRequest() - - def testCreateOrderRequest(self): - """Test CreateOrderRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_create_preference_request.py b/test/test_create_preference_request.py deleted file mode 100644 index 734acc1..0000000 --- a/test/test_create_preference_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.create_preference_request import ( - CreatePreferenceRequest, -) # noqa: E501 -from patch_api.rest import ApiException - - -class TestCreatePreferenceRequest(unittest.TestCase): - """CreatePreferenceRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test CreatePreferenceRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.create_preference_request.CreatePreferenceRequest() # noqa: E501 - if include_optional: - return CreatePreferenceRequest(project_id="0") - else: - return CreatePreferenceRequest(project_id="0") - - def testCreatePreferenceRequest(self): - """Test CreatePreferenceRequest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 7413234..76ad23c 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -46,7 +46,6 @@ def test_create_and_retrieve_mass_estimate(self): retrieved_estimate = self.api.retrieve_estimate(id=estimate.data.id) self.assertTrue(retrieved_estimate) - self.assertEqual(estimate.data.id, estimate.data.id) if __name__ == "__main__": diff --git a/test/test_meta_index_object.py b/test/test_meta_index_object.py index c046bb2..61f3c19 100644 --- a/test/test_meta_index_object.py +++ b/test/test_meta_index_object.py @@ -37,7 +37,7 @@ def make_instance(self, include_optional): optional params are included """ # model = patch_api.models.meta_index_object.MetaIndexObject() # noqa: E501 if include_optional: - return MetaIndexObject(prev_page=56, next_page=56) + return MetaIndexObject(prev_page=56, next_page=58) else: return MetaIndexObject() diff --git a/test/test_orders_api.py b/test/test_orders_api.py index d9eb83c..85630e8 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -59,8 +59,21 @@ def test_retrieve_orders(self): Retrieves a list of orders # noqa: E501 """ - orders = self.api.retrieve_orders() - self.assertTrue(isinstance(orders.data, list)) + orders = self.api.retrieve_orders().data + self.assertTrue(isinstance(orders, list)) + + if len(orders) > 1: + retrieved_order = orders[0] + + self.assertTrue(retrieved_order.id) + self.assertEqual(retrieved_order.mass_g, 100) + self.assertEqual(retrieved_order.production, False) + self.assertEqual(retrieved_order.state, "placed") + self.assertEqual(retrieved_order.allocation_state, "allocated") + self.assertEqual(retrieved_order.price_cents_usd, "1.0") + self.assertEqual(retrieved_order.metadata, {}) + self.assertEqual(retrieved_order.patch_fee_cents_usd, "0.0") + self.assertTrue(isinstance(retrieved_order.allocations, list)) if __name__ == "__main__": diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index c320a97..e8911b5 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -43,8 +43,11 @@ def test_retrieve_preferences_and_preference(self): if len(preferences.data) > 0: preference_id = preferences.data[0].id - preference = self.api.retrieve_preference(id=preference_id) - self.assertTrue(preference) + preference = self.api.retrieve_preference(id=preference_id).data + + self.assertTrue(preference.allocation_percentage) + self.assertTrue(preference.id) + self.assertTrue(preference.project) def test_delete_and_create_preferences(self): """Test case for create_preference and delete_preference @@ -54,11 +57,13 @@ def test_delete_and_create_preferences(self): if len(preferences.data) > 0: preference_id = preferences.data[0].id deleted_preference = self.api.delete_preference(id=preference_id) - self.assertTrue(deleted_preference) - preference = self.api.create_preference(opts={"project_id": project_id}) + self.assertTrue(deleted_preference) - self.assertTrue(preference) + preference = self.api.create_preference(opts={"project_id": project_id}).data + self.assertTrue(preference.allocation_percentage) + self.assertTrue(preference.id) + self.assertTrue(preference.project) if __name__ == "__main__": diff --git a/test/test_projects_api.py b/test/test_projects_api.py index ce35ee3..8c15ed2 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -29,7 +29,7 @@ def setUp(self): self.api = ProjectsApi(api_client=api_client) # noqa: E501 def tearDown(self): - pass + self.api = None def test_retrieve_project(self): """Test case for retrieve_project @@ -45,8 +45,22 @@ def test_retrieve_projects(self): Retrieves a list of projects # noqa: E501 """ - projects = self.api.retrieve_projects() - self.assertTrue(isinstance(projects.data, list)) + projects = self.api.retrieve_projects().data + self.assertTrue(isinstance(projects, list)) + + if len(projects) > 0: + project = projects[0] + + self.assertEqual(project.production, False) + self.assertEqual(project.average_price_per_tonne_cents_usd, 0) + self.assertEqual(project.remaining_mass_g, 0) + self.assertEqual(project.standard, None) + self.assertEqual(project.name, "Carbo Culture Biochar") + self.assertTrue(project.description) + self.assertEqual(project.country, "US") + self.assertEqual(project.type, "biomass") + self.assertEqual(project.developer, "Carbo Culture Biochar") + self.assertTrue(isinstance(project.photos, list)) if __name__ == "__main__": From 65e53e7e99ab2a1151336856dadc67a9f421c63c Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 12:47:18 -0700 Subject: [PATCH 12/23] Specify version --- README.md | 2 +- setup.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c29e0c9..21aab78 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ pip install patch_api ``` ### Requirements -- Python 3.0.0 +- Python 3.6.0 ## Usage diff --git a/setup.py b/setup.py index 6759d91..f6fb494 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Patch API V1 @@ -22,7 +20,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] +REQUIRES = ["urllib3 >= 1.25.3", "python-dateutil"] setup( name=NAME, @@ -32,6 +30,7 @@ author_email="developers@usepatch.com", url="", keywords=["OpenAPI", "OpenAPI-Generator", "Patch API V1"], + python_requires=">=3.6", install_requires=REQUIRES, packages=find_packages(exclude=["test", "tests"]), include_package_data=True, From e58c0b91aba209c5f52fdde522803d8b08ccc52c Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 13:23:25 -0700 Subject: [PATCH 13/23] Delete unused test filesimprove pre-cimmit --- .github/workflows/black.yml | 11 ++++ .pre-commit-config.yaml | 11 ++-- Makefile | 4 ++ git_push.sh | 58 --------------------- patch_api/api_client.py | 2 +- patch_api/configuration.py | 3 +- patch_api/exceptions.py | 2 +- requirements.txt | 2 + setup.py | 5 +- test/test_allocation.py | 55 -------------------- test/test_error_response.py | 54 ------------------- test/test_estimate.py | 55 -------------------- test/test_estimate_list_response.py | 65 ----------------------- test/test_estimate_response.py | 55 -------------------- test/test_estimates_api.py | 1 - test/test_meta_index_object.py | 54 ------------------- test/test_order.py | 75 --------------------------- test/test_order_list_response.py | 65 ----------------------- test/test_order_response.py | 55 -------------------- test/test_orders_api.py | 4 +- test/test_preference.py | 55 -------------------- test/test_preference_list_response.py | 67 ------------------------ test/test_preference_response.py | 59 --------------------- test/test_preferences_api.py | 6 +-- test/test_project.py | 55 -------------------- test/test_project_list_response.py | 65 ----------------------- test/test_project_response.py | 55 -------------------- 27 files changed, 34 insertions(+), 964 deletions(-) create mode 100644 .github/workflows/black.yml delete mode 100644 git_push.sh delete mode 100644 test/test_allocation.py delete mode 100644 test/test_error_response.py delete mode 100644 test/test_estimate.py delete mode 100644 test/test_estimate_list_response.py delete mode 100644 test/test_estimate_response.py delete mode 100644 test/test_meta_index_object.py delete mode 100644 test/test_order.py delete mode 100644 test/test_order_list_response.py delete mode 100644 test/test_order_response.py delete mode 100644 test/test_preference.py delete mode 100644 test/test_preference_list_response.py delete mode 100644 test/test_preference_response.py delete mode 100644 test/test_project.py delete mode 100644 test/test_project_list_response.py delete mode 100644 test/test_project_response.py diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..f58e4c6 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,11 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: psf/black@stable diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ebd6ff..4bdcc6f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,10 @@ repos: -- repo: https://github.com/psf/black - rev: 19.3b0 +- repo: https://github.com/ambv/black + rev: stable hooks: - - id: black + - id: black + language_version: python3.6 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v1.2.3 + hooks: + - id: flake8 diff --git a/Makefile b/Makefile index ce4ada5..d058da9 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ build: pip install -r requirements.txt \ python setup.py install +lint: + flake8 \ + + test: pip install -r test-requirements.txt && \ python -m unittest discover test/ diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index ced3be2..0000000 --- a/git_push.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/patch_api/api_client.py b/patch_api/api_client.py index f4e8be6..0f29505 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -97,7 +97,7 @@ def __del__(self): @property def pool(self): """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. + avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: self._pool = ThreadPool(self.pool_threads) diff --git a/patch_api/configuration.py b/patch_api/configuration.py index ce2baf4..4da45bf 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -65,8 +65,7 @@ def __init__( password=None, discard_unknown_keys=False, ): - """Constructor - """ + """Constructor""" self.host = host """Default Base url """ diff --git a/patch_api/exceptions.py b/patch_api/exceptions.py index fc75982..64b8229 100644 --- a/patch_api/exceptions.py +++ b/patch_api/exceptions.py @@ -20,7 +20,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): - """ Raises an exception for TypeErrors + """Raises an exception for TypeErrors Args: msg (str): the exception message diff --git a/requirements.txt b/requirements.txt index 26e1a7b..f8872e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 pre-commit >= 2.9.3 +autopep8 >= 1.5.4 +flake8 >= 3.8.4 diff --git a/setup.py b/setup.py index f6fb494..5702b6d 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,10 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.25.3", "python-dateutil"] +REQUIRES = [ + "urllib3 >= 1.25.3", + "python-dateutil", +] setup( name=NAME, diff --git a/test/test_allocation.py b/test/test_allocation.py deleted file mode 100644 index 694ea31..0000000 --- a/test/test_allocation.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.allocation import Allocation # noqa: E501 -from factories import AllocationFactory -from patch_api.rest import ApiException - - -class TestAllocation(unittest.TestCase): - """Allocation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Allocation - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.allocation.Allocation() # noqa: E501 - if include_optional: - return AllocationFactory() - else: - return AllocationFactory() - - def testAllocation(self): - """Test Allocation""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_error_response.py b/test/test_error_response.py deleted file mode 100644 index 46f54be..0000000 --- a/test/test_error_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.error_response import ErrorResponse # noqa: E501 -from patch_api.rest import ApiException - - -class TestErrorResponse(unittest.TestCase): - """ErrorResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ErrorResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.error_response.ErrorResponse() # noqa: E501 - if include_optional: - return ErrorResponse(success=True, error={}, data=None) - else: - return ErrorResponse(success=True, error={}, data=None) - - def testErrorResponse(self): - """Test ErrorResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimate.py b/test/test_estimate.py deleted file mode 100644 index 21d97b9..0000000 --- a/test/test_estimate.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.estimate import Estimate # noqa: E501 -from factories import EstimateFactory, OrderFactory -from patch_api.rest import ApiException - - -class TestEstimate(unittest.TestCase): - """Estimate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Estimate - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.estimate.Estimate() # noqa: E501 - if include_optional: - return EstimateFactory(order=OrderFactory()) - else: - return EstimateFactory(order=None) - - def testEstimate(self): - """Test Estimate""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimate_list_response.py b/test/test_estimate_list_response.py deleted file mode 100644 index 9efdd05..0000000 --- a/test/test_estimate_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.estimate_list_response import EstimateListResponse # noqa: E501 -from factories import EstimateFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestEstimateListResponse(unittest.TestCase): - """EstimateListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test EstimateListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.estimate_list_response.EstimateListResponse() # noqa: E501 - if include_optional: - return EstimateListResponse( - success=True, - error=None, - data=[EstimateFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return EstimateListResponse( - success=True, - error=None, - data=[EstimateFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testEstimateListResponse(self): - """Test EstimateListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimate_response.py b/test/test_estimate_response.py deleted file mode 100644 index 8538481..0000000 --- a/test/test_estimate_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.estimate_response import EstimateResponse # noqa: E501 -from factories import EstimateFactory -from patch_api.rest import ApiException - - -class TestEstimateResponse(unittest.TestCase): - """EstimateResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test EstimateResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.estimate_response.EstimateResponse() # noqa: E501 - if include_optional: - return EstimateResponse(success=True, error=None, data=EstimateFactory()) - else: - return EstimateResponse(success=True, error=None, data=EstimateFactory()) - - def testEstimateResponse(self): - """Test EstimateResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 76ad23c..56fe219 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -18,7 +18,6 @@ import patch_api from patch_api.api.estimates_api import EstimatesApi # noqa: E501 -from patch_api.rest import ApiException class TestEstimatesApi(unittest.TestCase): diff --git a/test/test_meta_index_object.py b/test/test_meta_index_object.py deleted file mode 100644 index 61f3c19..0000000 --- a/test/test_meta_index_object.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 -from patch_api.rest import ApiException - - -class TestMetaIndexObject(unittest.TestCase): - """MetaIndexObject unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test MetaIndexObject - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.meta_index_object.MetaIndexObject() # noqa: E501 - if include_optional: - return MetaIndexObject(prev_page=56, next_page=58) - else: - return MetaIndexObject() - - def testMetaIndexObject(self): - """Test MetaIndexObject""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_order.py b/test/test_order.py deleted file mode 100644 index 93c92fc..0000000 --- a/test/test_order.py +++ /dev/null @@ -1,75 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.order import Order # noqa: E501 -from patch_api.rest import ApiException -from factories import AllocationFactory - - -class TestOrder(unittest.TestCase): - """Order unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Order - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.order.Order() # noqa: E501 - if include_optional: - return Order( - id="0", - mass_g=1, - production=True, - state="draft", - allocation_state="pending", - price_cents_usd="0", - patch_fee_cents_usd="0", - allocations=[AllocationFactory()], - metadata={}, - ) - else: - return Order( - id="0", - mass_g=1, - production=True, - state="draft", - allocation_state="pending", - price_cents_usd="0", - patch_fee_cents_usd="0", - allocations=[AllocationFactory()], - metadata={}, - ) - - def testOrder(self): - """Test Order""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_order_list_response.py b/test/test_order_list_response.py deleted file mode 100644 index ff1adf5..0000000 --- a/test/test_order_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.order_list_response import OrderListResponse # noqa: E501 -from factories import OrderFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestOrderListResponse(unittest.TestCase): - """OrderListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test OrderListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.order_list_response.OrderListResponse() # noqa: E501 - if include_optional: - return OrderListResponse( - success=True, - error=None, - data=[OrderFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return OrderListResponse( - success=True, - error=None, - data=[OrderFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testOrderListResponse(self): - """Test OrderListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_order_response.py b/test/test_order_response.py deleted file mode 100644 index 1c3e9c3..0000000 --- a/test/test_order_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.order_response import OrderResponse # noqa: E501 -from factories import OrderFactory -from patch_api.rest import ApiException - - -class TestOrderResponse(unittest.TestCase): - """OrderResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test OrderResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.order_response.OrderResponse() # noqa: E501 - if include_optional: - return OrderResponse(success=True, error=None, data=OrderFactory()) - else: - return OrderResponse(success=True, error=None, data=OrderFactory()) - - def testOrderResponse(self): - """Test OrderResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 85630e8..3a60b91 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -18,7 +18,6 @@ import patch_api from patch_api.api.orders_api import OrdersApi # noqa: E501 -from patch_api.rest import ApiException class TestOrdersApi(unittest.TestCase): @@ -32,8 +31,7 @@ def tearDown(self): pass def test_interactions_with_an_order(self): - """Test case for create_order, retrieve_order, cancel_order - """ + """Test case for create_order, retrieve_order, cancel_order""" """Create an order """ diff --git a/test/test_preference.py b/test/test_preference.py deleted file mode 100644 index a120a3b..0000000 --- a/test/test_preference.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.preference import Preference # noqa: E501 -from factories import PreferenceFactory -from patch_api.rest import ApiException - - -class TestPreference(unittest.TestCase): - """Preference unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Preference - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.preference.Preference() # noqa: E501 - if include_optional: - return PreferenceFactory() - else: - return PreferenceFactory() - - def testPreference(self): - """Test Preference""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preference_list_response.py b/test/test_preference_list_response.py deleted file mode 100644 index fcc6e5d..0000000 --- a/test/test_preference_list_response.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.preference_list_response import ( - PreferenceListResponse, -) # noqa: E501 -from factories import MetaIndexObjectFactory, PreferenceFactory -from patch_api.rest import ApiException - - -class TestPreferenceListResponse(unittest.TestCase): - """PreferenceListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test PreferenceListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.preference_list_response.PreferenceListResponse() # noqa: E501 - if include_optional: - return PreferenceListResponse( - success=True, - error=None, - data=[PreferenceFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return PreferenceListResponse( - success=True, - error=None, - data=[PreferenceFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testPreferenceListResponse(self): - """Test PreferenceListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preference_response.py b/test/test_preference_response.py deleted file mode 100644 index f69d3fc..0000000 --- a/test/test_preference_response.py +++ /dev/null @@ -1,59 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.preference_response import PreferenceResponse # noqa: E501 -from factories import PreferenceFactory -from patch_api.rest import ApiException - - -class TestPreferenceResponse(unittest.TestCase): - """PreferenceResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test PreferenceResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.preference_response.PreferenceResponse() # noqa: E501 - if include_optional: - return PreferenceResponse( - success=True, error=None, data=PreferenceFactory() - ) - else: - return PreferenceResponse( - success=True, error=None, data=PreferenceFactory() - ) - - def testPreferenceResponse(self): - """Test PreferenceResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index e8911b5..f067a24 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -15,12 +15,9 @@ import unittest import os -from urllib.error import HTTPError import patch_api from patch_api.api.preferences_api import PreferencesApi # noqa: E501 -from patch_api.models.create_preference_request import CreatePreferenceRequest -from patch_api.rest import ApiException class TestPreferencesApi(unittest.TestCase): @@ -50,8 +47,7 @@ def test_retrieve_preferences_and_preference(self): self.assertTrue(preference.project) def test_delete_and_create_preferences(self): - """Test case for create_preference and delete_preference - """ + """Test case for create_preference and delete_preference""" project_id = "pro_test_0de1a59eed9ff8474e09077ddb3714b2" preferences = self.api.retrieve_preferences() if len(preferences.data) > 0: diff --git a/test/test_project.py b/test/test_project.py deleted file mode 100644 index cac1450..0000000 --- a/test/test_project.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project import Project # noqa: E501 -from patch_api.rest import ApiException -from factories import ProjectFactory - - -class TestProject(unittest.TestCase): - """Project unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Project - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project.Project() # noqa: E501 - if include_optional: - return ProjectFactory() - else: - return ProjectFactory(photos=None, standard=None, type=None) - - def testProject(self): - """Test Project""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_project_list_response.py b/test/test_project_list_response.py deleted file mode 100644 index 03a6b1e..0000000 --- a/test/test_project_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project_list_response import ProjectListResponse # noqa: E501 -from factories import ProjectFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestProjectListResponse(unittest.TestCase): - """ProjectListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ProjectListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project_list_response.ProjectListResponse() # noqa: E501 - if include_optional: - return ProjectListResponse( - success=True, - error=None, - data=[ProjectFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return ProjectListResponse( - success=True, - error=None, - data=[ProjectFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testProjectListResponse(self): - """Test ProjectListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_project_response.py b/test/test_project_response.py deleted file mode 100644 index 662b928..0000000 --- a/test/test_project_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project_response import ProjectResponse # noqa: E501 -from factories import ProjectFactory -from patch_api.rest import ApiException - - -class TestProjectResponse(unittest.TestCase): - """ProjectResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ProjectResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project_response.ProjectResponse() # noqa: E501 - if include_optional: - return ProjectResponse(success=True, error=None, data=ProjectFactory()) - else: - return ProjectResponse(success=True, error=None, data=ProjectFactory()) - - def testProjectResponse(self): - """Test ProjectResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() From 9a50112d0bcbd83f6768ff6eda27fe4f49f9cb95 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 13:23:25 -0700 Subject: [PATCH 14/23] Delete unused test filesimprove pre-cimmit --- .github/workflows/black.yml | 11 ++++ .pre-commit-config.yaml | 11 ++-- Makefile | 3 ++ git_push.sh | 58 --------------------- patch_api/api_client.py | 2 +- patch_api/configuration.py | 3 +- patch_api/exceptions.py | 2 +- requirements.txt | 2 + setup.py | 5 +- test/test_allocation.py | 55 -------------------- test/test_error_response.py | 54 ------------------- test/test_estimate.py | 55 -------------------- test/test_estimate_list_response.py | 65 ----------------------- test/test_estimate_response.py | 55 -------------------- test/test_estimates_api.py | 1 - test/test_meta_index_object.py | 54 ------------------- test/test_order.py | 75 --------------------------- test/test_order_list_response.py | 65 ----------------------- test/test_order_response.py | 55 -------------------- test/test_orders_api.py | 4 +- test/test_preference.py | 55 -------------------- test/test_preference_list_response.py | 67 ------------------------ test/test_preference_response.py | 59 --------------------- test/test_preferences_api.py | 6 +-- test/test_project.py | 55 -------------------- test/test_project_list_response.py | 65 ----------------------- test/test_project_response.py | 55 -------------------- 27 files changed, 33 insertions(+), 964 deletions(-) create mode 100644 .github/workflows/black.yml delete mode 100644 git_push.sh delete mode 100644 test/test_allocation.py delete mode 100644 test/test_error_response.py delete mode 100644 test/test_estimate.py delete mode 100644 test/test_estimate_list_response.py delete mode 100644 test/test_estimate_response.py delete mode 100644 test/test_meta_index_object.py delete mode 100644 test/test_order.py delete mode 100644 test/test_order_list_response.py delete mode 100644 test/test_order_response.py delete mode 100644 test/test_preference.py delete mode 100644 test/test_preference_list_response.py delete mode 100644 test/test_preference_response.py delete mode 100644 test/test_project.py delete mode 100644 test/test_project_list_response.py delete mode 100644 test/test_project_response.py diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..f58e4c6 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,11 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: psf/black@stable diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ebd6ff..4bdcc6f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,10 @@ repos: -- repo: https://github.com/psf/black - rev: 19.3b0 +- repo: https://github.com/ambv/black + rev: stable hooks: - - id: black + - id: black + language_version: python3.6 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v1.2.3 + hooks: + - id: flake8 diff --git a/Makefile b/Makefile index ce4ada5..2a83273 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ build: pip install -r requirements.txt \ python setup.py install +lint: + pre-commit + test: pip install -r test-requirements.txt && \ python -m unittest discover test/ diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index ced3be2..0000000 --- a/git_push.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/patch_api/api_client.py b/patch_api/api_client.py index f4e8be6..0f29505 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -97,7 +97,7 @@ def __del__(self): @property def pool(self): """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. + avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: self._pool = ThreadPool(self.pool_threads) diff --git a/patch_api/configuration.py b/patch_api/configuration.py index ce2baf4..4da45bf 100644 --- a/patch_api/configuration.py +++ b/patch_api/configuration.py @@ -65,8 +65,7 @@ def __init__( password=None, discard_unknown_keys=False, ): - """Constructor - """ + """Constructor""" self.host = host """Default Base url """ diff --git a/patch_api/exceptions.py b/patch_api/exceptions.py index fc75982..64b8229 100644 --- a/patch_api/exceptions.py +++ b/patch_api/exceptions.py @@ -20,7 +20,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): - """ Raises an exception for TypeErrors + """Raises an exception for TypeErrors Args: msg (str): the exception message diff --git a/requirements.txt b/requirements.txt index 26e1a7b..f8872e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 pre-commit >= 2.9.3 +autopep8 >= 1.5.4 +flake8 >= 3.8.4 diff --git a/setup.py b/setup.py index f6fb494..5702b6d 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,10 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.25.3", "python-dateutil"] +REQUIRES = [ + "urllib3 >= 1.25.3", + "python-dateutil", +] setup( name=NAME, diff --git a/test/test_allocation.py b/test/test_allocation.py deleted file mode 100644 index 694ea31..0000000 --- a/test/test_allocation.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.allocation import Allocation # noqa: E501 -from factories import AllocationFactory -from patch_api.rest import ApiException - - -class TestAllocation(unittest.TestCase): - """Allocation unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Allocation - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.allocation.Allocation() # noqa: E501 - if include_optional: - return AllocationFactory() - else: - return AllocationFactory() - - def testAllocation(self): - """Test Allocation""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_error_response.py b/test/test_error_response.py deleted file mode 100644 index 46f54be..0000000 --- a/test/test_error_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.error_response import ErrorResponse # noqa: E501 -from patch_api.rest import ApiException - - -class TestErrorResponse(unittest.TestCase): - """ErrorResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ErrorResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.error_response.ErrorResponse() # noqa: E501 - if include_optional: - return ErrorResponse(success=True, error={}, data=None) - else: - return ErrorResponse(success=True, error={}, data=None) - - def testErrorResponse(self): - """Test ErrorResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimate.py b/test/test_estimate.py deleted file mode 100644 index 21d97b9..0000000 --- a/test/test_estimate.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.estimate import Estimate # noqa: E501 -from factories import EstimateFactory, OrderFactory -from patch_api.rest import ApiException - - -class TestEstimate(unittest.TestCase): - """Estimate unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Estimate - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.estimate.Estimate() # noqa: E501 - if include_optional: - return EstimateFactory(order=OrderFactory()) - else: - return EstimateFactory(order=None) - - def testEstimate(self): - """Test Estimate""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimate_list_response.py b/test/test_estimate_list_response.py deleted file mode 100644 index 9efdd05..0000000 --- a/test/test_estimate_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.estimate_list_response import EstimateListResponse # noqa: E501 -from factories import EstimateFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestEstimateListResponse(unittest.TestCase): - """EstimateListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test EstimateListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.estimate_list_response.EstimateListResponse() # noqa: E501 - if include_optional: - return EstimateListResponse( - success=True, - error=None, - data=[EstimateFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return EstimateListResponse( - success=True, - error=None, - data=[EstimateFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testEstimateListResponse(self): - """Test EstimateListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimate_response.py b/test/test_estimate_response.py deleted file mode 100644 index 8538481..0000000 --- a/test/test_estimate_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.estimate_response import EstimateResponse # noqa: E501 -from factories import EstimateFactory -from patch_api.rest import ApiException - - -class TestEstimateResponse(unittest.TestCase): - """EstimateResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test EstimateResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.estimate_response.EstimateResponse() # noqa: E501 - if include_optional: - return EstimateResponse(success=True, error=None, data=EstimateFactory()) - else: - return EstimateResponse(success=True, error=None, data=EstimateFactory()) - - def testEstimateResponse(self): - """Test EstimateResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 76ad23c..56fe219 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -18,7 +18,6 @@ import patch_api from patch_api.api.estimates_api import EstimatesApi # noqa: E501 -from patch_api.rest import ApiException class TestEstimatesApi(unittest.TestCase): diff --git a/test/test_meta_index_object.py b/test/test_meta_index_object.py deleted file mode 100644 index 61f3c19..0000000 --- a/test/test_meta_index_object.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 -from patch_api.rest import ApiException - - -class TestMetaIndexObject(unittest.TestCase): - """MetaIndexObject unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test MetaIndexObject - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.meta_index_object.MetaIndexObject() # noqa: E501 - if include_optional: - return MetaIndexObject(prev_page=56, next_page=58) - else: - return MetaIndexObject() - - def testMetaIndexObject(self): - """Test MetaIndexObject""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_order.py b/test/test_order.py deleted file mode 100644 index 93c92fc..0000000 --- a/test/test_order.py +++ /dev/null @@ -1,75 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.order import Order # noqa: E501 -from patch_api.rest import ApiException -from factories import AllocationFactory - - -class TestOrder(unittest.TestCase): - """Order unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Order - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.order.Order() # noqa: E501 - if include_optional: - return Order( - id="0", - mass_g=1, - production=True, - state="draft", - allocation_state="pending", - price_cents_usd="0", - patch_fee_cents_usd="0", - allocations=[AllocationFactory()], - metadata={}, - ) - else: - return Order( - id="0", - mass_g=1, - production=True, - state="draft", - allocation_state="pending", - price_cents_usd="0", - patch_fee_cents_usd="0", - allocations=[AllocationFactory()], - metadata={}, - ) - - def testOrder(self): - """Test Order""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_order_list_response.py b/test/test_order_list_response.py deleted file mode 100644 index ff1adf5..0000000 --- a/test/test_order_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.order_list_response import OrderListResponse # noqa: E501 -from factories import OrderFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestOrderListResponse(unittest.TestCase): - """OrderListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test OrderListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.order_list_response.OrderListResponse() # noqa: E501 - if include_optional: - return OrderListResponse( - success=True, - error=None, - data=[OrderFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return OrderListResponse( - success=True, - error=None, - data=[OrderFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testOrderListResponse(self): - """Test OrderListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_order_response.py b/test/test_order_response.py deleted file mode 100644 index 1c3e9c3..0000000 --- a/test/test_order_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.order_response import OrderResponse # noqa: E501 -from factories import OrderFactory -from patch_api.rest import ApiException - - -class TestOrderResponse(unittest.TestCase): - """OrderResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test OrderResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.order_response.OrderResponse() # noqa: E501 - if include_optional: - return OrderResponse(success=True, error=None, data=OrderFactory()) - else: - return OrderResponse(success=True, error=None, data=OrderFactory()) - - def testOrderResponse(self): - """Test OrderResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 85630e8..3a60b91 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -18,7 +18,6 @@ import patch_api from patch_api.api.orders_api import OrdersApi # noqa: E501 -from patch_api.rest import ApiException class TestOrdersApi(unittest.TestCase): @@ -32,8 +31,7 @@ def tearDown(self): pass def test_interactions_with_an_order(self): - """Test case for create_order, retrieve_order, cancel_order - """ + """Test case for create_order, retrieve_order, cancel_order""" """Create an order """ diff --git a/test/test_preference.py b/test/test_preference.py deleted file mode 100644 index a120a3b..0000000 --- a/test/test_preference.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.preference import Preference # noqa: E501 -from factories import PreferenceFactory -from patch_api.rest import ApiException - - -class TestPreference(unittest.TestCase): - """Preference unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Preference - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.preference.Preference() # noqa: E501 - if include_optional: - return PreferenceFactory() - else: - return PreferenceFactory() - - def testPreference(self): - """Test Preference""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preference_list_response.py b/test/test_preference_list_response.py deleted file mode 100644 index fcc6e5d..0000000 --- a/test/test_preference_list_response.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.preference_list_response import ( - PreferenceListResponse, -) # noqa: E501 -from factories import MetaIndexObjectFactory, PreferenceFactory -from patch_api.rest import ApiException - - -class TestPreferenceListResponse(unittest.TestCase): - """PreferenceListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test PreferenceListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.preference_list_response.PreferenceListResponse() # noqa: E501 - if include_optional: - return PreferenceListResponse( - success=True, - error=None, - data=[PreferenceFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return PreferenceListResponse( - success=True, - error=None, - data=[PreferenceFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testPreferenceListResponse(self): - """Test PreferenceListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preference_response.py b/test/test_preference_response.py deleted file mode 100644 index f69d3fc..0000000 --- a/test/test_preference_response.py +++ /dev/null @@ -1,59 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.preference_response import PreferenceResponse # noqa: E501 -from factories import PreferenceFactory -from patch_api.rest import ApiException - - -class TestPreferenceResponse(unittest.TestCase): - """PreferenceResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test PreferenceResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.preference_response.PreferenceResponse() # noqa: E501 - if include_optional: - return PreferenceResponse( - success=True, error=None, data=PreferenceFactory() - ) - else: - return PreferenceResponse( - success=True, error=None, data=PreferenceFactory() - ) - - def testPreferenceResponse(self): - """Test PreferenceResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index e8911b5..f067a24 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -15,12 +15,9 @@ import unittest import os -from urllib.error import HTTPError import patch_api from patch_api.api.preferences_api import PreferencesApi # noqa: E501 -from patch_api.models.create_preference_request import CreatePreferenceRequest -from patch_api.rest import ApiException class TestPreferencesApi(unittest.TestCase): @@ -50,8 +47,7 @@ def test_retrieve_preferences_and_preference(self): self.assertTrue(preference.project) def test_delete_and_create_preferences(self): - """Test case for create_preference and delete_preference - """ + """Test case for create_preference and delete_preference""" project_id = "pro_test_0de1a59eed9ff8474e09077ddb3714b2" preferences = self.api.retrieve_preferences() if len(preferences.data) > 0: diff --git a/test/test_project.py b/test/test_project.py deleted file mode 100644 index cac1450..0000000 --- a/test/test_project.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project import Project # noqa: E501 -from patch_api.rest import ApiException -from factories import ProjectFactory - - -class TestProject(unittest.TestCase): - """Project unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test Project - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project.Project() # noqa: E501 - if include_optional: - return ProjectFactory() - else: - return ProjectFactory(photos=None, standard=None, type=None) - - def testProject(self): - """Test Project""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_project_list_response.py b/test/test_project_list_response.py deleted file mode 100644 index 03a6b1e..0000000 --- a/test/test_project_list_response.py +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project_list_response import ProjectListResponse # noqa: E501 -from factories import ProjectFactory, MetaIndexObjectFactory -from patch_api.rest import ApiException - - -class TestProjectListResponse(unittest.TestCase): - """ProjectListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ProjectListResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project_list_response.ProjectListResponse() # noqa: E501 - if include_optional: - return ProjectListResponse( - success=True, - error=None, - data=[ProjectFactory()], - meta=MetaIndexObjectFactory(), - ) - else: - return ProjectListResponse( - success=True, - error=None, - data=[ProjectFactory()], - meta=MetaIndexObjectFactory(), - ) - - def testProjectListResponse(self): - """Test ProjectListResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/test_project_response.py b/test/test_project_response.py deleted file mode 100644 index 662b928..0000000 --- a/test/test_project_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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 -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import patch_api -from patch_api.models.project_response import ProjectResponse # noqa: E501 -from factories import ProjectFactory -from patch_api.rest import ApiException - - -class TestProjectResponse(unittest.TestCase): - """ProjectResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ProjectResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = patch_api.models.project_response.ProjectResponse() # noqa: E501 - if include_optional: - return ProjectResponse(success=True, error=None, data=ProjectFactory()) - else: - return ProjectResponse(success=True, error=None, data=ProjectFactory()) - - def testProjectResponse(self): - """Test ProjectResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - - self.assertTrue(inst_req_only) - self.assertTrue(inst_req_and_optional) - - -if __name__ == "__main__": - unittest.main() From fe8831e8830305b1b687afc4ca7df885f4402df1 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 13:34:07 -0700 Subject: [PATCH 15/23] Run tests on push --- .github/workflows/black.yml | 6 +++++- .gitignore | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index f58e4c6..3706536 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,6 +1,10 @@ name: Lint -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: jobs: lint: diff --git a/.gitignore b/.gitignore index 43995bd..8facac9 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,5 @@ target/ #Ipython Notebook .ipynb_checkpoints + +git_push.sh From 2b10d2e77b4ea21f0638efe2ea8f72f611ba45fa Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 13:52:21 -0700 Subject: [PATCH 16/23] Ignore line too long errors" --- setup.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.cfg b/setup.cfg index 11433ee..c88f6e1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,7 @@ [flake8] max-line-length=99 + +# E501 is the "Line too long" error. We disable it because we use Black for +# code formatting. Black makes a best effort to keep lines under the max +# length, but can go over in some cases. +ignore = E501 From 5b433e80213c73668b8f823740b3cf3a62ee5176 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 17:28:10 -0700 Subject: [PATCH 17/23] Api fixes --- .flake8 | 6 ++++++ .gitignore | 1 - .pre-commit-config.yaml | 1 + patch_api/__init__.py | 4 ++++ patch_api/api/__init__.py | 9 +++++++++ patch_api/api/estimates_api.py | 3 --- patch_api/api/orders_api.py | 3 --- patch_api/api/preferences_api.py | 3 --- patch_api/api/projects_api.py | 3 --- patch_api/api_client.py | 13 +++++++++++++ requirements.txt | 2 -- setup.cfg | 9 +++------ test-requirements.txt | 9 +++------ test/test_estimates_api.py | 7 +++---- test/test_orders_api.py | 9 ++++----- test/test_preferences_api.py | 9 ++++----- test/test_projects_api.py | 12 ++++++------ 17 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..c5d27cb --- /dev/null +++ b/.flake8 @@ -0,0 +1,6 @@ +[flake8] +# E501 is the "Line too long" error and is disabled since we use the black code formatter. +# W504 is the "line break before binary operator" error and is disabled since we use +# the black code formatter. +# W503 is disabled by default, but must be disabled explicitly when using `ignore`. +ignore = E501, W503, W504 diff --git a/.gitignore b/.gitignore index 8facac9..fed4f8f 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,6 @@ coverage.xml *,cover .hypothesis/ venv/ -.venv/ .python-version .pytest_cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4bdcc6f..53ad7c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,3 +8,4 @@ repos: rev: v1.2.3 hooks: - id: flake8 + args: ['--config=.flake8'] diff --git a/patch_api/__init__.py b/patch_api/__init__.py index 21bea00..5cb843d 100644 --- a/patch_api/__init__.py +++ b/patch_api/__init__.py @@ -25,3 +25,7 @@ from patch_api.exceptions import ApiValueError from patch_api.exceptions import ApiKeyError from patch_api.exceptions import ApiException + +from patch_api.api import * + +from patch_api.models import * diff --git a/patch_api/api/__init__.py b/patch_api/api/__init__.py index e69de29..cd9725e 100644 --- a/patch_api/api/__init__.py +++ b/patch_api/api/__init__.py @@ -0,0 +1,9 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from patch_api.api.estimates_api import EstimatesApi +from patch_api.api.orders_api import OrdersApi +from patch_api.api.preferences_api import PreferencesApi +from patch_api.api.projects_api import ProjectsApi diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 1e80cdf..222d7be 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -18,7 +18,6 @@ # python 2 and python 3 compatibility library import six -from patch_api.api_client import ApiClient from patch_api.exceptions import ApiTypeError, ApiValueError @@ -30,8 +29,6 @@ class EstimatesApi(object): """ def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() self.api_client = api_client def create_mass_estimate( diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index 950ad6b..a86aa10 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -18,7 +18,6 @@ # python 2 and python 3 compatibility library import six -from patch_api.api_client import ApiClient from patch_api.exceptions import ApiTypeError, ApiValueError @@ -30,8 +29,6 @@ class OrdersApi(object): """ def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() self.api_client = api_client def cancel_order(self, opts={}, id={}, **kwargs): # noqa: E501 diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index 79778c0..91140a5 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -18,7 +18,6 @@ # python 2 and python 3 compatibility library import six -from patch_api.api_client import ApiClient from patch_api.exceptions import ApiTypeError, ApiValueError @@ -30,8 +29,6 @@ class PreferencesApi(object): """ def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() self.api_client = api_client def create_preference( diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index d89d6dd..9822382 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -18,7 +18,6 @@ # python 2 and python 3 compatibility library import six -from patch_api.api_client import ApiClient from patch_api.exceptions import ApiTypeError, ApiValueError @@ -30,8 +29,6 @@ class ProjectsApi(object): """ def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() self.api_client = api_client def retrieve_project(self, opts={}, id={}, **kwargs): # noqa: E501 diff --git a/patch_api/api_client.py b/patch_api/api_client.py index 0f29505..c4e91e5 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -25,6 +25,10 @@ from patch_api.configuration import Configuration import patch_api.models +from patch_api.api.projects_api import ProjectsApi +from patch_api.api.orders_api import OrdersApi +from patch_api.api.preferences_api import PreferencesApi +from patch_api.api.estimates_api import EstimatesApi from patch_api import rest from patch_api.exceptions import ApiValueError @@ -94,6 +98,15 @@ def __del__(self): self._pool.join() self._pool = None + def __getattr__(self, method): + resource = { + "projects": ProjectsApi, + "orders": OrdersApi, + "preferences": PreferencesApi, + "estimates": EstimatesApi, + }[method] + return resource(api_client=self) + @property def pool(self): """Create thread pool on first request diff --git a/requirements.txt b/requirements.txt index f8872e9..26e1a7b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,3 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 pre-commit >= 2.9.3 -autopep8 >= 1.5.4 -flake8 >= 3.8.4 diff --git a/setup.cfg b/setup.cfg index c88f6e1..b2df0a9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,4 @@ [flake8] -max-line-length=99 - -# E501 is the "Line too long" error. We disable it because we use Black for -# code formatting. Black makes a best effort to keep lines under the max -# length, but can go over in some cases. -ignore = E501 +# E501 is the "Line too long" error and is disabled since we use black code formatter. +# W503 is disabled by default, but must be disabled explicitly when using `ignore`. +ignore = E501, W503, W504 diff --git a/test-requirements.txt b/test-requirements.txt index 76f42de..4ed3991 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 -factory_boy>=2.12.0 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 56fe219..5f00716 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -16,16 +16,15 @@ import unittest import os -import patch_api -from patch_api.api.estimates_api import EstimatesApi # noqa: E501 +from patch_api.api_client import ApiClient class TestEstimatesApi(unittest.TestCase): """EstimatesApi unit test stubs""" def setUp(self): - api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) - self.api = EstimatesApi(api_client=api_client) # noqa: E501 + api_client = ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) + self.api = api_client.estimates # noqa: E501 def tearDown(self): self.api = None diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 3a60b91..06a7913 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -16,19 +16,18 @@ import unittest import os -import patch_api -from patch_api.api.orders_api import OrdersApi # noqa: E501 +from patch_api.api_client import ApiClient class TestOrdersApi(unittest.TestCase): """OrdersApi unit test stubs""" def setUp(self): - api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) - self.api = OrdersApi(api_client=api_client) # noqa: E501 + api_client = ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) + self.api = api_client.orders # noqa: E501 def tearDown(self): - pass + self.api = None def test_interactions_with_an_order(self): """Test case for create_order, retrieve_order, cancel_order""" diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index f067a24..2113751 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -16,19 +16,18 @@ import unittest import os -import patch_api -from patch_api.api.preferences_api import PreferencesApi # noqa: E501 +from patch_api.api_client import ApiClient class TestPreferencesApi(unittest.TestCase): """PreferencesApi unit test stubs""" def setUp(self): - api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) - self.api = PreferencesApi(api_client=api_client) # noqa: E501 + api_client = ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) + self.api = api_client.preferences # noqa: E501 def tearDown(self): - pass + self.api = None def test_retrieve_preferences_and_preference(self): """Test case for retrieve_preferences and retrieve_preference diff --git a/test/test_projects_api.py b/test/test_projects_api.py index 8c15ed2..4be6581 100644 --- a/test/test_projects_api.py +++ b/test/test_projects_api.py @@ -16,17 +16,15 @@ import unittest import os -import patch_api -from patch_api.api.projects_api import ProjectsApi # noqa: E501 -from patch_api.rest import ApiException +from patch_api.api_client import ApiClient class TestProjectsApi(unittest.TestCase): """ProjectsApi unit test stubs""" def setUp(self): - api_client = patch_api.ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) - self.api = ProjectsApi(api_client=api_client) # noqa: E501 + api_client = ApiClient(api_key=os.environ.get("SANDBOX_API_KEY")) + self.api = api_client.projects # noqa: E501 def tearDown(self): self.api = None @@ -37,8 +35,10 @@ def test_retrieve_project(self): Retrieves a project # noqa: E501 """ project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" - project = self.api.retrieve_project(id=project_id) + project = self.api.retrieve_project(id=project_id).data self.assertTrue(project) + self.assertEqual(project.production, False) + self.assertTrue(isinstance(project.photos, list)) def test_retrieve_projects(self): """Test case for retrieve_projects From ca9a6924c168cca798261a3d15864a4ff621059e Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 17:34:20 -0700 Subject: [PATCH 18/23] update Readme --- README.md | 80 +++--- .../models/create_mass_estimate_request.py | 166 ------------- patch_api/models/create_order_request.py | 232 ------------------ patch_api/models/create_preference_request.py | 124 ---------- setup.cfg | 4 +- 5 files changed, 29 insertions(+), 577 deletions(-) delete mode 100644 patch_api/models/create_mass_estimate_request.py delete mode 100644 patch_api/models/create_order_request.py delete mode 100644 patch_api/models/create_preference_request.py diff --git a/README.md b/README.md index 21aab78..6990356 100644 --- a/README.md +++ b/README.md @@ -32,22 +32,13 @@ pip install patch_api ### Configuration -After installing the gem, you'll have to initialize it with your API key which is available from the API key page in the Patch dashboard: +After installing the gem, you'll have to initialize it with your API key which is available from the API key page in the Patch dashboard. The `patch` object will be used to to make calls to the Patch API: ```python import patch_api -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -``` - -The `api_client` will be used to instantiate other API objects for Patch resources, for example the `OrdersApi`: - -``` -import patch_api -from patch_api.api.orders_api import OrdersApi as Orders - -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -orders_api = Orders(api_client=api_client) +patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +orders = patch.orders.retrieve_orders() ``` ### Orders @@ -64,44 +55,42 @@ fulfill the order for you. #### Examples ```python import patch_api -from patch_api.api.orders_api import OrdersApi as Orders -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -orders_api = Orders(api_client=api_client) +patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # Create an order - you can create an order # providing either mass_g or total_price_cents_usd, but not both # Create order with mass -orders_api.create_order(opts={'mass_g': 1_000_000}) # Pass in the mass in grams (i.e. 1 metric tonne) +patch.orders.create_order(opts={'mass_g': 1_000_000}) # Pass in the mass in grams (i.e. 1 metric tonne) # Create an order with maximum total price total_price_cents_usd = 5_00 # Pass in the total price in cents (i.e. 5 dollars) -orders_api.create_order(opts={'total_price_cents_usd': total_price_cents_usd}) +patch.orders.create_order(opts={'total_price_cents_usd': total_price_cents_usd}) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -orders_api.create_order(opts={'project_id': project_id, 'mass_g': mass_g}) +patch.orders.create_order(opts={'project_id': project_id, 'mass_g': mass_g}) ## Orders also accept a metadata field (optional) metadata = {user: "john doe"} -orders_api.create_order(opts={'metadata': metadata, 'mass_g': mass_g}) +patch.orders.create_order(opts={'metadata': metadata, 'mass_g': mass_g}) # Retrieve an order order_id = 'ord_test_1234' # Pass in the order's id -orders_api.retrieve_order(id=order_id) +patch.orders.retrieve_order(id=order_id) # Place an order order_id = 'ord_test_1234' # Pass in the order's id -orders_api.place_order(id=order_id) +patch.orders.place_order(id=order_id) # Cancel an order order_id = 'ord_test_1234' # Pass in the order's id -orders_api.cancel_order(id=order_id) +patch.orders.cancel_order(id=order_id) # Retrieve a list of orders page = 1 # Pass in which page of orders you'd like -orders_api.retrieve_orders(page=page) +patch.orders.retrieve_orders(page=page) ``` ### Estimates @@ -112,27 +101,25 @@ Estimates allow API users to get a quote for the cost of compensating a certain #### Examples ```python import patch_api -from patch_api.api.estimates_api import EstimatesApi as Estimates -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -estimates_api = Estimates(api_client=api_client) +patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # Create an estimate mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne) -estimates_api.create_estimate(opts={'mass_g': mass_g}) +patch.estimates.create_estimate(opts={'mass_g': mass_g}) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -estimates_api.create_estimate(opts={'mass_g': mass_g, 'project_id': project_id}) +patch.estimates.create_estimate(opts={'mass_g': mass_g, 'project_id': project_id}) # Retrieve an estimate estimate_id = 'est_test_1234' -estimates_api.retrieve_estimate(id=estimate_id) +patch.estimates.retrieve_estimate(id=estimate_id) # Retrieve a list of estimates page = 1 # Pass in which page of estimates you'd like -estimates_api.retrieve_estimates(page=page) +patch.estimates.retrieve_estimates(page=page) ``` ### Projects @@ -143,18 +130,16 @@ Projects are the ways Patch takes CO2 out of the air. They can represent refores #### Examples ```python import patch_api -from patch_api.api.projects_api import ProjectsApi as Projects -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -projects_api = Projects(api_client=api_client) +patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # Retrieve a project project_id = 'pro_test_1234' # Pass in the project's ID -projects_api.retrieve_project(id=project_id) +patch.projects.retrieve_project(id=project_id) # Retrieve a list of projects page = 1 # Pass in which page of projects you'd like -projects_api.retrieve_projects(page=page) +patch.projects.retrieve_projects(page=page) ``` ### Preferences @@ -165,27 +150,25 @@ Preferences are how you route your orders in Patch. If you don't have a preferen #### Examples ```python import patch_api -from patch_api.api.preferences_api import PreferencesApi as Preferences -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -preferences_api = Preferences(api_client=api_client) +patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # Create a preference project_id = 'pro_test_1234' # Pass in the project_id for your preference -preferences_api.create_preference(opts={'project_id': project_id}) +patch.preferences.create_preference(opts={'project_id': project_id}) # Retrieve a preference preference_id = 'pre_test_1234' # Pass in the preferences's id -preferences_api.retrieve_preference(preference_id=preference_id) +patch.preferences.retrieve_preference(preference_id=preference_id) # Delete a preference preference_id = 'pre_test_1234' # Pass in the preferences's id -preferences_api.delete_preference(preference_id=preference_id) +patch.preferences.delete_preference(preference_id=preference_id) # Retrieve a list of preferences page = 1 # Pass in which page of preferences you'd like -preferences_api.retrieve_preferences(page=page) +patch.preferences.retrieve_preferences(page=page) ``` ## Development @@ -231,15 +214,8 @@ To test the package locally, create a python file in a sibling directory and add import os import patch_api -# ..... your Patch API code goes here. See example below: - -from patch_api.api.orders_api import OrdersApi as Orders - -api_client = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -orders = Orders(api_client=api_client) - -list_orders = orders.retrieve_orders(opts={'page': 1}) +patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) +orders = patch.orders.retrieve_orders(opts={'page': 1}) -# Prints your organization's orders -print(list_orders) +print(orders) ``` diff --git a/patch_api/models/create_mass_estimate_request.py b/patch_api/models/create_mass_estimate_request.py deleted file mode 100644 index 20da476..0000000 --- a/patch_api/models/create_mass_estimate_request.py +++ /dev/null @@ -1,166 +0,0 @@ -# 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 CreateMassEstimateRequest(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 = {"mass_g": "int", "project_id": "str"} - - attribute_map = {"mass_g": "mass_g", "project_id": "project_id"} - - def __init__( - self, mass_g=None, project_id=None, local_vars_configuration=None - ): # noqa: E501 - """CreateMassEstimateRequest - 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._mass_g = None - self._project_id = None - self.discriminator = None - - self.mass_g = mass_g - if project_id is not None: - self.project_id = project_id - - @property - def mass_g(self): - """Gets the mass_g of this CreateMassEstimateRequest. # noqa: E501 - - - :return: The mass_g of this CreateMassEstimateRequest. # noqa: E501 - :rtype: int - """ - return self._mass_g - - @mass_g.setter - def mass_g(self, mass_g): - """Sets the mass_g of this CreateMassEstimateRequest. - - - :param mass_g: The mass_g of this CreateMassEstimateRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation and mass_g is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must not be `None`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._mass_g = mass_g - - @property - def project_id(self): - """Gets the project_id of this CreateMassEstimateRequest. # noqa: E501 - - - :return: The project_id of this CreateMassEstimateRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateMassEstimateRequest. - - - :param project_id: The project_id of this CreateMassEstimateRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - 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, CreateMassEstimateRequest): - 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, CreateMassEstimateRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_order_request.py b/patch_api/models/create_order_request.py deleted file mode 100644 index 07eb92e..0000000 --- a/patch_api/models/create_order_request.py +++ /dev/null @@ -1,232 +0,0 @@ -# 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 CreateOrderRequest(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 = { - "mass_g": "int", - "total_price_cents_usd": "int", - "project_id": "str", - "metadata": "object", - } - - attribute_map = { - "mass_g": "mass_g", - "total_price_cents_usd": "total_price_cents_usd", - "project_id": "project_id", - "metadata": "metadata", - } - - def __init__( - self, - mass_g=None, - total_price_cents_usd=None, - project_id=None, - metadata=None, - local_vars_configuration=None, - ): # noqa: E501 - """CreateOrderRequest - 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._mass_g = None - self._total_price_cents_usd = None - self._project_id = None - self._metadata = None - self.discriminator = None - - if mass_g is not None: - self.mass_g = mass_g - if total_price_cents_usd is not None: - self.total_price_cents_usd = total_price_cents_usd - if project_id is not None: - self.project_id = project_id - if metadata is not None: - self.metadata = metadata - - @property - def mass_g(self): - """Gets the mass_g of this CreateOrderRequest. # noqa: E501 - - - :return: The mass_g of this CreateOrderRequest. # noqa: E501 - :rtype: int - """ - return self._mass_g - - @mass_g.setter - def mass_g(self, mass_g): - """Sets the mass_g of this CreateOrderRequest. - - - :param mass_g: The mass_g of this CreateOrderRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g > 2000000000 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value less than or equal to `2000000000`" - ) # noqa: E501 - if ( - self.local_vars_configuration.client_side_validation - and mass_g is not None - and mass_g < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `mass_g`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._mass_g = mass_g - - @property - def total_price_cents_usd(self): - """Gets the total_price_cents_usd of this CreateOrderRequest. # noqa: E501 - - - :return: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 - :rtype: int - """ - return self._total_price_cents_usd - - @total_price_cents_usd.setter - def total_price_cents_usd(self, total_price_cents_usd): - """Sets the total_price_cents_usd of this CreateOrderRequest. - - - :param total_price_cents_usd: The total_price_cents_usd of this CreateOrderRequest. # noqa: E501 - :type: int - """ - if ( - self.local_vars_configuration.client_side_validation - and total_price_cents_usd is not None - and total_price_cents_usd < 1 - ): # noqa: E501 - raise ValueError( - "Invalid value for `total_price_cents_usd`, must be a value greater than or equal to `1`" - ) # noqa: E501 - - self._total_price_cents_usd = total_price_cents_usd - - @property - def project_id(self): - """Gets the project_id of this CreateOrderRequest. # noqa: E501 - - - :return: The project_id of this CreateOrderRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreateOrderRequest. - - - :param project_id: The project_id of this CreateOrderRequest. # noqa: E501 - :type: str - """ - - self._project_id = project_id - - @property - def metadata(self): - """Gets the metadata of this CreateOrderRequest. # noqa: E501 - - - :return: The metadata of this CreateOrderRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this CreateOrderRequest. - - - :param metadata: The metadata of this CreateOrderRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - 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, CreateOrderRequest): - 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, CreateOrderRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/patch_api/models/create_preference_request.py b/patch_api/models/create_preference_request.py deleted file mode 100644 index d5e14a4..0000000 --- a/patch_api/models/create_preference_request.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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 CreatePreferenceRequest(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 = {"project_id": "str"} - - attribute_map = {"project_id": "project_id"} - - def __init__(self, project_id=None, local_vars_configuration=None): # noqa: E501 - """CreatePreferenceRequest - 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._project_id = None - self.discriminator = None - - self.project_id = project_id - - @property - def project_id(self): - """Gets the project_id of this CreatePreferenceRequest. # noqa: E501 - - - :return: The project_id of this CreatePreferenceRequest. # noqa: E501 - :rtype: str - """ - return self._project_id - - @project_id.setter - def project_id(self, project_id): - """Sets the project_id of this CreatePreferenceRequest. - - - :param project_id: The project_id of this CreatePreferenceRequest. # noqa: E501 - :type: str - """ - if ( - self.local_vars_configuration.client_side_validation and project_id is None - ): # noqa: E501 - raise ValueError( - "Invalid value for `project_id`, must not be `None`" - ) # noqa: E501 - - self._project_id = project_id - - 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, CreatePreferenceRequest): - 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, CreatePreferenceRequest): - return True - - return self.to_dict() != other.to_dict() diff --git a/setup.cfg b/setup.cfg index b2df0a9..11433ee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,2 @@ [flake8] -# E501 is the "Line too long" error and is disabled since we use black code formatter. -# W503 is disabled by default, but must be disabled explicitly when using `ignore`. -ignore = E501, W503, W504 +max-line-length=99 From 3a2c3c3c42f5247eea1887a85206c46703e70cc6 Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 17:43:33 -0700 Subject: [PATCH 19/23] Remove unused models --- patch_api/models/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/patch_api/models/__init__.py b/patch_api/models/__init__.py index 9d7eea4..54572e0 100644 --- a/patch_api/models/__init__.py +++ b/patch_api/models/__init__.py @@ -16,9 +16,6 @@ # import models into model package from patch_api.models.allocation import Allocation -from patch_api.models.create_mass_estimate_request import CreateMassEstimateRequest -from patch_api.models.create_order_request import CreateOrderRequest -from patch_api.models.create_preference_request import CreatePreferenceRequest from patch_api.models.error_response import ErrorResponse from patch_api.models.estimate import Estimate from patch_api.models.estimate_list_response import EstimateListResponse From 70bf7603b6f70624f94a71a0289e12a95974a70d Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 17:45:32 -0700 Subject: [PATCH 20/23] remove factories --- test/factories.py | 94 ----------------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 test/factories.py diff --git a/test/factories.py b/test/factories.py deleted file mode 100644 index 8618eba..0000000 --- a/test/factories.py +++ /dev/null @@ -1,94 +0,0 @@ -import factory -from patch_api.models.order import Order # noqa: E501 -from patch_api.models.standard import Standard # noqa: E501 -from patch_api.models.estimate import Estimate # noqa: E501 -from patch_api.models.meta_index_object import MetaIndexObject # noqa: E501 -from patch_api.models.allocation import Allocation # noqa: E501 -from patch_api.models.project import Project # noqa: E501 -from patch_api.models.photo import Photo # noqa: E501 -from patch_api.models.preference import Preference # noqa: E501 - - -class OrderFactory(factory.Factory): - class Meta: - model = Order - - id = "0" - mass_g = 1 - production = True - state = "draft" - allocation_state = "pending" - price_cents_usd = "0" - patch_fee_cents_usd = "0" - allocations = [] - metadata = {} - - -class StandardFactory(factory.Factory): - class Meta: - model = Standard - - type = "0" - acronym = "0" - description = "0" - - -class MetaIndexObjectFactory(factory.Factory): - class Meta: - model = MetaIndexObject - - prev_page = 56 - next_page = 56 - - -class AllocationFactory(factory.Factory): - class Meta: - model = Allocation - - id = "0" - production = True - mass_g = 56 - - -class EstimateFactory(factory.Factory): - class Meta: - model = Estimate - - id = ("0",) - production = (True,) - type = ("0",) - order = OrderFactory() - - -class PhotoFactory(factory.Factory): - class Meta: - model = Photo - - id = "0" - url = "https://photo.com" - - -class ProjectFactory(factory.Factory): - class Meta: - model = Project - - id = "0" - production = True - name = "0" - description = "0" - type = "biomass" - country = "0" - developer = "0" - photos = ([PhotoFactory()],) - average_price_per_tonne_cents_usd = 56 - remaining_mass_g = 56 - standard = StandardFactory() - - -class PreferenceFactory(factory.Factory): - class Meta: - model = Preference - - id = "0" - allocation_percentage = 56 - project = ProjectFactory() From 456ba16186d08ef89a794a1b1f1b369ca909628f Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Fri, 29 Jan 2021 19:17:39 -0700 Subject: [PATCH 21/23] Remove opts arg --- README.md | 16 +++--- patch_api/api/estimates_api.py | 50 +++++++++++-------- patch_api/api/orders_api.py | 84 ++++++++++++++++++-------------- patch_api/api/preferences_api.py | 68 ++++++++++++++------------ patch_api/api/projects_api.py | 34 +++++++------ test/test_estimates_api.py | 4 +- test/test_orders_api.py | 4 +- test/test_preferences_api.py | 2 +- 8 files changed, 146 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index 6990356..76be6c8 100644 --- a/README.md +++ b/README.md @@ -62,19 +62,19 @@ patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # providing either mass_g or total_price_cents_usd, but not both # Create order with mass -patch.orders.create_order(opts={'mass_g': 1_000_000}) # Pass in the mass in grams (i.e. 1 metric tonne) +patch.orders.create_order(mass_g=1_000_000) # Pass in the mass in grams (i.e. 1 metric tonne) # Create an order with maximum total price total_price_cents_usd = 5_00 # Pass in the total price in cents (i.e. 5 dollars) -patch.orders.create_order(opts={'total_price_cents_usd': total_price_cents_usd}) +patch.orders.create_order(total_price_cents_usd=total_price_cents_usd) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -patch.orders.create_order(opts={'project_id': project_id, 'mass_g': mass_g}) +patch.orders.create_order(project_id=project_id, mass_g=mass_g) ## Orders also accept a metadata field (optional) metadata = {user: "john doe"} -patch.orders.create_order(opts={'metadata': metadata, 'mass_g': mass_g}) +patch.orders.create_order(metadata=metadata, mass_g=mass_g) # Retrieve an order order_id = 'ord_test_1234' # Pass in the order's id @@ -107,11 +107,11 @@ patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # Create an estimate mass_g = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne) -patch.estimates.create_estimate(opts={'mass_g': mass_g}) +patch.estimates.create_estimate(mass_g=mass_g) ## You can also specify a project-id field (optional) to be used instead of the preferred one project_id = 'pro_test_1234' # Pass in the project's ID -patch.estimates.create_estimate(opts={'mass_g': mass_g, 'project_id': project_id}) +patch.estimates.create_estimate(mass_g=mass_g, project_id=project_id) # Retrieve an estimate estimate_id = 'est_test_1234' @@ -156,7 +156,7 @@ patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) # Create a preference project_id = 'pro_test_1234' # Pass in the project_id for your preference -patch.preferences.create_preference(opts={'project_id': project_id}) +patch.preferences.create_preference(project_id=project_id) # Retrieve a preference preference_id = 'pre_test_1234' # Pass in the preferences's id @@ -215,7 +215,7 @@ import os import patch_api patch = patch_api.ApiClient(api_key=os.environ.get('SANDBOX_API_KEY')) -orders = patch.orders.retrieve_orders(opts={'page': 1}) +orders = patch.orders.retrieve_orders(page=1) print(orders) ``` diff --git a/patch_api/api/estimates_api.py b/patch_api/api/estimates_api.py index 222d7be..07f42ac 100644 --- a/patch_api/api/estimates_api.py +++ b/patch_api/api/estimates_api.py @@ -28,11 +28,13 @@ class EstimatesApi(object): Do not edit the class manually. """ + ALLOWED_QUERY_PARAMS = ["mass_g", "price_cents_usd", "project_id", "page"] + def __init__(self, api_client=None): self.api_client = api_client def create_mass_estimate( - self, opts={}, create_mass_estimate_request={}, **kwargs + self, create_mass_estimate_request={}, **kwargs ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 @@ -44,7 +46,6 @@ def create_mass_estimate( :param async_req bool: execute request asynchronously :param CreateMassEstimateRequest create_mass_estimate_request: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -58,11 +59,11 @@ def create_mass_estimate( """ kwargs["_return_http_data_only"] = True return self.create_mass_estimate_with_http_info( - opts, create_mass_estimate_request, **kwargs + create_mass_estimate_request, **kwargs ) # noqa: E501 def create_mass_estimate_with_http_info( - self, opts, create_mass_estimate_request, **kwargs + self, create_mass_estimate_request, **kwargs ): # noqa: E501 """Create an estimate based on mass of CO2 # noqa: E501 @@ -74,7 +75,6 @@ def create_mass_estimate_with_http_info( :param async_req bool: execute request asynchronously :param CreateMassEstimateRequest create_mass_estimate_request: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -96,6 +96,10 @@ def create_mass_estimate_with_http_info( all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -119,8 +123,8 @@ def create_mass_estimate_with_http_info( path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -165,7 +169,7 @@ def create_mass_estimate_with_http_info( collection_formats=collection_formats, ) - def retrieve_estimate(self, opts={}, id={}, **kwargs): # noqa: E501 + def retrieve_estimate(self, id={}, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -176,7 +180,6 @@ def retrieve_estimate(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -189,9 +192,9 @@ def retrieve_estimate(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_estimate_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.retrieve_estimate_with_http_info(id, **kwargs) # noqa: E501 - def retrieve_estimate_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def retrieve_estimate_with_http_info(self, id, **kwargs): # noqa: E501 """Retrieves an estimate # noqa: E501 Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -202,7 +205,6 @@ def retrieve_estimate_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -224,6 +226,10 @@ def retrieve_estimate_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -246,8 +252,8 @@ def retrieve_estimate_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -283,7 +289,7 @@ def retrieve_estimate_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_estimates(self, opts={}, **kwargs): # noqa: E501 + def retrieve_estimates(self, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -294,7 +300,6 @@ def retrieve_estimates(self, opts={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -307,9 +312,9 @@ def retrieve_estimates(self, opts={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_estimates_with_http_info(opts, **kwargs) # noqa: E501 + return self.retrieve_estimates_with_http_info(**kwargs) # noqa: E501 - def retrieve_estimates_with_http_info(self, opts, **kwargs): # noqa: E501 + def retrieve_estimates_with_http_info(self, **kwargs): # noqa: E501 """Retrieves a list of estimates # noqa: E501 Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for. # noqa: E501 @@ -320,7 +325,6 @@ def retrieve_estimates_with_http_info(self, opts, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -342,6 +346,10 @@ def retrieve_estimates_with_http_info(self, opts, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -357,8 +365,8 @@ def retrieve_estimates_with_http_info(self, opts, **kwargs): # noqa: E501 path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/api/orders_api.py b/patch_api/api/orders_api.py index a86aa10..6e22be6 100644 --- a/patch_api/api/orders_api.py +++ b/patch_api/api/orders_api.py @@ -28,10 +28,12 @@ class OrdersApi(object): Do not edit the class manually. """ + ALLOWED_QUERY_PARAMS = ["mass_g", "price_cents_usd", "project_id", "page"] + def __init__(self, api_client=None): self.api_client = api_client - def cancel_order(self, opts={}, id={}, **kwargs): # noqa: E501 + def cancel_order(self, id={}, **kwargs): # noqa: E501 """Cancel an order # noqa: E501 Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled. # noqa: E501 @@ -42,7 +44,6 @@ def cancel_order(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -55,9 +56,9 @@ def cancel_order(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.cancel_order_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.cancel_order_with_http_info(id, **kwargs) # noqa: E501 - def cancel_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def cancel_order_with_http_info(self, id, **kwargs): # noqa: E501 """Cancel an order # noqa: E501 Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled. # noqa: E501 @@ -68,7 +69,6 @@ def cancel_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -90,6 +90,10 @@ def cancel_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -112,8 +116,8 @@ def cancel_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -149,7 +153,7 @@ def cancel_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def create_order(self, opts={}, create_order_request={}, **kwargs): # noqa: E501 + def create_order(self, create_order_request={}, **kwargs): # noqa: E501 """Creates an order # noqa: E501 Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 @@ -160,7 +164,6 @@ def create_order(self, opts={}, create_order_request={}, **kwargs): # noqa: E50 :param async_req bool: execute request asynchronously :param CreateOrderRequest create_order_request: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -174,12 +177,10 @@ def create_order(self, opts={}, create_order_request={}, **kwargs): # noqa: E50 """ kwargs["_return_http_data_only"] = True return self.create_order_with_http_info( - opts, create_order_request, **kwargs + create_order_request, **kwargs ) # noqa: E501 - def create_order_with_http_info( - self, opts, create_order_request, **kwargs - ): # noqa: E501 + def create_order_with_http_info(self, create_order_request, **kwargs): # noqa: E501 """Creates an order # noqa: E501 Creates an order in the `placed` state. To create a `draft` order, create an estimate first. # noqa: E501 @@ -190,7 +191,6 @@ def create_order_with_http_info( :param async_req bool: execute request asynchronously :param CreateOrderRequest create_order_request: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -212,6 +212,10 @@ def create_order_with_http_info( all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -235,8 +239,8 @@ def create_order_with_http_info( path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -281,7 +285,7 @@ def create_order_with_http_info( collection_formats=collection_formats, ) - def place_order(self, opts={}, id={}, **kwargs): # noqa: E501 + def place_order(self, id={}, **kwargs): # noqa: E501 """Place an order # noqa: E501 Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed # noqa: E501 @@ -292,7 +296,6 @@ def place_order(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -305,9 +308,9 @@ def place_order(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.place_order_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.place_order_with_http_info(id, **kwargs) # noqa: E501 - def place_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def place_order_with_http_info(self, id, **kwargs): # noqa: E501 """Place an order # noqa: E501 Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed # noqa: E501 @@ -318,7 +321,6 @@ def place_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -340,6 +342,10 @@ def place_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -362,8 +368,8 @@ def place_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -399,7 +405,7 @@ def place_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_order(self, opts={}, id={}, **kwargs): # noqa: E501 + def retrieve_order(self, id={}, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -410,7 +416,6 @@ def retrieve_order(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -423,9 +428,9 @@ def retrieve_order(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_order_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.retrieve_order_with_http_info(id, **kwargs) # noqa: E501 - def retrieve_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def retrieve_order_with_http_info(self, id, **kwargs): # noqa: E501 """Retrieves an order # noqa: E501 Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -436,7 +441,6 @@ def retrieve_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -458,6 +462,10 @@ def retrieve_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -480,8 +488,8 @@ def retrieve_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -517,7 +525,7 @@ def retrieve_order_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_orders(self, opts={}, **kwargs): # noqa: E501 + def retrieve_orders(self, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -528,7 +536,6 @@ def retrieve_orders(self, opts={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -541,9 +548,9 @@ def retrieve_orders(self, opts={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_orders_with_http_info(opts, **kwargs) # noqa: E501 + return self.retrieve_orders_with_http_info(**kwargs) # noqa: E501 - def retrieve_orders_with_http_info(self, opts, **kwargs): # noqa: E501 + def retrieve_orders_with_http_info(self, **kwargs): # noqa: E501 """Retrieves a list of orders # noqa: E501 Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. # noqa: E501 @@ -554,7 +561,6 @@ def retrieve_orders_with_http_info(self, opts, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -576,6 +582,10 @@ def retrieve_orders_with_http_info(self, opts, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -591,8 +601,8 @@ def retrieve_orders_with_http_info(self, opts, **kwargs): # noqa: E501 path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/api/preferences_api.py b/patch_api/api/preferences_api.py index 91140a5..5efddc3 100644 --- a/patch_api/api/preferences_api.py +++ b/patch_api/api/preferences_api.py @@ -28,12 +28,12 @@ class PreferencesApi(object): Do not edit the class manually. """ + ALLOWED_QUERY_PARAMS = ["mass_g", "price_cents_usd", "project_id", "page"] + def __init__(self, api_client=None): self.api_client = api_client - def create_preference( - self, opts={}, create_preference_request={}, **kwargs - ): # noqa: E501 + def create_preference(self, create_preference_request={}, **kwargs): # noqa: E501 """creates a project preference # noqa: E501 Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to. # noqa: E501 @@ -44,7 +44,6 @@ def create_preference( :param async_req bool: execute request asynchronously :param CreatePreferenceRequest create_preference_request: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -58,11 +57,11 @@ def create_preference( """ kwargs["_return_http_data_only"] = True return self.create_preference_with_http_info( - opts, create_preference_request, **kwargs + create_preference_request, **kwargs ) # noqa: E501 def create_preference_with_http_info( - self, opts, create_preference_request, **kwargs + self, create_preference_request, **kwargs ): # noqa: E501 """creates a project preference # noqa: E501 @@ -74,7 +73,6 @@ def create_preference_with_http_info( :param async_req bool: execute request asynchronously :param CreatePreferenceRequest create_preference_request: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -96,6 +94,10 @@ def create_preference_with_http_info( all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -119,8 +121,8 @@ def create_preference_with_http_info( path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -165,7 +167,7 @@ def create_preference_with_http_info( collection_formats=collection_formats, ) - def delete_preference(self, opts={}, id={}, **kwargs): # noqa: E501 + def delete_preference(self, id={}, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. # noqa: E501 @@ -176,7 +178,6 @@ def delete_preference(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -189,9 +190,9 @@ def delete_preference(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.delete_preference_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.delete_preference_with_http_info(id, **kwargs) # noqa: E501 - def delete_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def delete_preference_with_http_info(self, id, **kwargs): # noqa: E501 """Deletes an organization's preference for a project # noqa: E501 Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one. # noqa: E501 @@ -202,7 +203,6 @@ def delete_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -224,6 +224,10 @@ def delete_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -246,8 +250,8 @@ def delete_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -283,7 +287,7 @@ def delete_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_preference(self, opts={}, id={}, **kwargs): # noqa: E501 + def retrieve_preference(self, id={}, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -294,7 +298,6 @@ def retrieve_preference(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -307,9 +310,9 @@ def retrieve_preference(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_preference_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.retrieve_preference_with_http_info(id, **kwargs) # noqa: E501 - def retrieve_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def retrieve_preference_with_http_info(self, id, **kwargs): # noqa: E501 """Retrieve the preference # noqa: E501 Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -320,7 +323,6 @@ def retrieve_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -342,6 +344,10 @@ def retrieve_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -364,8 +370,8 @@ def retrieve_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -401,7 +407,7 @@ def retrieve_preference_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_preferences(self, opts={}, **kwargs): # noqa: E501 + def retrieve_preferences(self, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -412,7 +418,6 @@ def retrieve_preferences(self, opts={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -425,9 +430,9 @@ def retrieve_preferences(self, opts={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_preferences_with_http_info(opts, **kwargs) # noqa: E501 + return self.retrieve_preferences_with_http_info(**kwargs) # noqa: E501 - def retrieve_preferences_with_http_info(self, opts, **kwargs): # noqa: E501 + def retrieve_preferences_with_http_info(self, **kwargs): # noqa: E501 """Retrieves a list of preferences # noqa: E501 Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization. # noqa: E501 @@ -438,7 +443,6 @@ def retrieve_preferences_with_http_info(self, opts, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -460,6 +464,10 @@ def retrieve_preferences_with_http_info(self, opts, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -475,8 +483,8 @@ def retrieve_preferences_with_http_info(self, opts, **kwargs): # noqa: E501 path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/patch_api/api/projects_api.py b/patch_api/api/projects_api.py index 9822382..4a6e3fe 100644 --- a/patch_api/api/projects_api.py +++ b/patch_api/api/projects_api.py @@ -28,10 +28,12 @@ class ProjectsApi(object): Do not edit the class manually. """ + ALLOWED_QUERY_PARAMS = ["mass_g", "price_cents_usd", "project_id", "page"] + def __init__(self, api_client=None): self.api_client = api_client - def retrieve_project(self, opts={}, id={}, **kwargs): # noqa: E501 + def retrieve_project(self, id={}, **kwargs): # noqa: E501 """Retrieves a project # noqa: E501 Retrieves a project available on Patch's platform. # noqa: E501 @@ -42,7 +44,6 @@ def retrieve_project(self, opts={}, id={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -55,9 +56,9 @@ def retrieve_project(self, opts={}, id={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_project_with_http_info(opts, id, **kwargs) # noqa: E501 + return self.retrieve_project_with_http_info(id, **kwargs) # noqa: E501 - def retrieve_project_with_http_info(self, opts, id, **kwargs): # noqa: E501 + def retrieve_project_with_http_info(self, id, **kwargs): # noqa: E501 """Retrieves a project # noqa: E501 Retrieves a project available on Patch's platform. # noqa: E501 @@ -68,7 +69,6 @@ def retrieve_project_with_http_info(self, opts, id, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param str id: (required) - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -90,6 +90,10 @@ def retrieve_project_with_http_info(self, opts, id, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -112,8 +116,8 @@ def retrieve_project_with_http_info(self, opts, id, **kwargs): # noqa: E501 path_params["id"] = local_var_params["id"] # noqa: E501 query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) header_params = {} @@ -149,7 +153,7 @@ def retrieve_project_with_http_info(self, opts, id, **kwargs): # noqa: E501 collection_formats=collection_formats, ) - def retrieve_projects(self, opts={}, **kwargs): # noqa: E501 + def retrieve_projects(self, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 Retrieves a list of projects available for purchase on Patch's platform. # noqa: E501 @@ -160,7 +164,6 @@ def retrieve_projects(self, opts={}, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (optional) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -173,9 +176,9 @@ def retrieve_projects(self, opts={}, **kwargs): # noqa: E501 returns the request thread. """ kwargs["_return_http_data_only"] = True - return self.retrieve_projects_with_http_info(opts, **kwargs) # noqa: E501 + return self.retrieve_projects_with_http_info(**kwargs) # noqa: E501 - def retrieve_projects_with_http_info(self, opts, **kwargs): # noqa: E501 + def retrieve_projects_with_http_info(self, **kwargs): # noqa: E501 """Retrieves a list of projects # noqa: E501 Retrieves a list of projects available for purchase on Patch's platform. # noqa: E501 @@ -186,7 +189,6 @@ def retrieve_projects_with_http_info(self, opts, **kwargs): # noqa: E501 :param async_req bool: execute request asynchronously :param int page: - :param dict opts: dictionary holding the optional arguments for the query (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -208,6 +210,10 @@ def retrieve_projects_with_http_info(self, opts, **kwargs): # noqa: E501 all_params.append("_return_http_data_only") all_params.append("_preload_content") all_params.append("_request_timeout") + all_params.append("mass_g") + all_params.append("price_cents_usd") + all_params.append("project_id") + all_params.append("metadata") for key, val in six.iteritems(local_var_params["kwargs"]): if key not in all_params: @@ -223,8 +229,8 @@ def retrieve_projects_with_http_info(self, opts, **kwargs): # noqa: E501 path_params = {} query_params = [] - for key in opts: - query_params.append([key, opts.get(key)]) + for key in kwargs: + query_params.append([key, kwargs.get(key)]) if "page" in local_var_params: query_params.append(("page", local_var_params["page"])) # noqa: E501 diff --git a/test/test_estimates_api.py b/test/test_estimates_api.py index 5f00716..9e5ffe3 100644 --- a/test/test_estimates_api.py +++ b/test/test_estimates_api.py @@ -36,9 +36,7 @@ def test_create_and_retrieve_mass_estimate(self): """ mass_g = 100 project_id = "pro_test_2b67b11a030b66e0a6dd61a56b49079a" - estimate = self.api.create_mass_estimate( - opts={"mass_g": mass_g, "project_id": project_id} - ) + estimate = self.api.create_mass_estimate(mass_g=mass_g, project_id=project_id) self.assertTrue(estimate) self.assertEqual(estimate.data.order.mass_g, mass_g) diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 06a7913..11f3202 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -34,13 +34,13 @@ def test_interactions_with_an_order(self): """Create an order """ - order = self.api.create_order(opts={"mass_g": 100}) + order = self.api.create_order(mass_g=100) self.assertTrue(order) """Retrieve an order """ - order = self.api.create_order(opts={"mass_g": 100}) + order = self.api.create_order(mass_g=100) retrieved_order = self.api.retrieve_order(id=order.data.id) self.assertTrue(retrieved_order) diff --git a/test/test_preferences_api.py b/test/test_preferences_api.py index 2113751..f7b8edf 100644 --- a/test/test_preferences_api.py +++ b/test/test_preferences_api.py @@ -55,7 +55,7 @@ def test_delete_and_create_preferences(self): self.assertTrue(deleted_preference) - preference = self.api.create_preference(opts={"project_id": project_id}).data + preference = self.api.create_preference(project_id=project_id).data self.assertTrue(preference.allocation_percentage) self.assertTrue(preference.id) self.assertTrue(preference.project) From 0716e42b09d5b0be7540239fc6bbad42de89d02c Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Mon, 1 Feb 2021 17:48:07 -0700 Subject: [PATCH 22/23] Update Makefile Co-authored-by: Thiago Araujo --- Makefile | 2 +- test/test_orders_api.py | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 2a83273..e4c7ea8 100644 --- a/Makefile +++ b/Makefile @@ -11,4 +11,4 @@ test: pip install -r test-requirements.txt && \ python -m unittest discover test/ -.PHONY: build test +.PHONY: build test lint diff --git a/test/test_orders_api.py b/test/test_orders_api.py index 11f3202..976a337 100644 --- a/test/test_orders_api.py +++ b/test/test_orders_api.py @@ -30,7 +30,7 @@ def tearDown(self): self.api = None def test_interactions_with_an_order(self): - """Test case for create_order, retrieve_order, cancel_order""" + """Test case for create_order, retrieve_order""" """Create an order """ @@ -45,12 +45,6 @@ def test_interactions_with_an_order(self): self.assertTrue(retrieved_order) - """Cancel an order - """ - cancelled_order = self.api.retrieve_order(id=order.data.id) - - self.assertTrue(cancelled_order) - def test_retrieve_orders(self): """Test case for retrieve_orders @@ -63,13 +57,10 @@ def test_retrieve_orders(self): retrieved_order = orders[0] self.assertTrue(retrieved_order.id) - self.assertEqual(retrieved_order.mass_g, 100) self.assertEqual(retrieved_order.production, False) self.assertEqual(retrieved_order.state, "placed") self.assertEqual(retrieved_order.allocation_state, "allocated") - self.assertEqual(retrieved_order.price_cents_usd, "1.0") self.assertEqual(retrieved_order.metadata, {}) - self.assertEqual(retrieved_order.patch_fee_cents_usd, "0.0") self.assertTrue(isinstance(retrieved_order.allocations, list)) From a416e2626de22ea51fff91c568d77f607e6030df Mon Sep 17 00:00:00 2001 From: Lovisa Svallingson Date: Mon, 1 Feb 2021 18:01:20 -0700 Subject: [PATCH 23/23] Alphabetize imports --- patch_api/api_client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/patch_api/api_client.py b/patch_api/api_client.py index c4e91e5..d57c691 100644 --- a/patch_api/api_client.py +++ b/patch_api/api_client.py @@ -25,10 +25,11 @@ from patch_api.configuration import Configuration import patch_api.models -from patch_api.api.projects_api import ProjectsApi +from patch_api.api.estimates_api import EstimatesApi from patch_api.api.orders_api import OrdersApi from patch_api.api.preferences_api import PreferencesApi -from patch_api.api.estimates_api import EstimatesApi +from patch_api.api.projects_api import ProjectsApi + from patch_api import rest from patch_api.exceptions import ApiValueError