diff --git a/setup.py b/setup.py index 0f12def3..62688523 100644 --- a/setup.py +++ b/setup.py @@ -48,5 +48,5 @@ def read_file(filename): keywords="xero python sdk API oAuth", name="xero_python", packages=find_packages(include=["xero_python", "xero_python.*"]), - version="1.4.0", + version="1.5.0", ) diff --git a/xero_python/__init__.py b/xero_python/__init__.py index cfbf45fc..73b6c8cd 100644 --- a/xero_python/__init__.py +++ b/xero_python/__init__.py @@ -2,4 +2,4 @@ __author__ = """Xero Developer API""" __email__ = "api@xero.com" -__version__ = "1.4.0" +__version__ = "1.5.0" diff --git a/xero_python/accounting/api/accounting_api.py b/xero_python/accounting/api/accounting_api.py index 34b4ed56..ae10df5e 100644 --- a/xero_python/accounting/api/accounting_api.py +++ b/xero_python/accounting/api/accounting_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib diff --git a/xero_python/accounting/docs/BatchPayment.md b/xero_python/accounting/docs/BatchPayment.md index 69f28b3c..527a54dc 100644 --- a/xero_python/accounting/docs/BatchPayment.md +++ b/xero_python/accounting/docs/BatchPayment.md @@ -19,6 +19,7 @@ Name | Type | Description | Notes **total_amount** | **str** | The total of the payments that make up the batch (read-only) | [optional] **updated_date_utc** | **datetime** | UTC timestamp of last update to the payment | [optional] **is_reconciled** | **str** | Booelan that tells you if the batch payment has been reconciled (read-only) | [optional] +**validation_errors** | [**list[ValidationError]**](ValidationError.md) | Displays array of validation error messages from the API | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/xero_python/accounting/docs/ImportSummaryAccounts.md b/xero_python/accounting/docs/ImportSummaryAccounts.md index bd71f7d9..88810e81 100644 --- a/xero_python/accounting/docs/ImportSummaryAccounts.md +++ b/xero_python/accounting/docs/ImportSummaryAccounts.md @@ -3,15 +3,15 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**total** | **float** | The total number of accounts in the org | [optional] -**new** | **float** | The number of new accounts created | [optional] -**updated** | **float** | The number of accounts updated | [optional] -**deleted** | **float** | The number of accounts deleted | [optional] -**locked** | **float** | The number of locked accounts | [optional] -**system** | **float** | The number of system accounts | [optional] -**errored** | **float** | The number of accounts that had an error | [optional] +**total** | **int** | The total number of accounts in the org | [optional] +**new** | **int** | The number of new accounts created | [optional] +**updated** | **int** | The number of accounts updated | [optional] +**deleted** | **int** | The number of accounts deleted | [optional] +**locked** | **int** | The number of locked accounts | [optional] +**system** | **int** | The number of system accounts | [optional] +**errored** | **int** | The number of accounts that had an error | [optional] **present** | **bool** | | [optional] -**new_or_updated** | **float** | The number of new or updated accounts | [optional] +**new_or_updated** | **int** | The number of new or updated accounts | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/xero_python/accounting/models/batch_payment.py b/xero_python/accounting/models/batch_payment.py index 3a83b7e0..4cfddad7 100644 --- a/xero_python/accounting/models/batch_payment.py +++ b/xero_python/accounting/models/batch_payment.py @@ -46,6 +46,7 @@ class BatchPayment(BaseModel): "total_amount": "str", "updated_date_utc": "datetime[ms-format]", "is_reconciled": "str", + "validation_errors": "list[ValidationError]", } attribute_map = { @@ -65,6 +66,7 @@ class BatchPayment(BaseModel): "total_amount": "TotalAmount", "updated_date_utc": "UpdatedDateUTC", "is_reconciled": "IsReconciled", + "validation_errors": "ValidationErrors", } def __init__( @@ -85,6 +87,7 @@ def __init__( total_amount=None, updated_date_utc=None, is_reconciled=None, + validation_errors=None, ): # noqa: E501 """BatchPayment - a model defined in OpenAPI""" # noqa: E501 @@ -104,6 +107,7 @@ def __init__( self._total_amount = None self._updated_date_utc = None self._is_reconciled = None + self._validation_errors = None self.discriminator = None if account is not None: @@ -138,6 +142,8 @@ def __init__( self.updated_date_utc = updated_date_utc if is_reconciled is not None: self.is_reconciled = is_reconciled + if validation_errors is not None: + self.validation_errors = validation_errors @property def account(self): @@ -541,3 +547,26 @@ def is_reconciled(self, is_reconciled): """ self._is_reconciled = is_reconciled + + @property + def validation_errors(self): + """Gets the validation_errors of this BatchPayment. # noqa: E501 + + Displays array of validation error messages from the API # noqa: E501 + + :return: The validation_errors of this BatchPayment. # noqa: E501 + :rtype: list[ValidationError] + """ + return self._validation_errors + + @validation_errors.setter + def validation_errors(self, validation_errors): + """Sets the validation_errors of this BatchPayment. + + Displays array of validation error messages from the API # noqa: E501 + + :param validation_errors: The validation_errors of this BatchPayment. # noqa: E501 + :type: list[ValidationError] + """ + + self._validation_errors = validation_errors diff --git a/xero_python/accounting/models/import_summary_accounts.py b/xero_python/accounting/models/import_summary_accounts.py index 00e81c40..d5b90723 100644 --- a/xero_python/accounting/models/import_summary_accounts.py +++ b/xero_python/accounting/models/import_summary_accounts.py @@ -30,15 +30,15 @@ class ImportSummaryAccounts(BaseModel): and the value is json key in definition. """ openapi_types = { - "total": "float", - "new": "float", - "updated": "float", - "deleted": "float", - "locked": "float", - "system": "float", - "errored": "float", + "total": "int", + "new": "int", + "updated": "int", + "deleted": "int", + "locked": "int", + "system": "int", + "errored": "int", "present": "bool", - "new_or_updated": "float", + "new_or_updated": "int", } attribute_map = { @@ -104,7 +104,7 @@ def total(self): The total number of accounts in the org # noqa: E501 :return: The total of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._total @@ -115,7 +115,7 @@ def total(self, total): The total number of accounts in the org # noqa: E501 :param total: The total of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._total = total @@ -127,7 +127,7 @@ def new(self): The number of new accounts created # noqa: E501 :return: The new of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._new @@ -138,7 +138,7 @@ def new(self, new): The number of new accounts created # noqa: E501 :param new: The new of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._new = new @@ -150,7 +150,7 @@ def updated(self): The number of accounts updated # noqa: E501 :return: The updated of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._updated @@ -161,7 +161,7 @@ def updated(self, updated): The number of accounts updated # noqa: E501 :param updated: The updated of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._updated = updated @@ -173,7 +173,7 @@ def deleted(self): The number of accounts deleted # noqa: E501 :return: The deleted of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._deleted @@ -184,7 +184,7 @@ def deleted(self, deleted): The number of accounts deleted # noqa: E501 :param deleted: The deleted of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._deleted = deleted @@ -196,7 +196,7 @@ def locked(self): The number of locked accounts # noqa: E501 :return: The locked of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._locked @@ -207,7 +207,7 @@ def locked(self, locked): The number of locked accounts # noqa: E501 :param locked: The locked of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._locked = locked @@ -219,7 +219,7 @@ def system(self): The number of system accounts # noqa: E501 :return: The system of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._system @@ -230,7 +230,7 @@ def system(self, system): The number of system accounts # noqa: E501 :param system: The system of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._system = system @@ -242,7 +242,7 @@ def errored(self): The number of accounts that had an error # noqa: E501 :return: The errored of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._errored @@ -253,7 +253,7 @@ def errored(self, errored): The number of accounts that had an error # noqa: E501 :param errored: The errored of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._errored = errored @@ -286,7 +286,7 @@ def new_or_updated(self): The number of new or updated accounts # noqa: E501 :return: The new_or_updated of this ImportSummaryAccounts. # noqa: E501 - :rtype: float + :rtype: int """ return self._new_or_updated @@ -297,7 +297,7 @@ def new_or_updated(self, new_or_updated): The number of new or updated accounts # noqa: E501 :param new_or_updated: The new_or_updated of this ImportSummaryAccounts. # noqa: E501 - :type: float + :type: int """ self._new_or_updated = new_or_updated diff --git a/xero_python/assets/api/asset_api.py b/xero_python/assets/api/asset_api.py index 1d3c9f86..a4b19fe9 100644 --- a/xero_python/assets/api/asset_api.py +++ b/xero_python/assets/api/asset_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib diff --git a/xero_python/docs/README.md b/xero_python/docs/README.md index 1bc72733..936590d9 100644 --- a/xero_python/docs/README.md +++ b/xero_python/docs/README.md @@ -3,8 +3,8 @@ These endpoints are related to managing authentication tokens and identity for X The `xero_python` package is automatically generated by the [XeroAPI SDK 2.0 Codegen](https://github.com/xero-github/xeroapi-sdk-codegen) project: -- API version: 2.9.3 -- Package version: 1.4.0 +- API version: 2.10.1 +- Package version: 1.5.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://developer.xero.com](https://developer.xero.com) diff --git a/xero_python/file/__init__.py b/xero_python/file/__init__.py new file mode 100644 index 00000000..1c631bcb --- /dev/null +++ b/xero_python/file/__init__.py @@ -0,0 +1,28 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +# import apis into sdk package +from xero_python.file.api.files_api import FilesApi + + +# import models into sdk package +from xero_python.file.models.association import Association +from xero_python.file.models.file_object import FileObject +from xero_python.file.models.files import Files +from xero_python.file.models.folder import Folder +from xero_python.file.models.folders import Folders +from xero_python.file.models.inline_object import InlineObject +from xero_python.file.models.object_group import ObjectGroup +from xero_python.file.models.object_type import ObjectType +from xero_python.file.models.user import User diff --git a/xero_python/file/api/__init__.py b/xero_python/file/api/__init__.py new file mode 100644 index 00000000..32f0e111 --- /dev/null +++ b/xero_python/file/api/__init__.py @@ -0,0 +1,4 @@ +# flake8: noqa + +# import apis into api package +from xero_python.file.api.files_api import FilesApi diff --git a/xero_python/file/api/files_api.py b/xero_python/file/api/files_api.py new file mode 100644 index 00000000..3c90f602 --- /dev/null +++ b/xero_python/file/api/files_api.py @@ -0,0 +1,1319 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + +""" + OpenAPI spec version: 2.10.1 +""" + +import importlib +import re # noqa: F401 + +from xero_python import exceptions +from xero_python.api_client import ApiClient, ModelFinder + +try: + from .exception_handler import translate_status_exception +except ImportError: + translate_status_exception = exceptions.translate_status_exception + + +class empty: + """ empty object to mark optional parameter not set """ + + +class FilesApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + base_url = "https://api.xero.com/files.xro/1.0" + models_module = importlib.import_module("xero_python.file.models") + + def __init__(self, api_client=None, base_url=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + self.base_url = base_url or self.base_url + + def get_resource_url(self, resource_path): + """ + Combine API base url with resource specific path + :param str resource_path: API endpoint specific path + :return: str full resource path + """ + return self.base_url + resource_path + + def get_model_finder(self): + return ModelFinder(self.models_module) + + def create_file_association( + self, + xero_tenant_id, + file_id, + association=empty, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Creates a new file association # noqa: E501 + OAuth2 scope: files + By passing in the appropriate options, you can create a new folder # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param Association association: + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: Association + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `create_file_association`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " + "when calling `create_file_association`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = association + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # HTTP header `Content-Type` + header_params["Content-Type"] = self.api_client.select_header_content_type( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}/Associations") + + try: + return self.api_client.call_api( + url, + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Association", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "create_file_association") + + def create_folder( + self, + xero_tenant_id, + folder=empty, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Creates a new folder # noqa: E501 + OAuth2 scope: files + By passing in the appropriate properties, you can create a new folder # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param Folder folder: + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: Folder + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `create_folder`" + ) + + collection_formats = {} + path_params = {} + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = folder + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # HTTP header `Content-Type` + header_params["Content-Type"] = self.api_client.select_header_content_type( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Folders") + + try: + return self.api_client.call_api( + url, + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Folder", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "create_folder") + + def delete_file( + self, + xero_tenant_id, + file_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Deletes a specific file # noqa: E501 + OAuth2 scope: files + Delete a specific file # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: None + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `delete_file`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " "when calling `delete_file`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}") + + try: + return self.api_client.call_api( + url, + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "delete_file") + + def delete_file_association( + self, + xero_tenant_id, + file_id, + object_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Deletes an existing file association # noqa: E501 + OAuth2 scope: files + By passing in the appropriate options, you can create a new folder # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param str object_id: Object id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: None + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `delete_file_association`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " + "when calling `delete_file_association`" + ) + # verify the required parameter 'object_id' is set + if object_id is None: + raise ValueError( + "Missing the required parameter `object_id` " + "when calling `delete_file_association`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + "ObjectId": object_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}/Associations/{ObjectId}") + + try: + return self.api_client.call_api( + url, + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "delete_file_association") + + def delete_folder( + self, + xero_tenant_id, + folder_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Deletes a folder # noqa: E501 + OAuth2 scope: files + By passing in the appropriate ID, you can delete a folder # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str folder_id: Folder id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: None + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `delete_folder`" + ) + # verify the required parameter 'folder_id' is set + if folder_id is None: + raise ValueError( + "Missing the required parameter `folder_id` " + "when calling `delete_folder`" + ) + + collection_formats = {} + path_params = { + "FolderId": folder_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Folders/{FolderId}") + + try: + return self.api_client.call_api( + url, + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "delete_folder") + + def get_associations_by_object( + self, + xero_tenant_id, + object_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves an association object using a unique object ID # noqa: E501 + OAuth2 scope: files.read + By passing in the appropriate options, # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str object_id: Object id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: list[Association] + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_associations_by_object`" + ) + # verify the required parameter 'object_id' is set + if object_id is None: + raise ValueError( + "Missing the required parameter `object_id` " + "when calling `get_associations_by_object`" + ) + + collection_formats = {} + path_params = { + "ObjectId": object_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Associations/{ObjectId}") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="list[Association]", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_associations_by_object") + + def get_file( + self, + xero_tenant_id, + file_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves a file by a unique file ID # noqa: E501 + OAuth2 scope: files.read + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: FileObject + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_file`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " "when calling `get_file`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="FileObject", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_file") + + def get_file_associations( + self, + xero_tenant_id, + file_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves a specific file associations # noqa: E501 + OAuth2 scope: files.read + By passing in the appropriate options, # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: list[Association] + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_file_associations`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " + "when calling `get_file_associations`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}/Associations") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="list[Association]", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_file_associations") + + def get_file_content( + self, + xero_tenant_id, + file_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves the content of a specific file # noqa: E501 + OAuth2 scope: files.read + By passing in the appropriate options, retrieve data for specific file # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: file + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_file_content`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " + "when calling `get_file_content`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/octet-stream"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}/Content") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="file", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_file_content") + + def get_files( + self, + xero_tenant_id, + pagesize=empty, + page=empty, + sort=empty, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves files # noqa: E501 + OAuth2 scope: files.read + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param int pagesize: pass an optional page size value + :param int page: number of records to skip for pagination + :param str sort: values to sort by + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: Files + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_files`" + ) + + if pagesize is not empty and pagesize > 100: + raise ValueError( + "Invalid value for parameter `pagesize` " + "when calling `get_files`, must be a value " + "less than or equal to " + "`100`" + ) + if page is not empty and page < 1: + raise ValueError( + "Invalid value for parameter `page` " + "when calling `get_files`, must be a value " + "greater than or equal to " + "`1`" + ) + collection_formats = {} + path_params = {} + + query_params = [] + + if pagesize is not empty: + query_params.append(("pagesize", pagesize)) + + if page is not empty: + query_params.append(("page", page)) + + if sort is not empty: + query_params.append(("sort", sort)) + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Files", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_files") + + def get_folder( + self, + xero_tenant_id, + folder_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves specific folder by using a unique folder ID # noqa: E501 + OAuth2 scope: files.read + By passing in the appropriate ID, you can search for specific folder # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str folder_id: Folder id for single object (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: Folder + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_folder`" + ) + # verify the required parameter 'folder_id' is set + if folder_id is None: + raise ValueError( + "Missing the required parameter `folder_id` " + "when calling `get_folder`" + ) + + collection_formats = {} + path_params = { + "FolderId": folder_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Folders/{FolderId}") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Folder", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_folder") + + def get_folders( + self, + xero_tenant_id, + sort=empty, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves folders # noqa: E501 + OAuth2 scope: files.read + By passing in the appropriate options, you can search for available folders # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str sort: values to sort by + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: list[Folder] + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_folders`" + ) + + collection_formats = {} + path_params = {} + + query_params = [] + + if sort is not empty: + query_params.append(("sort", sort)) + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Folders") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="list[Folder]", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_folders") + + def get_inbox( + self, + xero_tenant_id, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Retrieves inbox folder # noqa: E501 + OAuth2 scope: files.read + Search for the user inbox # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: Folder + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `get_inbox`" + ) + + collection_formats = {} + path_params = {} + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Inbox") + + try: + return self.api_client.call_api( + url, + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Folder", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "get_inbox") + + def update_file( + self, + xero_tenant_id, + file_id, + file_object=empty, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Update a file # noqa: E501 + OAuth2 scope: files + Updates file properties of a single file # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str file_id: File id for single object (required) + :param FileObject file_object: + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: FileObject + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `update_file`" + ) + # verify the required parameter 'file_id' is set + if file_id is None: + raise ValueError( + "Missing the required parameter `file_id` " "when calling `update_file`" + ) + + collection_formats = {} + path_params = { + "FileId": file_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = file_object + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # HTTP header `Content-Type` + header_params["Content-Type"] = self.api_client.select_header_content_type( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files/{FileId}") + + try: + return self.api_client.call_api( + url, + "PUT", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="FileObject", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "update_file") + + def update_folder( + self, + xero_tenant_id, + folder_id, + folder, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Updates an existing folder # noqa: E501 + OAuth2 scope: files + By passing in the appropriate ID and properties, you can update a folder # noqa: E501 + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str folder_id: Folder id for single object (required) + :param Folder folder: (required) + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: Folder + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `update_folder`" + ) + # verify the required parameter 'folder_id' is set + if folder_id is None: + raise ValueError( + "Missing the required parameter `folder_id` " + "when calling `update_folder`" + ) + # verify the required parameter 'folder' is set + if folder is None: + raise ValueError( + "Missing the required parameter `folder` " + "when calling `update_folder`" + ) + + collection_formats = {} + path_params = { + "FolderId": folder_id, + } + + query_params = [] + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [] + + body_params = folder + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # HTTP header `Content-Type` + header_params["Content-Type"] = self.api_client.select_header_content_type( + ["application/json"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Folders/{FolderId}") + + try: + return self.api_client.call_api( + url, + "PUT", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Folder", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "update_folder") + + def upload_file( + self, + xero_tenant_id, + folder_id=empty, + body=empty, + name=empty, + filename=empty, + mime_type=empty, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + ): + """Uploads a File # noqa: E501 + OAuth2 scope: files + :param str xero_tenant_id: Xero identifier for Tenant (required) + :param str folder_id: pass an optional folder id to save file to specific folder + :param str body: + :param str name: exact name of the file you are uploading + :param str filename: + :param str mime_type: + :param bool _return_http_data_only: return received data only + :param bool _preload_content: load received data in models + :param bool _request_timeout: maximum wait time for response + :return: FileObject + """ + + # verify the required parameter 'xero_tenant_id' is set + if xero_tenant_id is None: + raise ValueError( + "Missing the required parameter `xero_tenant_id` " + "when calling `upload_file`" + ) + + collection_formats = {} + path_params = {} + + query_params = [] + + if folder_id is not empty: + query_params.append(("FolderId", folder_id)) + + header_params = { + "xero-tenant-id": xero_tenant_id, + } + + local_var_files = {} + form_params = [ + ("body", body), + ("name", name), + ("filename", filename), + ("mimeType", mime_type), + ] + + body_params = None + body_params = body + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # HTTP header `Content-Type` + header_params["Content-Type"] = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + + # Authentication setting + auth_settings = ["OAuth2"] + url = self.get_resource_url("/Files") + + try: + return self.api_client.call_api( + url, + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="FileObject", + response_model_finder=self.get_model_finder(), + auth_settings=auth_settings, + _return_http_data_only=_return_http_data_only, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + collection_formats=collection_formats, + ) + except exceptions.HTTPStatusException as error: + raise translate_status_exception(error, self, "upload_file") diff --git a/xero_python/file/docs/Association.md b/xero_python/file/docs/Association.md new file mode 100644 index 00000000..029356d2 --- /dev/null +++ b/xero_python/file/docs/Association.md @@ -0,0 +1,13 @@ +# Association + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file_id** | **str** | The unique identifier of the file | [optional] +**object_id** | **str** | The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID) | [optional] +**object_group** | [**ObjectGroup**](ObjectGroup.md) | | [optional] +**object_type** | [**ObjectType**](ObjectType.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/FileObject.md b/xero_python/file/docs/FileObject.md new file mode 100644 index 00000000..e7432ba9 --- /dev/null +++ b/xero_python/file/docs/FileObject.md @@ -0,0 +1,17 @@ +# FileObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | File Name | [optional] +**mime_type** | **str** | MimeType of the file (image/png, image/jpeg, application/pdf, etc..) | [optional] +**size** | **int** | Numeric value in bytes | [optional] +**created_date_utc** | **str** | Created date in UTC | [optional] +**updated_date_utc** | **str** | Updated date in UTC | [optional] +**user** | [**User**](User.md) | | [optional] +**id** | **str** | File object's UUID | [optional] +**folder_id** | **str** | Folder relation object's UUID | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/Files.md b/xero_python/file/docs/Files.md new file mode 100644 index 00000000..0c030701 --- /dev/null +++ b/xero_python/file/docs/Files.md @@ -0,0 +1,13 @@ +# Files + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_count** | **int** | | [optional] +**page** | **int** | | [optional] +**per_page** | **int** | | [optional] +**items** | [**list[FileObject]**](FileObject.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/FilesApi.md b/xero_python/file/docs/FilesApi.md new file mode 100644 index 00000000..832f85bd --- /dev/null +++ b/xero_python/file/docs/FilesApi.md @@ -0,0 +1,1073 @@ +# xero_python.file.FilesApi + +All URIs are relative to *https://api.xero.com/files.xro/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_file_association**](FilesApi.md#create_file_association) | **POST** /Files/{FileId}/Associations | Creates a new file association +[**create_folder**](FilesApi.md#create_folder) | **POST** /Folders | Creates a new folder +[**delete_file**](FilesApi.md#delete_file) | **DELETE** /Files/{FileId} | Deletes a specific file +[**delete_file_association**](FilesApi.md#delete_file_association) | **DELETE** /Files/{FileId}/Associations/{ObjectId} | Deletes an existing file association +[**delete_folder**](FilesApi.md#delete_folder) | **DELETE** /Folders/{FolderId} | Deletes a folder +[**get_associations_by_object**](FilesApi.md#get_associations_by_object) | **GET** /Associations/{ObjectId} | Retrieves an association object using a unique object ID +[**get_file**](FilesApi.md#get_file) | **GET** /Files/{FileId} | Retrieves a file by a unique file ID +[**get_file_associations**](FilesApi.md#get_file_associations) | **GET** /Files/{FileId}/Associations | Retrieves a specific file associations +[**get_file_content**](FilesApi.md#get_file_content) | **GET** /Files/{FileId}/Content | Retrieves the content of a specific file +[**get_files**](FilesApi.md#get_files) | **GET** /Files | Retrieves files +[**get_folder**](FilesApi.md#get_folder) | **GET** /Folders/{FolderId} | Retrieves specific folder by using a unique folder ID +[**get_folders**](FilesApi.md#get_folders) | **GET** /Folders | Retrieves folders +[**get_inbox**](FilesApi.md#get_inbox) | **GET** /Inbox | Retrieves inbox folder +[**update_file**](FilesApi.md#update_file) | **PUT** /Files/{FileId} | Update a file +[**update_folder**](FilesApi.md#update_folder) | **PUT** /Folders/{FolderId} | Updates an existing folder +[**upload_file**](FilesApi.md#upload_file) | **POST** /Files | Uploads a File + + +# **create_file_association** +> Association create_file_association(xero_tenant_id, file_id, association=association) + +Creates a new file association + +By passing in the appropriate options, you can create a new folder + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +association = { "ObjectId": "1270bf7c-5d18-473a-9231-1e36c4bd33ed", "ObjectGroup": "Contact", "ObjectType": "Business" } # Association | (optional) +try: + # Creates a new file association + api_response = api_instance.create_file_association(xero_tenant_id, file_id, association=association) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->create_file_association: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + **association** | [**Association**](Association.md)| | [optional] + +### Return type + +[**Association**](Association.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_folder** +> Folder create_folder(xero_tenant_id, folder=folder) + +Creates a new folder + +By passing in the appropriate properties, you can create a new folder + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +folder = { "Name": "My Docs" } # Folder | (optional) +try: + # Creates a new folder + api_response = api_instance.create_folder(xero_tenant_id, folder=folder) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->create_folder: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **folder** | [**Folder**](Folder.md)| | [optional] + +### Return type + +[**Folder**](Folder.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_file** +> delete_file(xero_tenant_id, file_id) + +Deletes a specific file + +Delete a specific file + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi + + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +try: + # Deletes a specific file + api_instance.delete_file(xero_tenant_id, file_id) +except ApiException as e: + print("Exception when calling FilesApi->delete_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_file_association** +> delete_file_association(xero_tenant_id, file_id, object_id) + +Deletes an existing file association + +By passing in the appropriate options, you can create a new folder + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi + + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +object_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | Object id for single object +try: + # Deletes an existing file association + api_instance.delete_file_association(xero_tenant_id, file_id, object_id) +except ApiException as e: + print("Exception when calling FilesApi->delete_file_association: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + **object_id** | [**str**](.md)| Object id for single object | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_folder** +> delete_folder(xero_tenant_id, folder_id) + +Deletes a folder + +By passing in the appropriate ID, you can delete a folder + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi + + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +folder_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | Folder id for single object +try: + # Deletes a folder + api_instance.delete_folder(xero_tenant_id, folder_id) +except ApiException as e: + print("Exception when calling FilesApi->delete_folder: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **folder_id** | [**str**](.md)| Folder id for single object | + +### Return type + +void (empty response body) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_associations_by_object** +> list[Association] get_associations_by_object(xero_tenant_id, object_id) + +Retrieves an association object using a unique object ID + +By passing in the appropriate options, + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +object_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | Object id for single object +try: + # Retrieves an association object using a unique object ID + api_response = api_instance.get_associations_by_object(xero_tenant_id, object_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_associations_by_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **object_id** | [**str**](.md)| Object id for single object | + +### Return type + +[**list[Association]**](Association.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_file** +> FileObject get_file(xero_tenant_id, file_id) + +Retrieves a file by a unique file ID + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +try: + # Retrieves a file by a unique file ID + api_response = api_instance.get_file(xero_tenant_id, file_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + +### Return type + +[**FileObject**](FileObject.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_file_associations** +> list[Association] get_file_associations(xero_tenant_id, file_id) + +Retrieves a specific file associations + +By passing in the appropriate options, + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +try: + # Retrieves a specific file associations + api_response = api_instance.get_file_associations(xero_tenant_id, file_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_file_associations: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + +### Return type + +[**list[Association]**](Association.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_file_content** +> file get_file_content(xero_tenant_id, file_id) + +Retrieves the content of a specific file + +By passing in the appropriate options, retrieve data for specific file + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +try: + # Retrieves the content of a specific file + api_response = api_instance.get_file_content(xero_tenant_id, file_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_file_content: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + +### Return type + +**file** + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/octet-stream + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_files** +> Files get_files(xero_tenant_id, pagesize=pagesize, page=page, sort=sort) + +Retrieves files + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +pagesize = 50 # int | pass an optional page size value (optional) +page = 2 # int | number of records to skip for pagination (optional) +sort = 'CreatedDateUTC DESC' # str | values to sort by (optional) +try: + # Retrieves files + api_response = api_instance.get_files(xero_tenant_id, pagesize=pagesize, page=page, sort=sort) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_files: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **pagesize** | **int**| pass an optional page size value | [optional] + **page** | **int**| number of records to skip for pagination | [optional] + **sort** | **str**| values to sort by | [optional] + +### Return type + +[**Files**](Files.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_folder** +> Folder get_folder(xero_tenant_id, folder_id) + +Retrieves specific folder by using a unique folder ID + +By passing in the appropriate ID, you can search for specific folder + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +folder_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | Folder id for single object +try: + # Retrieves specific folder by using a unique folder ID + api_response = api_instance.get_folder(xero_tenant_id, folder_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_folder: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **folder_id** | [**str**](.md)| Folder id for single object | + +### Return type + +[**Folder**](Folder.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_folders** +> list[Folder] get_folders(xero_tenant_id, sort=sort) + +Retrieves folders + +By passing in the appropriate options, you can search for available folders + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +sort = 'CreatedDateUTC DESC' # str | values to sort by (optional) +try: + # Retrieves folders + api_response = api_instance.get_folders(xero_tenant_id, sort=sort) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_folders: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **sort** | **str**| values to sort by | [optional] + +### Return type + +[**list[Folder]**](Folder.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inbox** +> Folder get_inbox(xero_tenant_id) + +Retrieves inbox folder + +Search for the user inbox + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +try: + # Retrieves inbox folder + api_response = api_instance.get_inbox(xero_tenant_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->get_inbox: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + +### Return type + +[**Folder**](Folder.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_file** +> FileObject update_file(xero_tenant_id, file_id, file_object=file_object) + +Update a file + +Updates file properties of a single file + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +file_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | File id for single object +file_object = { "FolderId": "bf924975-7097-46f2-a143-1ecfbab3c8c3" } # FileObject | (optional) +try: + # Update a file + api_response = api_instance.update_file(xero_tenant_id, file_id, file_object=file_object) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->update_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **file_id** | [**str**](.md)| File id for single object | + **file_object** | [**FileObject**](FileObject.md)| | [optional] + +### Return type + +[**FileObject**](FileObject.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_folder** +> Folder update_folder(xero_tenant_id, folder_id, folder) + +Updates an existing folder + +By passing in the appropriate ID and properties, you can update a folder + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +folder_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | Folder id for single object +folder = { "Name": "Your Docs" } # Folder | +try: + # Updates an existing folder + api_response = api_instance.update_folder(xero_tenant_id, folder_id, folder) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->update_folder: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **folder_id** | [**str**](.md)| Folder id for single object | + **folder** | [**Folder**](Folder.md)| | + +### Return type + +[**Folder**](Folder.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file** +> FileObject upload_file(xero_tenant_id, folder_id=folder_id, body=body, name=name, filename=filename, mime_type=mime_type) + +Uploads a File + +### Example + +* OAuth Authentication (OAuth2): +```python +from xero_python.api_client import Configuration, ApiClient +from xero_python.api_client.oauth2 import OAuth2Token +from xero_python.exceptions import ApiException +from xero_python.file import FilesApi +from pprint import pprint + +# Configure OAuth2 access token for authorization: OAuth2 +# simplified version, `xero_oauth2_token` represents permanent global token storage +xero_oauth2_token = {} # set to valid xero oauth2 token dictionary +# create client configuration with client id and client secret for automatic token refresh +api_config = Configuration(oauth2_token=OAuth2Token( + client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET" +)) +# configure xero-python sdk client +api_client = ApiClient( + api_config, + oauth2_token_saver=lambda x: xero_oauth2_token.update(x), + oauth2_token_getter=lambda : xero_oauth2_token +) +# create an instance of the API class +api_instance = FilesApi(api_client) + +xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant +folder_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | pass an optional folder id to save file to specific folder (optional) +body = 'body_example' # str | (optional) +name = 'name_example' # str | exact name of the file you are uploading (optional) +filename = 'filename_example' # str | (optional) +mime_type = 'mime_type_example' # str | (optional) +try: + # Uploads a File + api_response = api_instance.upload_file(xero_tenant_id, folder_id=folder_id, body=body, name=name, filename=filename, mime_type=mime_type) + pprint(api_response) +except ApiException as e: + print("Exception when calling FilesApi->upload_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xero_tenant_id** | **str**| Xero identifier for Tenant | + **folder_id** | [**str**](.md)| pass an optional folder id to save file to specific folder | [optional] + **body** | **str**| | [optional] + **name** | **str**| exact name of the file you are uploading | [optional] + **filename** | **str**| | [optional] + **mime_type** | **str**| | [optional] + +### Return type + +[**FileObject**](FileObject.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/xero_python/file/docs/Folder.md b/xero_python/file/docs/Folder.md new file mode 100644 index 00000000..348f9223 --- /dev/null +++ b/xero_python/file/docs/Folder.md @@ -0,0 +1,14 @@ +# Folder + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the folder | [optional] +**file_count** | **int** | The number of files in the folder | [optional] +**email** | **str** | The email address used to email files to the inbox. Only the inbox will have this element. | [optional] +**is_inbox** | **bool** | to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted. | [optional] +**id** | **str** | Xero unique identifier for a folder Files | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/Folders.md b/xero_python/file/docs/Folders.md new file mode 100644 index 00000000..f10efe98 --- /dev/null +++ b/xero_python/file/docs/Folders.md @@ -0,0 +1,10 @@ +# Folders + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**folders** | [**list[Folder]**](Folder.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/InlineObject.md b/xero_python/file/docs/InlineObject.md new file mode 100644 index 00000000..fea79105 --- /dev/null +++ b/xero_python/file/docs/InlineObject.md @@ -0,0 +1,13 @@ +# InlineObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**body** | **str** | | [optional] +**name** | **str** | exact name of the file you are uploading | [optional] +**filename** | **str** | | [optional] +**mime_type** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/ObjectGroup.md b/xero_python/file/docs/ObjectGroup.md new file mode 100644 index 00000000..23ed1cdf --- /dev/null +++ b/xero_python/file/docs/ObjectGroup.md @@ -0,0 +1,9 @@ +# ObjectGroup + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/ObjectType.md b/xero_python/file/docs/ObjectType.md new file mode 100644 index 00000000..a3b2718b --- /dev/null +++ b/xero_python/file/docs/ObjectType.md @@ -0,0 +1,9 @@ +# ObjectType + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/docs/User.md b/xero_python/file/docs/User.md new file mode 100644 index 00000000..61e79d78 --- /dev/null +++ b/xero_python/file/docs/User.md @@ -0,0 +1,14 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Xero identifier | +**name** | **str** | Key is Name, but returns Email address of user who created the file | [optional] +**first_name** | **str** | First name of user | [optional] +**last_name** | **str** | Last name of user | [optional] +**full_name** | **str** | Last name of user | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/xero_python/file/models/__init__.py b/xero_python/file/models/__init__.py new file mode 100644 index 00000000..9ecdd74f --- /dev/null +++ b/xero_python/file/models/__init__.py @@ -0,0 +1,23 @@ +# coding: utf-8 + +# flake8: noqa +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +# import models into model package +from xero_python.file.models.association import Association +from xero_python.file.models.file_object import FileObject +from xero_python.file.models.files import Files +from xero_python.file.models.folder import Folder +from xero_python.file.models.folders import Folders +from xero_python.file.models.inline_object import InlineObject +from xero_python.file.models.object_group import ObjectGroup +from xero_python.file.models.object_type import ObjectType +from xero_python.file.models.user import User diff --git a/xero_python/file/models/association.py b/xero_python/file/models/association.py new file mode 100644 index 00000000..2b568922 --- /dev/null +++ b/xero_python/file/models/association.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class Association(BaseModel): + """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 = { + "file_id": "str", + "object_id": "str", + "object_group": "ObjectGroup", + "object_type": "ObjectType", + } + + attribute_map = { + "file_id": "FileId", + "object_id": "ObjectId", + "object_group": "ObjectGroup", + "object_type": "ObjectType", + } + + def __init__( + self, file_id=None, object_id=None, object_group=None, object_type=None + ): # noqa: E501 + """Association - a model defined in OpenAPI""" # noqa: E501 + + self._file_id = None + self._object_id = None + self._object_group = None + self._object_type = None + self.discriminator = None + + if file_id is not None: + self.file_id = file_id + if object_id is not None: + self.object_id = object_id + if object_group is not None: + self.object_group = object_group + if object_type is not None: + self.object_type = object_type + + @property + def file_id(self): + """Gets the file_id of this Association. # noqa: E501 + + The unique identifier of the file # noqa: E501 + + :return: The file_id of this Association. # noqa: E501 + :rtype: str + """ + return self._file_id + + @file_id.setter + def file_id(self, file_id): + """Sets the file_id of this Association. + + The unique identifier of the file # noqa: E501 + + :param file_id: The file_id of this Association. # noqa: E501 + :type: str + """ + + self._file_id = file_id + + @property + def object_id(self): + """Gets the object_id of this Association. # noqa: E501 + + The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID) # noqa: E501 + + :return: The object_id of this Association. # noqa: E501 + :rtype: str + """ + return self._object_id + + @object_id.setter + def object_id(self, object_id): + """Sets the object_id of this Association. + + The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID) # noqa: E501 + + :param object_id: The object_id of this Association. # noqa: E501 + :type: str + """ + + self._object_id = object_id + + @property + def object_group(self): + """Gets the object_group of this Association. # noqa: E501 + + + :return: The object_group of this Association. # noqa: E501 + :rtype: ObjectGroup + """ + return self._object_group + + @object_group.setter + def object_group(self, object_group): + """Sets the object_group of this Association. + + + :param object_group: The object_group of this Association. # noqa: E501 + :type: ObjectGroup + """ + + self._object_group = object_group + + @property + def object_type(self): + """Gets the object_type of this Association. # noqa: E501 + + + :return: The object_type of this Association. # noqa: E501 + :rtype: ObjectType + """ + return self._object_type + + @object_type.setter + def object_type(self, object_type): + """Sets the object_type of this Association. + + + :param object_type: The object_type of this Association. # noqa: E501 + :type: ObjectType + """ + + self._object_type = object_type diff --git a/xero_python/file/models/file_object.py b/xero_python/file/models/file_object.py new file mode 100644 index 00000000..ca9ad17f --- /dev/null +++ b/xero_python/file/models/file_object.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class FileObject(BaseModel): + """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", + "mime_type": "str", + "size": "int", + "created_date_utc": "str", + "updated_date_utc": "str", + "user": "User", + "id": "str", + "folder_id": "str", + } + + attribute_map = { + "name": "Name", + "mime_type": "MimeType", + "size": "Size", + "created_date_utc": "CreatedDateUtc", + "updated_date_utc": "UpdatedDateUtc", + "user": "User", + "id": "Id", + "folder_id": "FolderId", + } + + def __init__( + self, + name=None, + mime_type=None, + size=None, + created_date_utc=None, + updated_date_utc=None, + user=None, + id=None, + folder_id=None, + ): # noqa: E501 + """FileObject - a model defined in OpenAPI""" # noqa: E501 + + self._name = None + self._mime_type = None + self._size = None + self._created_date_utc = None + self._updated_date_utc = None + self._user = None + self._id = None + self._folder_id = None + self.discriminator = None + + if name is not None: + self.name = name + if mime_type is not None: + self.mime_type = mime_type + if size is not None: + self.size = size + if created_date_utc is not None: + self.created_date_utc = created_date_utc + if updated_date_utc is not None: + self.updated_date_utc = updated_date_utc + if user is not None: + self.user = user + if id is not None: + self.id = id + if folder_id is not None: + self.folder_id = folder_id + + @property + def name(self): + """Gets the name of this FileObject. # noqa: E501 + + File Name # noqa: E501 + + :return: The name of this FileObject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this FileObject. + + File Name # noqa: E501 + + :param name: The name of this FileObject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def mime_type(self): + """Gets the mime_type of this FileObject. # noqa: E501 + + MimeType of the file (image/png, image/jpeg, application/pdf, etc..) # noqa: E501 + + :return: The mime_type of this FileObject. # noqa: E501 + :rtype: str + """ + return self._mime_type + + @mime_type.setter + def mime_type(self, mime_type): + """Sets the mime_type of this FileObject. + + MimeType of the file (image/png, image/jpeg, application/pdf, etc..) # noqa: E501 + + :param mime_type: The mime_type of this FileObject. # noqa: E501 + :type: str + """ + + self._mime_type = mime_type + + @property + def size(self): + """Gets the size of this FileObject. # noqa: E501 + + Numeric value in bytes # noqa: E501 + + :return: The size of this FileObject. # noqa: E501 + :rtype: int + """ + return self._size + + @size.setter + def size(self, size): + """Sets the size of this FileObject. + + Numeric value in bytes # noqa: E501 + + :param size: The size of this FileObject. # noqa: E501 + :type: int + """ + + self._size = size + + @property + def created_date_utc(self): + """Gets the created_date_utc of this FileObject. # noqa: E501 + + Created date in UTC # noqa: E501 + + :return: The created_date_utc of this FileObject. # noqa: E501 + :rtype: str + """ + return self._created_date_utc + + @created_date_utc.setter + def created_date_utc(self, created_date_utc): + """Sets the created_date_utc of this FileObject. + + Created date in UTC # noqa: E501 + + :param created_date_utc: The created_date_utc of this FileObject. # noqa: E501 + :type: str + """ + + self._created_date_utc = created_date_utc + + @property + def updated_date_utc(self): + """Gets the updated_date_utc of this FileObject. # noqa: E501 + + Updated date in UTC # noqa: E501 + + :return: The updated_date_utc of this FileObject. # noqa: E501 + :rtype: str + """ + return self._updated_date_utc + + @updated_date_utc.setter + def updated_date_utc(self, updated_date_utc): + """Sets the updated_date_utc of this FileObject. + + Updated date in UTC # noqa: E501 + + :param updated_date_utc: The updated_date_utc of this FileObject. # noqa: E501 + :type: str + """ + + self._updated_date_utc = updated_date_utc + + @property + def user(self): + """Gets the user of this FileObject. # noqa: E501 + + + :return: The user of this FileObject. # noqa: E501 + :rtype: User + """ + return self._user + + @user.setter + def user(self, user): + """Sets the user of this FileObject. + + + :param user: The user of this FileObject. # noqa: E501 + :type: User + """ + + self._user = user + + @property + def id(self): + """Gets the id of this FileObject. # noqa: E501 + + File object's UUID # noqa: E501 + + :return: The id of this FileObject. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this FileObject. + + File object's UUID # noqa: E501 + + :param id: The id of this FileObject. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def folder_id(self): + """Gets the folder_id of this FileObject. # noqa: E501 + + Folder relation object's UUID # noqa: E501 + + :return: The folder_id of this FileObject. # noqa: E501 + :rtype: str + """ + return self._folder_id + + @folder_id.setter + def folder_id(self, folder_id): + """Sets the folder_id of this FileObject. + + Folder relation object's UUID # noqa: E501 + + :param folder_id: The folder_id of this FileObject. # noqa: E501 + :type: str + """ + + self._folder_id = folder_id diff --git a/xero_python/file/models/files.py b/xero_python/file/models/files.py new file mode 100644 index 00000000..340d4b1c --- /dev/null +++ b/xero_python/file/models/files.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class Files(BaseModel): + """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 = { + "total_count": "int", + "page": "int", + "per_page": "int", + "items": "list[FileObject]", + } + + attribute_map = { + "total_count": "TotalCount", + "page": "Page", + "per_page": "PerPage", + "items": "Items", + } + + def __init__( + self, total_count=None, page=None, per_page=None, items=None + ): # noqa: E501 + """Files - a model defined in OpenAPI""" # noqa: E501 + + self._total_count = None + self._page = None + self._per_page = None + self._items = None + self.discriminator = None + + if total_count is not None: + self.total_count = total_count + if page is not None: + self.page = page + if per_page is not None: + self.per_page = per_page + if items is not None: + self.items = items + + @property + def total_count(self): + """Gets the total_count of this Files. # noqa: E501 + + + :return: The total_count of this Files. # noqa: E501 + :rtype: int + """ + return self._total_count + + @total_count.setter + def total_count(self, total_count): + """Sets the total_count of this Files. + + + :param total_count: The total_count of this Files. # noqa: E501 + :type: int + """ + + self._total_count = total_count + + @property + def page(self): + """Gets the page of this Files. # noqa: E501 + + + :return: The page of this Files. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this Files. + + + :param page: The page of this Files. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def per_page(self): + """Gets the per_page of this Files. # noqa: E501 + + + :return: The per_page of this Files. # noqa: E501 + :rtype: int + """ + return self._per_page + + @per_page.setter + def per_page(self, per_page): + """Sets the per_page of this Files. + + + :param per_page: The per_page of this Files. # noqa: E501 + :type: int + """ + + self._per_page = per_page + + @property + def items(self): + """Gets the items of this Files. # noqa: E501 + + + :return: The items of this Files. # noqa: E501 + :rtype: list[FileObject] + """ + return self._items + + @items.setter + def items(self, items): + """Sets the items of this Files. + + + :param items: The items of this Files. # noqa: E501 + :type: list[FileObject] + """ + + self._items = items diff --git a/xero_python/file/models/folder.py b/xero_python/file/models/folder.py new file mode 100644 index 00000000..41305080 --- /dev/null +++ b/xero_python/file/models/folder.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class Folder(BaseModel): + """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", + "file_count": "int", + "email": "str", + "is_inbox": "bool", + "id": "str", + } + + attribute_map = { + "name": "Name", + "file_count": "FileCount", + "email": "Email", + "is_inbox": "IsInbox", + "id": "Id", + } + + def __init__( + self, name=None, file_count=None, email=None, is_inbox=None, id=None + ): # noqa: E501 + """Folder - a model defined in OpenAPI""" # noqa: E501 + + self._name = None + self._file_count = None + self._email = None + self._is_inbox = None + self._id = None + self.discriminator = None + + if name is not None: + self.name = name + if file_count is not None: + self.file_count = file_count + if email is not None: + self.email = email + if is_inbox is not None: + self.is_inbox = is_inbox + if id is not None: + self.id = id + + @property + def name(self): + """Gets the name of this Folder. # noqa: E501 + + The name of the folder # noqa: E501 + + :return: The name of this Folder. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Folder. + + The name of the folder # noqa: E501 + + :param name: The name of this Folder. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def file_count(self): + """Gets the file_count of this Folder. # noqa: E501 + + The number of files in the folder # noqa: E501 + + :return: The file_count of this Folder. # noqa: E501 + :rtype: int + """ + return self._file_count + + @file_count.setter + def file_count(self, file_count): + """Sets the file_count of this Folder. + + The number of files in the folder # noqa: E501 + + :param file_count: The file_count of this Folder. # noqa: E501 + :type: int + """ + + self._file_count = file_count + + @property + def email(self): + """Gets the email of this Folder. # noqa: E501 + + The email address used to email files to the inbox. Only the inbox will have this element. # noqa: E501 + + :return: The email of this Folder. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Folder. + + The email address used to email files to the inbox. Only the inbox will have this element. # noqa: E501 + + :param email: The email of this Folder. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def is_inbox(self): + """Gets the is_inbox of this Folder. # noqa: E501 + + to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted. # noqa: E501 + + :return: The is_inbox of this Folder. # noqa: E501 + :rtype: bool + """ + return self._is_inbox + + @is_inbox.setter + def is_inbox(self, is_inbox): + """Sets the is_inbox of this Folder. + + to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted. # noqa: E501 + + :param is_inbox: The is_inbox of this Folder. # noqa: E501 + :type: bool + """ + + self._is_inbox = is_inbox + + @property + def id(self): + """Gets the id of this Folder. # noqa: E501 + + Xero unique identifier for a folder Files # noqa: E501 + + :return: The id of this Folder. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Folder. + + Xero unique identifier for a folder Files # noqa: E501 + + :param id: The id of this Folder. # noqa: E501 + :type: str + """ + + self._id = id diff --git a/xero_python/file/models/folders.py b/xero_python/file/models/folders.py new file mode 100644 index 00000000..3b3b1906 --- /dev/null +++ b/xero_python/file/models/folders.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class Folders(BaseModel): + """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 = {"folders": "list[Folder]"} + + attribute_map = {"folders": "Folders"} + + def __init__(self, folders=None): # noqa: E501 + """Folders - a model defined in OpenAPI""" # noqa: E501 + + self._folders = None + self.discriminator = None + + if folders is not None: + self.folders = folders + + @property + def folders(self): + """Gets the folders of this Folders. # noqa: E501 + + + :return: The folders of this Folders. # noqa: E501 + :rtype: list[Folder] + """ + return self._folders + + @folders.setter + def folders(self, folders): + """Sets the folders of this Folders. + + + :param folders: The folders of this Folders. # noqa: E501 + :type: list[Folder] + """ + + self._folders = folders diff --git a/xero_python/file/models/inline_object.py b/xero_python/file/models/inline_object.py new file mode 100644 index 00000000..f6c88743 --- /dev/null +++ b/xero_python/file/models/inline_object.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class InlineObject(BaseModel): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + "body": "str", + "name": "str", + "filename": "str", + "mime_type": "str", + } + + attribute_map = { + "body": "body", + "name": "name", + "filename": "filename", + "mime_type": "mimeType", + } + + def __init__( + self, body=None, name=None, filename=None, mime_type=None + ): # noqa: E501 + """InlineObject - a model defined in OpenAPI""" # noqa: E501 + + self._body = None + self._name = None + self._filename = None + self._mime_type = None + self.discriminator = None + + if body is not None: + self.body = body + if name is not None: + self.name = name + if filename is not None: + self.filename = filename + if mime_type is not None: + self.mime_type = mime_type + + @property + def body(self): + """Gets the body of this InlineObject. # noqa: E501 + + + :return: The body of this InlineObject. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this InlineObject. + + + :param body: The body of this InlineObject. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def name(self): + """Gets the name of this InlineObject. # noqa: E501 + + exact name of the file you are uploading # noqa: E501 + + :return: The name of this InlineObject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this InlineObject. + + exact name of the file you are uploading # noqa: E501 + + :param name: The name of this InlineObject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def filename(self): + """Gets the filename of this InlineObject. # noqa: E501 + + + :return: The filename of this InlineObject. # noqa: E501 + :rtype: str + """ + return self._filename + + @filename.setter + def filename(self, filename): + """Sets the filename of this InlineObject. + + + :param filename: The filename of this InlineObject. # noqa: E501 + :type: str + """ + + self._filename = filename + + @property + def mime_type(self): + """Gets the mime_type of this InlineObject. # noqa: E501 + + + :return: The mime_type of this InlineObject. # noqa: E501 + :rtype: str + """ + return self._mime_type + + @mime_type.setter + def mime_type(self, mime_type): + """Sets the mime_type of this InlineObject. + + + :param mime_type: The mime_type of this InlineObject. # noqa: E501 + :type: str + """ + + self._mime_type = mime_type diff --git a/xero_python/file/models/object_group.py b/xero_python/file/models/object_group.py new file mode 100644 index 00000000..f8da4ff4 --- /dev/null +++ b/xero_python/file/models/object_group.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from enum import Enum + + +class ObjectGroup(Enum): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + allowed enum values + """ + + ACCOUNT = "Account" + BANKTRANSACTION = "BankTransaction" + CONTACT = "Contact" + CREDITNOTE = "CreditNote" + INVOICE = "Invoice" + ITEM = "Item" + MANUALJOURNAL = "ManualJournal" + OVERPAYMENT = "Overpayment" + PAYMENT = "Payment" + PREPAYMENT = "Prepayment" + RECEIPT = "Receipt" diff --git a/xero_python/file/models/object_type.py b/xero_python/file/models/object_type.py new file mode 100644 index 00000000..bf6bebd3 --- /dev/null +++ b/xero_python/file/models/object_type.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from enum import Enum + + +class ObjectType(Enum): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + allowed enum values + """ + + UNKNOWN = "Unknown" + ACCPAY = "Accpay" + ACCPAYCREDIT = "AccPayCredit" + ACCPAYPAYMENT = "AccPayPayment" + ACCREC = "AccRec" + ACCRECCREDIT = "AccRecCredit" + ACCRECPAYMENT = "AccRecPayment" + ADJUSTMENT = "Adjustment" + APCREDITPAYMENT = "ApCreditPayment" + APOVERPAYMENT = "ApOverPayment" + APOVERPAYMENTPAYMENT = "ApOverPaymentPayment" + APOVERPAYMENTSOURCEPAYMENT = "ApOverPaymentSourcePayment" + APPREPAYMENT = "ApPrepayment" + APPREPAYMENTPAYMENT = "ApPrepaymentPayment" + APPREPAYMENTSOURCEPAYMENT = "ApPrepaymentSourcePayment" + ARCREDITPAYMENT = "ArCreditPayment" + AROVERPAYMENT = "ArOverPayment" + AROVERPAYMENTPAYMENT = "ArOverpaymentPayment" + AROVERPAYMENTSOURCEPAYMENT = "ArOverpaymentSourcePayment" + ARPREPAYMENT = "ArPrepayment" + ARPREPAYMENTPAYMENT = "ArPrepaymentPayment" + ARPREPAYMENTSOURCEPAYMENT = "ArPrepaymentSourcePayment" + CASHPAID = "CashPaid" + CASHREC = "CashRec" + EXPPAYMENT = "ExpPayment" + MANJOURNAL = "ManJournal" + PURCHASEORDER = "PurchaseOrder" + RECEIPT = "Receipt" + TRANSFER = "Transfer" + ACCOUNT = "Account" + CONTACT = "Contact" + BUSINESS = "Business" + EMPLOYEE = "Employee" + PERSON = "Person" + USER = "User" + ORG = "Org" + FIXEDASSET = "FixedAsset" + PAYRUN = "PayRun" + PRICELISTITEM = "PriceListItem" + BANK = "Bank" + CURRENT = "Current" + EQUITY = "Equity" + EXPENSE = "Expense" + FIXED = "Fixed" + LIABILITY = "Liability" + PREPAYMENT = "Prepayment" + REVENUE = "Revenue" + SALES = "Sales" + OVERHEADS = "Overheads" + DEPRECIATN = "Depreciatn" + OTHERINCOME = "OtherIncome" + DIRECTCOSTS = "DirectCosts" + CURRLIAB = "Currliab" + TERMLIAB = "Termliab" + NONCURRENT = "NonCurrent" diff --git a/xero_python/file/models/user.py b/xero_python/file/models/user.py new file mode 100644 index 00000000..12715566 --- /dev/null +++ b/xero_python/file/models/user.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + Xero Files API + + These endpoints are specific to Xero Files API # noqa: E501 + + Contact: api@xero.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 + +from xero_python.models import BaseModel + + +class User(BaseModel): + """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", + "first_name": "str", + "last_name": "str", + "full_name": "str", + } + + attribute_map = { + "id": "Id", + "name": "Name", + "first_name": "FirstName", + "last_name": "LastName", + "full_name": "FullName", + } + + def __init__( + self, id=None, name=None, first_name=None, last_name=None, full_name=None + ): # noqa: E501 + """User - a model defined in OpenAPI""" # noqa: E501 + + self._id = None + self._name = None + self._first_name = None + self._last_name = None + self._full_name = None + self.discriminator = None + + self.id = id + if name is not None: + self.name = name + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if full_name is not None: + self.full_name = full_name + + @property + def id(self): + """Gets the id of this User. # noqa: E501 + + Xero identifier # noqa: E501 + + :return: The id of this User. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + Xero identifier # noqa: E501 + + :param id: The id of this User. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this User. # noqa: E501 + + Key is Name, but returns Email address of user who created the file # noqa: E501 + + :return: The name of this User. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this User. + + Key is Name, but returns Email address of user who created the file # noqa: E501 + + :param name: The name of this User. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def first_name(self): + """Gets the first_name of this User. # noqa: E501 + + First name of user # noqa: E501 + + :return: The first_name of this User. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + First name of user # noqa: E501 + + :param first_name: The first_name of this User. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. # noqa: E501 + + Last name of user # noqa: E501 + + :return: The last_name of this User. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + Last name of user # noqa: E501 + + :param last_name: The last_name of this User. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def full_name(self): + """Gets the full_name of this User. # noqa: E501 + + Last name of user # noqa: E501 + + :return: The full_name of this User. # noqa: E501 + :rtype: str + """ + return self._full_name + + @full_name.setter + def full_name(self, full_name): + """Sets the full_name of this User. + + Last name of user # noqa: E501 + + :param full_name: The full_name of this User. # noqa: E501 + :type: str + """ + + self._full_name = full_name diff --git a/xero_python/identity/api/identity_api.py b/xero_python/identity/api/identity_api.py index 018bdfb2..0879f5e2 100644 --- a/xero_python/identity/api/identity_api.py +++ b/xero_python/identity/api/identity_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib diff --git a/xero_python/identity/docs/AccessToken.md b/xero_python/identity/docs/AccessToken.md index b4bed3cf..1a4e8ea0 100644 --- a/xero_python/identity/docs/AccessToken.md +++ b/xero_python/identity/docs/AccessToken.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id_token** | **str** | Xero unique identifier | [optional] **access_token** | **str** | access token provided during authentication flow | [optional] -**expires_in** | **float** | time in milliseconds until access token expires. | [optional] +**expires_in** | **int** | time in seconds until access token expires. | [optional] **token_type** | **str** | type of token i.e. Bearer | [optional] **refresh_token** | **str** | token used to refresh an expired access token | [optional] diff --git a/xero_python/identity/models/access_token.py b/xero_python/identity/models/access_token.py index e2395ff5..2c86aaaa 100644 --- a/xero_python/identity/models/access_token.py +++ b/xero_python/identity/models/access_token.py @@ -32,7 +32,7 @@ class AccessToken(BaseModel): openapi_types = { "id_token": "str", "access_token": "str", - "expires_in": "float", + "expires_in": "int", "token_type": "str", "refresh_token": "str", } @@ -123,10 +123,10 @@ def access_token(self, access_token): def expires_in(self): """Gets the expires_in of this AccessToken. # noqa: E501 - time in milliseconds until access token expires. # noqa: E501 + time in seconds until access token expires. # noqa: E501 :return: The expires_in of this AccessToken. # noqa: E501 - :rtype: float + :rtype: int """ return self._expires_in @@ -134,10 +134,10 @@ def expires_in(self): def expires_in(self, expires_in): """Sets the expires_in of this AccessToken. - time in milliseconds until access token expires. # noqa: E501 + time in seconds until access token expires. # noqa: E501 :param expires_in: The expires_in of this AccessToken. # noqa: E501 - :type: float + :type: int """ self._expires_in = expires_in diff --git a/xero_python/payrollau/api/payroll_au_api.py b/xero_python/payrollau/api/payroll_au_api.py index 87129a2b..0d58c9bd 100644 --- a/xero_python/payrollau/api/payroll_au_api.py +++ b/xero_python/payrollau/api/payroll_au_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib diff --git a/xero_python/payrollnz/api/payroll_nz_api.py b/xero_python/payrollnz/api/payroll_nz_api.py index b7809b7f..d71e8b08 100644 --- a/xero_python/payrollnz/api/payroll_nz_api.py +++ b/xero_python/payrollnz/api/payroll_nz_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib diff --git a/xero_python/payrolluk/api/payroll_uk_api.py b/xero_python/payrolluk/api/payroll_uk_api.py index fe4edb83..d40ae3b9 100644 --- a/xero_python/payrolluk/api/payroll_uk_api.py +++ b/xero_python/payrolluk/api/payroll_uk_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib @@ -3779,8 +3779,7 @@ def get_employee_tax( def get_employees( self, xero_tenant_id, - first_name=empty, - last_name=empty, + filter=empty, page=empty, _return_http_data_only=True, _preload_content=True, @@ -3789,8 +3788,7 @@ def get_employees( """Retrieves employees # noqa: E501 OAuth2 scope: payroll.employees.read :param str xero_tenant_id: Xero identifier for Tenant (required) - :param str first_name: Filter by first name - :param str last_name: Filter by last name + :param str filter: Filter by first name and/or lastname :param int page: Page number which specifies the set of records to retrieve. By default the number of the records per set is 100. :param bool _return_http_data_only: return received data only :param bool _preload_content: load received data in models @@ -3810,11 +3808,8 @@ def get_employees( query_params = [] - if first_name is not empty: - query_params.append(("firstName", first_name)) - - if last_name is not empty: - query_params.append(("lastName", last_name)) + if filter is not empty: + query_params.append(("filter", filter)) if page is not empty: query_params.append(("page", page)) @@ -4839,8 +4834,7 @@ def get_timesheets( self, xero_tenant_id, page=empty, - employee_id=empty, - payroll_calendar_id=empty, + filter=empty, _return_http_data_only=True, _preload_content=True, _request_timeout=None, @@ -4849,8 +4843,7 @@ def get_timesheets( OAuth2 scope: payroll.timesheets.read, payroll.timesheets :param str xero_tenant_id: Xero identifier for Tenant (required) :param int page: Page number which specifies the set of records to retrieve. By default the number of the records per set is 100. - :param str employee_id: By default get Timesheets will return the timesheets for all employees in an organization. You can add GET https://…/timesheets?filter=employeeId=={EmployeeID} to get only the timesheets of a particular employee. - :param str payroll_calendar_id: By default get Timesheets will return all the timesheets for an organization. You can add GET https://…/timesheets?filter=payrollCalendarId=={PayrollCalendarID} to filter the timesheets by payroll calendar id + :param str filter: Filter by first name and/or lastname :param bool _return_http_data_only: return received data only :param bool _preload_content: load received data in models :param bool _request_timeout: maximum wait time for response @@ -4872,11 +4865,8 @@ def get_timesheets( if page is not empty: query_params.append(("page", page)) - if employee_id is not empty: - query_params.append(("employeeId", employee_id)) - - if payroll_calendar_id is not empty: - query_params.append(("payrollCalendarId", payroll_calendar_id)) + if filter is not empty: + query_params.append(("filter", filter)) header_params = { "Xero-Tenant-Id": xero_tenant_id, diff --git a/xero_python/payrolluk/docs/PayrollUkApi.md b/xero_python/payrolluk/docs/PayrollUkApi.md index 88f13116..2a9c03bc 100644 --- a/xero_python/payrolluk/docs/PayrollUkApi.md +++ b/xero_python/payrolluk/docs/PayrollUkApi.md @@ -3013,7 +3013,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_employees** -> Employees get_employees(xero_tenant_id, first_name=first_name, last_name=last_name, page=page) +> Employees get_employees(xero_tenant_id, filter=filter, page=page) Retrieves employees @@ -3044,12 +3044,11 @@ api_client = ApiClient( api_instance = PayrollUkApi(api_client) xero_tenant_id = 'xero_tenant_id_example' # str | Xero identifier for Tenant -first_name = 'John' # str | Filter by first name (optional) -last_name = 'Johnson' # str | Filter by last name (optional) +filter = 'firstName==John,lastName==Smith' # str | Filter by first name and/or lastname (optional) page = 56 # int | Page number which specifies the set of records to retrieve. By default the number of the records per set is 100. (optional) try: # Retrieves employees - api_response = api_instance.get_employees(xero_tenant_id, first_name=first_name, last_name=last_name, page=page) + api_response = api_instance.get_employees(xero_tenant_id, filter=filter, page=page) pprint(api_response) except ApiException as e: print("Exception when calling PayrollUkApi->get_employees: %s\n" % e) @@ -3060,8 +3059,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **xero_tenant_id** | **str**| Xero identifier for Tenant | - **first_name** | **str**| Filter by first name | [optional] - **last_name** | **str**| Filter by last name | [optional] + **filter** | **str**| Filter by first name and/or lastname | [optional] **page** | **int**| Page number which specifies the set of records to retrieve. By default the number of the records per set is 100. | [optional] ### Return type @@ -3905,7 +3903,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_timesheets** -> Timesheets get_timesheets(xero_tenant_id, page=page, employee_id=employee_id, payroll_calendar_id=payroll_calendar_id) +> Timesheets get_timesheets(xero_tenant_id, page=page, filter=filter) Retrieves timesheets @@ -3937,11 +3935,10 @@ api_instance = PayrollUkApi(api_client) xero_tenant_id = 'xero_tenant_id_example' # str | Xero identifier for Tenant page = 56 # int | Page number which specifies the set of records to retrieve. By default the number of the records per set is 100. (optional) -employee_id = 'employee_id_example' # str | By default get Timesheets will return the timesheets for all employees in an organization. You can add GET https://…/timesheets?filter=employeeId=={EmployeeID} to get only the timesheets of a particular employee. (optional) -payroll_calendar_id = 'payroll_calendar_id_example' # str | By default get Timesheets will return all the timesheets for an organization. You can add GET https://…/timesheets?filter=payrollCalendarId=={PayrollCalendarID} to filter the timesheets by payroll calendar id (optional) +filter = 'employeeId==00000000-0000-0000-0000-000000000000,payrollCalendarId==00000000-0000-0000-0000-000000000000' # str | Filter by first name and/or lastname (optional) try: # Retrieves timesheets - api_response = api_instance.get_timesheets(xero_tenant_id, page=page, employee_id=employee_id, payroll_calendar_id=payroll_calendar_id) + api_response = api_instance.get_timesheets(xero_tenant_id, page=page, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling PayrollUkApi->get_timesheets: %s\n" % e) @@ -3953,8 +3950,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **xero_tenant_id** | **str**| Xero identifier for Tenant | **page** | **int**| Page number which specifies the set of records to retrieve. By default the number of the records per set is 100. | [optional] - **employee_id** | [**str**](.md)| By default get Timesheets will return the timesheets for all employees in an organization. You can add GET https://…/timesheets?filter=employeeId=={EmployeeID} to get only the timesheets of a particular employee. | [optional] - **payroll_calendar_id** | [**str**](.md)| By default get Timesheets will return all the timesheets for an organization. You can add GET https://…/timesheets?filter=payrollCalendarId=={PayrollCalendarID} to filter the timesheets by payroll calendar id | [optional] + **filter** | **str**| Filter by first name and/or lastname | [optional] ### Return type diff --git a/xero_python/payrolluk/models/earnings_rate.py b/xero_python/payrolluk/models/earnings_rate.py index 1722e011..e1bd3f43 100644 --- a/xero_python/payrolluk/models/earnings_rate.py +++ b/xero_python/payrolluk/models/earnings_rate.py @@ -182,10 +182,17 @@ def earnings_type(self, earnings_type): "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", + "StatutoryAdoptionPayNonPensionable", + "StatutoryBereavementPay", "StatutoryMaternityPay", + "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", + "StatutoryPaternityPayNonPensionable", + "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", + "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", + "StatutorySickPayNonPensionable", "Tips(Direct)", "Tips(Non-Direct)", "None", diff --git a/xero_python/project/api/project_api.py b/xero_python/project/api/project_api.py index bc3a4cfd..5414be4f 100644 --- a/xero_python/project/api/project_api.py +++ b/xero_python/project/api/project_api.py @@ -10,7 +10,7 @@ """ """ - OpenAPI spec version: 2.9.3 + OpenAPI spec version: 2.10.1 """ import importlib diff --git a/xero_python/rest.py b/xero_python/rest.py index e87fe089..6bcf709b 100644 --- a/xero_python/rest.py +++ b/xero_python/rest.py @@ -139,11 +139,6 @@ def request( method = method.upper() assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] - if post_params and body: - raise ValueError( - "body parameter cannot be used with post_params parameter." - ) - post_params = post_params or {} headers = headers or {} @@ -194,11 +189,16 @@ def request( # Content-Type which generated by urllib3 will be # overwritten. del headers["Content-Type"] + boundary = "-----boundary" + headers["Content-Type"] = "multipart/form-data; boundary={}".format( + boundary + ) + fields = {post_params[2][1]: (post_params[1][1], body, None)} r = self.pool_manager.request( method, url, - fields=post_params, - encode_multipart=True, + fields=fields, + multipart_boundary=boundary, preload_content=_preload_content, timeout=timeout, headers=headers,