more doc strings
This commit is contained in:
+22
@@ -102,6 +102,28 @@ def PrintGetFieldById(client: OnspringClient, fieldId: int):
|
|||||||
|
|
||||||
# files
|
# files
|
||||||
|
|
||||||
|
def PrintGetFileById(client: OnspringClient, recordId: int, fieldId: int, fileId: int):
|
||||||
|
|
||||||
|
response = client.GetFileById(recordId, fieldId, fileId)
|
||||||
|
|
||||||
|
print(f'Status Code: {response.statusCode}')
|
||||||
|
print(f'Name: {response.data.file.name}')
|
||||||
|
print(f'Content Type: {response.data.file.contentType}')
|
||||||
|
print(f'Content Length: {response.data.file.contentLength}')
|
||||||
|
|
||||||
|
def PrintGetFileInfoById(client: OnspringClient, recordId: int, fieldId: int, fileId: int):
|
||||||
|
|
||||||
|
response = client.GetFileInfoById(recordId, fieldId, fileId)
|
||||||
|
|
||||||
|
print(f'Status Code: {response.statusCode}')
|
||||||
|
print(f'Name: {response.data.fileInfo.name}')
|
||||||
|
print(f'Type: {response.data.fileInfo.type}')
|
||||||
|
print(f'Owner: {response.data.fileInfo.owner}')
|
||||||
|
print(f'Content Type: {response.data.fileInfo.contentType}')
|
||||||
|
print(f'Created Date: {response.data.fileInfo.createdDate}')
|
||||||
|
print(f'Modified Date: {response.data.fileInfo.modifiedDate}')
|
||||||
|
print(f'File Href: {response.data.fileInfo.fileHref}')
|
||||||
|
|
||||||
def PrintSaveFile(client: OnspringClient, filePath: str, recordId: int, fieldId: int, notes: str=None, modifiedDate: datetime=None):
|
def PrintSaveFile(client: OnspringClient, filePath: str, recordId: int, fieldId: int, notes: str=None, modifiedDate: datetime=None):
|
||||||
|
|
||||||
filePath = filePath
|
filePath = filePath
|
||||||
|
|||||||
@@ -40,6 +40,22 @@ def main():
|
|||||||
if command == 'getfieldbyid':
|
if command == 'getfieldbyid':
|
||||||
PrintGetFieldById(onspring, 9686 )
|
PrintGetFieldById(onspring, 9686 )
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if command == 'getfileinfobyid':
|
||||||
|
|
||||||
|
if not argsLength > 4:
|
||||||
|
print('Please provide record id, fieldId, and fileId values')
|
||||||
|
return
|
||||||
|
|
||||||
|
recordId = sys.argv[2]
|
||||||
|
fieldId = sys.argv[3]
|
||||||
|
fileId = sys.argv[4]
|
||||||
|
|
||||||
|
PrintGetFileInfoById(onspring, recordId, fieldId, fileId)
|
||||||
|
return
|
||||||
|
|
||||||
|
PrintGetFileById(onspring, )
|
||||||
|
return
|
||||||
|
|
||||||
if command == 'savefile':
|
if command == 'savefile':
|
||||||
PrintSaveFile(
|
PrintSaveFile(
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class App:
|
|||||||
|
|
||||||
class GetAppsResponse:
|
class GetAppsResponse:
|
||||||
"""
|
"""
|
||||||
An object to represent a paginated response to a request made by an `OnspringClient` to request a collection of `Models.App`s.
|
An object to represent a paginated response to a request made by an `OnspringClient` to request a collection of Onspring apps.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
pageNumber (`int`): The page number returned.
|
pageNumber (`int`): The page number returned.
|
||||||
@@ -80,7 +80,7 @@ class GetAppsResponse:
|
|||||||
|
|
||||||
class GetAppByIdResponse:
|
class GetAppByIdResponse:
|
||||||
"""
|
"""
|
||||||
An object to represent a response to a request made by an `OnspringClient` to request a `Models.App`.
|
An object to represent a response to a request made by an `OnspringClient` to request an Onspring app.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
app (`Models.App`): The requested app.
|
app (`Models.App`): The requested app.
|
||||||
@@ -91,7 +91,7 @@ class GetAppByIdResponse:
|
|||||||
|
|
||||||
class GetAppsByIdsResponse:
|
class GetAppsByIdsResponse:
|
||||||
"""
|
"""
|
||||||
An object to represent a response to a request made by an `OnspringClient` to request a collection of `Models.App`s.
|
An object to represent a response to a request made by an `OnspringClient` to request a collection of Onspring apps.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
count (`int`): The number of apps requested.
|
count (`int`): The number of apps requested.
|
||||||
@@ -187,7 +187,7 @@ class Field:
|
|||||||
|
|
||||||
class GetFieldByIdResponse:
|
class GetFieldByIdResponse:
|
||||||
"""
|
"""
|
||||||
An object to represent a response to a request made by an `OnspringClient` to request a `Models.Field`.
|
An object to represent a response to a request made by an `OnspringClient` to request an Onspring field.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
field (`Models.Field`): The requested field.
|
field (`Models.Field`): The requested field.
|
||||||
@@ -198,7 +198,7 @@ class GetFieldByIdResponse:
|
|||||||
|
|
||||||
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.
|
An object to represent a response to a request made by an `OnspringClient` to request a collection of Onspring fields.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
count (`int`): The number of fields requested.
|
count (`int`): The number of fields requested.
|
||||||
@@ -211,7 +211,7 @@ class GetFieldsByIdsResponse:
|
|||||||
|
|
||||||
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.
|
An object to represent a paginated response to a request made by an `OnspringClient` to request a collection of Onspring fields.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
pageNumber (`int`): The page number returned.
|
pageNumber (`int`): The page number returned.
|
||||||
@@ -231,6 +231,16 @@ class GetFieldsByAppIdResponse:
|
|||||||
# file specific
|
# file specific
|
||||||
|
|
||||||
class File:
|
class File:
|
||||||
|
"""
|
||||||
|
An object to represent a file stored in Onsprng.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
name (`str`): The name of the file.
|
||||||
|
contentType (`str`): The content type of the file.
|
||||||
|
contentLength (`int`): The length of the file's content.
|
||||||
|
content (`bytes`): The content of the 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 = name
|
||||||
self.contentType = contentType
|
self.contentType = contentType
|
||||||
@@ -238,6 +248,19 @@ class File:
|
|||||||
self.content = content
|
self.content = content
|
||||||
|
|
||||||
class FileInfo:
|
class FileInfo:
|
||||||
|
"""
|
||||||
|
An object to represent the metadata for a file stored in Onspring.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
type (`str`): The type of file as stored in Onspring Attachment or Image.
|
||||||
|
contentType (`str`): The content type of the file itself.
|
||||||
|
name (`str`): The name of the file
|
||||||
|
createdDate (`datetime`): The created date of the file.
|
||||||
|
modifiedDate (`datetime`): The modified date of the file.
|
||||||
|
owner (`str`): The owner of the file.
|
||||||
|
fileHref (`str`): The href for the file.
|
||||||
|
"""
|
||||||
|
|
||||||
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 = type
|
||||||
self.contentType = contentType
|
self.contentType = contentType
|
||||||
@@ -248,10 +271,24 @@ class FileInfo:
|
|||||||
self.fileHref = fileHref
|
self.fileHref = fileHref
|
||||||
|
|
||||||
class GetFileInfoByIdResponse:
|
class GetFileInfoByIdResponse:
|
||||||
|
"""
|
||||||
|
An object to represent a response to a request made by an `OnspringClient` to request a info for a file in Onspring.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fileInfo (`Models.FileInfo`): The file info requested.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, fileInfo: FileInfo):
|
def __init__(self, fileInfo: FileInfo):
|
||||||
self.fileInfo = fileInfo
|
self.fileInfo = fileInfo
|
||||||
|
|
||||||
class GetFileByIdResponse:
|
class GetFileByIdResponse:
|
||||||
|
"""
|
||||||
|
An object to represent a response to a request made by an `OnspringClient` to request a file in Onspring.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
file (`Models.File`): The file requested.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, file: File):
|
def __init__(self, file: File):
|
||||||
self.file = file
|
self.file = file
|
||||||
|
|
||||||
@@ -278,6 +315,13 @@ class SaveFileRequest:
|
|||||||
self.contentType = contentType
|
self.contentType = contentType
|
||||||
|
|
||||||
class SaveFileResponse:
|
class SaveFileResponse:
|
||||||
|
"""
|
||||||
|
An object to represent a response to a request made by an `OnspringClient` to save a file in Onspring.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
id (`int`): The id of the file saved in Onspring.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, id: int):
|
def __init__(self, id: int):
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user