Test

<back to all web services

GetChatHistory

The following routes are available for this service:
All Verbs/chathistory
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
import 'dart:collection';

class ChatMessage implements IConvertible
{
    int? id;
    String? channel;
    String? fromUserId;
    String? fromName;
    String? displayName;
    String? message;
    String? userAuthId;
    bool? private;

    ChatMessage({this.id,this.channel,this.fromUserId,this.fromName,this.displayName,this.message,this.userAuthId,this.private});
    ChatMessage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        channel = json['channel'];
        fromUserId = json['fromUserId'];
        fromName = json['fromName'];
        displayName = json['displayName'];
        message = json['message'];
        userAuthId = json['userAuthId'];
        private = json['private'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'channel': channel,
        'fromUserId': fromUserId,
        'fromName': fromName,
        'displayName': displayName,
        'message': message,
        'userAuthId': userAuthId,
        'private': private
    };

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

class GetChatHistoryResponse implements IConvertible
{
    List<ChatMessage>? results;
    ResponseStatus? responseStatus;

    GetChatHistoryResponse({this.results,this.responseStatus});
    GetChatHistoryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        results = JsonConverters.fromJson(json['results'],'List<ChatMessage>',context!);
        responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'results': JsonConverters.toJson(results,'List<ChatMessage>',context!),
        'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
    };

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

class GetChatHistory implements IConvertible
{
    List<String>? channels;
    int? afterId;
    int? take;

    GetChatHistory({this.channels,this.afterId,this.take});
    GetChatHistory.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        channels = JsonConverters.fromJson(json['channels'],'List<String>',context!);
        afterId = json['afterId'];
        take = json['take'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'channels': JsonConverters.toJson(channels,'List<String>',context!),
        'afterId': afterId,
        'take': take
    };

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

TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
    'ChatMessage': TypeInfo(TypeOf.Class, create:() => ChatMessage()),
    'GetChatHistoryResponse': TypeInfo(TypeOf.Class, create:() => GetChatHistoryResponse()),
    'List<ChatMessage>': TypeInfo(TypeOf.Class, create:() => <ChatMessage>[]),
    'GetChatHistory': TypeInfo(TypeOf.Class, create:() => GetChatHistory()),
});

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

POST /chathistory HTTP/1.1 
Host: test.servicestack.net 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"channels":["String"],"afterId":0,"take":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"results":[{"id":0,"channel":"String","fromUserId":"String","fromName":"String","displayName":"String","message":"String","userAuthId":"String","private":false}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}