| GET | /api/activity | ||
|---|---|---|---|
| GET | /api/activity/{lastrowversion} |
import Foundation
import ServiceStack
/**
* Retrieves a list of activities of SupplierConnect schedule(s) for a given time window. This will return SupplierConnect schedule request(s), and the associated other details such as statuses
*/
// @Api(Description="Retrieves a list of activities of SupplierConnect schedule(s) for a given time window. This will return SupplierConnect schedule request(s), and the associated other details such as statuses")
public class GetRequestActivity : Codable
{
/**
* Row version of the last/latest record processed/returned in the previous request
*/
// @DataMember(Name="LastRowVersion")
// @ApiMember(Description="Row version of the last/latest record processed/returned in the previous request", IsRequired=true, Name="LastRowVersion")
public var LastRowVersion:String
required public init(){}
}
// @ApiResponse(Description="Returns the list of the schedule requests for the given list of Ids")
public class GetSchedulesResponse : Codable
{
public var success:Bool
public var message:String
public var scheduleRequests:[ScheduleDetails]
public var responseStatus:ResponseStatus
public var lastRowVersion:String
required public init(){}
}
public class ScheduleDetails : SupplierConnectSchedule
{
public var referenceId:String
public var index:Int
public var statusId:String
public var status:String
public var statusMessage:String
public var requestedBy:String
public var requestedDate:Date?
public var communicationId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case referenceId
case index
case statusId
case status
case statusMessage
case requestedBy
case requestedDate
case communicationId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
referenceId = try container.decodeIfPresent(String.self, forKey: .referenceId)
index = try container.decodeIfPresent(Int.self, forKey: .index)
statusId = try container.decodeIfPresent(String.self, forKey: .statusId)
status = try container.decodeIfPresent(String.self, forKey: .status)
statusMessage = try container.decodeIfPresent(String.self, forKey: .statusMessage)
requestedBy = try container.decodeIfPresent(String.self, forKey: .requestedBy)
requestedDate = try container.decodeIfPresent(Date.self, forKey: .requestedDate)
communicationId = try container.decodeIfPresent(String.self, forKey: .communicationId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if referenceId != nil { try container.encode(referenceId, forKey: .referenceId) }
if index != nil { try container.encode(index, forKey: .index) }
if statusId != nil { try container.encode(statusId, forKey: .statusId) }
if status != nil { try container.encode(status, forKey: .status) }
if statusMessage != nil { try container.encode(statusMessage, forKey: .statusMessage) }
if requestedBy != nil { try container.encode(requestedBy, forKey: .requestedBy) }
if requestedDate != nil { try container.encode(requestedDate, forKey: .requestedDate) }
if communicationId != nil { try container.encode(communicationId, forKey: .communicationId) }
}
}
public class SupplierConnectSchedule : Codable
{
public var requestId:String
public var previousRequestId:String
public var licenseeId:String
public var licenseeName:String
public var scheduleDateTime:Date
public var requester:SupplierConnectContactInfo
public var supplier:SupplierConnectContactInfo
public var project:SupplierConnectProjectInfo
public var purchaseOrder:SupplierConnectPurchaseOrderInfo
public var activity:SupplierConnectActivityReference
public var params:[SupplierConnectScheduleParams]
public var attachments:[EmailAttachment]
required public init(){}
}
public class SupplierConnectContactInfo : Codable
{
public var id:String
public var name:String
public var email:String
public var phone:String
public var contactReference:SupplierConnectObjectReference
required public init(){}
}
public class SupplierConnectObjectReference : Codable
{
public var rmsTableContextId:String
public var alternateKey:String
public var dataSourceInstanceId:String
required public init(){}
}
public class SupplierConnectProjectInfo : Codable
{
public var id:String
public var name:String
public var reference:String
public var Description:String
public var address:String
public var houseType:String
public var elevation:String
public var supervisor:SupplierConnectContactInfo
public var customerName:String
public var projectReference:SupplierConnectObjectReference
required public init(){}
}
public class SupplierConnectPurchaseOrderInfo : Codable
{
public var id:String
public var reference:String
public var Description:String
public var projectId:String
public var purchaseOrderReference:SupplierConnectObjectReference
required public init(){}
}
public class SupplierConnectActivityReference : Codable
{
public var name:String
public var notes:String
required public init(){}
}
public class SupplierConnectScheduleParams : Codable
{
public var name:String
public var value:String
required public init(){}
}
public class EmailAttachment : Codable
{
public var fileName:String
public var contentType:String
public var path:String
public var url:String
public var length:Int
public var fileStream:Data
public var streamContent:String
public var attachmentType:AttachmentType
public var processedAndUploadedAsBlob:Bool
required public init(){}
}
public enum AttachmentType : String, Codable
{
case Url
case FileStream
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/activity HTTP/1.1 Host: production-eros-gateway-api-supplierconnect.azurewebsites.net Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Success: False,
Message: String,
ScheduleRequests:
[
{
Index: 0,
Status: String,
StatusMessage: String,
RequestedBy: String,
RequestedDate: 0001-01-01,
LicenseeName: String,
ScheduleDateTime: 0001-01-01,
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,
Supervisor:
{
Name: String,
Email: String,
Phone: String,
ContactReference:
{
AlternateKey: String
}
},
CustomerName: 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
}
]
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
LastRowVersion: String
}