BokaMera.API.Host

<back to all web services

AddRating

The following routes are available for this service:
POST/rating/Create RatingScoreCreate rating from booking
import 'package:servicestack/servicestack.dart';

class RatingReviewResponse implements IConvertible
{
    /**
    * The title for the review
    */
    // @ApiMember(Description="The title for the review")
    String? Title;

    /**
    * The description for the review
    */
    // @ApiMember(Description="The description for the review")
    String? Description;

    /**
    * The rating score
    */
    // @ApiMember(Description="The rating score")
    int? RatingScore;

    /**
    * The review author
    */
    // @ApiMember(Description="The review author")
    String? Author;

    /**
    * The created date
    */
    // @ApiMember(Description="The created date")
    DateTime? Created;

    /**
    * The review answer from the company
    */
    // @ApiMember(Description="The review answer from the company")
    String? ReviewAnswer;

    RatingReviewResponse({this.Title,this.Description,this.RatingScore,this.Author,this.Created,this.ReviewAnswer});
    RatingReviewResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Title = json['Title'];
        Description = json['Description'];
        RatingScore = json['RatingScore'];
        Author = json['Author'];
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        ReviewAnswer = json['ReviewAnswer'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Title': Title,
        'Description': Description,
        'RatingScore': RatingScore,
        'Author': Author,
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'ReviewAnswer': ReviewAnswer
    };

    getTypeName() => "RatingReviewResponse";
    TypeContext? context = _ctx;
}

class CompanyRatingResponse implements IConvertible
{
    /**
    * 
    */
    // @ApiMember(Description="")
    String? CompanyId;

    /**
    * Id of the booking
    */
    // @ApiMember(Description="Id of the booking")
    int? BookingId;

    /**
    * The status of the rating, 1 = Active
    */
    // @ApiMember(Description="The status of the rating, 1 = Active")
    int? Status;

    /**
    * The rating score
    */
    // @ApiMember(Description="The rating score")
    int? RatingScore;

    /**
    * The review if any exists to the rating
    */
    // @ApiMember(Description="The review if any exists to the rating")
    RatingReviewResponse? Review;

    DateTime? CreatedDate;
    DateTime? UpdatedDate;

    CompanyRatingResponse({this.CompanyId,this.BookingId,this.Status,this.RatingScore,this.Review,this.CreatedDate,this.UpdatedDate});
    CompanyRatingResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        BookingId = json['BookingId'];
        Status = json['Status'];
        RatingScore = json['RatingScore'];
        Review = JsonConverters.fromJson(json['Review'],'RatingReviewResponse',context!);
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'BookingId': BookingId,
        'Status': Status,
        'RatingScore': RatingScore,
        'Review': JsonConverters.toJson(Review,'RatingReviewResponse',context!),
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!)
    };

    getTypeName() => "CompanyRatingResponse";
    TypeContext? context = _ctx;
}

class CreateReview implements IConvertible
{
    /**
    * The title for the review
    */
    // @ApiMember(Description="The title for the review")
    String? Title;

    /**
    * The description for the review
    */
    // @ApiMember(Description="The description for the review")
    String? Description;

    /**
    * The review author
    */
    // @ApiMember(Description="The review author")
    String? Author;

    /**
    * The review author
    */
    // @ApiMember(Description="The review author")
    String? ReviewAnswer;

    CreateReview({this.Title,this.Description,this.Author,this.ReviewAnswer});
    CreateReview.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Title = json['Title'];
        Description = json['Description'];
        Author = json['Author'];
        ReviewAnswer = json['ReviewAnswer'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Title': Title,
        'Description': Description,
        'Author': Author,
        'ReviewAnswer': ReviewAnswer
    };

    getTypeName() => "CreateReview";
    TypeContext? context = _ctx;
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class AddRating implements IConvertible
{
    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    String? CompanyId;

    /**
    * Id of the booking
    */
    // @ApiMember(Description="Id of the booking", IsRequired=true)
    int? BookingId;

    /**
    * The identifier for the booking, use to verify the booking.
    */
    // @ApiMember(Description="The identifier for the booking, use to verify the booking.", IsRequired=true)
    String? Identifier;

    /**
    * The rating score between 1 and 5.
    */
    // @ApiMember(Description="The rating score between 1 and 5.", IsRequired=true)
    int? RatingScore;

    /**
    * The review for the rating
    */
    // @ApiMember(Description="The review for the rating")
    CreateReview? Review;

    AddRating({this.CompanyId,this.BookingId,this.Identifier,this.RatingScore,this.Review});
    AddRating.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        BookingId = json['BookingId'];
        Identifier = json['Identifier'];
        RatingScore = json['RatingScore'];
        Review = JsonConverters.fromJson(json['Review'],'CreateReview',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'BookingId': BookingId,
        'Identifier': Identifier,
        'RatingScore': RatingScore,
        'Review': JsonConverters.toJson(Review,'CreateReview',context!)
    };

    getTypeName() => "AddRating";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'RatingReviewResponse': TypeInfo(TypeOf.Class, create:() => RatingReviewResponse()),
    'CompanyRatingResponse': TypeInfo(TypeOf.Class, create:() => CompanyRatingResponse()),
    'CreateReview': TypeInfo(TypeOf.Class, create:() => CreateReview()),
    'AddRating': TypeInfo(TypeOf.Class, create:() => AddRating()),
});

Dart AddRating DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /rating/ HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"BookingId":0,"Identifier":"String","RatingScore":0,"Review":{"Title":"String","Description":"String","Author":"String","ReviewAnswer":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"BookingId":0,"Status":0,"RatingScore":0,"Review":{"Title":"String","Description":"String","RatingScore":0,"Author":"String","ReviewAnswer":"String"}}