Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /messages/templates | Create a new company message templates | Create a new company message templates. |
---|
import java.math.*;
import java.util.*;
import net.servicestack.client.*;
public class dtos
{
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
@ValidateRequest(Validator="IsAuthenticated")
public static class CreateMessageTemplate implements ICompany
{
/**
* 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.")
public UUID CompanyId = null;
/**
* The message type id. See GET /messages/templates/types
*/
@ApiMember(Description="The message type id. See GET /messages/templates/types ", IsRequired=true)
public Integer TypeId = null;
/**
* The message template name.
*/
@ApiMember(Description="The message template name.", IsRequired=true)
public String Name = null;
/**
* The message template title.
*/
@ApiMember(Description="The message template title.", IsRequired=true)
public String Title = null;
/**
* The message template title.
*/
@ApiMember(Description="The message template title.", IsRequired=true)
public String Body = null;
/**
* 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).")
public String Sender = null;
/**
* Template Language sv / en
*/
@ApiMember(Description="Template Language sv / en")
public String Language = null;
/**
* 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.")
public ArrayList<Integer> Services = null;
public UUID getCompanyId() { return CompanyId; }
public CreateMessageTemplate setCompanyId(UUID value) { this.CompanyId = value; return this; }
public Integer getTypeId() { return TypeId; }
public CreateMessageTemplate setTypeId(Integer value) { this.TypeId = value; return this; }
public String getName() { return Name; }
public CreateMessageTemplate setName(String value) { this.Name = value; return this; }
public String getTitle() { return Title; }
public CreateMessageTemplate setTitle(String value) { this.Title = value; return this; }
public String getBody() { return Body; }
public CreateMessageTemplate setBody(String value) { this.Body = value; return this; }
public String getSender() { return Sender; }
public CreateMessageTemplate setSender(String value) { this.Sender = value; return this; }
public String getLanguage() { return Language; }
public CreateMessageTemplate setLanguage(String value) { this.Language = value; return this; }
public ArrayList<Integer> getServices() { return Services; }
public CreateMessageTemplate setServices(ArrayList<Integer> value) { this.Services = value; return this; }
}
public static class MessageTemplatesQueryResponse
{
/**
* The message template id
*/
@ApiMember(Description="The message template id")
public Integer Id = null;
/**
* The message template name.
*/
@ApiMember(Description="The message template name.")
public String Name = null;
/**
* The message template title.
*/
@ApiMember(Description="The message template title.")
public String Title = null;
/**
* The message template title.
*/
@ApiMember(Description="The message template title.")
public String Body = null;
/**
* 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).")
public String Sender = null;
/**
* If the message template is the default message currently in use.
*/
@ApiMember(Description="If the message template is the default message currently in use.")
public Boolean Default = null;
/**
* If the message type information.
*/
@ApiMember(Description="If the message type information.")
public MessageTypeQueryResponse MessageType = null;
/**
* Template language.
*/
@ApiMember(Description="Template language.")
public String Language = null;
/**
* 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.")
public ArrayList<MessageServices> Services = null;
public Integer getId() { return Id; }
public MessageTemplatesQueryResponse setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public MessageTemplatesQueryResponse setName(String value) { this.Name = value; return this; }
public String getTitle() { return Title; }
public MessageTemplatesQueryResponse setTitle(String value) { this.Title = value; return this; }
public String getBody() { return Body; }
public MessageTemplatesQueryResponse setBody(String value) { this.Body = value; return this; }
public String getSender() { return Sender; }
public MessageTemplatesQueryResponse setSender(String value) { this.Sender = value; return this; }
public Boolean isDefault() { return Default; }
public MessageTemplatesQueryResponse setDefault(Boolean value) { this.Default = value; return this; }
public MessageTypeQueryResponse getMessageType() { return MessageType; }
public MessageTemplatesQueryResponse setMessageType(MessageTypeQueryResponse value) { this.MessageType = value; return this; }
public String getLanguage() { return Language; }
public MessageTemplatesQueryResponse setLanguage(String value) { this.Language = value; return this; }
public ArrayList<MessageServices> getServices() { return Services; }
public MessageTemplatesQueryResponse setServices(ArrayList<MessageServices> value) { this.Services = value; return this; }
}
public static class MessageTypeQueryResponse
{
/**
* The message type id
*/
@ApiMember(Description="The message type id")
public Integer Id = null;
/**
* The message type name.
*/
@ApiMember(Description="The message type name.")
public String Name = null;
/**
* The message type description.
*/
@ApiMember(Description="The message type description.")
public String Description = null;
/**
* 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.")
public Integer MaxCharacters = null;
/**
* 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.")
public String DefaultText = null;
/**
* The send method for this type. 1 = Email, 2 = SMS.
*/
@ApiMember(Description="The send method for this type. 1 = Email, 2 = SMS.")
public Integer SendMethodId = null;
public Integer getId() { return Id; }
public MessageTypeQueryResponse setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public MessageTypeQueryResponse setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public MessageTypeQueryResponse setDescription(String value) { this.Description = value; return this; }
public Integer getMaxCharacters() { return MaxCharacters; }
public MessageTypeQueryResponse setMaxCharacters(Integer value) { this.MaxCharacters = value; return this; }
public String getDefaultText() { return DefaultText; }
public MessageTypeQueryResponse setDefaultText(String value) { this.DefaultText = value; return this; }
public Integer getSendMethodId() { return SendMethodId; }
public MessageTypeQueryResponse setSendMethodId(Integer value) { this.SendMethodId = value; return this; }
}
public static class MessageServices
{
public Integer Id = null;
/**
* Name of the service
*/
@ApiMember(Description="Name of the service")
public String Name = null;
/**
* The image url of the service
*/
@ApiMember(Description="The image url of the service")
public Uri ImageUrl = null;
public Integer getId() { return Id; }
public MessageServices setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public MessageServices setName(String value) { this.Name = value; return this; }
public Uri getImageUrl() { return ImageUrl; }
public MessageServices setImageUrl(Uri value) { this.ImageUrl = value; return this; }
}
}
Java CreateMessageTemplate DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /messages/templates HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
TypeId: 0,
Name: String,
Title: String,
Body: String,
Sender: String,
Language: String,
Services:
[
0
]
}
HTTP/1.1 200 OK Content-Type: text/jsv 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 } ] }