feat: update package dependencies and refactor Python SDK examples for consistency
- Bump versions of eslint-plugin-prettier, jest, jest-environment-jsdom, and prettier in package.json. - Refactor Python SDK examples to use consistent naming conventions (snake_case) for method and parameter names. - Update example responses to reflect changes in the SDK, including status code and data field names. - Ensure all Python imports are updated to use the correct module naming.
This commit is contained in:
Generated
+1707
-7637
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -32,10 +32,10 @@
|
|||||||
"@types/prismjs": "^1.26.6",
|
"@types/prismjs": "^1.26.6",
|
||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-prettier": "^5.5.5",
|
"eslint-plugin-prettier": "^5.5.6",
|
||||||
"jest": "^30.3.0",
|
"jest": "^30.4.2",
|
||||||
"jest-environment-jsdom": "^30.3.0",
|
"jest-environment-jsdom": "^30.4.1",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.5",
|
||||||
"ts-node": "^10.9.2"
|
"ts-node": "^10.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ console.log(app);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -48,12 +48,13 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
|
|
||||||
response = client.GetAppById(appId=195)
|
response = client.get_app_by_id(app_id=195)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'id: {response.data.app.id}')
|
print(f'id: {response.data.app.id}')
|
||||||
print(f'Name: {response.data.app.name}')
|
print(f'Name: {response.data.app.name}')
|
||||||
print(f'href: {response.data.app.href}')
|
print(f'href: {response.data.app.href}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ for (const app of apps) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,18 +52,19 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetApps()
|
response = client.get_apps()
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for app in response.data.apps:
|
for app in response.data.apps:
|
||||||
print(f'Id: {app.id}')
|
print(f'Id: {app.id}')
|
||||||
print(f'Name: {app.name}')
|
print(f'Name: {app.name}')
|
||||||
print(f'href: {app.href}')
|
print(f'href: {app.href}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ for (const app of apps) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -56,15 +56,16 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetAppsByIds(appIds=[195, 240])
|
response = client.get_apps_by_ids(app_ids=[195, 240])
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Count: {response.data.count}')
|
print(f'Count: {response.data.count}')
|
||||||
|
|
||||||
for app in response.data.apps:
|
for app in response.data.apps:
|
||||||
print(f'Id: {app.id}')
|
print(f'Id: {app.id}')
|
||||||
print(f'Name: {app.name}')
|
print(f'Name: {app.name}')
|
||||||
print(f'href: {app.href}')
|
print(f'href: {app.href}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ console.log(res);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -48,12 +48,13 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
|
|
||||||
canConnect = client.CanConnect()
|
canConnect = client.can_connect()
|
||||||
|
|
||||||
if canConnect:
|
if can_connect:
|
||||||
print('Connected successfully')
|
print('Connected successfully')
|
||||||
else:
|
else:
|
||||||
print('Attempt to connect failed')
|
print('Attempt to connect failed')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ console.log(field);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -48,10 +48,11 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFieldById(fieldId=6986)
|
response = client.get_field_by_id(field_id=6986)
|
||||||
|
|
||||||
|
print(f'Status Code: {response.status_code}')
|
||||||
|
print(f'Field Id: {response.data.field.id}')
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
|
||||||
print(f'Field Id: {response.data.id}')
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ for (const field of fields) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,16 +52,17 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFieldsByAppId(appId=195)
|
response = client.get_fields_by_app_id(app_id=195)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Field Id: {field.id}')
|
print(f'Field Id: {field.id}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ for (const field of fields) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -54,13 +54,14 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFieldsByIds(fieldIds=[6983, 6986, 6987, 6985, 6984])
|
response = client.get_fields_by_ids(field_ids=[6983, 6986, 6987, 6985, 6984])
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Count: {response.data.count}')
|
print(f'Count: {response.data.count}')
|
||||||
|
|
||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Field Id: {field.id}')
|
print(f'Field Id: {field.id}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ console.log(fileId);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import SaveFileRequest
|
from onspring_api_sdk.models import SaveFileRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -81,19 +81,20 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = SaveFileRequest(
|
request = SaveFileRequest(
|
||||||
recordId=140,
|
record_id=140,
|
||||||
fieldId=6989,
|
field_id=6989,
|
||||||
fileName='test-attachment.txt',
|
file_name='test-attachment.txt',
|
||||||
filePath='test-attachment.txt',
|
file_path='test-attachment.txt',
|
||||||
contentType='text/plain',
|
content_type='text/plain',
|
||||||
notes='Updating record with attachment.',
|
notes='Updating record with attachment.',
|
||||||
modifiedDate=datetime.now()
|
modified_date=datetime.now()
|
||||||
)
|
)
|
||||||
|
|
||||||
response = client.SaveFile(request)
|
response = client.save_file(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'File Id: {response.data.id}')
|
print(f'File Id: {response.data.id}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,12 +52,13 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.DeleteFileById(recordId=140, fieldId=6989, fileId=1904)
|
response = client.delete_file_by_id(record_id=140, field_id=6989, fileId=1904)
|
||||||
|
|
||||||
if response.status_code == 204:
|
if response.status_code == 204:
|
||||||
print('File deleted')
|
print('File deleted')
|
||||||
else:
|
else:
|
||||||
print('Error deleting file')
|
print('Error deleting file')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ file.stream.pipe(fs.createWriteStream(file.fileName));
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -61,19 +61,20 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFileById(recordId=1, fieldId=6989, fileId=89)
|
response = client.get_file_by_id(record_id=1, field_id=6989, fileId=89)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Name: {response.data.file.name}')
|
print(f'Name: {response.data.file.name}')
|
||||||
print(f'Content Type: {response.data.file.contentType}')
|
print(f'Content Type: {response.data.file.content_type}')
|
||||||
print(f'Content Length: {response.data.file.contentLength}')
|
print(f'Content Length: {response.data.file.content_length}')
|
||||||
|
|
||||||
filePath = f'C:\\Users\\sfree\\Documents\\Temp\\{response.data.file.name}'
|
file_path = f'C:\\Users\\sfree\\Documents\\Temp\\{response.data.file.name}'
|
||||||
|
|
||||||
with open(filePath, "wb") as file:
|
with open(file_path, "wb") as file:
|
||||||
file.write(response.data.file.content)
|
file.write(response.data.file.content)
|
||||||
|
|
||||||
print(f'File Location: {filePath}')
|
print(f'File Location: {file_path}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ console.log(fileInfo);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -47,10 +47,11 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetFileInfoById(recordId=1, fieldId=6989, fileId=89)
|
response = client.get_file_info_by_id(record_id=1, field_id=6989, fileId=89)
|
||||||
|
|
||||||
|
print(f'Name: {response.data.file_info.name}')
|
||||||
|
print(f'Content Type: {response.data.fileInfo.content_type}')
|
||||||
|
|
||||||
print(f'Name: {response.data.fileInfo.name}')
|
|
||||||
print(f'Content Type: {response.data.fileInfo.contentType}')
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -58,13 +58,14 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.DeleteListItem(
|
response = client.delete_list_item(
|
||||||
listId=906,
|
list_id=906,
|
||||||
itemId='36f94d8c-2b9d-465e-9ad1-ede04109efc9'
|
itemId='36f94d8c-2b9d-465e-9ad1-ede04109efc9'
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Message: {response.message}')
|
print(f'Message: {response.message}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ console.log(itemId);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import ListItemRequest
|
from onspring_api_sdk.models import ListItemRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -76,17 +76,18 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = ListItemRequest(
|
request = ListItemRequest(
|
||||||
listId=906,
|
list_id=906,
|
||||||
name='Not Started',
|
name='Not Started',
|
||||||
id=None,
|
id=None,
|
||||||
numericValue=0,
|
numeric_value=0,
|
||||||
color='#ffffff'
|
color='#ffffff'
|
||||||
)
|
)
|
||||||
|
|
||||||
response = client.AddOrUpdateListItem(request)
|
response = client.add_or_update_list_item(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Id: {response.data.id}')
|
print(f'Id: {response.data.id}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,10 +52,11 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.DeleteRecordById(appId=195, recordId=140)
|
response = client.delete_record_by_id(app_id=195, recordId=140)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Message: {response.message}')
|
print(f'Message: {response.message}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ res.statusCode === 204
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import DeleteBatchRecordsRequest
|
from onspring_api_sdk.models import DeleteBatchRecordsRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -66,11 +66,12 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = DeleteBatchRecordsRequest(appId=195, recordIds=[138, 139])
|
request = DeleteBatchRecordsRequest(app_id=195, record_ids=[138, 139])
|
||||||
response = client.DeleteRecordsByIds(request)
|
response = client.delete_records_by_ids(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Message: {response.message}')
|
print(f'Message: {response.message}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -52,22 +52,23 @@ console.log(record);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetRecordByIdRequest
|
from onspring_api_sdk.models import GetRecordByIdRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
request = GetRecordByIdRequest(appId=195, recordId=1)
|
request = GetRecordByIdRequest(appId=195, recordId=1)
|
||||||
|
|
||||||
response = client.GetRecordById(request)
|
response = client.get_record_by_id(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'AppId: {response.data.appId}')
|
print(f'AppId: {response.data.app_id}')
|
||||||
print(f'RecordId: {response.data.recordId}')
|
print(f'RecordId: {response.data.record_id}')
|
||||||
|
|
||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ for (const app of apps) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetRecordsByAppRequest
|
from onspring_api_sdk.models import GetRecordsByAppRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -53,22 +53,23 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = GetRecordsByAppRequest(appId=195)
|
request = GetRecordsByAppRequest(appId=195)
|
||||||
response = client.GetRecordsByAppId(request)
|
response = client.get_records_by_app_id(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for record in response.data.records:
|
for record in response.data.records:
|
||||||
print(f'AppId: {record.appId}')
|
print(f'AppId: {record.app_id}')
|
||||||
print(f'RecordId: {record.recordId}')
|
print(f'RecordId: {record.record_id}')
|
||||||
|
|
||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ for (const record of records) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetBatchRecordsRequest
|
from onspring_api_sdk.models import GetBatchRecordsRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -80,24 +80,25 @@ url = cfg['prod']['url']
|
|||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = GetBatchRecordsRequest(
|
request = GetBatchRecordsRequest(
|
||||||
appId=195,
|
app_id=195,
|
||||||
recordIds=[1],
|
record_ids=[1],
|
||||||
fieldIds=[6983, 6986, 6987, 6985, 6984],
|
field_ids=[6983, 6986, 6987, 6985, 6984],
|
||||||
dataFormat='Raw'
|
data_format='Raw'
|
||||||
)
|
)
|
||||||
response = client.GetRecordsByIds(request)
|
response = client.get_records_by_ids(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Count: {response.data.count}')
|
print(f'Count: {response.data.count}')
|
||||||
|
|
||||||
for record in response.data.records:
|
for record in response.data.records:
|
||||||
print(f'AppId: {record.appId}')
|
print(f'AppId: {record.app_id}')
|
||||||
print(f'RecordId: {record.recordId}')
|
print(f'RecordId: {record.record_id}')
|
||||||
|
|
||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ for (const record of records) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import QueryRecordsRequest
|
from onspring_api_sdk.models import QueryRecordsRequest
|
||||||
from OnspringApiSdk.Enums import DataFormat
|
from onspring_api_sdk.enums import DataFormat
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -102,28 +102,29 @@ operator = 'eq'
|
|||||||
value = '\'Test Task 5\''
|
value = '\'Test Task 5\''
|
||||||
|
|
||||||
request = QueryRecordsRequest(
|
request = QueryRecordsRequest(
|
||||||
appId=195,
|
app_id=195,
|
||||||
filter=f'{fieldId} {operator} {value}',
|
filter=f'{fieldId} {operator} {value}',
|
||||||
fieldIds=[6983, 6986, 6987, 6985, 6984],
|
field_ids=[6983, 6986, 6987, 6985, 6984],
|
||||||
dataFormat=DataFormat.Formatted.name,
|
data_format=DataFormat.Formatted.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
response = client.QueryRecords(request)
|
response = client.query_records(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Page Size: {response.data.pageSize}')
|
print(f'Page Size: {response.data.page_size}')
|
||||||
print(f'Page Number: {response.data.pageNumber}')
|
print(f'Page Number: {response.data.page_number}')
|
||||||
print(f'Total Pages: {response.data.totalPages}')
|
print(f'Total Pages: {response.data.total_pages}')
|
||||||
print(f'Total Records: {response.data.totalRecords}')
|
print(f'Total Records: {response.data.total_records}')
|
||||||
|
|
||||||
for record in response.data.records:
|
for record in response.data.records:
|
||||||
print(f'AppId: {record.appId}')
|
print(f'AppId: {record.app_id}')
|
||||||
print(f'RecordId: {record.recordId}')
|
print(f'RecordId: {record.record_id}')
|
||||||
|
|
||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.field_id}')
|
||||||
print(f'Value: {field.GetResultValueString()}')
|
print(f'Value: {field.value}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -87,40 +87,42 @@ console.log(newRecordId);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import StringFieldValue, GuidFieldValue, DateFieldValue, IntegerListValue, Record
|
from onspring_api_sdk.models import StringFieldValue, GuidFieldValue, DateFieldValue, IntegerListValue, Record
|
||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
|
cfg = ConfigParser()
|
||||||
|
cfg.read('config.ini')
|
||||||
|
|
||||||
|
key = cfg['prod']['key']
|
||||||
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
|
client = OnspringClient(url, key)
|
||||||
|
|
||||||
fields = []
|
fields = []
|
||||||
|
|
||||||
fields.append(StringFieldValue(6983, 'A New Test Task'))
|
fields.append(StringFieldValue(field_id=6983, value='A New Test Task'))
|
||||||
fields.append(StringFieldValue(6984, 'This is a test task.'))
|
fields.append(StringFieldValue(field_id=6984, value='This is a test task.'))
|
||||||
fields.append(
|
fields.append(
|
||||||
GuidFieldValue(
|
GuidFieldValue(field_id=6986, value=uuid.UUID('4118d53a-9121-4345-8682-07f23d606daa'))
|
||||||
6986,
|
|
||||||
uuid.UUID('4118d53a-9121-4345-8682-07f23d606daa')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
fields.append(
|
fields.append(
|
||||||
DateFieldValue(
|
DateFieldValue(field_id=6985, value=datetime(2021, 12, 25))
|
||||||
6985,
|
|
||||||
datetime.datetime(2021, 12, 25)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
fields.append(IntegerListValue(6987, [4]))
|
fields.append(IntegerListValue(field_id=6987, value=[4]))
|
||||||
|
|
||||||
record = Record(
|
record = Record(app_id=195, fields=fields)
|
||||||
appId=195,
|
|
||||||
fields
|
|
||||||
)
|
|
||||||
|
|
||||||
response = client.AddOrUpdateRecord(record)
|
response = client.add_or_update_record(record)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'Id: {response.data.id}')
|
print(f'Id: {response.data.id}')
|
||||||
|
|
||||||
for warning in response.data.warnings:
|
for warning in response.data.warnings:
|
||||||
print(f'Warning: {warning}')
|
print(f'Warning: {warning}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ console.log(report);
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from OnspringApiSdk.Models import GetReportByIdRequest
|
from onspring_api_sdk.models import GetReportByIdRequest
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,16 +52,17 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
request = GetReportByIdRequest(reportId=613)
|
request = GetReportByIdRequest(report_id=613)
|
||||||
response = client.GetReportById(request)
|
response = client.get_report_by_id(request)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print('Columns:')
|
print('Columns:')
|
||||||
print(f'{", ".join(response.data.columns)}')
|
print(f'{", ".join(response.data.columns)}')
|
||||||
print('Rows:')
|
print('Rows:')
|
||||||
|
|
||||||
for row in response.data.rows:
|
for row in response.data.rows:
|
||||||
print(f'Record Id {row.recordId}: {", ".join([str(cell) for cell in row.cells])}')
|
print(f'Record Id {row.record_id}: {", ".join([str(cell) for cell in row.cells])}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ for (const report of reports) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from OnspringApiSdk.OnspringClient import OnspringClient
|
from onspring_api_sdk import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser()
|
||||||
@@ -52,16 +52,18 @@ key = cfg['prod']['key']
|
|||||||
url = cfg['prod']['url']
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
client = OnspringClient(url, key)
|
client = OnspringClient(url, key)
|
||||||
response = client.GetReportsByAppId(appId=195)
|
app_id = 195
|
||||||
|
response = client.get_reports_by_app_id(app_id=app_id)
|
||||||
|
|
||||||
print(f'Status Code: {response.statusCode}')
|
print(f'Status Code: {response.status_code}')
|
||||||
print(f'App Id: {appId}')
|
print(f'App Id: {app_id}')
|
||||||
print('Reports:')
|
print('Reports:')
|
||||||
|
|
||||||
for report in response.data.reports:
|
for report in response.data.reports:
|
||||||
print(f' Id: {report.id}')
|
print(f' Id: {report.id}')
|
||||||
print(f' Name: {report.name}')
|
print(f' Name: {report.name}')
|
||||||
print(f' Description: {report.description}')
|
print(f' Description: {report.description}')
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|||||||
Reference in New Issue
Block a user