/* Options: Date: 2024-06-17 05:27:15 SwiftVersion: 5.0 Version: 8.23 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://testapi.bokamera.se //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: NewsletterTemplatesQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/newsletter/templates", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class NewsletterTemplatesQuery : QueryDb2, IReturn, ICompany { public typealias Return = QueryResponse /** * The company id, if empty will use the company id for the user you are logged in with. */ // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.") public var companyId:String? /** * The newsletter template id. */ // @ApiMember(Description="The newsletter template id.") public var id:Int? /** * If you want to include the message send method information */ // @ApiMember(DataType="boolean", Description="If you want to include the message send method information", ParameterType="query") public var includeSendMethodInformation:Bool /** * If you want to include the email template information */ // @ApiMember(DataType="boolean", Description="If you want to include the email template information", ParameterType="query") public var includeEmailTemplateInformation:Bool required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case id case includeSendMethodInformation case includeEmailTemplateInformation } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) id = try container.decodeIfPresent(Int.self, forKey: .id) includeSendMethodInformation = try container.decodeIfPresent(Bool.self, forKey: .includeSendMethodInformation) includeEmailTemplateInformation = try container.decodeIfPresent(Bool.self, forKey: .includeEmailTemplateInformation) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if companyId != nil { try container.encode(companyId, forKey: .companyId) } if id != nil { try container.encode(id, forKey: .id) } if includeSendMethodInformation != nil { try container.encode(includeSendMethodInformation, forKey: .includeSendMethodInformation) } if includeEmailTemplateInformation != nil { try container.encode(includeEmailTemplateInformation, forKey: .includeEmailTemplateInformation) } } } public protocol ICompany { var companyId:String? { get set } } public class SendMethod : BaseModel { // @Required() public var name:String? // @Required() public var Description:String? public var modifiedDate:Date? public var id:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case name case Description case modifiedDate case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) Description = try container.decodeIfPresent(String.self, forKey: .Description) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) id = try container.decodeIfPresent(Int.self, forKey: .id) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if name != nil { try container.encode(name, forKey: .name) } if Description != nil { try container.encode(Description, forKey: .Description) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if id != nil { try container.encode(id, forKey: .id) } } } public class NewsletterSendMethodQueryResponse : Codable { /** * The send method id */ // @ApiMember(Description="The send method id") public var id:Int /** * The send method name. */ // @ApiMember(Description="The send method name.") public var name:String /** * The send method description. */ // @ApiMember(Description="The send method description.") public var Description:String required public init(){} } public class EmailTemplate : BaseModel { // @Required() public var name:String? // @Required() public var Description:String? // @Required() public var body:String? // @Required() public var type:Int? public var modifiedDate:Date? public var id:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case name case Description case body case type case modifiedDate case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) Description = try container.decodeIfPresent(String.self, forKey: .Description) body = try container.decodeIfPresent(String.self, forKey: .body) type = try container.decodeIfPresent(Int.self, forKey: .type) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) id = try container.decodeIfPresent(Int.self, forKey: .id) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if name != nil { try container.encode(name, forKey: .name) } if Description != nil { try container.encode(Description, forKey: .Description) } if body != nil { try container.encode(body, forKey: .body) } if type != nil { try container.encode(type, forKey: .type) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if id != nil { try container.encode(id, forKey: .id) } } } public class NewsletterEmailTemplatesQueryResponse : Codable { /** * The email template id */ // @ApiMember(Description="The email template id") public var id:Int /** * The email template name. */ // @ApiMember(Description="The email template name.") public var name:String /** * The email template description. */ // @ApiMember(Description="The email template description.") public var Description:String /** * The email template html content. */ // @ApiMember(Description="The email template html content.") public var body:String required public init(){} } public class NewsletterTemplate : BaseModel { public var sendMethod:SendMethod public var emailTemplate:EmailTemplate // @Required() public var companyId:String? public var id:Int // @Required() public var heading:String? // @Required() public var body:String? public var imageUrl:String // @Required() public var sendMethodId:Int? public var emailTemplateId:Int? // @Required() public var created:Date? public var modifiedDate:Date? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case sendMethod case emailTemplate case companyId case id case heading case body case imageUrl case sendMethodId case emailTemplateId case created case modifiedDate } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) sendMethod = try container.decodeIfPresent(SendMethod.self, forKey: .sendMethod) emailTemplate = try container.decodeIfPresent(EmailTemplate.self, forKey: .emailTemplate) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) id = try container.decodeIfPresent(Int.self, forKey: .id) heading = try container.decodeIfPresent(String.self, forKey: .heading) body = try container.decodeIfPresent(String.self, forKey: .body) imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl) sendMethodId = try container.decodeIfPresent(Int.self, forKey: .sendMethodId) emailTemplateId = try container.decodeIfPresent(Int.self, forKey: .emailTemplateId) created = try container.decodeIfPresent(Date.self, forKey: .created) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if sendMethod != nil { try container.encode(sendMethod, forKey: .sendMethod) } if emailTemplate != nil { try container.encode(emailTemplate, forKey: .emailTemplate) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } if id != nil { try container.encode(id, forKey: .id) } if heading != nil { try container.encode(heading, forKey: .heading) } if body != nil { try container.encode(body, forKey: .body) } if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) } if sendMethodId != nil { try container.encode(sendMethodId, forKey: .sendMethodId) } if emailTemplateId != nil { try container.encode(emailTemplateId, forKey: .emailTemplateId) } if created != nil { try container.encode(created, forKey: .created) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } } } public class BaseModel : Codable { required public init(){} } public class NewsletterTemplatesQueryResponse : Codable { /** * The newsletter template id */ // @ApiMember(Description="The newsletter template id") public var id:Int /** * The newsletter template heading. */ // @ApiMember(Description="The newsletter template heading.") public var heading:String /** * The newsletter template body. */ // @ApiMember(Description="The newsletter template body.") public var body:String /** * The email template the newsletter uses. */ // @ApiMember(Description="The email template the newsletter uses.") public var emailTemplateId:Int? /** * Send Method. 1 = Email, 2 = SMS */ // @ApiMember(Description="Send Method. 1 = Email, 2 = SMS") public var sendMethodId:Int /** * The newsletter template image url. */ // @ApiMember(Description="The newsletter template image url.") public var imageUrl:String /** * The newsletter created date. */ // @ApiMember(Description="The newsletter created date.") public var created:Date /** * Send method information. */ // @ApiMember(Description="Send method information.") public var sendMethodInformation:NewsletterSendMethodQueryResponse /** * Email template information. */ // @ApiMember(Description="Email template information.") public var emailTemplateInformation:NewsletterEmailTemplatesQueryResponse required public init(){} }