BokaMera.API.Host

<back to all web services

UpdateMessageTemplate

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/messages/templates/{Id}Updates an existing company message templatesUpdate an existing company message templates.
import 'package:servicestack/servicestack.dart';

class MessageTypeQueryResponse implements IConvertible
{
    /**
    * The message type id
    */
    // @ApiMember(Description="The message type id")
    int? Id;

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

    /**
    * The message type description.
    */
    // @ApiMember(Description="The message type description.")
    String? Description;

    /**
    * The maximum number of charachters that can be entered into message body using this type.
    */
    // @ApiMember(Description="The maximum number of charachters that can be entered into message body using this type.")
    int? MaxCharacters;

    /**
    * The default text that is always included when sending messages of this type.
    */
    // @ApiMember(Description="The default text that is always included when sending messages of this type.")
    String? DefaultText;

    /**
    * The send method for this type. 1 = Email, 2 = SMS.
    */
    // @ApiMember(Description="The send method for this type. 1 = Email, 2 = SMS.")
    int? SendMethodId;

    MessageTypeQueryResponse({this.Id,this.Name,this.Description,this.MaxCharacters,this.DefaultText,this.SendMethodId});
    MessageTypeQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class MessageServices implements IConvertible
{
    int? Id;
    /**
    * Name of the service
    */
    // @ApiMember(Description="Name of the service")
    String? Name;

    /**
    * The image url of the service
    */
    // @ApiMember(Description="The image url of the service")
    Uri? ImageUrl;

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

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

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!)
    };

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

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

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

    /**
    * The message template title.
    */
    // @ApiMember(Description="The message template title.")
    String? Title;

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

    /**
    * The message template sender (an email for message types with sendmethod 1, for SMS this cannot be set).
    */
    // @ApiMember(Description="The message template sender (an email for message types with sendmethod 1, for SMS this cannot be set).")
    String? Sender;

    /**
    * If the message template is the default message currently in use.
    */
    // @ApiMember(Description="If the message template is the default message currently in use.")
    bool? Default;

    /**
    * If the message type information.
    */
    // @ApiMember(Description="If the message type information.")
    MessageTypeQueryResponse? MessageType;

    /**
    * Template language.
    */
    // @ApiMember(Description="Template language.")
    String? Language;

    /**
    * The connected services which the template is valid for. If empty then it's valid for all services.
    */
    // @ApiMember(Description="The connected services which the template is valid for. If empty then it's valid for all services.")
    List<MessageServices>? Services;

    MessageTemplatesQueryResponse({this.Id,this.Name,this.Title,this.Body,this.Sender,this.Default,this.MessageType,this.Language,this.Services});
    MessageTemplatesQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Title = json['Title'];
        Body = json['Body'];
        Sender = json['Sender'];
        Default = json['Default'];
        MessageType = JsonConverters.fromJson(json['MessageType'],'MessageTypeQueryResponse',context!);
        Language = json['Language'];
        Services = JsonConverters.fromJson(json['Services'],'List<MessageServices>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Title': Title,
        'Body': Body,
        'Sender': Sender,
        'Default': Default,
        'MessageType': JsonConverters.toJson(MessageType,'MessageTypeQueryResponse',context!),
        'Language': Language,
        'Services': JsonConverters.toJson(Services,'List<MessageServices>',context!)
    };

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateMessageTemplate 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 message template id.
    */
    // @ApiMember(Description="The message template id.", IsRequired=true, ParameterType="path")
    int? Id;

    /**
    * The message type id. See GET /messages/templates/types 
    */
    // @ApiMember(Description="The message type id. See GET /messages/templates/types ")
    int? TypeId;

    /**
    * The message should be default and the one to be used. All other messages for the same message type will be set to Default = false
    */
    // @ApiMember(Description="The message should be default and the one to be used. All other messages for the same message type will be set to Default = false")
    bool? Default;

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

    /**
    * The message template title.
    */
    // @ApiMember(Description="The message template title.")
    String? Title;

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

    /**
    * The message template sender (an email for message types with sendmethod 1, for SMS this cannot be set).
    */
    // @ApiMember(Description="The message template sender (an email for message types with sendmethod 1, for SMS this cannot be set).")
    String? Sender;

    /**
    * Message template lanugage
    */
    // @ApiMember(Description="Message template lanugage", IsRequired=true)
    String? Language;

    /**
    * The services that is connected to the template. If null it will be connected to all services.
    */
    // @ApiMember(Description="The services that is connected to the template. If null it will be connected to all services.")
    List<int>? Services;

    UpdateMessageTemplate({this.CompanyId,this.Id,this.TypeId,this.Default,this.Name,this.Title,this.Body,this.Sender,this.Language,this.Services});
    UpdateMessageTemplate.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        TypeId = json['TypeId'];
        Default = json['Default'];
        Name = json['Name'];
        Title = json['Title'];
        Body = json['Body'];
        Sender = json['Sender'];
        Language = json['Language'];
        Services = JsonConverters.fromJson(json['Services'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Id': Id,
        'TypeId': TypeId,
        'Default': Default,
        'Name': Name,
        'Title': Title,
        'Body': Body,
        'Sender': Sender,
        'Language': Language,
        'Services': JsonConverters.toJson(Services,'List<int>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'MessageTypeQueryResponse': TypeInfo(TypeOf.Class, create:() => MessageTypeQueryResponse()),
    'MessageServices': TypeInfo(TypeOf.Class, create:() => MessageServices()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
    'MessageTemplatesQueryResponse': TypeInfo(TypeOf.Class, create:() => MessageTemplatesQueryResponse()),
    'List<MessageServices>': TypeInfo(TypeOf.Class, create:() => <MessageServices>[]),
    'UpdateMessageTemplate': TypeInfo(TypeOf.Class, create:() => UpdateMessageTemplate()),
});

Dart UpdateMessageTemplate DTOs

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

HTTP + OTHER

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

PUT /messages/templates/{Id} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"TypeId":0,"Default":false,"Name":"String","Title":"String","Body":"String","Sender":"String","Language":"String","Services":[0]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"Name":"String","Title":"String","Body":"String","Sender":"String","Default":false,"MessageType":{"Id":0,"Name":"String","Description":"String","MaxCharacters":0,"DefaultText":"String","SendMethodId":0},"Language":"String","Services":[{"Id":0,"Name":"String"}]}