/* Options: Date: 2025-01-18 08:53:59 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: ListWebhookMessages.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/webhook/messages", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class ListWebhookMessages : ListMessagesRequestDto, IReturn, ICompany { public typealias Return = ListMessagesResponseDto /** * 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.", IsRequired=true, ParameterType="query") public var companyId:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId } 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) } 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) } } } public class ListMessagesResponseDto : Codable { public var data:[GetMessageResponseDto] = [] public var done:Bool public var iterator:String required public init(){} } public protocol ICompany { var companyId:String? { get set } } public enum Ordering : Int, Codable { case Ascending = 1 case Descending = 2 } public class ListMessagesRequestDto : ClientWebhookRequestBase { public var before:Date? public var after:Date? public var channel:String public var iterator:String public var limit:Int? public var order:Ordering? public var eventTypes:[String] = [] public var withContent:Bool? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case before case after case channel case iterator case limit case order case eventTypes case withContent } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) before = try container.decodeIfPresent(Date.self, forKey: .before) after = try container.decodeIfPresent(Date.self, forKey: .after) channel = try container.decodeIfPresent(String.self, forKey: .channel) iterator = try container.decodeIfPresent(String.self, forKey: .iterator) limit = try container.decodeIfPresent(Int.self, forKey: .limit) order = try container.decodeIfPresent(Ordering.self, forKey: .order) eventTypes = try container.decodeIfPresent([String].self, forKey: .eventTypes) ?? [] withContent = try container.decodeIfPresent(Bool.self, forKey: .withContent) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if before != nil { try container.encode(before, forKey: .before) } if after != nil { try container.encode(after, forKey: .after) } if channel != nil { try container.encode(channel, forKey: .channel) } if iterator != nil { try container.encode(iterator, forKey: .iterator) } if limit != nil { try container.encode(limit, forKey: .limit) } if order != nil { try container.encode(order, forKey: .order) } if eventTypes.count > 0 { try container.encode(eventTypes, forKey: .eventTypes) } if withContent != nil { try container.encode(withContent, forKey: .withContent) } } } public class ClientWebhookRequestBase : Codable { public var clientId:String required public init(){} }