GET | /conversations |
---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
enum MessageDirections
{
Incoming,
Outgoing,
}
class MessageInfo implements IConvertible
{
String? id;
String? accountId;
String? customerId;
String? endpointId;
String? endpointDisplayName;
String? date;
MessageDirections? direction;
String? otherAddress;
String? sender;
String? text;
bool? isUnread;
MessageInfo({this.id,this.accountId,this.customerId,this.endpointId,this.endpointDisplayName,this.date,this.direction,this.otherAddress,this.sender,this.text,this.isUnread});
MessageInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
accountId = json['accountId'];
customerId = json['customerId'];
endpointId = json['endpointId'];
endpointDisplayName = json['endpointDisplayName'];
date = json['date'];
direction = JsonConverters.fromJson(json['direction'],'MessageDirections',context!);
otherAddress = json['otherAddress'];
sender = json['sender'];
text = json['text'];
isUnread = json['isUnread'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'accountId': accountId,
'customerId': customerId,
'endpointId': endpointId,
'endpointDisplayName': endpointDisplayName,
'date': date,
'direction': JsonConverters.toJson(direction,'MessageDirections',context!),
'otherAddress': otherAddress,
'sender': sender,
'text': text,
'isUnread': isUnread
};
getTypeName() => "MessageInfo";
TypeContext? context = _ctx;
}
class ConversationInfo implements IConvertible
{
String? id;
String? endpointId;
String? otherAddress;
MessageInfo? mostRecentMessage;
ConversationInfo({this.id,this.endpointId,this.otherAddress,this.mostRecentMessage});
ConversationInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
endpointId = json['endpointId'];
otherAddress = json['otherAddress'];
mostRecentMessage = JsonConverters.fromJson(json['mostRecentMessage'],'MessageInfo',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'endpointId': endpointId,
'otherAddress': otherAddress,
'mostRecentMessage': JsonConverters.toJson(mostRecentMessage,'MessageInfo',context!)
};
getTypeName() => "ConversationInfo";
TypeContext? context = _ctx;
}
class ListConversationsResponse implements IConvertible
{
List<ConversationInfo>? conversations;
ListConversationsResponse({this.conversations});
ListConversationsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
conversations = JsonConverters.fromJson(json['conversations'],'List<ConversationInfo>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'conversations': JsonConverters.toJson(conversations,'List<ConversationInfo>',context!)
};
getTypeName() => "ListConversationsResponse";
TypeContext? context = _ctx;
}
class ListConversations implements IConvertible
{
/**
* The IDs of the account whose conversations you want to retrieve
*/
// @ApiMember(Description="The IDs of the account whose conversations you want to retrieve")
List<String>? accountIds;
/**
* The list of endpoint IDs whose conversations you want to retrieve
*/
// @ApiMember(Description="The list of endpoint IDs whose conversations you want to retrieve")
List<String>? endpointIds;
/**
* The list of customer IDs whose conversations you want to retrieve
*/
// @ApiMember(Description="The list of customer IDs whose conversations you want to retrieve")
List<String>? customerIds;
/**
* The start date for the conversations you want to retrieve
*/
// @ApiMember(Description="The start date for the conversations you want to retrieve")
String? afterDate;
ListConversations({this.accountIds,this.endpointIds,this.customerIds,this.afterDate});
ListConversations.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
accountIds = JsonConverters.fromJson(json['accountIds'],'List<String>',context!);
endpointIds = JsonConverters.fromJson(json['endpointIds'],'List<String>',context!);
customerIds = JsonConverters.fromJson(json['customerIds'],'List<String>',context!);
afterDate = json['afterDate'];
return this;
}
Map<String, dynamic> toJson() => {
'accountIds': JsonConverters.toJson(accountIds,'List<String>',context!),
'endpointIds': JsonConverters.toJson(endpointIds,'List<String>',context!),
'customerIds': JsonConverters.toJson(customerIds,'List<String>',context!),
'afterDate': afterDate
};
getTypeName() => "ListConversations";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'team.evovoice.io', types: <String, TypeInfo> {
'MessageDirections': TypeInfo(TypeOf.Enum, enumValues:MessageDirections.values),
'MessageInfo': TypeInfo(TypeOf.Class, create:() => MessageInfo()),
'ConversationInfo': TypeInfo(TypeOf.Class, create:() => ConversationInfo()),
'ListConversationsResponse': TypeInfo(TypeOf.Class, create:() => ListConversationsResponse()),
'List<ConversationInfo>': TypeInfo(TypeOf.Class, create:() => <ConversationInfo>[]),
'ListConversations': TypeInfo(TypeOf.Class, create:() => ListConversations()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /conversations HTTP/1.1 Host: team.evovoice.io Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"conversations":[{"id":"String","endpointId":"String","otherAddress":"String","mostRecentMessage":{"id":"String","accountId":"String","customerId":"String","endpointId":"String","endpointDisplayName":"String","date":"String","direction":"Incoming","otherAddress":"String","sender":"String","text":"String","isUnread":false}}]}