BokaMera.API.Host

<back to all web services

ReviewQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
GET/rating/reviewsGet ReviewsGet Reviews.
import Foundation
import ServiceStack

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class ReviewQuery : QueryDb2<Review, RatingReviewResponse>, ICompany
{
    /**
    * 
    */
    // @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 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 BaseModel : Codable
{
    required public init(){}
}

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 AccessKeyTypeResponse : Codable
{
    public var id:Int
    public var keyType:String
    public var Description:String

    required public init(){}
}


Swift ReviewQuery DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /rating/reviews HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfRatingReviewResponseWg5EthtI xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Offset>0</Offset>
  <Total>0</Total>
  <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
    <d2p1:RatingReviewResponse>
      <d2p1:Author>String</d2p1:Author>
      <d2p1:Created>0001-01-01T00:00:00</d2p1:Created>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:RatingScore>0</d2p1:RatingScore>
      <d2p1:ReviewAnswer>String</d2p1:ReviewAnswer>
      <d2p1:Title>String</d2p1:Title>
    </d2p1:RatingReviewResponse>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Meta>
      </ResponseError>
    </Errors>
    <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Meta>
  </ResponseStatus>
</QueryResponseOfRatingReviewResponseWg5EthtI>