continue adding doc strings

This commit is contained in:
StevanFreeborn
2022-04-28 11:51:04 -05:00
parent 9cf44fe0f9
commit 3e5882d027
+64
View File
@@ -105,6 +105,17 @@ class GetAppsByIdsResponse:
# field specific # field specific
class ListValue: class ListValue:
"""
An object to represent an Onspring list value.
Attributes:
id (`int`): The id of the Onspring list value.
name (`str`): The list value's name.
sortOrder (`int`): The list value's sort order in respect to other values in the same list.
numericalValue (`Decimal`): The numeric value assigned to the list value.
color (`str`): The color assigned to the list value.
"""
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 = id
self.name = name self.name = name
@@ -118,9 +129,36 @@ class ListValue:
self.color = color self.color = color
def AsString(self): def AsString(self):
"""
Gets the list value as a comma separated string of it's properties and their values.
Args:
None
Returns:
A `str` representation of the list value object.
"""
return f'Id: {self.id}, Name: {self.name}, Value: {self.numericValue}, Sort Order: {self.sortOrder}, Color: {self.color}' return f'Id: {self.id}, Name: {self.name}, Value: {self.numericValue}, Sort Order: {self.sortOrder}, Color: {self.color}'
class Field: class Field:
"""
An object to represent an Onspring field.
Attributes:
id (`int`): The id of the Onspring field.
appId ('int'): The id of the Onspring app where the field resides.
name (`str`): The name of the field.
type (`str`): The type of the field.
status (`str`): The stuat of the field.
isRequired (`bool`): Indicates whether the field is required in Onspring or not.
isUnique (`bool`): Indicates whether the field requires unique values in Onspring or not.
listId (`int`): The id of the fields list if applicable. Used for list fields and formula fields with list output type.
values (`list[Models.ListValue]`): The values of the fields list if applicable. Used for list fields and formula fields with list output type.
multiplicity (`str`): The multiplicity of the field if applicable. Used for list fields, reference fields, and formula fields with a list output type.
outputType (`str`): The output type of the field if applicable. Used for formula fields.
"""
def __init__( def __init__(
self, id: int, self, id: int,
appId: int, appId: int,
@@ -148,15 +186,41 @@ class Field:
self.multiplicity = multiplicity self.multiplicity = multiplicity
class GetFieldByIdResponse: class GetFieldByIdResponse:
"""
An object to represent a response to a request made by an `OnspringClient` to request a `Models.Field`.
Attributes:
field (`Models.Field`): The requested field.
"""
def __init__(self, field: Field): def __init__(self, field: Field):
self.field = field self.field = field
class GetFieldsByIdsResponse: class GetFieldsByIdsResponse:
"""
An object to represent a response to a request made by an `OnspringClient` to request a collection of `Models.App`s.
Attributes:
count (`int`): The number of fields requested.
fields (`list[Models.Field]`): The fields requested.
"""
def __init__(self, count: int, fields: list[Field]): def __init__(self, count: int, fields: list[Field]):
self.count = count self.count = count
self.fields = fields self.fields = fields
class GetFieldsByAppIdResponse: class GetFieldsByAppIdResponse:
"""
An object to represent a paginated response to a request made by an `OnspringClient` to request a collection of `Models.Field`s.
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.
fields (`list[Models.Field]`): The fields requested.
"""
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 = pageNumber
self.pageSize = pageSize self.pageSize = pageSize