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.12",
version="1.0.13",
)
17 changes: 17 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,23 @@ def oauth2_token(
"token_type": "Bearer",
}

@pytest.fixture()
def oauth2_token_without_id_token(
xero_access_token,
xero_refresh_token,
xero_scope,
xero_expires_in,
xero_expires_at,
):
return {
"access_token": xero_access_token,
"expires_at": xero_expires_at,
"expires_in": xero_expires_in,
"refresh_token": xero_refresh_token,
"scope": xero_scope,
"token_type": "Bearer",
}


@pytest.fixture()
def oauth2_refresh_token(oauth2_token, xero_refresh_token):
Expand Down
16 changes: 16 additions & 0 deletions tests/test_api_client/test_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,22 @@ def test_auth2_call_refresh_token_api(oauth2_refresh_token):
assert call_kwargs == {}
assert new_token is token

def test_auth2_call_refresh_token_api_without_id_token(oauth2_token_without_id_token):
# Given valid refresh token and client credentials without using OpenID scope (id_token absent)
oauth2_token = OAuth2Token()
oauth2_token.update_token(**oauth2_token_without_id_token)
token = {}
token_api = FakeClass()
token_api.refresh_token = FakeMethod(return_value=token)
# When refresh token API endpoint called
new_token = oauth2_token.call_refresh_token_api(token_api)
# Then new oauth2 token received
assert len(token_api.refresh_token.calls) == 1
call_args, call_kwargs = token_api.refresh_token.calls[0]
assert call_args == (oauth2_token.refresh_token, oauth2_token.scope)
assert call_kwargs == {}
assert new_token is token


def test_token_api_refresh_token(
xero_client_id, xero_client_secret, xero_scope, vcr, vcr_cassette_name
Expand Down
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.12"
__version__ = "1.0.13"
4 changes: 3 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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand All @@ -23,6 +23,8 @@
from xero_python.accounting.models.accounts import Accounts
from xero_python.accounting.models.accounts_payable import AccountsPayable
from xero_python.accounting.models.accounts_receivable import AccountsReceivable
from xero_python.accounting.models.action import Action
from xero_python.accounting.models.actions import Actions
from xero_python.accounting.models.address import Address
from xero_python.accounting.models.allocation import Allocation
from xero_python.accounting.models.allocations import Allocations
Expand Down
281 changes: 257 additions & 24 deletions xero_python/accounting/api/accounting_api.py

Large diffs are not rendered by default.

414 changes: 303 additions & 111 deletions xero_python/accounting/docs/AccountingApi.md

Large diffs are not rendered by default.

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | Name of the actions for this organisation | [optional]
**status** | **str** | Status of the action for this organisation | [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/Actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Actions

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


2 changes: 1 addition & 1 deletion xero_python/accounting/docs/ExpenseClaim.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Name | Type | Description | Notes
**amount_paid** | **float** | The amount still to pay for an expense claim | [optional]
**payment_due_date** | **date** | The date when the expense claim is due to be paid YYYY-MM-DD | [optional]
**reporting_date** | **date** | The date the expense claim will be reported in Xero YYYY-MM-DD | [optional]
**receipt_id** | **str** | The Xero identifier for the Receipt e.g. e59a2c7f-1306-4078-a0f3-73537afcbba9 | [optional]
**receipt_id** | **str** | The Xero identifier for the Receipt e.g. e59a2c7f-1306-4078-a0f3-73537afcbba9 | [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)

Expand Down
4 changes: 3 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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand All @@ -18,6 +18,8 @@
from xero_python.accounting.models.accounts import Accounts
from xero_python.accounting.models.accounts_payable import AccountsPayable
from xero_python.accounting.models.accounts_receivable import AccountsReceivable
from xero_python.accounting.models.action import Action
from xero_python.accounting.models.actions import Actions
from xero_python.accounting.models.address import Address
from xero_python.accounting.models.allocation import Allocation
from xero_python.accounting.models.allocations import Allocations
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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/account_type.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/accounts.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/accounts_payable.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/accounts_receivable.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
100 changes: 100 additions & 0 deletions xero_python/accounting/models/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# coding: utf-8

"""
Accounting API

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

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


import re # noqa: F401

from xero_python.models import BaseModel


class Action(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", "status": "str"}

attribute_map = {"name": "Name", "status": "Status"}

def __init__(self, name=None, status=None): # noqa: E501
"""Action - a model defined in OpenAPI""" # noqa: E501

self._name = None
self._status = None
self.discriminator = None

if name is not None:
self.name = name
if status is not None:
self.status = status

@property
def name(self):
"""Gets the name of this Action. # noqa: E501

Name of the actions for this organisation # noqa: E501

:return: The name of this Action. # noqa: E501
:rtype: str
"""
return self._name

@name.setter
def name(self, name):
"""Sets the name of this Action.

Name of the actions for this organisation # noqa: E501

:param name: The name of this Action. # noqa: E501
:type: str
"""

self._name = name

@property
def status(self):
"""Gets the status of this Action. # noqa: E501

Status of the action for this organisation # noqa: E501

:return: The status of this Action. # noqa: E501
:rtype: str
"""
return self._status

@status.setter
def status(self, status):
"""Sets the status of this Action.

Status of the action for this organisation # noqa: E501

:param status: The status of this Action. # noqa: E501
:type: str
"""
allowed_values = ["ALLOWED", "NOT-ALLOWED", "None"] # noqa: E501
if status not in allowed_values:
raise ValueError(
"Invalid value for `status` ({0}), must be one of {1}".format( # noqa: E501
status, allowed_values
)
)

self._status = status
65 changes: 65 additions & 0 deletions xero_python/accounting/models/actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# coding: utf-8

"""
Accounting API

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

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


import re # noqa: F401

from xero_python.models import BaseModel


class Actions(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 = {"actions": "list[Action]"}

attribute_map = {"actions": "Actions"}

def __init__(self, actions=None): # noqa: E501
"""Actions - a model defined in OpenAPI""" # noqa: E501

self._actions = None
self.discriminator = None

if actions is not None:
self.actions = actions

@property
def actions(self):
"""Gets the actions of this Actions. # noqa: E501


:return: The actions of this Actions. # noqa: E501
:rtype: list[Action]
"""
return self._actions

@actions.setter
def actions(self, actions):
"""Sets the actions of this Actions.


:param actions: The actions of this Actions. # noqa: E501
:type: list[Action]
"""

self._actions = actions
2 changes: 1 addition & 1 deletion xero_python/accounting/models/address.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/allocation.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/allocations.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/attachment.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/attachments.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion xero_python/accounting/models/balances.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.3.4
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
Expand Down
Loading