BokaMera.API.Host

<back to all web services

NewsletterTemplatesQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read
The following routes are available for this service:
GET/newsletter/templatesGet company newsletter templatesGet all company newsletter templates.
import 'package:servicestack/servicestack.dart';

// @DataContract
abstract class QueryBase
{
    /**
    * Skip over a given number of elements in a sequence and then return the remainder. Use this when you need paging.<br/><br/><strong>Example:</strong><br/><code>?skip=10&orderBy=Id</code>
    */
    // @DataMember(Order=1)
    int? Skip;

    /**
    * Return a given number of elements in a sequence and then skip over the remainder. Use this when you need paging.<br/><br/><strong>Example:</strong><br/><code>?take=20</code>
    */
    // @DataMember(Order=2)
    int? Take;

    /**
    * Comma separated list of fields to order by. Prefix the field name with a minus if you wan't to invert the sort for that field.<br/><br/><strong>Example:</strong><br/><code>?orderBy=Id,-Age,FirstName</code>
    */
    // @DataMember(Order=3)
    String? OrderBy;

    /**
    * Comma separated list of fields to order by in descending order. Prefix the field name with a minus if you wan't to invert the sort for that field.<br/><br/><strong>Example:</strong><br/><code>?orderByDesc=Id,-Age,FirstName</code>
    */
    // @DataMember(Order=4)
    String? OrderByDesc;

    /**
    * Include any of the aggregates <code>AVG, COUNT, FIRST, LAST, MAX, MIN, SUM</code> in your result set. The results will be returned in the meta field.<br/><br/><strong>Example:</strong><br/><code>?include=COUNT(*) as Total</code><br/><br/>or multiple fields with<br/><code>?include=Count(*) Total, Min(Age), AVG(Age) AverageAge</code><br/></br>or unique with<br/><code>?include=COUNT(DISTINCT LivingStatus) as UniqueStatus</code>
    */
    // @DataMember(Order=5)
    String? Include;

    // @DataMember(Order=6)
    String? Fields;

    // @DataMember(Order=7)
    Map<String,String?>? Meta;

    QueryBase({this.Skip,this.Take,this.OrderBy,this.OrderByDesc,this.Include,this.Fields,this.Meta});
    QueryBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Skip = json['Skip'];
        Take = json['Take'];
        OrderBy = json['OrderBy'];
        OrderByDesc = json['OrderByDesc'];
        Include = json['Include'];
        Fields = json['Fields'];
        Meta = JsonConverters.toStringMap(json['Meta']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Skip': Skip,
        'Take': Take,
        'OrderBy': OrderBy,
        'OrderByDesc': OrderByDesc,
        'Include': Include,
        'Fields': Fields,
        'Meta': Meta
    };

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

abstract class QueryDb2<From,Into> extends QueryBase
{
    QueryDb2();
    QueryDb2.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "QueryDb<$From,$Into>";
    TypeContext? context = _ctx;
}

class NewsletterSendMethodQueryResponse implements IConvertible
{
    /**
    * The send method id
    */
    // @ApiMember(Description="The send method id")
    int? Id;

    /**
    * The send method name.
    */
    // @ApiMember(Description="The send method name.")
    String? Name;

    /**
    * The send method description.
    */
    // @ApiMember(Description="The send method description.")
    String? Description;

    NewsletterSendMethodQueryResponse({this.Id,this.Name,this.Description});
    NewsletterSendMethodQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Description': Description
    };

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

class NewsletterEmailTemplatesQueryResponse implements IConvertible
{
    /**
    * The email template id
    */
    // @ApiMember(Description="The email template id")
    int? Id;

    /**
    * The email template name.
    */
    // @ApiMember(Description="The email template name.")
    String? Name;

    /**
    * The email template description.
    */
    // @ApiMember(Description="The email template description.")
    String? Description;

    /**
    * The email template html content.
    */
    // @ApiMember(Description="The email template html content.")
    String? Body;

    NewsletterEmailTemplatesQueryResponse({this.Id,this.Name,this.Description,this.Body});
    NewsletterEmailTemplatesQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Body = json['Body'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Description': Description,
        'Body': Body
    };

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

class NewsletterTemplatesQueryResponse implements IConvertible
{
    /**
    * The newsletter template id
    */
    // @ApiMember(Description="The newsletter template id")
    int? Id;

    /**
    * The newsletter template heading.
    */
    // @ApiMember(Description="The newsletter template heading.")
    String? Heading;

    /**
    * The newsletter template body.
    */
    // @ApiMember(Description="The newsletter template body.")
    String? Body;

    /**
    * The email template the newsletter uses.
    */
    // @ApiMember(Description="The email template the newsletter uses.")
    int? EmailTemplateId;

    /**
    * Send Method. 1 = Email, 2 = SMS
    */
    // @ApiMember(Description="Send Method. 1 = Email, 2 = SMS")
    int? SendMethodId;

    /**
    * The newsletter template image url.
    */
    // @ApiMember(Description="The newsletter template image url.")
    String? ImageUrl;

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

    /**
    * Send method information.
    */
    // @ApiMember(Description="Send method information.")
    NewsletterSendMethodQueryResponse? SendMethodInformation;

    /**
    * Email template information.
    */
    // @ApiMember(Description="Email template information.")
    NewsletterEmailTemplatesQueryResponse? EmailTemplateInformation;

    NewsletterTemplatesQueryResponse({this.Id,this.Heading,this.Body,this.EmailTemplateId,this.SendMethodId,this.ImageUrl,this.Created,this.SendMethodInformation,this.EmailTemplateInformation});
    NewsletterTemplatesQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Heading = json['Heading'];
        Body = json['Body'];
        EmailTemplateId = json['EmailTemplateId'];
        SendMethodId = json['SendMethodId'];
        ImageUrl = json['ImageUrl'];
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        SendMethodInformation = JsonConverters.fromJson(json['SendMethodInformation'],'NewsletterSendMethodQueryResponse',context!);
        EmailTemplateInformation = JsonConverters.fromJson(json['EmailTemplateInformation'],'NewsletterEmailTemplatesQueryResponse',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Heading': Heading,
        'Body': Body,
        'EmailTemplateId': EmailTemplateId,
        'SendMethodId': SendMethodId,
        'ImageUrl': ImageUrl,
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'SendMethodInformation': JsonConverters.toJson(SendMethodInformation,'NewsletterSendMethodQueryResponse',context!),
        'EmailTemplateInformation': JsonConverters.toJson(EmailTemplateInformation,'NewsletterEmailTemplatesQueryResponse',context!)
    };

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

class BaseModel implements IConvertible
{
    BaseModel();
    BaseModel.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "BaseModel";
    TypeContext? context = _ctx;
}

class SendMethod extends BaseModel implements IConvertible
{
    // @Required()
    String? Name;

    // @Required()
    String? Description;

    DateTime? ModifiedDate;
    int? Id;

    SendMethod({this.Name,this.Description,this.ModifiedDate,this.Id});
    SendMethod.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Name = json['Name'];
        Description = json['Description'];
        ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
        Id = json['Id'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Name': Name,
        'Description': Description,
        'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!),
        'Id': Id
    });

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

class EmailTemplate extends BaseModel implements IConvertible
{
    // @Required()
    String? Name;

    // @Required()
    String? Description;

    // @Required()
    String? Body;

    // @Required()
    int? Type;

    DateTime? ModifiedDate;
    int? Id;

    EmailTemplate({this.Name,this.Description,this.Body,this.Type,this.ModifiedDate,this.Id});
    EmailTemplate.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Name = json['Name'];
        Description = json['Description'];
        Body = json['Body'];
        Type = json['Type'];
        ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
        Id = json['Id'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Name': Name,
        'Description': Description,
        'Body': Body,
        'Type': Type,
        'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!),
        'Id': Id
    });

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

class NewsletterTemplate extends BaseModel implements IConvertible
{
    SendMethod? SendMethod;
    EmailTemplate? EmailTemplate;
    // @Required()
    String? CompanyId;

    int? Id;
    // @Required()
    String? Heading;

    // @Required()
    String? Body;

    String? ImageUrl;
    // @Required()
    int? SendMethodId;

    int? EmailTemplateId;
    // @Required()
    DateTime? Created;

    DateTime? ModifiedDate;

    NewsletterTemplate({this.SendMethod,this.EmailTemplate,this.CompanyId,this.Id,this.Heading,this.Body,this.ImageUrl,this.SendMethodId,this.EmailTemplateId,this.Created,this.ModifiedDate});
    NewsletterTemplate.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        SendMethod = JsonConverters.fromJson(json['SendMethod'],'SendMethod',context!);
        EmailTemplate = JsonConverters.fromJson(json['EmailTemplate'],'EmailTemplate',context!);
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        Heading = json['Heading'];
        Body = json['Body'];
        ImageUrl = json['ImageUrl'];
        SendMethodId = json['SendMethodId'];
        EmailTemplateId = json['EmailTemplateId'];
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'SendMethod': JsonConverters.toJson(SendMethod,'SendMethod',context!),
        'EmailTemplate': JsonConverters.toJson(EmailTemplate,'EmailTemplate',context!),
        'CompanyId': CompanyId,
        'Id': Id,
        'Heading': Heading,
        'Body': Body,
        'ImageUrl': ImageUrl,
        'SendMethodId': SendMethodId,
        'EmailTemplateId': EmailTemplateId,
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!)
    });

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class NewsletterTemplatesQuery extends QueryDb2<NewsletterTemplate,NewsletterTemplatesQueryResponse> implements ICompany, IConvertible
{
    /**
    * 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.")
    String? CompanyId;

    /**
    * The newsletter template id.
    */
    // @ApiMember(Description="The newsletter template id.")
    int? Id;

    /**
    * 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")
    bool? IncludeSendMethodInformation;

    /**
    * If you want to include the email template information
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the email template information", ParameterType="query")
    bool? IncludeEmailTemplateInformation;

    NewsletterTemplatesQuery({this.CompanyId,this.Id,this.IncludeSendMethodInformation,this.IncludeEmailTemplateInformation});
    NewsletterTemplatesQuery.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        IncludeSendMethodInformation = json['IncludeSendMethodInformation'];
        IncludeEmailTemplateInformation = json['IncludeEmailTemplateInformation'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'CompanyId': CompanyId,
        'Id': Id,
        'IncludeSendMethodInformation': IncludeSendMethodInformation,
        'IncludeEmailTemplateInformation': IncludeEmailTemplateInformation
    });

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

class AccessKeyTypeResponse implements IConvertible
{
    int? Id;
    String? KeyType;
    String? Description;

    AccessKeyTypeResponse({this.Id,this.KeyType,this.Description});
    AccessKeyTypeResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'KeyType': KeyType,
        'Description': Description
    };

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

// @DataContract
class QueryResponse<AccessKeyTypeResponse> implements IConvertible
{
    // @DataMember(Order=1)
    int? Offset;

    // @DataMember(Order=2)
    int? Total;

    // @DataMember(Order=3)
    List<AccessKeyTypeResponse>? Results;

    // @DataMember(Order=4)
    Map<String,String?>? Meta;

    // @DataMember(Order=5)
    ResponseStatus? ResponseStatus;

    QueryResponse({this.Offset,this.Total,this.Results,this.Meta,this.ResponseStatus});
    QueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Offset = json['Offset'];
        Total = json['Total'];
        Results = JsonConverters.fromJson(json['Results'],'List<${runtimeGenericTypeDefs(this,[0]).join(",")}>',context!);
        Meta = JsonConverters.toStringMap(json['Meta']);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Offset': Offset,
        'Total': Total,
        'Results': JsonConverters.toJson(Results,'List<AccessKeyTypeResponse>',context!),
        'Meta': Meta,
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "QueryResponse<$AccessKeyTypeResponse>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'NewsletterSendMethodQueryResponse': TypeInfo(TypeOf.Class, create:() => NewsletterSendMethodQueryResponse()),
    'NewsletterEmailTemplatesQueryResponse': TypeInfo(TypeOf.Class, create:() => NewsletterEmailTemplatesQueryResponse()),
    'NewsletterTemplatesQueryResponse': TypeInfo(TypeOf.Class, create:() => NewsletterTemplatesQueryResponse()),
    'BaseModel': TypeInfo(TypeOf.Class, create:() => BaseModel()),
    'SendMethod': TypeInfo(TypeOf.Class, create:() => SendMethod()),
    'EmailTemplate': TypeInfo(TypeOf.Class, create:() => EmailTemplate()),
    'NewsletterTemplate': TypeInfo(TypeOf.Class, create:() => NewsletterTemplate()),
    'NewsletterTemplatesQuery': TypeInfo(TypeOf.Class, create:() => NewsletterTemplatesQuery()),
    'List<NewsletterTemplatesQueryResponse>': TypeInfo(TypeOf.Class, create:() => <NewsletterTemplatesQueryResponse>[]),
    'AccessKeyTypeResponse': TypeInfo(TypeOf.Class, create:() => AccessKeyTypeResponse()),
    'QueryResponse<AccessKeyTypeResponse>': TypeInfo(TypeOf.Class, create:() => QueryResponse<AccessKeyTypeResponse>()),
});

Dart NewsletterTemplatesQuery 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.

GET /newsletter/templates HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Offset":0,"Total":0,"Results":[{"Id":0,"Heading":"String","Body":"String","EmailTemplateId":0,"SendMethodId":0,"ImageUrl":"String","SendMethodInformation":{"Id":0,"Name":"String","Description":"String"},"EmailTemplateInformation":{"Id":0,"Name":"String","Description":"String","Body":"String"}}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}