fix: added missing type hints
This commit is contained in:
@@ -2,7 +2,7 @@ import uuid
|
||||
|
||||
# connectivity endpoints
|
||||
|
||||
def GetPingEndpoint(baseUrl: str):
|
||||
def GetPingEndpoint(baseUrl: str) -> str:
|
||||
"""
|
||||
Returns the ping endpoint.
|
||||
|
||||
@@ -17,7 +17,7 @@ def GetPingEndpoint(baseUrl: str):
|
||||
|
||||
# app endpoints
|
||||
|
||||
def GetAppsEndpoint(baseUrl: str):
|
||||
def GetAppsEndpoint(baseUrl: str) -> str:
|
||||
"""
|
||||
Returns the get apps endpoint.
|
||||
|
||||
@@ -30,7 +30,7 @@ def GetAppsEndpoint(baseUrl: str):
|
||||
|
||||
return f'{baseUrl}/Apps'
|
||||
|
||||
def GetAppByIdEndpoint(baseUrl: str, appId: int):
|
||||
def GetAppByIdEndpoint(baseUrl: str, appId: int) -> str:
|
||||
"""
|
||||
Returns the get app by id endpoint.
|
||||
|
||||
@@ -44,7 +44,7 @@ def GetAppByIdEndpoint(baseUrl: str, appId: int):
|
||||
|
||||
return f'{baseUrl}/Apps/id/{appId}'
|
||||
|
||||
def GetAppsByIdsEndpoint(baseUrl: str):
|
||||
def GetAppsByIdsEndpoint(baseUrl: str) -> str:
|
||||
"""
|
||||
Returns the get apps by ids endpoint.
|
||||
|
||||
@@ -59,7 +59,7 @@ def GetAppsByIdsEndpoint(baseUrl: str):
|
||||
|
||||
# field endpoints
|
||||
|
||||
def GetFieldByIdEndpoint(baseUrl: str, fieldId: int):
|
||||
def GetFieldByIdEndpoint(baseUrl: str, fieldId: int) -> str:
|
||||
"""
|
||||
Returns the get field by id endpoint.
|
||||
|
||||
@@ -73,7 +73,7 @@ def GetFieldByIdEndpoint(baseUrl: str, fieldId: int):
|
||||
|
||||
return f'{baseUrl}/Fields/id/{fieldId}'
|
||||
|
||||
def GetFieldsByIdsEndpoint(baseUrl: str):
|
||||
def GetFieldsByIdsEndpoint(baseUrl: str) -> str:
|
||||
"""
|
||||
Returns the get fields by ids endpoint.
|
||||
|
||||
@@ -86,7 +86,7 @@ def GetFieldsByIdsEndpoint(baseUrl: str):
|
||||
|
||||
return f'{baseUrl}/Fields/batch-get'
|
||||
|
||||
def GetFieldsByAppIdEndpoint(baseUrl: str, appId: int):
|
||||
def GetFieldsByAppIdEndpoint(baseUrl: str, appId: int) -> str:
|
||||
"""
|
||||
Returns the get fields by app id endpoint.
|
||||
|
||||
@@ -102,7 +102,7 @@ def GetFieldsByAppIdEndpoint(baseUrl: str, appId: int):
|
||||
|
||||
# file endpoints
|
||||
|
||||
def GetFileInfoByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int):
|
||||
def GetFileInfoByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int) -> str:
|
||||
"""
|
||||
Returns the get file info by its id endpoint.
|
||||
|
||||
@@ -118,7 +118,7 @@ def GetFileInfoByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: i
|
||||
|
||||
return f'{baseUrl}/Files/recordId/{recordId}/fieldId/{fieldId}/fileId/{fileId}'
|
||||
|
||||
def DeleteFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int):
|
||||
def DeleteFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int) -> str:
|
||||
"""
|
||||
Returns the delete file by its id endpoint.
|
||||
|
||||
@@ -134,7 +134,7 @@ def DeleteFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: in
|
||||
|
||||
return f'{baseUrl}/Files/recordId/{recordId}/fieldId/{fieldId}/fileId/{fileId}'
|
||||
|
||||
def GetFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int):
|
||||
def GetFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int) -> str:
|
||||
"""
|
||||
Returns the get file by its id endpoint.
|
||||
|
||||
@@ -150,7 +150,7 @@ def GetFileByIdEndpoint(baseUrl: str, recordId: int, fieldId: int, fileId: int):
|
||||
|
||||
return f'{baseUrl}/Files/recordId/{recordId}/fieldId/{fieldId}/fileId/{fileId}/file'
|
||||
|
||||
def SaveFileEndpoint(baseUrl: str):
|
||||
def SaveFileEndpoint(baseUrl: str) -> str:
|
||||
"""
|
||||
Returns the save file endpoint.
|
||||
|
||||
@@ -165,7 +165,7 @@ def SaveFileEndpoint(baseUrl: str):
|
||||
|
||||
# list endpoints
|
||||
|
||||
def AddOrUpdateListItemEndpoint(baseUrl, listId: int):
|
||||
def AddOrUpdateListItemEndpoint(baseUrl, listId: int) -> str:
|
||||
"""
|
||||
Returns the add or update list item endpoint.
|
||||
|
||||
@@ -179,7 +179,7 @@ def AddOrUpdateListItemEndpoint(baseUrl, listId: int):
|
||||
|
||||
return f'{baseUrl}/Lists/id/{listId}/items'
|
||||
|
||||
def DeleteListItemEndpoint(baseUrl: str, listId: int, itemId: uuid):
|
||||
def DeleteListItemEndpoint(baseUrl: str, listId: int, itemId: uuid) -> str:
|
||||
"""
|
||||
Returns the delete list item endpoint.
|
||||
|
||||
@@ -196,7 +196,7 @@ def DeleteListItemEndpoint(baseUrl: str, listId: int, itemId: uuid):
|
||||
|
||||
# record endpoints
|
||||
|
||||
def GetRecordsByAppIdEndpoint(baseUrl, appId: int):
|
||||
def GetRecordsByAppIdEndpoint(baseUrl, appId: int) -> str:
|
||||
"""
|
||||
Returns the get records by app id endpoint.
|
||||
|
||||
@@ -210,7 +210,7 @@ def GetRecordsByAppIdEndpoint(baseUrl, appId: int):
|
||||
|
||||
return f'{baseUrl}/Records/appId/{appId}'
|
||||
|
||||
def GetRecordByIdEndpoint(baseUrl, appId: int, recordId: int):
|
||||
def GetRecordByIdEndpoint(baseUrl, appId: int, recordId: int) -> str:
|
||||
"""
|
||||
Returns the get record by id endpoint.
|
||||
|
||||
@@ -225,7 +225,7 @@ def GetRecordByIdEndpoint(baseUrl, appId: int, recordId: int):
|
||||
|
||||
return f'{baseUrl}/Records/appId/{appId}/recordId/{recordId}'
|
||||
|
||||
def DeleteRecordByIdEndpoint(baseUrl, appId: int, recordId: int):
|
||||
def DeleteRecordByIdEndpoint(baseUrl, appId: int, recordId: int) -> str:
|
||||
"""
|
||||
Returns the delete record by id endpoint.
|
||||
|
||||
@@ -240,7 +240,7 @@ def DeleteRecordByIdEndpoint(baseUrl, appId: int, recordId: int):
|
||||
|
||||
return f'{baseUrl}/Records/appId/{appId}/recordId/{recordId}'
|
||||
|
||||
def GetRecordsByIdsEndpoint(baseUrl):
|
||||
def GetRecordsByIdsEndpoint(baseUrl) -> str:
|
||||
"""
|
||||
Returns the get records by ids endpoint.
|
||||
|
||||
@@ -253,7 +253,7 @@ def GetRecordsByIdsEndpoint(baseUrl):
|
||||
|
||||
return f'{baseUrl}/Records/batch-get'
|
||||
|
||||
def QueryRecordsEndpoint(baseUrl):
|
||||
def QueryRecordsEndpoint(baseUrl) -> str:
|
||||
"""
|
||||
Returns the query records endpoint.
|
||||
|
||||
@@ -266,7 +266,7 @@ def QueryRecordsEndpoint(baseUrl):
|
||||
|
||||
return f'{baseUrl}/Records/Query'
|
||||
|
||||
def AddOrUpdateRecordEndpoint(baseUrl):
|
||||
def AddOrUpdateRecordEndpoint(baseUrl) -> str:
|
||||
"""
|
||||
Returns the add or update record endpoint.
|
||||
|
||||
@@ -279,7 +279,7 @@ def AddOrUpdateRecordEndpoint(baseUrl):
|
||||
|
||||
return f'{baseUrl}/Records'
|
||||
|
||||
def DeleteRecordsByIds(baseUrl):
|
||||
def DeleteRecordsByIds(baseUrl) -> str:
|
||||
"""
|
||||
Returns the delete records by ids endpoint.
|
||||
|
||||
@@ -294,7 +294,7 @@ def DeleteRecordsByIds(baseUrl):
|
||||
|
||||
# report endpoints
|
||||
|
||||
def GetReportByIdEndpoint(baseUrl, reportId: int):
|
||||
def GetReportByIdEndpoint(baseUrl, reportId: int) -> str:
|
||||
"""
|
||||
Returns the get report by id endpoint.
|
||||
|
||||
@@ -308,7 +308,7 @@ def GetReportByIdEndpoint(baseUrl, reportId: int):
|
||||
|
||||
return f'{baseUrl}/Reports/id/{reportId}'
|
||||
|
||||
def GetReportsByAppIdEndpoint(baseUrl, appId: int):
|
||||
def GetReportsByAppIdEndpoint(baseUrl, appId: int) -> str:
|
||||
"""
|
||||
Returns the get reports by app id endpoint.
|
||||
|
||||
|
||||
+26
-26
@@ -5,50 +5,50 @@ class DataFormat(Enum):
|
||||
The possible data format types for record field values.
|
||||
"""
|
||||
|
||||
Raw = 0
|
||||
Formatted = 1
|
||||
Raw:int = 0
|
||||
Formatted:int = 1
|
||||
|
||||
class ReportDataType(Enum):
|
||||
"""
|
||||
The possible report data types for reports.
|
||||
"""
|
||||
ReportData = 0
|
||||
ChartData = 1
|
||||
ReportData:int = 0
|
||||
ChartData:int = 1
|
||||
|
||||
class ResultValueType(Enum):
|
||||
"""
|
||||
The possible types for record field values.
|
||||
"""
|
||||
String = 0
|
||||
Integer = 1
|
||||
Decimal = 2
|
||||
Date = 3
|
||||
TimeSpan = 4
|
||||
Guid = 5
|
||||
StringList = 6
|
||||
IntegerList = 7
|
||||
GuidList = 8
|
||||
AttachmentList = 9
|
||||
ScoringGroupList = 10
|
||||
FileList = 11
|
||||
String:int = 0
|
||||
Integer:int = 1
|
||||
Decimal:int = 2
|
||||
Date:int = 3
|
||||
TimeSpan:int = 4
|
||||
Guid:int = 5
|
||||
StringList:int = 6
|
||||
IntegerList:int = 7
|
||||
GuidList:int = 8
|
||||
AttachmentList:int = 9
|
||||
ScoringGroupList:int = 10
|
||||
FileList:int = 11
|
||||
|
||||
class Increment(Enum):
|
||||
"""
|
||||
The possible values for the increment property of timespan data in an Onspring timespan field.
|
||||
"""
|
||||
Seconds = "Second(s)"
|
||||
Minutes = "Minute(s)"
|
||||
Hours = "Hour(s)"
|
||||
Days = "Day(s)"
|
||||
Weeks = "Week(s)"
|
||||
Months = "Month(s)"
|
||||
Years = "Year(s)"
|
||||
Seconds:str = "Second(s)"
|
||||
Minutes:str = "Minute(s)"
|
||||
Hours:str = "Hour(s)"
|
||||
Days:str = "Day(s)"
|
||||
Weeks:str = "Week(s)"
|
||||
Months:str = "Month(s)"
|
||||
Years:str = "Year(s)"
|
||||
|
||||
class Recurrence(Enum):
|
||||
"""
|
||||
The possible values for the recurrence property of timespan data in an Onspring timespan field.
|
||||
"""
|
||||
Empty = "None"
|
||||
EndByDate = "EndByDate"
|
||||
EndAfterOccurrences = 'EndAfterOccurrences'
|
||||
Empty:str = "None"
|
||||
EndByDate:str = "EndByDate"
|
||||
EndAfterOccurrences:str = 'EndAfterOccurrences'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from datetime import datetime
|
||||
from OnspringApiSdk.Enums import *
|
||||
|
||||
def parseDate(date: str):
|
||||
def parseDate(date: str) -> datetime:
|
||||
|
||||
if date==None:
|
||||
return None
|
||||
|
||||
+252
-227
@@ -5,26 +5,9 @@ from OnspringApiSdk.Enums import *
|
||||
from decimal import Decimal
|
||||
from datetime import datetime
|
||||
from OnspringApiSdk.Helpers import parseDate
|
||||
from requests import Response
|
||||
|
||||
# generic
|
||||
|
||||
class ApiResponse:
|
||||
"""
|
||||
An object to represent a response to a request made by an `OnspringClient`.
|
||||
|
||||
Attributes:
|
||||
statusCode (`int`): The http status code of the response.
|
||||
data: If the request was successful will contain the response data deserialized to custom python objects.
|
||||
message (`str`): A message that may provide more detail about the requests success or failure.
|
||||
raw (`requests.Response`): Exposes the raw response object of the request if you'd like to handle it directly.
|
||||
"""
|
||||
|
||||
def __init__(self, statusCode=None, data=None, message=None, raw=None):
|
||||
self.statusCode = statusCode
|
||||
self.isSuccessful = int(statusCode) < 400
|
||||
self.data = data
|
||||
self.message = message
|
||||
self.raw = raw
|
||||
# paging
|
||||
|
||||
class PagingRequest:
|
||||
"""
|
||||
@@ -36,8 +19,8 @@ class PagingRequest:
|
||||
"""
|
||||
|
||||
def __init__(self, pageNumber: int, pageSize: int):
|
||||
self.pageNumber = pageNumber
|
||||
self.pageSize = pageSize
|
||||
self.pageNumber:int = pageNumber
|
||||
self.pageSize:int = pageSize
|
||||
|
||||
#app specific
|
||||
|
||||
@@ -52,9 +35,9 @@ class App:
|
||||
"""
|
||||
|
||||
def __init__(self, href: str, id: int, name: str):
|
||||
self.href = href
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.href:str = href
|
||||
self.id:int = id
|
||||
self.name:str = name
|
||||
|
||||
class GetAppsResponse:
|
||||
"""
|
||||
@@ -69,11 +52,11 @@ class GetAppsResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, pageNumber: int, pageSize: int, totalPages:int , totalRecords: int, apps: list[App]):
|
||||
self.pageNumber = pageNumber
|
||||
self.pageSize = pageSize
|
||||
self.totalPages = totalPages
|
||||
self.totalRecords = totalRecords
|
||||
self.apps = apps
|
||||
self.pageNumber:int = pageNumber
|
||||
self.pageSize:int = pageSize
|
||||
self.totalPages:int = totalPages
|
||||
self.totalRecords:int = totalRecords
|
||||
self.apps:list[App] = apps
|
||||
|
||||
class GetAppByIdResponse:
|
||||
"""
|
||||
@@ -84,7 +67,7 @@ class GetAppByIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, app: App):
|
||||
self.app = app
|
||||
self.app:App = app
|
||||
|
||||
class GetAppsByIdsResponse:
|
||||
"""
|
||||
@@ -96,8 +79,8 @@ class GetAppsByIdsResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, count: int, apps: list[App]):
|
||||
self.count = count
|
||||
self.apps = apps
|
||||
self.count:int = count
|
||||
self.apps:list[App] = apps
|
||||
|
||||
# field specific
|
||||
|
||||
@@ -114,18 +97,18 @@ class ListValue:
|
||||
"""
|
||||
|
||||
def __init__(self, id: int, name: str, sortOrder: int, numericValue: Decimal, color: str):
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.sortOrder = sortOrder
|
||||
self.id:int = id
|
||||
self.name:str = name
|
||||
self.sortOrder:int = sortOrder
|
||||
|
||||
if numericValue != None:
|
||||
self.numericValue = Decimal(numericValue)
|
||||
self.numericValue:Decimal = Decimal(numericValue)
|
||||
else:
|
||||
self.numericValue = numericValue
|
||||
self.numericValue:Decimal = numericValue
|
||||
|
||||
self.color = color
|
||||
self.color:str = color
|
||||
|
||||
def AsString(self):
|
||||
def AsString(self) -> str:
|
||||
"""
|
||||
Gets the list value as a comma separated string of it's properties and their values.
|
||||
|
||||
@@ -170,17 +153,17 @@ class Field:
|
||||
outputType: str=None
|
||||
):
|
||||
|
||||
self.id = id
|
||||
self.appId = appId
|
||||
self.name = name
|
||||
self.type = type
|
||||
self.status = status
|
||||
self.isRequired = isRequired
|
||||
self.isUnique = isUnique
|
||||
self.listId = listId
|
||||
self.values = values
|
||||
self.outputType = outputType
|
||||
self.multiplicity = multiplicity
|
||||
self.id:int = id
|
||||
self.appId:int = appId
|
||||
self.name:str = name
|
||||
self.type:str = type
|
||||
self.status:str = status
|
||||
self.isRequired:bool = isRequired
|
||||
self.isUnique:bool = isUnique
|
||||
self.listId:int = listId
|
||||
self.values:list[ListValue] = values
|
||||
self.outputType:str = outputType
|
||||
self.multiplicity:str = multiplicity
|
||||
|
||||
class GetFieldByIdResponse:
|
||||
"""
|
||||
@@ -191,7 +174,7 @@ class GetFieldByIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, field: Field):
|
||||
self.field = field
|
||||
self.field:Field = field
|
||||
|
||||
class GetFieldsByIdsResponse:
|
||||
"""
|
||||
@@ -203,8 +186,8 @@ class GetFieldsByIdsResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, count: int, fields: list[Field]):
|
||||
self.count = count
|
||||
self.fields = fields
|
||||
self.count:int = count
|
||||
self.fields:list[Field] = fields
|
||||
|
||||
class GetFieldsByAppIdResponse:
|
||||
"""
|
||||
@@ -219,11 +202,11 @@ class GetFieldsByAppIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, fields: list[Field]):
|
||||
self.pageNumber = pageNumber
|
||||
self.pageSize = pageSize
|
||||
self.totalPages = totalPages
|
||||
self.totalRecords = totalRecords
|
||||
self.fields = fields
|
||||
self.pageNumber:int = pageNumber
|
||||
self.pageSize:int = pageSize
|
||||
self.totalPages:int = totalPages
|
||||
self.totalRecords:int = totalRecords
|
||||
self.fields:list[Field] = fields
|
||||
|
||||
# file specific
|
||||
|
||||
@@ -239,10 +222,10 @@ class File:
|
||||
"""
|
||||
|
||||
def __init__(self, name: str, contentType: str, contentLength: int, content: bytes):
|
||||
self.name = name
|
||||
self.contentType = contentType
|
||||
self.contentLength = contentLength
|
||||
self.content = content
|
||||
self.name:str = name
|
||||
self.contentType:str = contentType
|
||||
self.contentLength:int = contentLength
|
||||
self.content:bytes = content
|
||||
|
||||
class FileInfo:
|
||||
"""
|
||||
@@ -259,13 +242,13 @@ class FileInfo:
|
||||
"""
|
||||
|
||||
def __init__(self, type: str, contentType: str, name: str, createdDate: datetime, modifiedDate: datetime, owner: str, fileHref: str):
|
||||
self.type = type
|
||||
self.contentType = contentType
|
||||
self.name = name
|
||||
self.createdDate = createdDate
|
||||
self.modifiedDate = modifiedDate
|
||||
self.owner = owner
|
||||
self.fileHref = fileHref
|
||||
self.type:str = type
|
||||
self.contentType:str = contentType
|
||||
self.name:str = name
|
||||
self.createdDate:datetime = createdDate
|
||||
self.modifiedDate:datetime = modifiedDate
|
||||
self.owner:str = owner
|
||||
self.fileHref:str = fileHref
|
||||
|
||||
class GetFileInfoByIdResponse:
|
||||
"""
|
||||
@@ -276,7 +259,7 @@ class GetFileInfoByIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, fileInfo: FileInfo):
|
||||
self.fileInfo = fileInfo
|
||||
self.fileInfo:FileInfo = fileInfo
|
||||
|
||||
class GetFileByIdResponse:
|
||||
"""
|
||||
@@ -287,7 +270,7 @@ class GetFileByIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, file: File):
|
||||
self.file = file
|
||||
self.file:File = file
|
||||
|
||||
class SaveFileRequest:
|
||||
"""
|
||||
@@ -303,13 +286,13 @@ class SaveFileRequest:
|
||||
notes (`datetime`): An optional date noting when the file was modified.
|
||||
"""
|
||||
def __init__(self, recordId: int, fieldId: int, fileName: str, filePath: str, contentType: str, notes: str=None, modifiedDate: datetime=None):
|
||||
self.recordId = recordId
|
||||
self.fieldId = fieldId
|
||||
self.notes = notes
|
||||
self.modifiedDate = modifiedDate
|
||||
self.fileName = fileName
|
||||
self.filePath = filePath
|
||||
self.contentType = contentType
|
||||
self.recordId:int = recordId
|
||||
self.fieldId:int = fieldId
|
||||
self.notes:str = notes
|
||||
self.modifiedDate:datetime = modifiedDate
|
||||
self.fileName:str = fileName
|
||||
self.filePath:str = filePath
|
||||
self.contentType:str = contentType
|
||||
|
||||
class SaveFileResponse:
|
||||
"""
|
||||
@@ -320,7 +303,7 @@ class SaveFileResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, id: int):
|
||||
self.id = id
|
||||
self.id:int = id
|
||||
|
||||
# list specific
|
||||
|
||||
@@ -336,12 +319,12 @@ class ListItemRequest:
|
||||
color (`str`): The color value assigned to the list value.
|
||||
"""
|
||||
|
||||
def __init__(self, listId: int, name: str, id: uuid=None, numericValue: int=None, color: str=None):
|
||||
self.listId = listId
|
||||
self.name = name
|
||||
self.id = id
|
||||
self.numericValue = numericValue
|
||||
self.color = color
|
||||
def __init__(self, listId: int, name: str, id: uuid.UUID=None, numericValue: int=None, color: str=None):
|
||||
self.listId:int = listId
|
||||
self.name:str = name
|
||||
self.id:uuid.UUID = id
|
||||
self.numericValue:int = numericValue
|
||||
self.color:str = color
|
||||
|
||||
class AddOrUpdateListItemResponse:
|
||||
"""
|
||||
@@ -351,11 +334,73 @@ class AddOrUpdateListItemResponse:
|
||||
id (`int`): The id of the list value updated or added in Onspring.
|
||||
"""
|
||||
|
||||
def __init__(self, id: uuid):
|
||||
self.id = id
|
||||
def __init__(self, id: uuid.UUID):
|
||||
self.id:uuid.UUID = id
|
||||
|
||||
# record specific
|
||||
|
||||
class TimeSpanData:
|
||||
"""
|
||||
An object to represent the data that makes up an Onspring timespan field.
|
||||
|
||||
Attributes:
|
||||
quantity (`Decimal`):
|
||||
increment (`Enums.Increment`):
|
||||
recurrence (`Enums.Recurrence`):
|
||||
endByDate (`datetime`):
|
||||
endAfterOccurrences (`int`):
|
||||
"""
|
||||
|
||||
def __init__(self, quantity: Decimal, increment: Increment, recurrence: Recurrence=None, endByDate: datetime=None, endAfterOccurrences: int=None):
|
||||
self.quantity:Decimal = quantity
|
||||
self.increment:Increment = increment
|
||||
self.recurrence:Recurrence = recurrence
|
||||
self.endByDate:datetime = endByDate
|
||||
self.endAfterOccurrences:int = endAfterOccurrences
|
||||
|
||||
def AsString(self) -> str:
|
||||
if self.endByDate != None:
|
||||
formattedDate = self.endByDate.strftime("%m/%d/%Y %I:%M %p")
|
||||
return f'Every {self.quantity} {self.increment} End By {formattedDate}'
|
||||
elif self.endAfterOccurrences != None:
|
||||
return f'Every {self.quantity} {self.increment} End After {self.endAfterOccurrences}'
|
||||
else:
|
||||
return f'{self.quantity} {self.increment}'
|
||||
|
||||
class Attachment:
|
||||
"""
|
||||
An object to represent an attachment in Onspring.
|
||||
|
||||
Attributes:
|
||||
fileId (`int`): The id of the file in Onspring.
|
||||
fileName (`str`): The name of the file in Onspring.
|
||||
notes (`str`): The notes for the file in Onspring.
|
||||
storageLocation (`str`): The storage location of the file in Onspring.
|
||||
"""
|
||||
|
||||
def __init__(self, fileId: int, fileName: str, notes: str, storageLocation: str):
|
||||
self.fileId:int = fileId
|
||||
self.fileName:str = fileName
|
||||
self.notes:str = notes
|
||||
self.storageLocation:str = storageLocation
|
||||
|
||||
class ScoringGroup:
|
||||
"""
|
||||
An object to represent an Onspring scoring group.
|
||||
|
||||
Attributes:
|
||||
listValueId (`UUID`): The id of the list value.
|
||||
name (`str`): The name of the list value.
|
||||
score (`Decimal`): The score for the list value.
|
||||
maximumScore (`Decimal`): The maximum possible score for the group.
|
||||
"""
|
||||
|
||||
def __init__(self, listValueId: uuid.UUID, name: str, score: Decimal, maximumScore: Decimal):
|
||||
self.listValueId:uuid.UUID = listValueId
|
||||
self.name:str = name
|
||||
self.score:Decimal = score
|
||||
self.maximumScore:Decimal = maximumScore
|
||||
|
||||
class RecordFieldValue:
|
||||
"""
|
||||
An object to represent the value in a field in an Onspring record.
|
||||
@@ -366,12 +411,12 @@ class RecordFieldValue:
|
||||
type (`str`): The type of value.
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: str, type: str=None):
|
||||
self.fieldId = fieldId
|
||||
def __init__(self, fieldId: int, value, type: str=None):
|
||||
self.fieldId:int = fieldId
|
||||
self.value = value
|
||||
self.type = type
|
||||
self.type:str = type
|
||||
|
||||
def AsString(self):
|
||||
def AsString(self) -> str | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is String will return the value property as a `str` otherwise will return `None`.
|
||||
|
||||
@@ -387,7 +432,7 @@ class RecordFieldValue:
|
||||
|
||||
return StringFieldValue(self.fieldId, self.value).value
|
||||
|
||||
def AsInteger(self):
|
||||
def AsInteger(self) -> int | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is Integer will return the value property as an `int` otherwise will return `None`.
|
||||
|
||||
@@ -403,7 +448,7 @@ class RecordFieldValue:
|
||||
|
||||
return IntegerFieldValue(self.fieldId, int(self.value)).value
|
||||
|
||||
def AsDecimal(self):
|
||||
def AsDecimal(self) -> Decimal | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is Decimal will return the value property as a `Decimal` otherwise will return `None`.
|
||||
|
||||
@@ -419,7 +464,7 @@ class RecordFieldValue:
|
||||
|
||||
return DecimalFieldValue(self.fieldId, Decimal(self.value)).value
|
||||
|
||||
def AsDate(self):
|
||||
def AsDate(self) -> datetime | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is Date will return the value property as a `datetime` otherwise will return `None`.
|
||||
|
||||
@@ -437,7 +482,7 @@ class RecordFieldValue:
|
||||
|
||||
return DateFieldValue(self.fieldId, date).value
|
||||
|
||||
def AsGuid(self):
|
||||
def AsGuid(self) -> uuid.UUID | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is Guid will return the value property as an `UUID` otherwise will return `None`.
|
||||
|
||||
@@ -453,7 +498,7 @@ class RecordFieldValue:
|
||||
|
||||
return GuidFieldValue(self.fieldId, uuid.UUID(self.value)).value
|
||||
|
||||
def AsTimeSpan(self):
|
||||
def AsTimeSpan(self) -> TimeSpanData | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is TimeSpan will return the value property as a `Model.TimeSpanData` otherwise will return `None`.
|
||||
|
||||
@@ -486,7 +531,7 @@ class RecordFieldValue:
|
||||
|
||||
return TimeSpanValue(self.fieldId, data).value
|
||||
|
||||
def AsStringList(self):
|
||||
def AsStringList(self) -> list[str] | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is StringList will return the value property as a `list[str]` otherwise will return `None`.
|
||||
|
||||
@@ -504,7 +549,7 @@ class RecordFieldValue:
|
||||
|
||||
return StringListValue(self.fieldId, strings).value
|
||||
|
||||
def AsIntegerList(self):
|
||||
def AsIntegerList(self) -> list[int] | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is IntegerList will return the value property as a `list[int]` otherwise will return `None`.
|
||||
|
||||
@@ -522,7 +567,7 @@ class RecordFieldValue:
|
||||
|
||||
return IntegerListValue(self.fieldId, integers).value
|
||||
|
||||
def AsGuidList(self):
|
||||
def AsGuidList(self) -> list[uuid.UUID] | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is GuidList will return the value property as a `list[UUID]` otherwise will return `None`.
|
||||
|
||||
@@ -543,7 +588,7 @@ class RecordFieldValue:
|
||||
|
||||
return GuidListValue(self.fieldId, guids).value
|
||||
|
||||
def AsAttachmentList(self):
|
||||
def AsAttachmentList(self) -> list[Attachment] | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is AttachmentList will return the value property as a `list[Models.Attachment]` otherwise will return `None`.
|
||||
|
||||
@@ -573,7 +618,7 @@ class RecordFieldValue:
|
||||
|
||||
return AttachmentListValue(self.fieldId, attachments).value
|
||||
|
||||
def AsScoringGroupList(self):
|
||||
def AsScoringGroupList(self) -> list[ScoringGroup] | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is ScoringGroupList will return the value property as a `list[Models.ScoringGroup]` otherwise will return `None`.
|
||||
|
||||
@@ -585,7 +630,7 @@ class RecordFieldValue:
|
||||
"""
|
||||
|
||||
if self.type != ResultValueType.ScoringGroupList.name:
|
||||
return
|
||||
return None
|
||||
|
||||
scoringGroups = []
|
||||
|
||||
@@ -603,7 +648,7 @@ class RecordFieldValue:
|
||||
|
||||
return ScoringGroupListValue(self.fieldId, scoringGroups).value
|
||||
|
||||
def AsFileList(self):
|
||||
def AsFileList(self) -> list[int] | None:
|
||||
"""
|
||||
If the `Models.RecordFieldValue` type is FileList will return the value property as a `list[int]` otherwise will return `None`.
|
||||
|
||||
@@ -621,7 +666,7 @@ class RecordFieldValue:
|
||||
|
||||
return FileListValue(self.fieldId, files).value
|
||||
|
||||
def getValue(self):
|
||||
def getValue(self) -> object:
|
||||
"""
|
||||
Will determine the appropriate way to return the fields value based on it's type.
|
||||
|
||||
@@ -671,7 +716,7 @@ class RecordFieldValue:
|
||||
else:
|
||||
return None
|
||||
|
||||
def GetResultValueString(self):
|
||||
def GetResultValueString(self) -> str:
|
||||
"""
|
||||
Will return the value property regardless of the field value's type as a string.
|
||||
|
||||
@@ -752,9 +797,9 @@ class Record:
|
||||
"""
|
||||
|
||||
def __init__(self, appId: int, fields: list[RecordFieldValue], recordId: int=None):
|
||||
self.appId = appId
|
||||
self.recordId = recordId
|
||||
self.fields = fields
|
||||
self.appId:int = appId
|
||||
self.recordId:recordId = recordId
|
||||
self.fields:list[RecordFieldValue] = fields
|
||||
|
||||
class GetRecordsByAppRequest:
|
||||
"""
|
||||
@@ -768,11 +813,11 @@ class GetRecordsByAppRequest:
|
||||
"""
|
||||
|
||||
def __init__(self, appId: int, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name, pagingRequest: PagingRequest=PagingRequest(1,50)):
|
||||
self.appId = appId
|
||||
self.fieldIds = fieldIds
|
||||
self.dataFormat = dataFormat
|
||||
self.pageSize = pagingRequest.pageSize
|
||||
self.pageNumber = pagingRequest.pageNumber
|
||||
self.appId:int = appId
|
||||
self.fieldIds:list[int] = fieldIds
|
||||
self.dataFormat:str = dataFormat
|
||||
self.pageSize:int = pagingRequest.pageSize
|
||||
self.pageNumber:int = pagingRequest.pageNumber
|
||||
|
||||
class QueryRecordsRequest:
|
||||
"""
|
||||
@@ -787,11 +832,11 @@ class QueryRecordsRequest:
|
||||
"""
|
||||
|
||||
def __init__(self, appId: int, filter: str, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name, pagingRequest: PagingRequest=PagingRequest(1,50)):
|
||||
self.appId = appId
|
||||
self.filter = filter
|
||||
self.fieldIds = fieldIds
|
||||
self.dataFormat = dataFormat
|
||||
self.pagingRequest = pagingRequest
|
||||
self.appId:int = appId
|
||||
self.filter:str = filter
|
||||
self.fieldIds:list[int] = fieldIds
|
||||
self.dataFormat:str = dataFormat
|
||||
self.pagingRequest:PagingRequest = pagingRequest
|
||||
|
||||
class GetRecordsResponse:
|
||||
"""
|
||||
@@ -806,11 +851,11 @@ class GetRecordsResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, records: list[Record]):
|
||||
self.pageNumber = pageNumber
|
||||
self.pageSize = pageSize
|
||||
self.totalPages = totalPages
|
||||
self.totalRecords = totalRecords
|
||||
self.records = records
|
||||
self.pageNumber:int = pageNumber
|
||||
self.pageSize:int = pageSize
|
||||
self.totalPages:int = totalPages
|
||||
self.totalRecords:int = totalRecords
|
||||
self.records:list[Record] = records
|
||||
|
||||
class GetRecordByIdRequest:
|
||||
"""
|
||||
@@ -823,10 +868,10 @@ class GetRecordByIdRequest:
|
||||
dataFormat (`str`): The format of the response data.
|
||||
"""
|
||||
def __init__(self, appId: int, recordId: int, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name):
|
||||
self.appId = appId
|
||||
self.recordId = recordId
|
||||
self.fieldIds = fieldIds
|
||||
self.dataFormat = dataFormat
|
||||
self.appId:int = appId
|
||||
self.recordId:int = recordId
|
||||
self.fieldIds:list[int] = fieldIds
|
||||
self.dataFormat:str = dataFormat
|
||||
|
||||
class GetBatchRecordsRequest:
|
||||
"""
|
||||
@@ -840,10 +885,10 @@ class GetBatchRecordsRequest:
|
||||
"""
|
||||
|
||||
def __init__(self, appId: int, recordIds: list[int], fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name):
|
||||
self.appId = appId
|
||||
self.recordIds = recordIds
|
||||
self.fieldIds = fieldIds
|
||||
self.dataFormat = dataFormat
|
||||
self.appId:int = appId
|
||||
self.recordIds:list[int] = recordIds
|
||||
self.fieldIds:list[int] = fieldIds
|
||||
self.dataFormat:str = dataFormat
|
||||
|
||||
class GetBatchRecordsResponse:
|
||||
"""
|
||||
@@ -855,8 +900,8 @@ class GetBatchRecordsResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, count: int, records: list[Record]):
|
||||
self.count = count
|
||||
self.records = records
|
||||
self.count:int = count
|
||||
self.records:list[Record] = records
|
||||
|
||||
class AddOrUpdateRecordResponse:
|
||||
"""
|
||||
@@ -868,8 +913,8 @@ class AddOrUpdateRecordResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, id: int, warnings: list[str]=[]):
|
||||
self.id = id
|
||||
self.warnings = warnings
|
||||
self.id:int = id
|
||||
self.warnings:list[str] = warnings
|
||||
|
||||
class DeleteBatchRecordsRequest:
|
||||
"""
|
||||
@@ -881,8 +926,8 @@ class DeleteBatchRecordsRequest:
|
||||
"""
|
||||
|
||||
def __init__(self, appId: int, recordIds: list[int]):
|
||||
self.appId = appId
|
||||
self.recordIds = recordIds
|
||||
self.appId:int = appId
|
||||
self.recordIds:list[int] = recordIds
|
||||
|
||||
# field types
|
||||
|
||||
@@ -897,7 +942,7 @@ class StringFieldValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value):
|
||||
self.type = ResultValueType.String.name
|
||||
self.type:str = ResultValueType.String.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class IntegerFieldValue(RecordFieldValue):
|
||||
@@ -911,7 +956,7 @@ class IntegerFieldValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: int):
|
||||
self.type = ResultValueType.Integer.name
|
||||
self.type:str = ResultValueType.Integer.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class DecimalFieldValue(RecordFieldValue):
|
||||
@@ -925,7 +970,7 @@ class DecimalFieldValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: Decimal):
|
||||
self.type = ResultValueType.Decimal.name
|
||||
self.type:str = ResultValueType.Decimal.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class DateFieldValue(RecordFieldValue):
|
||||
@@ -939,7 +984,7 @@ class DateFieldValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: datetime):
|
||||
self.type = ResultValueType.Date.name
|
||||
self.type:str = ResultValueType.Date.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class GuidFieldValue(RecordFieldValue):
|
||||
@@ -953,37 +998,9 @@ class GuidFieldValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: uuid.UUID):
|
||||
self.type = ResultValueType.Guid.name
|
||||
self.type:str = ResultValueType.Guid.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class TimeSpanData:
|
||||
"""
|
||||
An object to represent the data that makes up an Onspring timespan field.
|
||||
|
||||
Attributes:
|
||||
quantity (`Decimal`):
|
||||
increment (`Enums.Increment`):
|
||||
recurrence (`Enums.Recurrence`):
|
||||
endByDate (`datetime`):
|
||||
endAfterOccurrences (`int`):
|
||||
"""
|
||||
|
||||
def __init__(self, quantity: Decimal, increment: Increment, recurrence: Recurrence=None, endByDate: datetime=None, endAfterOccurrences: int=None):
|
||||
self.quantity = quantity
|
||||
self.increment = increment
|
||||
self.recurrence = recurrence
|
||||
self.endByDate = endByDate
|
||||
self.endAfterOccurrences = endAfterOccurrences
|
||||
|
||||
def AsString(self):
|
||||
if self.endByDate != None:
|
||||
formattedDate = self.endByDate.strftime("%m/%d/%Y %I:%M %p")
|
||||
return f'Every {self.quantity} {self.increment} End By {formattedDate}'
|
||||
elif self.endAfterOccurrences != None:
|
||||
return f'Every {self.quantity} {self.increment} End After {self.endAfterOccurrences}'
|
||||
else:
|
||||
return f'{self.quantity} {self.increment}'
|
||||
|
||||
class TimeSpanValue(RecordFieldValue):
|
||||
"""
|
||||
An object to represent an Onspring field value of the TimeSpan type.
|
||||
@@ -995,7 +1012,7 @@ class TimeSpanValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: TimeSpanData):
|
||||
self.type = ResultValueType.TimeSpan.name
|
||||
self.type:str = ResultValueType.TimeSpan.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class StringListValue(RecordFieldValue):
|
||||
@@ -1009,7 +1026,7 @@ class StringListValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: list[str]):
|
||||
self.type = ResultValueType.StringList.name
|
||||
self.type:str = ResultValueType.StringList.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class IntegerListValue(RecordFieldValue):
|
||||
@@ -1023,7 +1040,7 @@ class IntegerListValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: list[int]):
|
||||
self.type = ResultValueType.IntegerList.name
|
||||
self.type:str = ResultValueType.IntegerList.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class GuidListValue(RecordFieldValue):
|
||||
@@ -1037,26 +1054,9 @@ class GuidListValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: list[uuid.UUID]):
|
||||
self.type = ResultValueType.GuidList.name
|
||||
self.type:str = ResultValueType.GuidList.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class Attachment:
|
||||
"""
|
||||
An object to represent an attachment in Onspring.
|
||||
|
||||
Attributes:
|
||||
fileId (`int`): The id of the file in Onspring.
|
||||
fileName (`str`): The name of the file in Onspring.
|
||||
notes (`str`): The notes for the file in Onspring.
|
||||
storageLocation (`str`): The storage location of the file in Onspring.
|
||||
"""
|
||||
|
||||
def __init__(self, fileId: int, fileName: str, notes: str, storageLocation: str):
|
||||
self.fileId = fileId
|
||||
self.fileName = fileName
|
||||
self.notes = notes
|
||||
self.storageLocation = storageLocation
|
||||
|
||||
class AttachmentListValue(RecordFieldValue):
|
||||
"""
|
||||
An object to represent an Onspring field value of the AttachmentList type.
|
||||
@@ -1068,7 +1068,7 @@ class AttachmentListValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: list[Attachment]):
|
||||
self.type = ResultValueType.AttachmentList.name
|
||||
self.type:str = ResultValueType.AttachmentList.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class FileListValue(RecordFieldValue):
|
||||
@@ -1082,26 +1082,9 @@ class FileListValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: list[int]):
|
||||
self.type = ResultValueType.FileList.name
|
||||
self.type:str = ResultValueType.FileList.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
class ScoringGroup:
|
||||
"""
|
||||
An object to represent an Onspring scoring group.
|
||||
|
||||
Attributes:
|
||||
listValueId (`UUID`): The id of the list value.
|
||||
name (`str`): The name of the list value.
|
||||
score (`Decimal`): The score for the list value.
|
||||
maximumScore (`Decimal`): The maximum possible score for the group.
|
||||
"""
|
||||
|
||||
def __init__(self, listValueId: uuid.UUID, name: str, score: Decimal, maximumScore: Decimal):
|
||||
self.listValueId = listValueId
|
||||
self.name = name
|
||||
self.score = score
|
||||
self.maximumScore = maximumScore
|
||||
|
||||
class ScoringGroupListValue(RecordFieldValue):
|
||||
"""
|
||||
An object to represent an Onspring field value of the ScoringGroupList type.
|
||||
@@ -1113,7 +1096,7 @@ class ScoringGroupListValue(RecordFieldValue):
|
||||
"""
|
||||
|
||||
def __init__(self, fieldId: int, value: list[ScoringGroup]):
|
||||
self.type = ResultValueType.ScoringGroupList.name
|
||||
self.type:str = ResultValueType.ScoringGroupList.name
|
||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||
|
||||
# report specific
|
||||
@@ -1129,9 +1112,9 @@ class GetReportByIdRequest:
|
||||
"""
|
||||
|
||||
def __init__(self, reportId: int, apiDataFormat: str=DataFormat.Raw.name, dataType: str=ReportDataType.ReportData.name):
|
||||
self.reportId = reportId
|
||||
self.apiDataFormat = apiDataFormat
|
||||
self.dataType = dataType
|
||||
self.reportId:int = reportId
|
||||
self.apiDataFormat:str = apiDataFormat
|
||||
self.dataType:str = dataType
|
||||
|
||||
class Row:
|
||||
"""
|
||||
@@ -1143,8 +1126,8 @@ class Row:
|
||||
"""
|
||||
|
||||
def __init__(self, recordId: int, cells: list[str]):
|
||||
self.recordId = recordId
|
||||
self.cells = cells
|
||||
self.recordId:int = recordId
|
||||
self.cells:list[str] = cells
|
||||
|
||||
class GetReportByIdResponse:
|
||||
"""
|
||||
@@ -1156,8 +1139,8 @@ class GetReportByIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, columns: list[str], rows: list[Row]):
|
||||
self.columns = columns
|
||||
self.rows = rows
|
||||
self.columns:list[str] = columns
|
||||
self.rows:list[Row] = rows
|
||||
|
||||
class Report:
|
||||
"""
|
||||
@@ -1171,10 +1154,10 @@ class Report:
|
||||
"""
|
||||
|
||||
def __init__(self, appId: int, id: int, name: str, description: str):
|
||||
self.appId = appId
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.description = description
|
||||
self.appId:int = appId
|
||||
self.id:int = id
|
||||
self.name:str = name
|
||||
self.description:str = description
|
||||
|
||||
class GetReportsByAppIdResponse:
|
||||
"""
|
||||
@@ -1189,8 +1172,50 @@ class GetReportsByAppIdResponse:
|
||||
"""
|
||||
|
||||
def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, reports: list[Report]):
|
||||
self.pageNumber = pageNumber
|
||||
self.pageSize = pageSize
|
||||
self.totalPages = totalPages
|
||||
self.totalRecords = totalRecords
|
||||
self.reports = reports
|
||||
self.pageNumber:int = pageNumber
|
||||
self.pageSize:int = pageSize
|
||||
self.totalPages:int = totalPages
|
||||
self.totalRecords:int = totalRecords
|
||||
self.reports:list[Report] = reports
|
||||
|
||||
# generic
|
||||
|
||||
class ApiResponse:
|
||||
"""
|
||||
An object to represent a response to a request made by an `OnspringClient`.
|
||||
|
||||
Attributes:
|
||||
statusCode (`int`): The http status code of the response.
|
||||
data: If the request was successful will contain the response data deserialized to custom python objects.
|
||||
message (`str`): A message that may provide more detail about the requests success or failure.
|
||||
raw (`requests.Response`): Exposes the raw response object of the request if you'd like to handle it directly.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
statusCode:int=None,
|
||||
data:
|
||||
GetAppsResponse|
|
||||
GetAppByIdResponse|
|
||||
GetAppsByIdsResponse|
|
||||
GetFieldByIdResponse|
|
||||
GetFieldsByIdsResponse|
|
||||
GetFieldsByAppIdResponse|
|
||||
GetFileInfoByIdResponse|
|
||||
GetFileByIdResponse|
|
||||
SaveFileResponse|
|
||||
AddOrUpdateListItemResponse|
|
||||
GetRecordsResponse|
|
||||
Record|
|
||||
GetBatchRecordsResponse|
|
||||
AddOrUpdateRecordResponse|
|
||||
GetReportByIdResponse|
|
||||
GetReportsByAppIdResponse=None,
|
||||
message:str=None,
|
||||
raw:Response=None
|
||||
):
|
||||
self.statusCode:int = statusCode
|
||||
self.isSuccessful:bool = int(statusCode) < 400
|
||||
self.data = data
|
||||
self.message:str = message
|
||||
self.raw:Response = raw
|
||||
@@ -22,7 +22,7 @@ class OnspringClient:
|
||||
|
||||
# connectivity methods
|
||||
|
||||
def CanConnect(self):
|
||||
def CanConnect(self) -> bool:
|
||||
"""
|
||||
Verifies if the API is reachable by calling the ping endpoint.
|
||||
|
||||
@@ -43,7 +43,7 @@ class OnspringClient:
|
||||
|
||||
# app methods
|
||||
|
||||
def GetApps(self, pagingRequest=PagingRequest(1, 50)):
|
||||
def GetApps(self, pagingRequest=PagingRequest(1, 50)) -> ApiResponse:
|
||||
"""
|
||||
Gets all accessible apps for client.
|
||||
|
||||
@@ -109,7 +109,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetAppById(self, appId: int):
|
||||
def GetAppById(self, appId: int) -> ApiResponse:
|
||||
"""
|
||||
Get an app by it's id.
|
||||
|
||||
@@ -168,7 +168,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetAppsByIds(self, appIds: list):
|
||||
def GetAppsByIds(self, appIds: list) -> ApiResponse:
|
||||
"""
|
||||
Get a set of apps by their ids.
|
||||
|
||||
@@ -243,7 +243,7 @@ class OnspringClient:
|
||||
|
||||
# field methods
|
||||
|
||||
def GetFieldById(self, fieldId: int):
|
||||
def GetFieldById(self, fieldId: int) -> ApiResponse:
|
||||
"""
|
||||
Get a field by it's id.
|
||||
|
||||
@@ -329,7 +329,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetFieldsByIds(self, fieldIds: list):
|
||||
def GetFieldsByIds(self, fieldIds: list) -> ApiResponse:
|
||||
"""
|
||||
Get a set of fields by their ids.
|
||||
|
||||
@@ -413,7 +413,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetFieldsByAppId(self, appId: int, pagingRequest=PagingRequest(1, 50)):
|
||||
def GetFieldsByAppId(self, appId: int, pagingRequest=PagingRequest(1, 50)) -> ApiResponse:
|
||||
"""
|
||||
Get all fields for an app.
|
||||
|
||||
@@ -488,7 +488,7 @@ class OnspringClient:
|
||||
|
||||
# file methods
|
||||
|
||||
def GetFileInfoById(self, recordId: int, fieldId: int, fileId: int):
|
||||
def GetFileInfoById(self, recordId: int, fieldId: int, fileId: int) -> ApiResponse:
|
||||
"""
|
||||
Get the metadata information for a file.
|
||||
|
||||
@@ -567,7 +567,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def DeleteFileById(self, recordId: int, fieldId: int, fileId: int):
|
||||
def DeleteFileById(self, recordId: int, fieldId: int, fileId: int) -> ApiResponse:
|
||||
"""
|
||||
Delete a file by its id.
|
||||
|
||||
@@ -632,7 +632,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetFileById(self, recordId: int, fieldId: int, fileId: int):
|
||||
def GetFileById(self, recordId: int, fieldId: int, fileId: int) -> ApiResponse:
|
||||
"""
|
||||
Get a file by its id.
|
||||
|
||||
@@ -710,7 +710,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def SaveFile(self, saveFileRequest: SaveFileRequest):
|
||||
def SaveFile(self, saveFileRequest: SaveFileRequest) -> ApiResponse:
|
||||
"""
|
||||
Delete a file by its id.
|
||||
|
||||
@@ -784,7 +784,7 @@ class OnspringClient:
|
||||
|
||||
# list methods
|
||||
|
||||
def AddOrUpdateListItem(self, listItemRequest: ListItemRequest):
|
||||
def AddOrUpdateListItem(self, listItemRequest: ListItemRequest) -> ApiResponse:
|
||||
"""
|
||||
Add or update a list value by its id.
|
||||
|
||||
@@ -853,7 +853,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def DeleteListItem(self, listId: int, itemId: str):
|
||||
def DeleteListItem(self, listId: int, itemId: str) -> ApiResponse:
|
||||
"""
|
||||
Delete a list value by its id and it's parent list id.
|
||||
|
||||
@@ -908,7 +908,7 @@ class OnspringClient:
|
||||
|
||||
# record methods
|
||||
|
||||
def GetRecordsByAppId(self, getRecordsByAppRequest: GetRecordsByAppRequest):
|
||||
def GetRecordsByAppId(self, getRecordsByAppRequest: GetRecordsByAppRequest) -> ApiResponse:
|
||||
"""
|
||||
Get all the records for an app by its id.
|
||||
|
||||
@@ -1002,7 +1002,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetRecordById(self, getRecordByIdRequest: GetRecordByIdRequest):
|
||||
def GetRecordById(self, getRecordByIdRequest: GetRecordByIdRequest) -> ApiResponse:
|
||||
"""
|
||||
Get a record by its id.
|
||||
|
||||
@@ -1080,7 +1080,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def DeleteRecordById(self, appId: int, recordId: int):
|
||||
def DeleteRecordById(self, appId: int, recordId: int) -> ApiResponse:
|
||||
"""
|
||||
Delete a record by its id.
|
||||
|
||||
@@ -1133,7 +1133,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetRecordsByIds(self, getBatchRecordsRequest: GetBatchRecordsRequest):
|
||||
def GetRecordsByIds(self, getBatchRecordsRequest: GetBatchRecordsRequest) -> ApiResponse:
|
||||
"""
|
||||
Get records by their id.
|
||||
|
||||
@@ -1224,7 +1224,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def QueryRecords(self, queryRecordsRequest: QueryRecordsRequest):
|
||||
def QueryRecords(self, queryRecordsRequest: QueryRecordsRequest) -> ApiResponse:
|
||||
"""
|
||||
Get records based on a criteria.
|
||||
|
||||
@@ -1325,7 +1325,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def AddOrUpdateRecord(self, record: Record):
|
||||
def AddOrUpdateRecord(self, record: Record) -> ApiResponse:
|
||||
"""
|
||||
Add a new record or update a record by its id. Not including an id adds a new record.
|
||||
|
||||
@@ -1401,7 +1401,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def DeleteRecordsByIds(self, deleteBatchRecordsRequest: DeleteBatchRecordsRequest):
|
||||
def DeleteRecordsByIds(self, deleteBatchRecordsRequest: DeleteBatchRecordsRequest) -> ApiResponse:
|
||||
"""
|
||||
Delete records by their ids.
|
||||
|
||||
@@ -1467,7 +1467,7 @@ class OnspringClient:
|
||||
|
||||
# report methods
|
||||
|
||||
def GetReportById(self, getReportByIdRequest: GetReportByIdRequest):
|
||||
def GetReportById(self, getReportByIdRequest: GetReportByIdRequest) -> ApiResponse:
|
||||
"""
|
||||
Get a report by its id.
|
||||
|
||||
@@ -1548,7 +1548,7 @@ class OnspringClient:
|
||||
response.status_code,
|
||||
raw=response)
|
||||
|
||||
def GetReportsByAppId(self, appId: int, pagingRequest: PagingRequest=PagingRequest(1,50)):
|
||||
def GetReportsByAppId(self, appId: int, pagingRequest: PagingRequest=PagingRequest(1,50)) -> ApiResponse:
|
||||
"""
|
||||
Get reports for an app by its id..
|
||||
|
||||
|
||||
Reference in New Issue
Block a user