fix: added missing type hints

This commit is contained in:
Stevan Freeborn
2023-01-25 11:29:44 -06:00
parent e21a798dca
commit 533b8b7959
5 changed files with 323 additions and 298 deletions
+22 -22
View File
@@ -2,7 +2,7 @@ import uuid
# connectivity endpoints # connectivity endpoints
def GetPingEndpoint(baseUrl: str): def GetPingEndpoint(baseUrl: str) -> str:
""" """
Returns the ping endpoint. Returns the ping endpoint.
@@ -17,7 +17,7 @@ def GetPingEndpoint(baseUrl: str):
# app endpoints # app endpoints
def GetAppsEndpoint(baseUrl: str): def GetAppsEndpoint(baseUrl: str) -> str:
""" """
Returns the get apps endpoint. Returns the get apps endpoint.
@@ -30,7 +30,7 @@ def GetAppsEndpoint(baseUrl: str):
return f'{baseUrl}/Apps' return f'{baseUrl}/Apps'
def GetAppByIdEndpoint(baseUrl: str, appId: int): def GetAppByIdEndpoint(baseUrl: str, appId: int) -> str:
""" """
Returns the get app by id endpoint. Returns the get app by id endpoint.
@@ -44,7 +44,7 @@ def GetAppByIdEndpoint(baseUrl: str, appId: int):
return f'{baseUrl}/Apps/id/{appId}' return f'{baseUrl}/Apps/id/{appId}'
def GetAppsByIdsEndpoint(baseUrl: str): def GetAppsByIdsEndpoint(baseUrl: str) -> str:
""" """
Returns the get apps by ids endpoint. Returns the get apps by ids endpoint.
@@ -59,7 +59,7 @@ def GetAppsByIdsEndpoint(baseUrl: str):
# field endpoints # field endpoints
def GetFieldByIdEndpoint(baseUrl: str, fieldId: int): def GetFieldByIdEndpoint(baseUrl: str, fieldId: int) -> str:
""" """
Returns the get field by id endpoint. Returns the get field by id endpoint.
@@ -73,7 +73,7 @@ def GetFieldByIdEndpoint(baseUrl: str, fieldId: int):
return f'{baseUrl}/Fields/id/{fieldId}' return f'{baseUrl}/Fields/id/{fieldId}'
def GetFieldsByIdsEndpoint(baseUrl: str): def GetFieldsByIdsEndpoint(baseUrl: str) -> str:
""" """
Returns the get fields by ids endpoint. Returns the get fields by ids endpoint.
@@ -86,7 +86,7 @@ def GetFieldsByIdsEndpoint(baseUrl: str):
return f'{baseUrl}/Fields/batch-get' 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. Returns the get fields by app id endpoint.
@@ -102,7 +102,7 @@ def GetFieldsByAppIdEndpoint(baseUrl: str, appId: int):
# file endpoints # 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. 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}' 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. 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}' 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. 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' 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. Returns the save file endpoint.
@@ -165,7 +165,7 @@ def SaveFileEndpoint(baseUrl: str):
# list endpoints # list endpoints
def AddOrUpdateListItemEndpoint(baseUrl, listId: int): def AddOrUpdateListItemEndpoint(baseUrl, listId: int) -> str:
""" """
Returns the add or update list item endpoint. Returns the add or update list item endpoint.
@@ -179,7 +179,7 @@ def AddOrUpdateListItemEndpoint(baseUrl, listId: int):
return f'{baseUrl}/Lists/id/{listId}/items' 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. Returns the delete list item endpoint.
@@ -196,7 +196,7 @@ def DeleteListItemEndpoint(baseUrl: str, listId: int, itemId: uuid):
# record endpoints # record endpoints
def GetRecordsByAppIdEndpoint(baseUrl, appId: int): def GetRecordsByAppIdEndpoint(baseUrl, appId: int) -> str:
""" """
Returns the get records by app id endpoint. Returns the get records by app id endpoint.
@@ -210,7 +210,7 @@ def GetRecordsByAppIdEndpoint(baseUrl, appId: int):
return f'{baseUrl}/Records/appId/{appId}' 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. 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}' 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. 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}' return f'{baseUrl}/Records/appId/{appId}/recordId/{recordId}'
def GetRecordsByIdsEndpoint(baseUrl): def GetRecordsByIdsEndpoint(baseUrl) -> str:
""" """
Returns the get records by ids endpoint. Returns the get records by ids endpoint.
@@ -253,7 +253,7 @@ def GetRecordsByIdsEndpoint(baseUrl):
return f'{baseUrl}/Records/batch-get' return f'{baseUrl}/Records/batch-get'
def QueryRecordsEndpoint(baseUrl): def QueryRecordsEndpoint(baseUrl) -> str:
""" """
Returns the query records endpoint. Returns the query records endpoint.
@@ -266,7 +266,7 @@ def QueryRecordsEndpoint(baseUrl):
return f'{baseUrl}/Records/Query' return f'{baseUrl}/Records/Query'
def AddOrUpdateRecordEndpoint(baseUrl): def AddOrUpdateRecordEndpoint(baseUrl) -> str:
""" """
Returns the add or update record endpoint. Returns the add or update record endpoint.
@@ -279,7 +279,7 @@ def AddOrUpdateRecordEndpoint(baseUrl):
return f'{baseUrl}/Records' return f'{baseUrl}/Records'
def DeleteRecordsByIds(baseUrl): def DeleteRecordsByIds(baseUrl) -> str:
""" """
Returns the delete records by ids endpoint. Returns the delete records by ids endpoint.
@@ -294,7 +294,7 @@ def DeleteRecordsByIds(baseUrl):
# report endpoints # report endpoints
def GetReportByIdEndpoint(baseUrl, reportId: int): def GetReportByIdEndpoint(baseUrl, reportId: int) -> str:
""" """
Returns the get report by id endpoint. Returns the get report by id endpoint.
@@ -308,7 +308,7 @@ def GetReportByIdEndpoint(baseUrl, reportId: int):
return f'{baseUrl}/Reports/id/{reportId}' 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. Returns the get reports by app id endpoint.
+26 -26
View File
@@ -5,50 +5,50 @@ class DataFormat(Enum):
The possible data format types for record field values. The possible data format types for record field values.
""" """
Raw = 0 Raw:int = 0
Formatted = 1 Formatted:int = 1
class ReportDataType(Enum): class ReportDataType(Enum):
""" """
The possible report data types for reports. The possible report data types for reports.
""" """
ReportData = 0 ReportData:int = 0
ChartData = 1 ChartData:int = 1
class ResultValueType(Enum): class ResultValueType(Enum):
""" """
The possible types for record field values. The possible types for record field values.
""" """
String = 0 String:int = 0
Integer = 1 Integer:int = 1
Decimal = 2 Decimal:int = 2
Date = 3 Date:int = 3
TimeSpan = 4 TimeSpan:int = 4
Guid = 5 Guid:int = 5
StringList = 6 StringList:int = 6
IntegerList = 7 IntegerList:int = 7
GuidList = 8 GuidList:int = 8
AttachmentList = 9 AttachmentList:int = 9
ScoringGroupList = 10 ScoringGroupList:int = 10
FileList = 11 FileList:int = 11
class Increment(Enum): class Increment(Enum):
""" """
The possible values for the increment property of timespan data in an Onspring timespan field. The possible values for the increment property of timespan data in an Onspring timespan field.
""" """
Seconds = "Second(s)" Seconds:str = "Second(s)"
Minutes = "Minute(s)" Minutes:str = "Minute(s)"
Hours = "Hour(s)" Hours:str = "Hour(s)"
Days = "Day(s)" Days:str = "Day(s)"
Weeks = "Week(s)" Weeks:str = "Week(s)"
Months = "Month(s)" Months:str = "Month(s)"
Years = "Year(s)" Years:str = "Year(s)"
class Recurrence(Enum): class Recurrence(Enum):
""" """
The possible values for the recurrence property of timespan data in an Onspring timespan field. The possible values for the recurrence property of timespan data in an Onspring timespan field.
""" """
Empty = "None" Empty:str = "None"
EndByDate = "EndByDate" EndByDate:str = "EndByDate"
EndAfterOccurrences = 'EndAfterOccurrences' EndAfterOccurrences:str = 'EndAfterOccurrences'
+1 -1
View File
@@ -1,7 +1,7 @@
from datetime import datetime from datetime import datetime
from OnspringApiSdk.Enums import * from OnspringApiSdk.Enums import *
def parseDate(date: str): def parseDate(date: str) -> datetime:
if date==None: if date==None:
return None return None
+252 -227
View File
@@ -5,26 +5,9 @@ from OnspringApiSdk.Enums import *
from decimal import Decimal from decimal import Decimal
from datetime import datetime from datetime import datetime
from OnspringApiSdk.Helpers import parseDate from OnspringApiSdk.Helpers import parseDate
from requests import Response
# generic # paging
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
class PagingRequest: class PagingRequest:
""" """
@@ -36,8 +19,8 @@ class PagingRequest:
""" """
def __init__(self, pageNumber: int, pageSize: int): def __init__(self, pageNumber: int, pageSize: int):
self.pageNumber = pageNumber self.pageNumber:int = pageNumber
self.pageSize = pageSize self.pageSize:int = pageSize
#app specific #app specific
@@ -52,9 +35,9 @@ class App:
""" """
def __init__(self, href: str, id: int, name: str): def __init__(self, href: str, id: int, name: str):
self.href = href self.href:str = href
self.id = id self.id:int = id
self.name = name self.name:str = name
class GetAppsResponse: class GetAppsResponse:
""" """
@@ -69,11 +52,11 @@ class GetAppsResponse:
""" """
def __init__(self, pageNumber: int, pageSize: int, totalPages:int , totalRecords: int, apps: list[App]): def __init__(self, pageNumber: int, pageSize: int, totalPages:int , totalRecords: int, apps: list[App]):
self.pageNumber = pageNumber self.pageNumber:int = pageNumber
self.pageSize = pageSize self.pageSize:int = pageSize
self.totalPages = totalPages self.totalPages:int = totalPages
self.totalRecords = totalRecords self.totalRecords:int = totalRecords
self.apps = apps self.apps:list[App] = apps
class GetAppByIdResponse: class GetAppByIdResponse:
""" """
@@ -84,7 +67,7 @@ class GetAppByIdResponse:
""" """
def __init__(self, app: App): def __init__(self, app: App):
self.app = app self.app:App = app
class GetAppsByIdsResponse: class GetAppsByIdsResponse:
""" """
@@ -96,8 +79,8 @@ class GetAppsByIdsResponse:
""" """
def __init__(self, count: int, apps: list[App]): def __init__(self, count: int, apps: list[App]):
self.count = count self.count:int = count
self.apps = apps self.apps:list[App] = apps
# field specific # field specific
@@ -114,18 +97,18 @@ class ListValue:
""" """
def __init__(self, id: int, name: str, sortOrder: int, numericValue: Decimal, color: str): def __init__(self, id: int, name: str, sortOrder: int, numericValue: Decimal, color: str):
self.id = id self.id:int = id
self.name = name self.name:str = name
self.sortOrder = sortOrder self.sortOrder:int = sortOrder
if numericValue != None: if numericValue != None:
self.numericValue = Decimal(numericValue) self.numericValue:Decimal = Decimal(numericValue)
else: 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. 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 outputType: str=None
): ):
self.id = id self.id:int = id
self.appId = appId self.appId:int = appId
self.name = name self.name:str = name
self.type = type self.type:str = type
self.status = status self.status:str = status
self.isRequired = isRequired self.isRequired:bool = isRequired
self.isUnique = isUnique self.isUnique:bool = isUnique
self.listId = listId self.listId:int = listId
self.values = values self.values:list[ListValue] = values
self.outputType = outputType self.outputType:str = outputType
self.multiplicity = multiplicity self.multiplicity:str = multiplicity
class GetFieldByIdResponse: class GetFieldByIdResponse:
""" """
@@ -191,7 +174,7 @@ class GetFieldByIdResponse:
""" """
def __init__(self, field: Field): def __init__(self, field: Field):
self.field = field self.field:Field = field
class GetFieldsByIdsResponse: class GetFieldsByIdsResponse:
""" """
@@ -203,8 +186,8 @@ class GetFieldsByIdsResponse:
""" """
def __init__(self, count: int, fields: list[Field]): def __init__(self, count: int, fields: list[Field]):
self.count = count self.count:int = count
self.fields = fields self.fields:list[Field] = fields
class GetFieldsByAppIdResponse: class GetFieldsByAppIdResponse:
""" """
@@ -219,11 +202,11 @@ class GetFieldsByAppIdResponse:
""" """
def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, fields: list[Field]): def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, fields: list[Field]):
self.pageNumber = pageNumber self.pageNumber:int = pageNumber
self.pageSize = pageSize self.pageSize:int = pageSize
self.totalPages = totalPages self.totalPages:int = totalPages
self.totalRecords = totalRecords self.totalRecords:int = totalRecords
self.fields = fields self.fields:list[Field] = fields
# file specific # file specific
@@ -239,10 +222,10 @@ class File:
""" """
def __init__(self, name: str, contentType: str, contentLength: int, content: bytes): def __init__(self, name: str, contentType: str, contentLength: int, content: bytes):
self.name = name self.name:str = name
self.contentType = contentType self.contentType:str = contentType
self.contentLength = contentLength self.contentLength:int = contentLength
self.content = content self.content:bytes = content
class FileInfo: 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): def __init__(self, type: str, contentType: str, name: str, createdDate: datetime, modifiedDate: datetime, owner: str, fileHref: str):
self.type = type self.type:str = type
self.contentType = contentType self.contentType:str = contentType
self.name = name self.name:str = name
self.createdDate = createdDate self.createdDate:datetime = createdDate
self.modifiedDate = modifiedDate self.modifiedDate:datetime = modifiedDate
self.owner = owner self.owner:str = owner
self.fileHref = fileHref self.fileHref:str = fileHref
class GetFileInfoByIdResponse: class GetFileInfoByIdResponse:
""" """
@@ -276,7 +259,7 @@ class GetFileInfoByIdResponse:
""" """
def __init__(self, fileInfo: FileInfo): def __init__(self, fileInfo: FileInfo):
self.fileInfo = fileInfo self.fileInfo:FileInfo = fileInfo
class GetFileByIdResponse: class GetFileByIdResponse:
""" """
@@ -287,7 +270,7 @@ class GetFileByIdResponse:
""" """
def __init__(self, file: File): def __init__(self, file: File):
self.file = file self.file:File = file
class SaveFileRequest: class SaveFileRequest:
""" """
@@ -303,13 +286,13 @@ class SaveFileRequest:
notes (`datetime`): An optional date noting when the file was modified. 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): def __init__(self, recordId: int, fieldId: int, fileName: str, filePath: str, contentType: str, notes: str=None, modifiedDate: datetime=None):
self.recordId = recordId self.recordId:int = recordId
self.fieldId = fieldId self.fieldId:int = fieldId
self.notes = notes self.notes:str = notes
self.modifiedDate = modifiedDate self.modifiedDate:datetime = modifiedDate
self.fileName = fileName self.fileName:str = fileName
self.filePath = filePath self.filePath:str = filePath
self.contentType = contentType self.contentType:str = contentType
class SaveFileResponse: class SaveFileResponse:
""" """
@@ -320,7 +303,7 @@ class SaveFileResponse:
""" """
def __init__(self, id: int): def __init__(self, id: int):
self.id = id self.id:int = id
# list specific # list specific
@@ -336,12 +319,12 @@ class ListItemRequest:
color (`str`): The color value assigned to the list value. 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): def __init__(self, listId: int, name: str, id: uuid.UUID=None, numericValue: int=None, color: str=None):
self.listId = listId self.listId:int = listId
self.name = name self.name:str = name
self.id = id self.id:uuid.UUID = id
self.numericValue = numericValue self.numericValue:int = numericValue
self.color = color self.color:str = color
class AddOrUpdateListItemResponse: class AddOrUpdateListItemResponse:
""" """
@@ -351,11 +334,73 @@ class AddOrUpdateListItemResponse:
id (`int`): The id of the list value updated or added in Onspring. id (`int`): The id of the list value updated or added in Onspring.
""" """
def __init__(self, id: uuid): def __init__(self, id: uuid.UUID):
self.id = id self.id:uuid.UUID = id
# record specific # 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: class RecordFieldValue:
""" """
An object to represent the value in a field in an Onspring record. 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. type (`str`): The type of value.
""" """
def __init__(self, fieldId: int, value: str, type: str=None): def __init__(self, fieldId: int, value, type: str=None):
self.fieldId = fieldId self.fieldId:int = fieldId
self.value = value 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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 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`. 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: if self.type != ResultValueType.ScoringGroupList.name:
return return None
scoringGroups = [] scoringGroups = []
@@ -603,7 +648,7 @@ class RecordFieldValue:
return ScoringGroupListValue(self.fieldId, scoringGroups).value 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`. 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 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. Will determine the appropriate way to return the fields value based on it's type.
@@ -671,7 +716,7 @@ class RecordFieldValue:
else: else:
return None return None
def GetResultValueString(self): def GetResultValueString(self) -> str:
""" """
Will return the value property regardless of the field value's type as a string. 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): def __init__(self, appId: int, fields: list[RecordFieldValue], recordId: int=None):
self.appId = appId self.appId:int = appId
self.recordId = recordId self.recordId:recordId = recordId
self.fields = fields self.fields:list[RecordFieldValue] = fields
class GetRecordsByAppRequest: 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)): def __init__(self, appId: int, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name, pagingRequest: PagingRequest=PagingRequest(1,50)):
self.appId = appId self.appId:int = appId
self.fieldIds = fieldIds self.fieldIds:list[int] = fieldIds
self.dataFormat = dataFormat self.dataFormat:str = dataFormat
self.pageSize = pagingRequest.pageSize self.pageSize:int = pagingRequest.pageSize
self.pageNumber = pagingRequest.pageNumber self.pageNumber:int = pagingRequest.pageNumber
class QueryRecordsRequest: 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)): def __init__(self, appId: int, filter: str, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name, pagingRequest: PagingRequest=PagingRequest(1,50)):
self.appId = appId self.appId:int = appId
self.filter = filter self.filter:str = filter
self.fieldIds = fieldIds self.fieldIds:list[int] = fieldIds
self.dataFormat = dataFormat self.dataFormat:str = dataFormat
self.pagingRequest = pagingRequest self.pagingRequest:PagingRequest = pagingRequest
class GetRecordsResponse: class GetRecordsResponse:
""" """
@@ -806,11 +851,11 @@ class GetRecordsResponse:
""" """
def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, records: list[Record]): def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, records: list[Record]):
self.pageNumber = pageNumber self.pageNumber:int = pageNumber
self.pageSize = pageSize self.pageSize:int = pageSize
self.totalPages = totalPages self.totalPages:int = totalPages
self.totalRecords = totalRecords self.totalRecords:int = totalRecords
self.records = records self.records:list[Record] = records
class GetRecordByIdRequest: class GetRecordByIdRequest:
""" """
@@ -823,10 +868,10 @@ class GetRecordByIdRequest:
dataFormat (`str`): The format of the response data. dataFormat (`str`): The format of the response data.
""" """
def __init__(self, appId: int, recordId: int, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name): def __init__(self, appId: int, recordId: int, fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name):
self.appId = appId self.appId:int = appId
self.recordId = recordId self.recordId:int = recordId
self.fieldIds = fieldIds self.fieldIds:list[int] = fieldIds
self.dataFormat = dataFormat self.dataFormat:str = dataFormat
class GetBatchRecordsRequest: class GetBatchRecordsRequest:
""" """
@@ -840,10 +885,10 @@ class GetBatchRecordsRequest:
""" """
def __init__(self, appId: int, recordIds: list[int], fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name): def __init__(self, appId: int, recordIds: list[int], fieldIds: list[int]=[], dataFormat: str=DataFormat.Raw.name):
self.appId = appId self.appId:int = appId
self.recordIds = recordIds self.recordIds:list[int] = recordIds
self.fieldIds = fieldIds self.fieldIds:list[int] = fieldIds
self.dataFormat = dataFormat self.dataFormat:str = dataFormat
class GetBatchRecordsResponse: class GetBatchRecordsResponse:
""" """
@@ -855,8 +900,8 @@ class GetBatchRecordsResponse:
""" """
def __init__(self, count: int, records: list[Record]): def __init__(self, count: int, records: list[Record]):
self.count = count self.count:int = count
self.records = records self.records:list[Record] = records
class AddOrUpdateRecordResponse: class AddOrUpdateRecordResponse:
""" """
@@ -868,8 +913,8 @@ class AddOrUpdateRecordResponse:
""" """
def __init__(self, id: int, warnings: list[str]=[]): def __init__(self, id: int, warnings: list[str]=[]):
self.id = id self.id:int = id
self.warnings = warnings self.warnings:list[str] = warnings
class DeleteBatchRecordsRequest: class DeleteBatchRecordsRequest:
""" """
@@ -881,8 +926,8 @@ class DeleteBatchRecordsRequest:
""" """
def __init__(self, appId: int, recordIds: list[int]): def __init__(self, appId: int, recordIds: list[int]):
self.appId = appId self.appId:int = appId
self.recordIds = recordIds self.recordIds:list[int] = recordIds
# field types # field types
@@ -897,7 +942,7 @@ class StringFieldValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value): def __init__(self, fieldId: int, value):
self.type = ResultValueType.String.name self.type:str = ResultValueType.String.name
RecordFieldValue.__init__(self, fieldId, value, self.type) RecordFieldValue.__init__(self, fieldId, value, self.type)
class IntegerFieldValue(RecordFieldValue): class IntegerFieldValue(RecordFieldValue):
@@ -911,7 +956,7 @@ class IntegerFieldValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: int): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class DecimalFieldValue(RecordFieldValue): class DecimalFieldValue(RecordFieldValue):
@@ -925,7 +970,7 @@ class DecimalFieldValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: Decimal): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class DateFieldValue(RecordFieldValue): class DateFieldValue(RecordFieldValue):
@@ -939,7 +984,7 @@ class DateFieldValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: datetime): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class GuidFieldValue(RecordFieldValue): class GuidFieldValue(RecordFieldValue):
@@ -953,37 +998,9 @@ class GuidFieldValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: uuid.UUID): 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) 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): class TimeSpanValue(RecordFieldValue):
""" """
An object to represent an Onspring field value of the TimeSpan type. 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): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class StringListValue(RecordFieldValue): class StringListValue(RecordFieldValue):
@@ -1009,7 +1026,7 @@ class StringListValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: list[str]): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class IntegerListValue(RecordFieldValue): class IntegerListValue(RecordFieldValue):
@@ -1023,7 +1040,7 @@ class IntegerListValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: list[int]): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class GuidListValue(RecordFieldValue): class GuidListValue(RecordFieldValue):
@@ -1037,26 +1054,9 @@ class GuidListValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: list[uuid.UUID]): 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) 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): class AttachmentListValue(RecordFieldValue):
""" """
An object to represent an Onspring field value of the AttachmentList type. 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]): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
class FileListValue(RecordFieldValue): class FileListValue(RecordFieldValue):
@@ -1082,26 +1082,9 @@ class FileListValue(RecordFieldValue):
""" """
def __init__(self, fieldId: int, value: list[int]): 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) 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): class ScoringGroupListValue(RecordFieldValue):
""" """
An object to represent an Onspring field value of the ScoringGroupList type. 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]): 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) RecordFieldValue.__init__(self, fieldId, value, self.type)
# report specific # report specific
@@ -1129,9 +1112,9 @@ class GetReportByIdRequest:
""" """
def __init__(self, reportId: int, apiDataFormat: str=DataFormat.Raw.name, dataType: str=ReportDataType.ReportData.name): def __init__(self, reportId: int, apiDataFormat: str=DataFormat.Raw.name, dataType: str=ReportDataType.ReportData.name):
self.reportId = reportId self.reportId:int = reportId
self.apiDataFormat = apiDataFormat self.apiDataFormat:str = apiDataFormat
self.dataType = dataType self.dataType:str = dataType
class Row: class Row:
""" """
@@ -1143,8 +1126,8 @@ class Row:
""" """
def __init__(self, recordId: int, cells: list[str]): def __init__(self, recordId: int, cells: list[str]):
self.recordId = recordId self.recordId:int = recordId
self.cells = cells self.cells:list[str] = cells
class GetReportByIdResponse: class GetReportByIdResponse:
""" """
@@ -1156,8 +1139,8 @@ class GetReportByIdResponse:
""" """
def __init__(self, columns: list[str], rows: list[Row]): def __init__(self, columns: list[str], rows: list[Row]):
self.columns = columns self.columns:list[str] = columns
self.rows = rows self.rows:list[Row] = rows
class Report: class Report:
""" """
@@ -1171,10 +1154,10 @@ class Report:
""" """
def __init__(self, appId: int, id: int, name: str, description: str): def __init__(self, appId: int, id: int, name: str, description: str):
self.appId = appId self.appId:int = appId
self.id = id self.id:int = id
self.name = name self.name:str = name
self.description = description self.description:str = description
class GetReportsByAppIdResponse: class GetReportsByAppIdResponse:
""" """
@@ -1189,8 +1172,50 @@ class GetReportsByAppIdResponse:
""" """
def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, reports: list[Report]): def __init__(self, pageNumber: int, pageSize: int, totalPages: int, totalRecords: int, reports: list[Report]):
self.pageNumber = pageNumber self.pageNumber:int = pageNumber
self.pageSize = pageSize self.pageSize:int = pageSize
self.totalPages = totalPages self.totalPages:int = totalPages
self.totalRecords = totalRecords self.totalRecords:int = totalRecords
self.reports = reports 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 -22
View File
@@ -22,7 +22,7 @@ class OnspringClient:
# connectivity methods # connectivity methods
def CanConnect(self): def CanConnect(self) -> bool:
""" """
Verifies if the API is reachable by calling the ping endpoint. Verifies if the API is reachable by calling the ping endpoint.
@@ -43,7 +43,7 @@ class OnspringClient:
# app methods # app methods
def GetApps(self, pagingRequest=PagingRequest(1, 50)): def GetApps(self, pagingRequest=PagingRequest(1, 50)) -> ApiResponse:
""" """
Gets all accessible apps for client. Gets all accessible apps for client.
@@ -109,7 +109,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def GetAppById(self, appId: int): def GetAppById(self, appId: int) -> ApiResponse:
""" """
Get an app by it's id. Get an app by it's id.
@@ -168,7 +168,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def GetAppsByIds(self, appIds: list): def GetAppsByIds(self, appIds: list) -> ApiResponse:
""" """
Get a set of apps by their ids. Get a set of apps by their ids.
@@ -243,7 +243,7 @@ class OnspringClient:
# field methods # field methods
def GetFieldById(self, fieldId: int): def GetFieldById(self, fieldId: int) -> ApiResponse:
""" """
Get a field by it's id. Get a field by it's id.
@@ -329,7 +329,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def GetFieldsByIds(self, fieldIds: list): def GetFieldsByIds(self, fieldIds: list) -> ApiResponse:
""" """
Get a set of fields by their ids. Get a set of fields by their ids.
@@ -413,7 +413,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) 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. Get all fields for an app.
@@ -488,7 +488,7 @@ class OnspringClient:
# file methods # 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. Get the metadata information for a file.
@@ -567,7 +567,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) 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. Delete a file by its id.
@@ -632,7 +632,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) 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. Get a file by its id.
@@ -710,7 +710,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def SaveFile(self, saveFileRequest: SaveFileRequest): def SaveFile(self, saveFileRequest: SaveFileRequest) -> ApiResponse:
""" """
Delete a file by its id. Delete a file by its id.
@@ -784,7 +784,7 @@ class OnspringClient:
# list methods # list methods
def AddOrUpdateListItem(self, listItemRequest: ListItemRequest): def AddOrUpdateListItem(self, listItemRequest: ListItemRequest) -> ApiResponse:
""" """
Add or update a list value by its id. Add or update a list value by its id.
@@ -853,7 +853,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) 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. Delete a list value by its id and it's parent list id.
@@ -908,7 +908,7 @@ class OnspringClient:
# record methods # record methods
def GetRecordsByAppId(self, getRecordsByAppRequest: GetRecordsByAppRequest): def GetRecordsByAppId(self, getRecordsByAppRequest: GetRecordsByAppRequest) -> ApiResponse:
""" """
Get all the records for an app by its id. Get all the records for an app by its id.
@@ -1002,7 +1002,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def GetRecordById(self, getRecordByIdRequest: GetRecordByIdRequest): def GetRecordById(self, getRecordByIdRequest: GetRecordByIdRequest) -> ApiResponse:
""" """
Get a record by its id. Get a record by its id.
@@ -1080,7 +1080,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def DeleteRecordById(self, appId: int, recordId: int): def DeleteRecordById(self, appId: int, recordId: int) -> ApiResponse:
""" """
Delete a record by its id. Delete a record by its id.
@@ -1133,7 +1133,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def GetRecordsByIds(self, getBatchRecordsRequest: GetBatchRecordsRequest): def GetRecordsByIds(self, getBatchRecordsRequest: GetBatchRecordsRequest) -> ApiResponse:
""" """
Get records by their id. Get records by their id.
@@ -1224,7 +1224,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) raw=response)
def QueryRecords(self, queryRecordsRequest: QueryRecordsRequest): def QueryRecords(self, queryRecordsRequest: QueryRecordsRequest) -> ApiResponse:
""" """
Get records based on a criteria. Get records based on a criteria.
@@ -1325,7 +1325,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) 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. 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, response.status_code,
raw=response) raw=response)
def DeleteRecordsByIds(self, deleteBatchRecordsRequest: DeleteBatchRecordsRequest): def DeleteRecordsByIds(self, deleteBatchRecordsRequest: DeleteBatchRecordsRequest) -> ApiResponse:
""" """
Delete records by their ids. Delete records by their ids.
@@ -1467,7 +1467,7 @@ class OnspringClient:
# report methods # report methods
def GetReportById(self, getReportByIdRequest: GetReportByIdRequest): def GetReportById(self, getReportByIdRequest: GetReportByIdRequest) -> ApiResponse:
""" """
Get a report by its id. Get a report by its id.
@@ -1548,7 +1548,7 @@ class OnspringClient:
response.status_code, response.status_code,
raw=response) 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.. Get reports for an app by its id..