finished adding doc strings to models
This commit is contained in:
@@ -1,14 +1,24 @@
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
class DataFormat(Enum):
|
class DataFormat(Enum):
|
||||||
|
"""
|
||||||
|
The possible data format types for record field values.
|
||||||
|
"""
|
||||||
|
|
||||||
Raw = 0
|
Raw = 0
|
||||||
Formatted = 1
|
Formatted = 1
|
||||||
|
|
||||||
class ReportDataType(Enum):
|
class ReportDataType(Enum):
|
||||||
|
"""
|
||||||
|
The possible report data types for reports.
|
||||||
|
"""
|
||||||
ReportData = 0
|
ReportData = 0
|
||||||
ChartData = 1
|
ChartData = 1
|
||||||
|
|
||||||
class ResultValueType(Enum):
|
class ResultValueType(Enum):
|
||||||
|
"""
|
||||||
|
The possible types for record field values.
|
||||||
|
"""
|
||||||
String = 0
|
String = 0
|
||||||
Integer = 1
|
Integer = 1
|
||||||
Decimal = 2
|
Decimal = 2
|
||||||
@@ -23,6 +33,9 @@ class ResultValueType(Enum):
|
|||||||
FileList = 11
|
FileList = 11
|
||||||
|
|
||||||
class Increment(Enum):
|
class Increment(Enum):
|
||||||
|
"""
|
||||||
|
The possible values for the increment property of timespan data in an Onspring timespan field.
|
||||||
|
"""
|
||||||
Seconds = "Second(s)"
|
Seconds = "Second(s)"
|
||||||
Minutes = "Minute(s)"
|
Minutes = "Minute(s)"
|
||||||
Hours = "Hour(s)"
|
Hours = "Hour(s)"
|
||||||
@@ -32,6 +45,9 @@ class Increment(Enum):
|
|||||||
Years = "Year(s)"
|
Years = "Year(s)"
|
||||||
|
|
||||||
class Recurrence(Enum):
|
class Recurrence(Enum):
|
||||||
|
"""
|
||||||
|
The possible values for the recurrence property of timespan data in an Onspring timespan field.
|
||||||
|
"""
|
||||||
Empty = "None"
|
Empty = "None"
|
||||||
EndByDate = "EndByDate"
|
EndByDate = "EndByDate"
|
||||||
EndAfterOccurrences = 'EndAfterOccurrences'
|
EndAfterOccurrences = 'EndAfterOccurrences'
|
||||||
|
|||||||
@@ -887,31 +887,87 @@ class DeleteBatchRecordsRequest:
|
|||||||
# field types
|
# field types
|
||||||
|
|
||||||
class StringFieldValue(RecordFieldValue):
|
class StringFieldValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the String type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`str`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value):
|
def __init__(self, fieldId: int, value):
|
||||||
self.type = ResultValueType.String.name
|
self.type = ResultValueType.String.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class IntegerFieldValue(RecordFieldValue):
|
class IntegerFieldValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the Integer type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`int`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: int):
|
def __init__(self, fieldId: int, value: int):
|
||||||
self.type = ResultValueType.Integer.name
|
self.type = ResultValueType.Integer.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class DecimalFieldValue(RecordFieldValue):
|
class DecimalFieldValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the Decimal type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`Decimal`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: Decimal):
|
def __init__(self, fieldId: int, value: Decimal):
|
||||||
self.type = ResultValueType.Decimal.name
|
self.type = ResultValueType.Decimal.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class DateFieldValue(RecordFieldValue):
|
class DateFieldValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the Date type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`datetime`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: datetime):
|
def __init__(self, fieldId: int, value: datetime):
|
||||||
self.type = ResultValueType.Date.name
|
self.type = ResultValueType.Date.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class GuidFieldValue(RecordFieldValue):
|
class GuidFieldValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the Guid type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`UUID`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: uuid.UUID):
|
def __init__(self, fieldId: int, value: uuid.UUID):
|
||||||
self.type = ResultValueType.Guid.name
|
self.type = ResultValueType.Guid.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class TimeSpanData:
|
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):
|
def __init__(self, quantity: Decimal, increment: Increment, recurrence: Recurrence=None, endByDate: datetime=None, endAfterOccurrences: int=None):
|
||||||
self.quantity = quantity
|
self.quantity = quantity
|
||||||
self.increment = increment
|
self.increment = increment
|
||||||
@@ -929,26 +985,72 @@ class TimeSpanData:
|
|||||||
return f'{self.quantity} {self.increment}'
|
return f'{self.quantity} {self.increment}'
|
||||||
|
|
||||||
class TimeSpanValue(RecordFieldValue):
|
class TimeSpanValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the TimeSpan type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`Models.TimeSpanData`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: TimeSpanData):
|
def __init__(self, fieldId: int, value: TimeSpanData):
|
||||||
self.type = ResultValueType.TimeSpan.name
|
self.type = ResultValueType.TimeSpan.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class StringListValue(RecordFieldValue):
|
class StringListValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the StringList type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`list[str]`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: list[str]):
|
def __init__(self, fieldId: int, value: list[str]):
|
||||||
self.type = ResultValueType.StringList.name
|
self.type = ResultValueType.StringList.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class IntegerListValue(RecordFieldValue):
|
class IntegerListValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the IntegerList type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`list[int]`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: list[int]):
|
def __init__(self, fieldId: int, value: list[int]):
|
||||||
self.type = ResultValueType.IntegerList.name
|
self.type = ResultValueType.IntegerList.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class GuidListValue(RecordFieldValue):
|
class GuidListValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the GuidList type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`list[UUID]`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
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 = ResultValueType.GuidList.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class Attachment:
|
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):
|
def __init__(self, fileId: int, fileName: str, notes: str, storageLocation: str):
|
||||||
self.fileId = fileId
|
self.fileId = fileId
|
||||||
self.fileName = fileName
|
self.fileName = fileName
|
||||||
@@ -956,16 +1058,44 @@ class Attachment:
|
|||||||
self.storageLocation = storageLocation
|
self.storageLocation = storageLocation
|
||||||
|
|
||||||
class AttachmentListValue(RecordFieldValue):
|
class AttachmentListValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the AttachmentList type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`list[Models.Attachment]`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: list[Attachment]):
|
def __init__(self, fieldId: int, value: list[Attachment]):
|
||||||
self.type = ResultValueType.AttachmentList.name
|
self.type = ResultValueType.AttachmentList.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class FileListValue(RecordFieldValue):
|
class FileListValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the FileList type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`list[int]`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: list[int]):
|
def __init__(self, fieldId: int, value: list[int]):
|
||||||
self.type = ResultValueType.FileList.name
|
self.type = ResultValueType.FileList.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class ScoringGroup:
|
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):
|
def __init__(self, listValueId: uuid.UUID, name: str, score: Decimal, maximumScore: Decimal):
|
||||||
self.listValueId = listValueId
|
self.listValueId = listValueId
|
||||||
self.name = name
|
self.name = name
|
||||||
@@ -973,6 +1103,15 @@ class ScoringGroup:
|
|||||||
self.maximumScore = maximumScore
|
self.maximumScore = maximumScore
|
||||||
|
|
||||||
class ScoringGroupListValue(RecordFieldValue):
|
class ScoringGroupListValue(RecordFieldValue):
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring field value of the ScoringGroupList type.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fieldId (`int`): The id of the field that the value is in.
|
||||||
|
value (`list[Models.ScoringGroup]`): The value of the field.
|
||||||
|
type (`str`): The type of value.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fieldId: int, value: list[ScoringGroup]):
|
def __init__(self, fieldId: int, value: list[ScoringGroup]):
|
||||||
self.type = ResultValueType.ScoringGroupList.name
|
self.type = ResultValueType.ScoringGroupList.name
|
||||||
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
@@ -980,22 +1119,57 @@ class ScoringGroupListValue(RecordFieldValue):
|
|||||||
# report specific
|
# report specific
|
||||||
|
|
||||||
class GetReportByIdRequest:
|
class GetReportByIdRequest:
|
||||||
|
"""
|
||||||
|
An object to represent the necessary information to make a successful request to get a report by it's id.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
reportId (`int`): The id of the report.
|
||||||
|
apiDataFormat (`str`): The format of the data in the report.
|
||||||
|
dataType (`str`): The data type for the report.
|
||||||
|
"""
|
||||||
|
|
||||||
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 = reportId
|
||||||
self.apiDataFormat = apiDataFormat
|
self.apiDataFormat = apiDataFormat
|
||||||
self.dataType = dataType
|
self.dataType = dataType
|
||||||
|
|
||||||
class Row:
|
class Row:
|
||||||
|
"""
|
||||||
|
An object to represent a row of an Onspring report.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
recordId (`int`): The id of the record who's data is held in the row.
|
||||||
|
cells (`list[str]`): The record field values held in the row.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, recordId: int, cells: list[str]):
|
def __init__(self, recordId: int, cells: list[str]):
|
||||||
self.recordId = recordId
|
self.recordId = recordId
|
||||||
self.cells = cells
|
self.cells = cells
|
||||||
|
|
||||||
class GetReportByIdResponse:
|
class GetReportByIdResponse:
|
||||||
|
"""
|
||||||
|
An object to represent the response to a request made by an `OnspringClient` to get a report by its id.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
columns (`list[int]`): Values indicating the columns in the report.
|
||||||
|
rows (`list[Models.Row]`): A collection of rows representing the records in the report.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, columns: list[str], rows: list[Row]):
|
def __init__(self, columns: list[str], rows: list[Row]):
|
||||||
self.columns = columns
|
self.columns = columns
|
||||||
self.rows = rows
|
self.rows = rows
|
||||||
|
|
||||||
class Report:
|
class Report:
|
||||||
|
"""
|
||||||
|
An object to represent an Onspring report.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
appId (`int`): The id of the app the report resides in.
|
||||||
|
id (`int`): The id of the report.
|
||||||
|
name (`str`): The name of the report.
|
||||||
|
description (`str`): The description for the 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 = appId
|
||||||
self.id = id
|
self.id = id
|
||||||
@@ -1003,6 +1177,17 @@ class Report:
|
|||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
class GetReportsByAppIdResponse:
|
class GetReportsByAppIdResponse:
|
||||||
|
"""
|
||||||
|
An object to represent the response to a request made by an `OnspringClient` to get a collection of reports by an app id.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
pageNumber (`int`): The page number returned.
|
||||||
|
pageSize (`int`): The size of the page returned.
|
||||||
|
totalPages (`int`): The total number of pages for the request.
|
||||||
|
totalRecords (`int`): The total records for the request.
|
||||||
|
reports (`list[Models.Report]`): The requested reports for the current page.
|
||||||
|
"""
|
||||||
|
|
||||||
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 = pageNumber
|
||||||
self.pageSize = pageSize
|
self.pageSize = pageSize
|
||||||
|
|||||||
Reference in New Issue
Block a user