BokaMera.API.Host

<back to all web services

CreateNewsletterTemplate

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/newsletter/templatesCreate a new company newsletter template.Create a new company newsletter template.
import 'package:servicestack/servicestack.dart';

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;
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateNewsletterTemplate 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 heading.
    */
    // @ApiMember(Description="The newsletter template heading.")
    String? Heading;

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

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

    /**
    * The newsletter template send method (1=email, 2=sms).
    */
    // @ApiMember(Description="The newsletter template send method (1=email, 2=sms).")
    int? SendMethodId;

    /**
    * The email template id. Get valid email templates from GET /newsletter/emailtemplates
    */
    // @ApiMember(Description="The email template id. Get valid email templates from GET /newsletter/emailtemplates")
    int? EmailTemplateId;

    CreateNewsletterTemplate({this.CompanyId,this.Heading,this.Body,this.ImageUrl,this.SendMethodId,this.EmailTemplateId});
    CreateNewsletterTemplate.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Heading = json['Heading'];
        Body = json['Body'];
        ImageUrl = json['ImageUrl'];
        SendMethodId = json['SendMethodId'];
        EmailTemplateId = json['EmailTemplateId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Heading': Heading,
        'Body': Body,
        'ImageUrl': ImageUrl,
        'SendMethodId': SendMethodId,
        'EmailTemplateId': EmailTemplateId
    };

    getTypeName() => "CreateNewsletterTemplate";
    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()),
    'CreateNewsletterTemplate': TypeInfo(TypeOf.Class, create:() => CreateNewsletterTemplate()),
});

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

POST /newsletter/templates HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateNewsletterTemplate xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Body>String</Body>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <EmailTemplateId>0</EmailTemplateId>
  <Heading>String</Heading>
  <ImageUrl>String</ImageUrl>
  <SendMethodId>0</SendMethodId>
</CreateNewsletterTemplate>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<NewsletterTemplatesQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Body>String</Body>
  <Created>0001-01-01T00:00:00</Created>
  <EmailTemplateId>0</EmailTemplateId>
  <EmailTemplateInformation>
    <Body>String</Body>
    <Description>String</Description>
    <Id>0</Id>
    <Name>String</Name>
  </EmailTemplateInformation>
  <Heading>String</Heading>
  <Id>0</Id>
  <ImageUrl>String</ImageUrl>
  <SendMethodId>0</SendMethodId>
  <SendMethodInformation>
    <Description>String</Description>
    <Id>0</Id>
    <Name>String</Name>
  </SendMethodInformation>
</NewsletterTemplatesQueryResponse>