more work;
This commit is contained in:
+9
-10
@@ -4,7 +4,6 @@ import sys
|
|||||||
|
|
||||||
from OnspringClient import OnspringClient
|
from OnspringClient import OnspringClient
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from Helpers import GetResultValueString
|
|
||||||
|
|
||||||
from Models import *
|
from Models import *
|
||||||
from Enums import *
|
from Enums import *
|
||||||
@@ -69,7 +68,7 @@ def main():
|
|||||||
return
|
return
|
||||||
|
|
||||||
if command == 'addrecord':
|
if command == 'addrecord':
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
StringFieldValue(6983, 'A New Test Task'),
|
StringFieldValue(6983, 'A New Test Task'),
|
||||||
StringFieldValue(6984, 'This is a test task.')
|
StringFieldValue(6984, 'This is a test task.')
|
||||||
@@ -166,7 +165,7 @@ def PrintGetRecordsByAppId(client: OnspringClient, appId: int):
|
|||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.fieldId}')
|
||||||
print(f'Value: {GetResultValueString(field)}')
|
print(f'Value: {field.GetResultValueString()}')
|
||||||
print('--')
|
print('--')
|
||||||
|
|
||||||
print('----')
|
print('----')
|
||||||
@@ -190,7 +189,7 @@ def PrintGetRecordById(client: OnspringClient, appId: int, recordId: int, fieldI
|
|||||||
for field in response.data.fields:
|
for field in response.data.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.fieldId}')
|
||||||
print(f'Value: {GetResultValueString(field)}')
|
print(f'Value: {field.GetResultValueString()}')
|
||||||
print('--')
|
print('--')
|
||||||
|
|
||||||
print('----')
|
print('----')
|
||||||
@@ -224,7 +223,7 @@ def PrintGetRecordsByIds(client: OnspringClient, appId: int, recordIds: list[int
|
|||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.fieldId}')
|
||||||
print(f'Value: {GetResultValueString(field)}')
|
print(f'Value: {field.GetResultValueString()}')
|
||||||
print('--')
|
print('--')
|
||||||
|
|
||||||
print('----')
|
print('----')
|
||||||
@@ -256,7 +255,7 @@ def PrintQueryRecords(client: OnspringClient, appId: int, filter: str, fieldIds:
|
|||||||
for field in record.fields:
|
for field in record.fields:
|
||||||
print(f'Type: {field.type}')
|
print(f'Type: {field.type}')
|
||||||
print(f'FieldId: {field.fieldId}')
|
print(f'FieldId: {field.fieldId}')
|
||||||
print(f'Value: {GetResultValueString(field)}')
|
print(f'Value: {field.GetResultValueString()}')
|
||||||
print('--')
|
print('--')
|
||||||
|
|
||||||
print('----')
|
print('----')
|
||||||
@@ -270,11 +269,11 @@ def PrintAddOrUpdateRecord(client: OnspringClient, appId: int, fields: list[Reco
|
|||||||
|
|
||||||
response = client.AddOrUpdateRecord(record)
|
response = client.AddOrUpdateRecord(record)
|
||||||
|
|
||||||
print(response.status_code)
|
print(f'Status Code: {response.statusCode}')
|
||||||
print(response.text)
|
print(f'Id: {response.data.id}')
|
||||||
print(response.request.body)
|
for warning in response.data.warnings:
|
||||||
|
print(f'Warning: {warning}')
|
||||||
|
|
||||||
|
|
||||||
# files
|
# files
|
||||||
|
|
||||||
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):
|
||||||
|
|||||||
+1
-60
@@ -10,63 +10,4 @@ def parseDate(date: str):
|
|||||||
try:
|
try:
|
||||||
return datetime.strptime(date, format)
|
return datetime.strptime(date, format)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetResultValueString(value):
|
|
||||||
match value.type:
|
|
||||||
case ResultValueType.String.name:
|
|
||||||
return value.AsString()
|
|
||||||
|
|
||||||
case ResultValueType.Integer.name:
|
|
||||||
return value.AsInteger()
|
|
||||||
|
|
||||||
case ResultValueType.Decimal.name:
|
|
||||||
return value.AsDecimal()
|
|
||||||
|
|
||||||
case ResultValueType.Date.name:
|
|
||||||
return value.AsDate()
|
|
||||||
|
|
||||||
case ResultValueType.TimeSpan.name:
|
|
||||||
data = value.AsTimeSpan()
|
|
||||||
return f'Quantity: {data.quantity}, Increment: {data.increment}, Recurrence: {data.recurrence}, EndByDate: {data.endByDate}, EndAfterOccurrences: {data.endAfterOccurrences}'
|
|
||||||
|
|
||||||
case ResultValueType.Guid.name:
|
|
||||||
return value.AsGuid()
|
|
||||||
|
|
||||||
case ResultValueType.StringList.name:
|
|
||||||
data = value.AsStringList()
|
|
||||||
return f'{",".join(data)}'
|
|
||||||
|
|
||||||
case ResultValueType.IntegerList.name:
|
|
||||||
data = value.AsIntegerList()
|
|
||||||
return f'{",".join([str(i) for i in data])}'
|
|
||||||
|
|
||||||
case ResultValueType.GuidList.name:
|
|
||||||
data = value.AsGuidList()
|
|
||||||
return f'{",".join([str(guid) for guid in data])}'
|
|
||||||
|
|
||||||
case ResultValueType.AttachmentList.name:
|
|
||||||
data = value.AsAttachmentList()
|
|
||||||
|
|
||||||
strings = []
|
|
||||||
|
|
||||||
for attachment in data:
|
|
||||||
string = f'FileId: {attachment.fileId}, FileName: {attachment.fileName}, Notes: {attachment.notes}, StorageLocation: {attachment.storageLocation}'
|
|
||||||
strings.append(string)
|
|
||||||
|
|
||||||
return f'{"; ".join(strings)}'
|
|
||||||
|
|
||||||
case ResultValueType.ScoringGroupList.name:
|
|
||||||
data = value.AsScoringGroupList()
|
|
||||||
|
|
||||||
strings = []
|
|
||||||
|
|
||||||
for scoringGroup in data:
|
|
||||||
string = f'ListValueId: {scoringGroup.listValueId}, Name: {scoringGroup.name}, Score: {scoringGroup.score}, Max Score: {scoringGroup.maximumScore}'
|
|
||||||
strings.append(string)
|
|
||||||
|
|
||||||
return f'{"; ".join(strings)}'
|
|
||||||
|
|
||||||
case ResultValueType.FileList.name:
|
|
||||||
data = value.AsFileList()
|
|
||||||
return f'{",".join([str(i) for i in data])}'
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
from dataclasses import field
|
|
||||||
import datetime
|
import datetime
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@@ -133,8 +132,6 @@ class AddOrUpdateListItemResponse:
|
|||||||
def __init__(self, id: uuid):
|
def __init__(self, id: uuid):
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# record specific
|
# record specific
|
||||||
|
|
||||||
class RecordFieldValue:
|
class RecordFieldValue:
|
||||||
@@ -155,14 +152,14 @@ class RecordFieldValue:
|
|||||||
if self.type != ResultValueType.Integer.name:
|
if self.type != ResultValueType.Integer.name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return IntegerFieldValue(int(self.value), self.fieldId).value
|
return IntegerFieldValue(self.fieldId, int(self.value)).value
|
||||||
|
|
||||||
def AsDecimal(self):
|
def AsDecimal(self):
|
||||||
|
|
||||||
if self.type != ResultValueType.Decimal.name:
|
if self.type != ResultValueType.Decimal.name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return DecimalFieldValue(Decimal(self.value), self.fieldId).value
|
return DecimalFieldValue(self.fieldId, Decimal(self.value)).value
|
||||||
|
|
||||||
def AsDate(self):
|
def AsDate(self):
|
||||||
|
|
||||||
@@ -171,14 +168,14 @@ class RecordFieldValue:
|
|||||||
|
|
||||||
date = parseDate(self.value)
|
date = parseDate(self.value)
|
||||||
|
|
||||||
return DateFieldValue(date, self.fieldId).value
|
return DateFieldValue(self.fieldId, date).value
|
||||||
|
|
||||||
def AsGuid(self):
|
def AsGuid(self):
|
||||||
|
|
||||||
if self.type != ResultValueType.Guid.name:
|
if self.type != ResultValueType.Guid.name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return GuidFieldValue(uuid.UUID(self.value), self.fieldId).value
|
return GuidFieldValue(self.fieldId, uuid.UUID(self.value)).value
|
||||||
|
|
||||||
def AsTimeSpan(self):
|
def AsTimeSpan(self):
|
||||||
|
|
||||||
@@ -202,21 +199,25 @@ class RecordFieldValue:
|
|||||||
endByDate,
|
endByDate,
|
||||||
endAfterOccurrences)
|
endAfterOccurrences)
|
||||||
|
|
||||||
return TimeSpanValue(data, self.fieldId).value
|
return TimeSpanValue(self.fieldId, data).value
|
||||||
|
|
||||||
def AsStringList(self):
|
def AsStringList(self):
|
||||||
|
|
||||||
if self.type != ResultValueType.StringList.name:
|
if self.type != ResultValueType.StringList.name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return StringListValue(self.value, self.fieldId).value
|
strings = [str(string) for string in self.value]
|
||||||
|
|
||||||
|
return StringListValue(self.fieldId, strings).value
|
||||||
|
|
||||||
def AsIntegerList(self):
|
def AsIntegerList(self):
|
||||||
|
|
||||||
if self.type != ResultValueType.IntegerList.name:
|
if self.type != ResultValueType.IntegerList.name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
integers = [int(integer) for integer in self.value]
|
||||||
|
|
||||||
return IntegerListValue(self.value, self.fieldId).value
|
return IntegerListValue(self.fieldId, integers).value
|
||||||
|
|
||||||
def AsGuidList(self):
|
def AsGuidList(self):
|
||||||
|
|
||||||
@@ -228,7 +229,7 @@ class RecordFieldValue:
|
|||||||
for guid in self.value:
|
for guid in self.value:
|
||||||
guids.append(uuid.UUID(guid))
|
guids.append(uuid.UUID(guid))
|
||||||
|
|
||||||
return GuidListValue(guids, self.fieldId).value
|
return GuidListValue(self.fieldId, guids).value
|
||||||
|
|
||||||
def AsAttachmentList(self):
|
def AsAttachmentList(self):
|
||||||
|
|
||||||
@@ -249,7 +250,7 @@ class RecordFieldValue:
|
|||||||
|
|
||||||
attachments.append(attachment)
|
attachments.append(attachment)
|
||||||
|
|
||||||
return AttachmentListValue(attachments, self.fieldId).value
|
return AttachmentListValue(self.fieldId, attachments).value
|
||||||
|
|
||||||
def AsScoringGroupList(self):
|
def AsScoringGroupList(self):
|
||||||
|
|
||||||
@@ -270,14 +271,16 @@ class RecordFieldValue:
|
|||||||
|
|
||||||
scoringGroups.append(scoringGroup)
|
scoringGroups.append(scoringGroup)
|
||||||
|
|
||||||
return ScoringGroupListValue(scoringGroups, self.fieldId).value
|
return ScoringGroupListValue(self.fieldId, scoringGroups).value
|
||||||
|
|
||||||
def AsFileList(self):
|
def AsFileList(self):
|
||||||
|
|
||||||
if self.type != ResultValueType.FileList.name:
|
if self.type != ResultValueType.FileList.name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
files = [int(file) for file in self.value]
|
||||||
|
|
||||||
return FileListValue(self.value, self.fieldId).value
|
return FileListValue(self.fieldId, files).value
|
||||||
|
|
||||||
def getValue(self):
|
def getValue(self):
|
||||||
|
|
||||||
@@ -308,6 +311,65 @@ class RecordFieldValue:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def GetResultValueString(self):
|
||||||
|
match self.type:
|
||||||
|
case ResultValueType.String.name:
|
||||||
|
return self.AsString()
|
||||||
|
|
||||||
|
case ResultValueType.Integer.name:
|
||||||
|
return self.AsInteger()
|
||||||
|
|
||||||
|
case ResultValueType.Decimal.name:
|
||||||
|
return self.AsDecimal()
|
||||||
|
|
||||||
|
case ResultValueType.Date.name:
|
||||||
|
return self.AsDate()
|
||||||
|
|
||||||
|
case ResultValueType.TimeSpan.name:
|
||||||
|
data = self.AsTimeSpan()
|
||||||
|
return f'Quantity: {data.quantity}, Increment: {data.increment}, Recurrence: {data.recurrence}, EndByDate: {data.endByDate}, EndAfterOccurrences: {data.endAfterOccurrences}'
|
||||||
|
|
||||||
|
case ResultValueType.Guid.name:
|
||||||
|
return self.AsGuid()
|
||||||
|
|
||||||
|
case ResultValueType.StringList.name:
|
||||||
|
data = self.AsStringList()
|
||||||
|
return f'{",".join(data)}'
|
||||||
|
|
||||||
|
case ResultValueType.IntegerList.name:
|
||||||
|
data = self.AsIntegerList()
|
||||||
|
return f'{",".join([str(i) for i in data])}'
|
||||||
|
|
||||||
|
case ResultValueType.GuidList.name:
|
||||||
|
data = self.AsGuidList()
|
||||||
|
return f'{",".join([str(guid) for guid in data])}'
|
||||||
|
|
||||||
|
case ResultValueType.AttachmentList.name:
|
||||||
|
data = self.AsAttachmentList()
|
||||||
|
|
||||||
|
strings = []
|
||||||
|
|
||||||
|
for attachment in data:
|
||||||
|
string = f'FileId: {attachment.fileId}, FileName: {attachment.fileName}, Notes: {attachment.notes}, StorageLocation: {attachment.storageLocation}'
|
||||||
|
strings.append(string)
|
||||||
|
|
||||||
|
return f'{"; ".join(strings)}'
|
||||||
|
|
||||||
|
case ResultValueType.ScoringGroupList.name:
|
||||||
|
data = self.AsScoringGroupList()
|
||||||
|
|
||||||
|
strings = []
|
||||||
|
|
||||||
|
for scoringGroup in data:
|
||||||
|
string = f'ListValueId: {scoringGroup.listValueId}, Name: {scoringGroup.name}, Score: {scoringGroup.score}, Max Score: {scoringGroup.maximumScore}'
|
||||||
|
strings.append(string)
|
||||||
|
|
||||||
|
return f'{"; ".join(strings)}'
|
||||||
|
|
||||||
|
case ResultValueType.FileList.name:
|
||||||
|
data = self.AsFileList()
|
||||||
|
return f'{",".join([str(i) for i in data])}'
|
||||||
|
|
||||||
class Record:
|
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 = appId
|
||||||
@@ -362,6 +424,11 @@ class AddOrUpdateRecordResponse:
|
|||||||
self.id = id
|
self.id = id
|
||||||
self.warnings = warnings
|
self.warnings = warnings
|
||||||
|
|
||||||
|
class DeleteBatchRecordsRequest:
|
||||||
|
def __init__(self, appId: int, recordIds: list[int]):
|
||||||
|
self.id = id
|
||||||
|
self.recordIds = recordIds
|
||||||
|
|
||||||
# field types
|
# field types
|
||||||
|
|
||||||
class StringFieldValue(RecordFieldValue):
|
class StringFieldValue(RecordFieldValue):
|
||||||
@@ -369,29 +436,25 @@ class StringFieldValue(RecordFieldValue):
|
|||||||
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:
|
class IntegerFieldValue(RecordFieldValue):
|
||||||
def __init__(self, value: int, fieldId: int):
|
def __init__(self, fieldId: int, value: int):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.Integer.name
|
self.type = ResultValueType.Integer.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class DecimalFieldValue:
|
class DecimalFieldValue(RecordFieldValue):
|
||||||
def __init__(self, value: Decimal, fieldId: int):
|
def __init__(self, fieldId: int, value: Decimal):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.Decimal.name
|
self.type = ResultValueType.Decimal.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class DateFieldValue:
|
class DateFieldValue(RecordFieldValue):
|
||||||
def __init__(self, value: datetime, fieldId: int):
|
def __init__(self, fieldId: int, value: datetime):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.Date.name
|
self.type = ResultValueType.Date.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class GuidFieldValue:
|
class GuidFieldValue(RecordFieldValue):
|
||||||
def __init__(self, value: uuid.UUID, fieldId: int):
|
def __init__(self, fieldId: int, value: uuid.UUID):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.Guid.name
|
self.type = ResultValueType.Guid.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class TimeSpanData:
|
class TimeSpanData:
|
||||||
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):
|
||||||
@@ -410,29 +473,25 @@ class TimeSpanData:
|
|||||||
else:
|
else:
|
||||||
return f'{self.quantity} {self.increment}'
|
return f'{self.quantity} {self.increment}'
|
||||||
|
|
||||||
class TimeSpanValue:
|
class TimeSpanValue(RecordFieldValue):
|
||||||
def __init__(self, value: TimeSpanData, fieldId: int):
|
def __init__(self, fieldId: int, value: TimeSpanData):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.TimeSpan.name
|
self.type = ResultValueType.TimeSpan.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class StringListValue:
|
class StringListValue(RecordFieldValue):
|
||||||
def __init__(self, value: list[str], fieldId: int):
|
def __init__(self, fieldId: int, value: list[str]):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.StringList.name
|
self.type = ResultValueType.StringList.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class IntegerListValue:
|
class IntegerListValue(RecordFieldValue):
|
||||||
def __init__(self, value: list[int], fieldId: int):
|
def __init__(self, fieldId: int, value: list[int]):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.IntegerList.name
|
self.type = ResultValueType.IntegerList.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class GuidListValue:
|
class GuidListValue(RecordFieldValue):
|
||||||
def __init__(self, value: list[uuid.UUID], fieldId: int):
|
def __init__(self, fieldId: int, value: list[uuid.UUID]):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.GuidList.name
|
self.type = ResultValueType.GuidList.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class Attachment:
|
class Attachment:
|
||||||
def __init__(self, fileId: int, fileName: str, notes: str, storageLocation: str):
|
def __init__(self, fileId: int, fileName: str, notes: str, storageLocation: str):
|
||||||
@@ -441,17 +500,15 @@ class Attachment:
|
|||||||
self.notes = notes
|
self.notes = notes
|
||||||
self.storageLocation = storageLocation
|
self.storageLocation = storageLocation
|
||||||
|
|
||||||
class AttachmentListValue:
|
class AttachmentListValue(RecordFieldValue):
|
||||||
def __init__(self, value: list[Attachment], fieldId: int):
|
def __init__(self, fieldId: int, value: list[Attachment]):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.AttachmentList.name
|
self.type = ResultValueType.AttachmentList.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class FileListValue:
|
class FileListValue(RecordFieldValue):
|
||||||
def __init__(self, value: list[int], fieldId: int):
|
def __init__(self, fieldId: int, value: list[int]):
|
||||||
self.value = value
|
|
||||||
self.fieldId = fieldId
|
|
||||||
self.type = ResultValueType.FileList.name
|
self.type = ResultValueType.FileList.name
|
||||||
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
|
|
||||||
class ScoringGroup:
|
class ScoringGroup:
|
||||||
def __init__(self, listValueId: uuid.UUID, name: str, score: Decimal, maximumScore: Decimal):
|
def __init__(self, listValueId: uuid.UUID, name: str, score: Decimal, maximumScore: Decimal):
|
||||||
@@ -460,8 +517,7 @@ class ScoringGroup:
|
|||||||
self.score = score
|
self.score = score
|
||||||
self.maximumScore = maximumScore
|
self.maximumScore = maximumScore
|
||||||
|
|
||||||
class ScoringGroupListValue:
|
class ScoringGroupListValue(RecordFieldValue):
|
||||||
def __init__(self, value: list[ScoringGroup], fieldId: int):
|
def __init__(self, fieldId: int, value: list[ScoringGroup]):
|
||||||
self.value = value
|
self.type = ResultValueType.ScoringGroupList.name
|
||||||
self.fieldId = fieldId
|
RecordFieldValue.__init__(self, fieldId, value, self.type)
|
||||||
self.type = ResultValueType.ScoringGroupList.name
|
|
||||||
+46
-3
@@ -1120,8 +1120,7 @@ class OnspringClient:
|
|||||||
return ApiResponse(
|
return ApiResponse(
|
||||||
response.status_code,
|
response.status_code,
|
||||||
data,
|
data,
|
||||||
headers=response.headers,
|
raw=response)
|
||||||
responseText=response.text)
|
|
||||||
|
|
||||||
return ApiResponse(
|
return ApiResponse(
|
||||||
response.status_code,
|
response.status_code,
|
||||||
@@ -1148,7 +1147,51 @@ class OnspringClient:
|
|||||||
headers=self.headers,
|
headers=self.headers,
|
||||||
data=requestData)
|
data=requestData)
|
||||||
|
|
||||||
return response
|
if response.status_code == 400:
|
||||||
|
|
||||||
|
return ApiResponse(
|
||||||
|
response.status_code,
|
||||||
|
message='Request is data is invalid',
|
||||||
|
raw=response)
|
||||||
|
|
||||||
|
if response.status_code == 401:
|
||||||
|
|
||||||
|
return ApiResponse(
|
||||||
|
response.status_code,
|
||||||
|
message='Unauthorized request',
|
||||||
|
raw=response)
|
||||||
|
|
||||||
|
if response.status_code in [403, 404]:
|
||||||
|
|
||||||
|
jsonResponse = dict(response.json())
|
||||||
|
|
||||||
|
return ApiResponse(
|
||||||
|
response.status_code,
|
||||||
|
message=jsonResponse.get('message'),
|
||||||
|
raw=response)
|
||||||
|
|
||||||
|
if response.status_code in [200, 201]:
|
||||||
|
|
||||||
|
jsonResponse = dict(response.json())
|
||||||
|
|
||||||
|
data = AddOrUpdateRecordResponse(
|
||||||
|
jsonResponse.get('id'),
|
||||||
|
jsonResponse.get('warnings'))
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
message = 'Record updated successfully'
|
||||||
|
else:
|
||||||
|
message = 'Record created successfully'
|
||||||
|
|
||||||
|
return ApiResponse(
|
||||||
|
response.status_code,
|
||||||
|
data,
|
||||||
|
message=message,
|
||||||
|
raw=response)
|
||||||
|
|
||||||
|
return ApiResponse(
|
||||||
|
response.status_code,
|
||||||
|
raw=response)
|
||||||
|
|
||||||
def DeleteRecordsByIds(self):
|
def DeleteRecordsByIds(self):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user