POST | /api/schedules | ||
---|---|---|---|
PUT | /api/schedules/{RequestId} |
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ScheduleResponse:
reference_id: Optional[str] = None
communication_id: Optional[str] = None
success: bool = False
message: Optional[str] = None
payload: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ObjectReference:
rms_table_context_id: Optional[str] = None
alternate_key: Optional[str] = None
data_source_instance_id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ContactInfo:
id: Optional[str] = None
name: Optional[str] = None
email: Optional[str] = None
phone: Optional[str] = None
contact_reference: Optional[ObjectReference] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProjectInfo:
id: Optional[str] = None
name: Optional[str] = None
reference: Optional[str] = None
description: Optional[str] = None
address: Optional[str] = None
house_type: Optional[str] = None
elevation: Optional[str] = None
customer_name: Optional[str] = None
supervisor: Optional[ContactInfo] = None
project_reference: Optional[ObjectReference] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PurchaseOrderInfo:
id: Optional[str] = None
reference: Optional[str] = None
description: Optional[str] = None
purchase_order_reference: Optional[ObjectReference] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ActivityReference:
# @ApiMember(Description="Name/details of the activity", IsRequired=true, Name="Name")
name: Optional[str] = None
"""
Name/details of the activity
"""
notes: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ScheduleParams:
name: Optional[str] = None
value: Optional[str] = None
class AttachmentType(str, Enum):
URL = 'Url'
FILE_STREAM = 'FileStream'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EmailAttachment:
file_name: Optional[str] = None
content_type: Optional[str] = None
path: Optional[str] = None
url: Optional[str] = None
length: int = 0
file_stream: Optional[bytes] = None
stream_content: Optional[str] = None
attachment_type: Optional[AttachmentType] = None
processed_and_uploaded_as_blob: bool = False
# @Api(Description="Creates or Reschedules a SupplierConnect schedule. This will return the id of the schedule request created and the communication id of the notification sent.")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ScheduleRequest:
"""
Creates or Reschedules a SupplierConnect schedule. This will return the id of the schedule request created and the communication id of the notification sent.
"""
# @ApiMember(Description="Id of the schedule request to be recreated", IsRequired=true, Name="RequestId")
request_id: Optional[str] = None
"""
Id of the schedule request to be recreated
"""
# @ApiMember(Description="Date/Time of the activity", IsRequired=true, Name="ScheduleDateTime")
# @Required()
schedule_date_time: datetime.datetime = datetime.datetime(1, 1, 1)
"""
Date/Time of the activity
"""
requester: Optional[ContactInfo] = None
supplier: Optional[ContactInfo] = None
project: Optional[ProjectInfo] = None
purchase_order: Optional[PurchaseOrderInfo] = None
activity: Optional[ActivityReference] = None
params: Optional[List[ScheduleParams]] = None
attachments: Optional[List[EmailAttachment]] = None
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/schedules HTTP/1.1
Host: production-eros-gateway-api-supplierconnect.azurewebsites.net
Accept: application/json
Content-Type: application/json
Content-Length: length
{"ScheduleDateTime":"0001-01-01T00:00:00.0000000","Requester":{"Name":"String","Email":"String","Phone":"String","ContactReference":{"AlternateKey":"String"}},"Supplier":{"Name":"String","Email":"String","Phone":"String","ContactReference":{"AlternateKey":"String"}},"Project":{"Name":"String","Reference":"String","Description":"String","Address":"String","HouseType":"String","Elevation":"String","CustomerName":"String","Supervisor":{"Name":"String","Email":"String","Phone":"String","ContactReference":{"AlternateKey":"String"}},"ProjectReference":{"AlternateKey":"String"}},"PurchaseOrder":{"Reference":"String","Description":"String","PurchaseOrderReference":{"AlternateKey":"String"}},"Activity":{"name":"String","notes":"String"},"Params":[{"Name":"String","Value":"String"}],"Attachments":[{"FileName":"String","ContentType":"String","Path":"String","Url":"String","Length":0,"StreamContent":"String","AttachmentType":"Url","ProcessedAndUploadedAsBlob":false}]}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Success":false,"Message":"String","Payload":"String"}