| GET | /template-approval/list |
|---|
import Foundation
import ServiceStack
public class TemplateApprovalList : ApiServiceRequest
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class ApiServiceRequest : IServiceRequest, IHasApiKey, IHasDeviceInfo, Codable
{
/**
* The API Key required for authentication
*/
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
public var apiKey:String
/**
* Latitude of the user making this request
*/
// @ApiMember(DataType="double", Description="Latitude of the user making this request")
public var latitude:Double
/**
* Longitude of the user making this request
*/
// @ApiMember(DataType="double", Description="Longitude of the user making this request")
public var longitude:Double
required public init(){}
}
public class TemplateApprovalListResponse : ApiServiceResponse
{
public var templates:[TemplateApprovalListItem] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case templates
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
templates = try container.decodeIfPresent([TemplateApprovalListItem].self, forKey: .templates) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if templates.count > 0 { try container.encode(templates, forKey: .templates) }
}
}
public class ApiServiceResponse : IServiceResponse, Codable
{
public var Description:String
public var heading:String
public var wasSuccessful:Bool
//modelState:Object ignored. Type could not be extended in Swift
required public init(){}
}
public class TemplateApprovalListItem : Codable
{
public var userCrmId:String
public var approvalDate:String
public var templateApprovalId:Int
public var approvalStatus:TemplateApprovalStatus
public var approvalStatusString:String
public var templateType:TemplateType
public var templateTypeString:String
public var templateName:String
public var systemUserName:String
public var templateChangeDetail:[SectionSummary] = []
public var templateDetail:[SectionSummary] = []
public var content:String
required public init(){}
}
public enum TemplateApprovalStatus : Int, Codable
{
case AwaitingApproval = 0
case Rejected = 1
case Approved = 2
}
public enum TemplateType : Int, Codable
{
case Introductory = 0
case Refresher = 1
}
public class SectionSummary : Codable
{
public var title:SectionTitle
public var titleString:String
public var sectionId:Int
public var sectionName:String
required public init(){}
}
public enum SectionTitle : Int, Codable
{
case Welcome = 0
case Cochrane = 1
case Iconic = 2
case OurBestWork = 3
case RealityOfRisk = 4
case ProductRange = 5
case ProductDeployments = 6
case Industries = 7
case ClearVu = 8
case CaseStudies = 9
case Expertise = 10
case Media = 11
case ThankYou = 12
case ClearVuRange = 13
case Presentations = 14
case LegacyVideos = 15
}
Swift TemplateApprovalList DTOs
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 /template-approval/list HTTP/1.1 Host: cochraneplus-api-dev.happen.zone Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
templates:
[
{
}
],
description: String,
heading: String,
wasSuccessful: False,
modelState: {}
}