GalaxyMobile App API

<back to all web services

PostMessage

The following routes are available for this service:
POST/galaxy/sendmessageSends a push message to users, notifying them of a message in the app.
import 'package:servicestack/servicestack.dart';

class ApiServiceResponse implements IServiceResponse, IConvertible
{
    String? Description;
    String? Heading;
    bool? WasSuccessful;
    dynamic? ModelState;

    ApiServiceResponse({this.Description,this.Heading,this.WasSuccessful,this.ModelState});
    ApiServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Description = json['Description'];
        Heading = json['Heading'];
        WasSuccessful = json['WasSuccessful'];
        ModelState = JsonConverters.fromJson(json['ModelState'],'dynamic',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Description': Description,
        'Heading': Heading,
        'WasSuccessful': WasSuccessful,
        'ModelState': JsonConverters.toJson(ModelState,'dynamic',context!)
    };

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

class PostMessageResponse extends ApiServiceResponse implements IConvertible
{
    PostMessageResponse();
    PostMessageResponse.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() => "PostMessageResponse";
    TypeContext? context = _ctx;
}

// @Flags()
class MessageType
{
    static const MessageType Info = const MessageType._(1);
    static const MessageType Marketing = const MessageType._(2);
    static const MessageType Policy = const MessageType._(3);
    static const MessageType Announcement = const MessageType._(4);
    static const MessageType General = const MessageType._(5);
    static const MessageType Claim = const MessageType._(6);

    final int _value;
    const MessageType._(this._value);
    int get value => _value;
    static List<MessageType> get values => const [Info,Marketing,Policy,Announcement,General,Claim];
}

class UserDetails implements IConvertible
{
    String? IdNumber;
    int? GalaxyCompanyId;

    UserDetails({this.IdNumber,this.GalaxyCompanyId});
    UserDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        IdNumber = json['IdNumber'];
        GalaxyCompanyId = json['GalaxyCompanyId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'IdNumber': IdNumber,
        'GalaxyCompanyId': GalaxyCompanyId
    };

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

class PostMessage implements ILogRequest, IHasApiKey, IConvertible
{
    /**
    * The type of message being sent.
    */
    // @ApiMember(DataType="MessageType", Description="The type of message being sent.", IsRequired=true)
    MessageType? Type;

    /**
    * The subject of the message
    */
    // @ApiMember(DataType="string", Description="The subject of the message", IsRequired=true)
    String? Subject;

    /**
    * The content of the message
    */
    // @ApiMember(DataType="string", Description="The content of the message", IsRequired=true)
    String? Content;

    /**
    * The recipients who will be receiving the message
    */
    // @ApiMember(Description="The recipients who will be receiving the message", IsRequired=true)
    List<UserDetails>? Recipients;

    /**
    * The API Key required for authentication
    */
    // @ApiMember(Description="The API Key required for authentication", IsRequired=true)
    String? ApiKey;

    /**
    * If set, the message will be displayed in the user's inbox in the app. Otherwise will just be a push notification.
    */
    // @ApiMember(Description="If set, the message will be displayed in the user's inbox in the app. Otherwise will just be a push notification.", IsRequired=true)
    bool? ShowInInbox;

    PostMessage({this.Type,this.Subject,this.Content,this.Recipients,this.ApiKey,this.ShowInInbox});
    PostMessage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Type = JsonConverters.fromJson(json['Type'],'MessageType',context!);
        Subject = json['Subject'];
        Content = json['Content'];
        Recipients = JsonConverters.fromJson(json['Recipients'],'List<UserDetails>',context!);
        ApiKey = json['ApiKey'];
        ShowInInbox = json['ShowInInbox'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Type': JsonConverters.toJson(Type,'MessageType',context!),
        'Subject': Subject,
        'Content': Content,
        'Recipients': JsonConverters.toJson(Recipients,'List<UserDetails>',context!),
        'ApiKey': ApiKey,
        'ShowInInbox': ShowInInbox
    };

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

TypeContext _ctx = TypeContext(library: 'galaxymobile.api.dev.86degrees.com', types: <String, TypeInfo> {
    'ApiServiceResponse': TypeInfo(TypeOf.Class, create:() => ApiServiceResponse()),
    'PostMessageResponse': TypeInfo(TypeOf.Class, create:() => PostMessageResponse()),
    'MessageType': TypeInfo(TypeOf.Enum, enumValues:MessageType.values),
    'UserDetails': TypeInfo(TypeOf.Class, create:() => UserDetails()),
    'PostMessage': TypeInfo(TypeOf.Class, create:() => PostMessage()),
    'List<UserDetails>': TypeInfo(TypeOf.Class, create:() => <UserDetails>[]),
});

Dart PostMessage DTOs

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

HTTP + CSV

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

POST /galaxy/sendmessage HTTP/1.1 
Host: galaxymobile.api.dev.86degrees.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"Type":1,"Subject":"String","Content":"String","Recipients":[{"IdNumber":"String","GalaxyCompanyId":0}],"ApiKey":"String","ShowInInbox":false}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Description":"String","Heading":"String","WasSuccessful":false,"ModelState":{}}