/* Options: Date: 2024-06-17 09:16:10 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: ReviewQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/rating/reviews", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class ReviewQuery : QueryDb2, IReturn, ICompany { public typealias Return = QueryResponse /** * */ // @ApiMember(Description="") public var companyId:String? /** * */ // @ApiMember(Description="") public var id:String? /** * If you want to collect only active reviews */ // @ApiMember(Description="If you want to collect only active reviews") public var active:Bool? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case id case active } 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(String.self, forKey: .id) active = try container.decodeIfPresent(Bool.self, forKey: .active) } 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 active != nil { try container.encode(active, forKey: .active) } } } public protocol ICompany { var companyId:String? { get set } } public class Review : BaseModel { public var reviewId:String // @Required() public var companyId:String? // @Required() public var title:String? // @Required() public var Description:String? // @Required() public var author:String? // @Required() public var status:Int? // @Required() public var created:Date? // @Required() public var updated:Date? public var modifiedDate:Date? public var reviewAnswer:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case reviewId case companyId case title case Description case author case status case created case updated case modifiedDate case reviewAnswer } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) reviewId = try container.decodeIfPresent(String.self, forKey: .reviewId) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) title = try container.decodeIfPresent(String.self, forKey: .title) Description = try container.decodeIfPresent(String.self, forKey: .Description) author = try container.decodeIfPresent(String.self, forKey: .author) status = try container.decodeIfPresent(Int.self, forKey: .status) created = try container.decodeIfPresent(Date.self, forKey: .created) updated = try container.decodeIfPresent(Date.self, forKey: .updated) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) reviewAnswer = try container.decodeIfPresent(String.self, forKey: .reviewAnswer) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if reviewId != nil { try container.encode(reviewId, forKey: .reviewId) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } if title != nil { try container.encode(title, forKey: .title) } if Description != nil { try container.encode(Description, forKey: .Description) } if author != nil { try container.encode(author, forKey: .author) } if status != nil { try container.encode(status, forKey: .status) } if created != nil { try container.encode(created, forKey: .created) } if updated != nil { try container.encode(updated, forKey: .updated) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if reviewAnswer != nil { try container.encode(reviewAnswer, forKey: .reviewAnswer) } } } public class RatingReviewResponse : Codable { /** * The title for the review */ // @ApiMember(Description="The title for the review") public var title:String /** * The description for the review */ // @ApiMember(Description="The description for the review") public var Description:String /** * The rating score */ // @ApiMember(Description="The rating score") public var ratingScore:Int /** * The review author */ // @ApiMember(Description="The review author") public var author:String /** * The created date */ // @ApiMember(Description="The created date") public var created:Date /** * The review answer from the company */ // @ApiMember(Description="The review answer from the company") public var reviewAnswer:String required public init(){} } public class BaseModel : Codable { required public init(){} }