Skip to content

Commit 9789789

Browse files
authored
Merge pull request #42 from XeroAPI/sid-development
Initial SDK reference docs
2 parents 22a2f78 + b8e946c commit 9789789

File tree

19 files changed

+122698
-27
lines changed

19 files changed

+122698
-27
lines changed

docs/v1/accounting/index.html

Lines changed: 122340 additions & 0 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ def read_file(filename):
4848
keywords="xero python sdk API oAuth",
4949
name="xero_python",
5050
packages=find_packages(include=["xero_python", "xero_python.*"]),
51-
version="1.5.0",
51+
version="1.5.1",
5252
)

xero_python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__author__ = """Xero Developer API"""
44
__email__ = "[email protected]"
5-
__version__ = "1.5.0"
5+
__version__ = "1.5.1"

xero_python/accounting/api/accounting_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111

1212
"""
13-
OpenAPI spec version: 2.10.1
13+
OpenAPI spec version: 2.10.2
1414
"""
1515

1616
import importlib

xero_python/assets/api/asset_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111

1212
"""
13-
OpenAPI spec version: 2.10.1
13+
OpenAPI spec version: 2.10.2
1414
"""
1515

1616
import importlib

xero_python/docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ These endpoints are related to managing authentication tokens and identity for X
33

44
The `xero_python` package is automatically generated by the [XeroAPI SDK 2.0 Codegen](https://github.com/xero-github/xeroapi-sdk-codegen) project:
55

6-
- API version: 2.10.1
7-
- Package version: 1.5.0
6+
- API version: 2.10.2
7+
- Package version: 1.5.1
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99
For more information, please visit [https://developer.xero.com](https://developer.xero.com)
1010

xero_python/file/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from xero_python.file.models.folder import Folder
2424
from xero_python.file.models.folders import Folders
2525
from xero_python.file.models.inline_object import InlineObject
26+
from xero_python.file.models.inline_object1 import InlineObject1
2627
from xero_python.file.models.object_group import ObjectGroup
2728
from xero_python.file.models.object_type import ObjectType
2829
from xero_python.file.models.user import User

xero_python/file/api/files_api.py

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111

1212
"""
13-
OpenAPI spec version: 2.10.1
13+
OpenAPI spec version: 2.10.2
1414
"""
1515

1616
import importlib
@@ -1231,7 +1231,6 @@ def update_folder(
12311231
def upload_file(
12321232
self,
12331233
xero_tenant_id,
1234-
folder_id=empty,
12351234
body=empty,
12361235
name=empty,
12371236
filename=empty,
@@ -1240,10 +1239,9 @@ def upload_file(
12401239
_preload_content=True,
12411240
_request_timeout=None,
12421241
):
1243-
"""Uploads a File # noqa: E501
1242+
"""Uploads a File to the inbox # noqa: E501
12441243
OAuth2 scope: files
12451244
:param str xero_tenant_id: Xero identifier for Tenant (required)
1246-
:param str folder_id: pass an optional folder id to save file to specific folder
12471245
:param str body:
12481246
:param str name: exact name of the file you are uploading
12491247
:param str filename:
@@ -1266,9 +1264,6 @@ def upload_file(
12661264

12671265
query_params = []
12681266

1269-
if folder_id is not empty:
1270-
query_params.append(("FolderId", folder_id))
1271-
12721267
header_params = {
12731268
"xero-tenant-id": xero_tenant_id,
12741269
}
@@ -1317,3 +1312,98 @@ def upload_file(
13171312
)
13181313
except exceptions.HTTPStatusException as error:
13191314
raise translate_status_exception(error, self, "upload_file")
1315+
1316+
def upload_file_to_folder(
1317+
self,
1318+
xero_tenant_id,
1319+
folder_id,
1320+
body=empty,
1321+
name=empty,
1322+
filename=empty,
1323+
mime_type=empty,
1324+
_return_http_data_only=True,
1325+
_preload_content=True,
1326+
_request_timeout=None,
1327+
):
1328+
"""Uploads a File to a specific folder # noqa: E501
1329+
OAuth2 scope: files
1330+
:param str xero_tenant_id: Xero identifier for Tenant (required)
1331+
:param str folder_id: pass required folder id to save file to specific folder (required)
1332+
:param str body:
1333+
:param str name: exact name of the file you are uploading
1334+
:param str filename:
1335+
:param str mime_type:
1336+
:param bool _return_http_data_only: return received data only
1337+
:param bool _preload_content: load received data in models
1338+
:param bool _request_timeout: maximum wait time for response
1339+
:return: FileObject
1340+
"""
1341+
1342+
# verify the required parameter 'xero_tenant_id' is set
1343+
if xero_tenant_id is None:
1344+
raise ValueError(
1345+
"Missing the required parameter `xero_tenant_id` "
1346+
"when calling `upload_file_to_folder`"
1347+
)
1348+
# verify the required parameter 'folder_id' is set
1349+
if folder_id is None:
1350+
raise ValueError(
1351+
"Missing the required parameter `folder_id` "
1352+
"when calling `upload_file_to_folder`"
1353+
)
1354+
1355+
collection_formats = {}
1356+
path_params = {
1357+
"FolderId": folder_id,
1358+
}
1359+
1360+
query_params = []
1361+
1362+
header_params = {
1363+
"xero-tenant-id": xero_tenant_id,
1364+
}
1365+
1366+
local_var_files = {}
1367+
form_params = [
1368+
("body", body),
1369+
("name", name),
1370+
("filename", filename),
1371+
("mimeType", mime_type),
1372+
]
1373+
1374+
body_params = None
1375+
body_params = body
1376+
# HTTP header `Accept`
1377+
header_params["Accept"] = self.api_client.select_header_accept(
1378+
["application/json"]
1379+
)
1380+
1381+
# HTTP header `Content-Type`
1382+
header_params["Content-Type"] = self.api_client.select_header_content_type(
1383+
["multipart/form-data"]
1384+
)
1385+
1386+
# Authentication setting
1387+
auth_settings = ["OAuth2"]
1388+
url = self.get_resource_url("/Folders/{FolderId}")
1389+
1390+
try:
1391+
return self.api_client.call_api(
1392+
url,
1393+
"POST",
1394+
path_params,
1395+
query_params,
1396+
header_params,
1397+
body=body_params,
1398+
post_params=form_params,
1399+
files=local_var_files,
1400+
response_type="FileObject",
1401+
response_model_finder=self.get_model_finder(),
1402+
auth_settings=auth_settings,
1403+
_return_http_data_only=_return_http_data_only,
1404+
_preload_content=_preload_content,
1405+
_request_timeout=_request_timeout,
1406+
collection_formats=collection_formats,
1407+
)
1408+
except exceptions.HTTPStatusException as error:
1409+
raise translate_status_exception(error, self, "upload_file_to_folder")

xero_python/file/docs/FilesApi.md

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Method | HTTP request | Description
1919
[**get_inbox**](FilesApi.md#get_inbox) | **GET** /Inbox | Retrieves inbox folder
2020
[**update_file**](FilesApi.md#update_file) | **PUT** /Files/{FileId} | Update a file
2121
[**update_folder**](FilesApi.md#update_folder) | **PUT** /Folders/{FolderId} | Updates an existing folder
22-
[**upload_file**](FilesApi.md#upload_file) | **POST** /Files | Uploads a File
22+
[**upload_file**](FilesApi.md#upload_file) | **POST** /Files | Uploads a File to the inbox
23+
[**upload_file_to_folder**](FilesApi.md#upload_file_to_folder) | **POST** /Folders/{FolderId} | Uploads a File to a specific folder
2324

2425

2526
# **create_file_association**
@@ -1001,9 +1002,9 @@ Name | Type | Description | Notes
10011002
[[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)
10021003

10031004
# **upload_file**
1004-
> FileObject upload_file(xero_tenant_id, folder_id=folder_id, body=body, name=name, filename=filename, mime_type=mime_type)
1005+
> FileObject upload_file(xero_tenant_id, body=body, name=name, filename=filename, mime_type=mime_type)
10051006
1006-
Uploads a File
1007+
Uploads a File to the inbox
10071008

10081009
### Example
10091010

@@ -1032,14 +1033,13 @@ api_client = ApiClient(
10321033
api_instance = FilesApi(api_client)
10331034

10341035
xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant
1035-
folder_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | pass an optional folder id to save file to specific folder (optional)
10361036
body = 'body_example' # str | (optional)
10371037
name = 'name_example' # str | exact name of the file you are uploading (optional)
10381038
filename = 'filename_example' # str | (optional)
10391039
mime_type = 'mime_type_example' # str | (optional)
10401040
try:
1041-
# Uploads a File
1042-
api_response = api_instance.upload_file(xero_tenant_id, folder_id=folder_id, body=body, name=name, filename=filename, mime_type=mime_type)
1041+
# Uploads a File to the inbox
1042+
api_response = api_instance.upload_file(xero_tenant_id, body=body, name=name, filename=filename, mime_type=mime_type)
10431043
pprint(api_response)
10441044
except ApiException as e:
10451045
print("Exception when calling FilesApi->upload_file: %s\n" % e)
@@ -1050,7 +1050,77 @@ except ApiException as e:
10501050
Name | Type | Description | Notes
10511051
------------- | ------------- | ------------- | -------------
10521052
**xero_tenant_id** | **str**| Xero identifier for Tenant |
1053-
**folder_id** | [**str**](.md)| pass an optional folder id to save file to specific folder | [optional]
1053+
**body** | **str**| | [optional]
1054+
**name** | **str**| exact name of the file you are uploading | [optional]
1055+
**filename** | **str**| | [optional]
1056+
**mime_type** | **str**| | [optional]
1057+
1058+
### Return type
1059+
1060+
[**FileObject**](FileObject.md)
1061+
1062+
### Authorization
1063+
1064+
[OAuth2](../README.md#OAuth2)
1065+
1066+
### HTTP request headers
1067+
1068+
- **Content-Type**: multipart/form-data
1069+
- **Accept**: application/json
1070+
1071+
[[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)
1072+
1073+
# **upload_file_to_folder**
1074+
> FileObject upload_file_to_folder(xero_tenant_id, folder_id, body=body, name=name, filename=filename, mime_type=mime_type)
1075+
1076+
Uploads a File to a specific folder
1077+
1078+
### Example
1079+
1080+
* OAuth Authentication (OAuth2):
1081+
```python
1082+
from xero_python.api_client import Configuration, ApiClient
1083+
from xero_python.api_client.oauth2 import OAuth2Token
1084+
from xero_python.exceptions import ApiException
1085+
from xero_python.file import FilesApi
1086+
from pprint import pprint
1087+
1088+
# Configure OAuth2 access token for authorization: OAuth2
1089+
# simplified version, `xero_oauth2_token` represents permanent global token storage
1090+
xero_oauth2_token = {} # set to valid xero oauth2 token dictionary
1091+
# create client configuration with client id and client secret for automatic token refresh
1092+
api_config = Configuration(oauth2_token=OAuth2Token(
1093+
client_id="YOUR_API_CLIENT_ID", client_secret="YOUR_API_CLIENT_SECRET"
1094+
))
1095+
# configure xero-python sdk client
1096+
api_client = ApiClient(
1097+
api_config,
1098+
oauth2_token_saver=lambda x: xero_oauth2_token.update(x),
1099+
oauth2_token_getter=lambda : xero_oauth2_token
1100+
)
1101+
# create an instance of the API class
1102+
api_instance = FilesApi(api_client)
1103+
1104+
xero_tenant_id = 'YOUR_XERO_TENANT_ID' # str | Xero identifier for Tenant
1105+
folder_id = '4ff1e5cc-9835-40d5-bb18-09fdb118db9c' # str | pass required folder id to save file to specific folder
1106+
body = 'body_example' # str | (optional)
1107+
name = 'name_example' # str | exact name of the file you are uploading (optional)
1108+
filename = 'filename_example' # str | (optional)
1109+
mime_type = 'mime_type_example' # str | (optional)
1110+
try:
1111+
# Uploads a File to a specific folder
1112+
api_response = api_instance.upload_file_to_folder(xero_tenant_id, folder_id, body=body, name=name, filename=filename, mime_type=mime_type)
1113+
pprint(api_response)
1114+
except ApiException as e:
1115+
print("Exception when calling FilesApi->upload_file_to_folder: %s\n" % e)
1116+
```
1117+
1118+
### Parameters
1119+
1120+
Name | Type | Description | Notes
1121+
------------- | ------------- | ------------- | -------------
1122+
**xero_tenant_id** | **str**| Xero identifier for Tenant |
1123+
**folder_id** | [**str**](.md)| pass required folder id to save file to specific folder |
10541124
**body** | **str**| | [optional]
10551125
**name** | **str**| exact name of the file you are uploading | [optional]
10561126
**filename** | **str**| | [optional]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# InlineObject1
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**body** | **str** | | [optional]
7+
**name** | **str** | exact name of the file you are uploading | [optional]
8+
**filename** | **str** | | [optional]
9+
**mime_type** | **str** | | [optional]
10+
11+
[[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+
13+

0 commit comments

Comments
 (0)