Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.0.13",
version="1.1.0",
)
2 changes: 1 addition & 1 deletion xero_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """Xero Developer API"""
__email__ = "api@xero.com"
__version__ = "1.0.13"
__version__ = "1.1.0"
12 changes: 11 additions & 1 deletion xero_python/accounting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501

OpenAPI spec version: 2.4.0
OpenAPI spec version: 2.4.4
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand All @@ -30,6 +30,7 @@
from xero_python.accounting.models.allocations import Allocations
from xero_python.accounting.models.attachment import Attachment
from xero_python.accounting.models.attachments import Attachments
from xero_python.accounting.models.balance_details import BalanceDetails
from xero_python.accounting.models.balances import Balances
from xero_python.accounting.models.bank_transaction import BankTransaction
from xero_python.accounting.models.bank_transactions import BankTransactions
Expand All @@ -49,6 +50,8 @@
from xero_python.accounting.models.contact_groups import ContactGroups
from xero_python.accounting.models.contact_person import ContactPerson
from xero_python.accounting.models.contacts import Contacts
from xero_python.accounting.models.conversion_balances import ConversionBalances
from xero_python.accounting.models.conversion_date import ConversionDate
from xero_python.accounting.models.country_code import CountryCode
from xero_python.accounting.models.credit_note import CreditNote
from xero_python.accounting.models.credit_notes import CreditNotes
Expand All @@ -64,6 +67,12 @@
from xero_python.accounting.models.external_link import ExternalLink
from xero_python.accounting.models.history_record import HistoryRecord
from xero_python.accounting.models.history_records import HistoryRecords
from xero_python.accounting.models.import_summary import ImportSummary
from xero_python.accounting.models.import_summary_accounts import ImportSummaryAccounts
from xero_python.accounting.models.import_summary_object import ImportSummaryObject
from xero_python.accounting.models.import_summary_organisation import (
ImportSummaryOrganisation,
)
from xero_python.accounting.models.invoice import Invoice
from xero_python.accounting.models.invoice_reminder import InvoiceReminder
from xero_python.accounting.models.invoice_reminders import InvoiceReminders
Expand Down Expand Up @@ -121,6 +130,7 @@
from xero_python.accounting.models.row_type import RowType
from xero_python.accounting.models.sales_tracking_category import SalesTrackingCategory
from xero_python.accounting.models.schedule import Schedule
from xero_python.accounting.models.setup import Setup
from xero_python.accounting.models.tax_component import TaxComponent
from xero_python.accounting.models.tax_rate import TaxRate
from xero_python.accounting.models.tax_rates import TaxRates
Expand Down
80 changes: 79 additions & 1 deletion xero_python/accounting/api/accounting_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501

OpenAPI spec version: 2.4.0
OpenAPI spec version: 2.4.4
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down Expand Up @@ -15909,6 +15909,84 @@ def get_users(
except exceptions.HTTPStatusException as error:
raise translate_status_exception(error, self, "get_users")

def post_setup(
self,
xero_tenant_id,
setup,
_return_http_data_only=True,
_preload_content=True,
_request_timeout=None,
):
"""Allows you to set the chart of accounts, the conversion date and conversion balances # noqa: E501
OAuth2 scope: accounting.settings
:param str xero_tenant_id: Xero identifier for Tenant (required)
:param Setup setup: Object including an accounts array, a conversion balances array and a conversion date object in body of request (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: ImportSummaryObject
"""

# 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 `post_setup`"
)
# verify the required parameter 'setup' is set
if setup is None:
raise ValueError(
"Missing the required parameter `setup` " "when calling `post_setup`"
)

collection_formats = {}
path_params = {}

query_params = []

header_params = {
"xero-tenant-id": xero_tenant_id,
}

local_var_files = {}
form_params = []

body_params = setup
# 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("/Setup")

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="ImportSummaryObject",
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, "post_setup")

def update_account(
self,
xero_tenant_id,
Expand Down
64 changes: 64 additions & 0 deletions xero_python/accounting/docs/AccountingApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ Method | HTTP request | Description
[**get_tracking_category**](AccountingApi.md#get_tracking_category) | **GET** /TrackingCategories/{TrackingCategoryID} | Allows you to retrieve tracking categories and options for specified category
[**get_user**](AccountingApi.md#get_user) | **GET** /Users/{UserID} | Allows you to retrieve a specified user
[**get_users**](AccountingApi.md#get_users) | **GET** /Users | Allows you to retrieve users
[**post_setup**](AccountingApi.md#post_setup) | **POST** /Setup | Allows you to set the chart of accounts, the conversion date and conversion balances
[**update_account**](AccountingApi.md#update_account) | **POST** /Accounts/{AccountID} | Allows you to update a chart of accounts
[**update_account_attachment_by_file_name**](AccountingApi.md#update_account_attachment_by_file_name) | **POST** /Accounts/{AccountID}/Attachments/{FileName} | Allows you to update Attachment on Account by Filename
[**update_bank_transaction**](AccountingApi.md#update_bank_transaction) | **POST** /BankTransactions/{BankTransactionID} | Allows you to update a single spend or receive money transaction
Expand Down Expand Up @@ -12441,6 +12442,69 @@ 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)

# **post_setup**
> ImportSummaryObject post_setup(xero_tenant_id, setup)

Allows you to set the chart of accounts, the conversion date and conversion balances

### 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.accounting import AccountingApi
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 = AccountingApi(api_client)

xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant
setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] } # Setup | Object including an accounts array, a conversion balances array and a conversion date object in body of request
try:
# Allows you to set the chart of accounts, the conversion date and conversion balances
api_response = api_instance.post_setup(xero_tenant_id, setup)
pprint(api_response)
except ApiException as e:
print("Exception when calling AccountingApi->post_setup: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xero_tenant_id** | **str**| Xero identifier for Tenant |
**setup** | [**Setup**](Setup.md)| Object including an accounts array, a conversion balances array and a conversion date object in body of request |

### Return type

[**ImportSummaryObject**](ImportSummaryObject.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_account**
> Accounts update_account(xero_tenant_id, account_id, accounts)

Expand Down
12 changes: 12 additions & 0 deletions xero_python/accounting/docs/BalanceDetails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# BalanceDetails

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**balance** | **float** | The opening balances of the account. Debits are positive, credits are negative values | [optional]
**currency_code** | **str** | The currency of the balance (Not required for base currency) | [optional]
**currency_rate** | **float** | (Optional) Exchange rate to base currency when money is spent or received. If not specified, XE rate for the day is applied | [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)


12 changes: 12 additions & 0 deletions xero_python/accounting/docs/ConversionBalances.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ConversionBalances

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**account_code** | **str** | The account code for a account | [optional]
**balance** | **float** | The opening balances of the account. Debits are positive, credits are negative values | [optional]
**balance_details** | [**list[BalanceDetails]**](BalanceDetails.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)


11 changes: 11 additions & 0 deletions xero_python/accounting/docs/ConversionDate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ConversionDate

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**month** | **int** | The month the organisation starts using Xero. Value is an integer between 1 and 12 | [optional]
**year** | **int** | The year the organisation starts using Xero. Value is an integer greater than 2006 | [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)


11 changes: 11 additions & 0 deletions xero_python/accounting/docs/ImportSummary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ImportSummary

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**accounts** | [**ImportSummaryAccounts**](ImportSummaryAccounts.md) | | [optional]
**organisation** | [**ImportSummaryOrganisation**](ImportSummaryOrganisation.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)


18 changes: 18 additions & 0 deletions xero_python/accounting/docs/ImportSummaryAccounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ImportSummaryAccounts

## 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]
**present** | **bool** | | [optional]
**new_or_updated** | **float** | 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)


10 changes: 10 additions & 0 deletions xero_python/accounting/docs/ImportSummaryObject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ImportSummaryObject

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**import_summary** | [**ImportSummary**](ImportSummary.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)


10 changes: 10 additions & 0 deletions xero_python/accounting/docs/ImportSummaryOrganisation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ImportSummaryOrganisation

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**present** | **bool** | | [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)


12 changes: 12 additions & 0 deletions xero_python/accounting/docs/Setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Setup

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**conversion_date** | [**ConversionDate**](ConversionDate.md) | | [optional]
**conversion_balances** | [**list[ConversionBalances]**](ConversionBalances.md) | Balance supplied for each account that has a value as at the conversion date. | [optional]
**accounts** | [**list[Account]**](Account.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)


12 changes: 11 additions & 1 deletion xero_python/accounting/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501

OpenAPI spec version: 2.4.0
OpenAPI spec version: 2.4.4
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand All @@ -25,6 +25,7 @@
from xero_python.accounting.models.allocations import Allocations
from xero_python.accounting.models.attachment import Attachment
from xero_python.accounting.models.attachments import Attachments
from xero_python.accounting.models.balance_details import BalanceDetails
from xero_python.accounting.models.balances import Balances
from xero_python.accounting.models.bank_transaction import BankTransaction
from xero_python.accounting.models.bank_transactions import BankTransactions
Expand All @@ -44,6 +45,8 @@
from xero_python.accounting.models.contact_groups import ContactGroups
from xero_python.accounting.models.contact_person import ContactPerson
from xero_python.accounting.models.contacts import Contacts
from xero_python.accounting.models.conversion_balances import ConversionBalances
from xero_python.accounting.models.conversion_date import ConversionDate
from xero_python.accounting.models.country_code import CountryCode
from xero_python.accounting.models.credit_note import CreditNote
from xero_python.accounting.models.credit_notes import CreditNotes
Expand All @@ -59,6 +62,12 @@
from xero_python.accounting.models.external_link import ExternalLink
from xero_python.accounting.models.history_record import HistoryRecord
from xero_python.accounting.models.history_records import HistoryRecords
from xero_python.accounting.models.import_summary import ImportSummary
from xero_python.accounting.models.import_summary_accounts import ImportSummaryAccounts
from xero_python.accounting.models.import_summary_object import ImportSummaryObject
from xero_python.accounting.models.import_summary_organisation import (
ImportSummaryOrganisation,
)
from xero_python.accounting.models.invoice import Invoice
from xero_python.accounting.models.invoice_reminder import InvoiceReminder
from xero_python.accounting.models.invoice_reminders import InvoiceReminders
Expand Down Expand Up @@ -116,6 +125,7 @@
from xero_python.accounting.models.row_type import RowType
from xero_python.accounting.models.sales_tracking_category import SalesTrackingCategory
from xero_python.accounting.models.schedule import Schedule
from xero_python.accounting.models.setup import Setup
from xero_python.accounting.models.tax_component import TaxComponent
from xero_python.accounting.models.tax_rate import TaxRate
from xero_python.accounting.models.tax_rates import TaxRates
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501

OpenAPI spec version: 2.4.0
OpenAPI spec version: 2.4.4
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
Loading