Files
onspring-api-sdk-python/src/OnspringApiSdk/Endpoints.py
T

323 lines
8.0 KiB
Python
Raw Normal View History

2022-04-16 22:55:22 -05:00
import uuid
# connectivity endpoints
2023-01-25 11:29:44 -06:00
def GetPingEndpoint(baseUrl: str) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the ping endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The ping endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Ping'
# app endpoints
2023-01-25 11:29:44 -06:00
def GetAppsEndpoint(baseUrl: str) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the get apps endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The get apps endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Apps'
2023-01-25 11:29:44 -06:00
def GetAppByIdEndpoint(baseUrl: str, appId: int) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the get app by id endpoint.
Args:
baseUrl (`str`): The base url for the api.
appId (`int`): The id of the app being requested.
Returns:
The get app by id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Apps/id/{appId}'
2023-01-25 11:29:44 -06:00
def GetAppsByIdsEndpoint(baseUrl: str) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the get apps by ids endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The get apps by ids endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Apps/batch-get'
# field endpoints
2023-01-25 11:29:44 -06:00
def GetFieldByIdEndpoint(baseUrl: str, fieldId: int) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the get field by id endpoint.
Args:
baseUrl (`str`): The base url for the api.
fieldId (`int`): The id of the field being requested.
Returns:
The get field by id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Fields/id/{fieldId}'
2023-01-25 11:29:44 -06:00
def GetFieldsByIdsEndpoint(baseUrl: str) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the get fields by ids endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The get fields by ids endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Fields/batch-get'
2023-01-25 11:29:44 -06:00
def GetFieldsByAppIdEndpoint(baseUrl: str, appId: int) -> str:
2022-04-29 13:15:49 -05:00
"""
Returns the get fields by app id endpoint.
Args:
baseUrl (`str`): The base url for the api.
appId (`int`): The id of the app whose fields are being requested.
Returns:
The get fields by app id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Fields/appId/{appId}'
# file endpoints
2023-01-25 11:29:44 -06:00
def GetFileInfoByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get file info by its id endpoint.
Args:
baseUrl (`str`): The base url for the api.
recordId (`int`): The id for the record where the file resides.
fieldId (`int`): The id for the field in the record where the file is held.
fileId ('int'): The id of the file.
Returns:
The get file info by its id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Files/recordId/{recordId}/fieldId/{fieldId}/fileId/{fileId}'
2023-01-25 11:29:44 -06:00
def DeleteFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the delete file by its id endpoint.
Args:
baseUrl (`str`): The base url for the api.
recordId (`int`): The id for the record where the file resides.
fieldId (`int`): The id for the field in the record where the file is held.
fileId ('int'): The id of the file.
Returns:
The delete file by its id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Files/recordId/{recordId}/fieldId/{fieldId}/fileId/{fileId}'
2023-01-25 11:29:44 -06:00
def GetFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get file by its id endpoint.
Args:
baseUrl (`str`): The base url for the api.
recordId (`int`): The id for the record where the file resides.
fieldId (`int`): The id for the field in the record where the file is held.
fileId ('int'): The id of the file.
Returns:
The get file by its id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Files/recordId/{recordId}/fieldId/{fieldId}/fileId/{fileId}/file'
2023-01-25 11:29:44 -06:00
def SaveFileEndpoint(baseUrl: str) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the save file endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The save file endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Files'
# list endpoints
2023-01-25 11:29:44 -06:00
def AddOrUpdateListItemEndpoint(baseUrl, listId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the add or update list item endpoint.
Args:
baseUrl (`str`): The base url for the api.
listId (`int`): The id of the list for which the item belongs when being updated or being added to.
Returns:
The add or update list item endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Lists/id/{listId}/items'
2023-01-25 11:29:44 -06:00
def DeleteListItemEndpoint(baseUrl: str, listId: int, itemId: uuid) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the delete list item endpoint.
Args:
baseUrl (`str`): The base url for the api.
listId (`int`): The id of the list for which the list item belongs.
itemId (`int`): The id list item.
Returns:
The delete list item endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Lists/id/{listId}/itemId/{itemId}'
# record endpoints
2023-01-25 11:29:44 -06:00
def GetRecordsByAppIdEndpoint(baseUrl, appId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get records by app id endpoint.
Args:
baseUrl (`str`): The base url for the api.
appId (`int`): The id of the app where the records reside.
Returns:
The get records by app id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records/appId/{appId}'
2023-01-25 11:29:44 -06:00
def GetRecordByIdEndpoint(baseUrl, appId: int, recordId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get record by id endpoint.
Args:
baseUrl (`str`): The base url for the api.
appId (`int`): The id of the app where the record resides.
recordId (`int`): The id of the record.
Returns:
The get record by id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records/appId/{appId}/recordId/{recordId}'
2023-01-25 11:29:44 -06:00
def DeleteRecordByIdEndpoint(baseUrl, appId: int, recordId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the delete record by id endpoint.
Args:
baseUrl (`str`): The base url for the api.
appId (`int`): The id of the app where the record resides.
recordId (`int`): The id of the record.
Returns:
The delete record by id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records/appId/{appId}/recordId/{recordId}'
2023-01-25 11:29:44 -06:00
def GetRecordsByIdsEndpoint(baseUrl) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get records by ids endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The get records by ids endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records/batch-get'
2023-01-25 11:29:44 -06:00
def QueryRecordsEndpoint(baseUrl) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the query records endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The query records endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records/Query'
2023-01-25 11:29:44 -06:00
def AddOrUpdateRecordEndpoint(baseUrl) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the add or update record endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The add or update record endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records'
2023-01-25 11:29:44 -06:00
def DeleteRecordsByIds(baseUrl) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the delete records by ids endpoint.
Args:
baseUrl (`str`): The base url for the api.
Returns:
The delete records by ids endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Records/batch-delete'
# report endpoints
2023-01-25 11:29:44 -06:00
def GetReportByIdEndpoint(baseUrl, reportId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get report by id endpoint.
Args:
baseUrl (`str`): The base url for the api.
reportId (`int`): The id of the report.
Returns:
The get report by id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Reports/id/{reportId}'
2023-01-25 11:29:44 -06:00
def GetReportsByAppIdEndpoint(baseUrl, appId: int) -> str:
2022-05-02 12:43:26 -05:00
"""
Returns the get reports by app id endpoint.
Args:
baseUrl (`str`): The base url for the api.
appId (`int`): The id of the app where the reports reside.
Returns:
The get reports by app id endpoint as a string.
"""
2022-04-16 22:55:22 -05:00
return f'{baseUrl}/Reports/appId/{appId}'