GET | /messages |
---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
enum SortOrders
{
Ascend,
Descend,
}
abstract class ListRequest<T> implements IGet
{
/**
* The page of data to retrieve
*/
// @ApiMember(Description="The page of data to retrieve")
int? page;
/**
* If you want all objects to be returned. This should be used with care
*/
// @ApiMember(Description="If you want all objects to be returned. This should be used with care")
bool? all;
/**
* The number per page to retrieve
*/
// @ApiMember(Description="The number per page to retrieve")
int? countPerPage;
/**
* Specific IDs
*/
// @ApiMember(Description="Specific IDs")
List<String>? specificIds;
/**
* Specify a sort field
*/
// @ApiMember(Description="Specify a sort field")
String? sortField;
/**
* Specify a sort order
*/
// @ApiMember(Description="Specify a sort order")
SortOrders? sortOrder;
/**
* Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array
*/
// @ApiMember(Description="Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array")
bool? simplifiedPaging;
ListRequest({this.page,this.all,this.countPerPage,this.specificIds,this.sortField,this.sortOrder,this.simplifiedPaging});
ListRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
page = json['page'];
all = json['all'];
countPerPage = json['countPerPage'];
specificIds = JsonConverters.fromJson(json['specificIds'],'List<String>',context!);
sortField = json['sortField'];
sortOrder = JsonConverters.fromJson(json['sortOrder'],'SortOrders',context!);
simplifiedPaging = json['simplifiedPaging'];
return this;
}
Map<String, dynamic> toJson() => {
'page': page,
'all': all,
'countPerPage': countPerPage,
'specificIds': JsonConverters.toJson(specificIds,'List<String>',context!),
'sortField': sortField,
'sortOrder': JsonConverters.toJson(sortOrder,'SortOrders',context!),
'simplifiedPaging': simplifiedPaging
};
getTypeName() => "ListRequest<$T>";
TypeContext? context = _ctx;
}
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 ListMessages extends ListRequest<MessageInfo> implements IConvertible
{
/**
* The IDs of the account whose messages you want to retrieve
*/
// @ApiMember(Description="The IDs of the account whose messages you want to retrieve")
List<String>? accountIds;
/**
* The IDs of the customers whose messages you want to retrieve
*/
// @ApiMember(Description="The IDs of the customers whose messages you want to retrieve")
List<String>? customerIds;
/**
* The IDs of the endpoints whose messages you want to retrieve
*/
// @ApiMember(Description="The IDs of the endpoints whose messages you want to retrieve")
List<String>? endpointIds;
/**
* The ID of the conversations whose messages you want to retrieve
*/
// @ApiMember(Description="The ID of the conversations whose messages you want to retrieve")
List<String>? conversationIds;
/**
* The date after which messages should be retrieved
*/
// @ApiMember(Description="The date after which messages should be retrieved")
String? afterDate;
ListMessages({this.accountIds,this.customerIds,this.endpointIds,this.conversationIds,this.afterDate});
ListMessages.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
accountIds = JsonConverters.fromJson(json['accountIds'],'List<String>',context!);
customerIds = JsonConverters.fromJson(json['customerIds'],'List<String>',context!);
endpointIds = JsonConverters.fromJson(json['endpointIds'],'List<String>',context!);
conversationIds = JsonConverters.fromJson(json['conversationIds'],'List<String>',context!);
afterDate = json['afterDate'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'accountIds': JsonConverters.toJson(accountIds,'List<String>',context!),
'customerIds': JsonConverters.toJson(customerIds,'List<String>',context!),
'endpointIds': JsonConverters.toJson(endpointIds,'List<String>',context!),
'conversationIds': JsonConverters.toJson(conversationIds,'List<String>',context!),
'afterDate': afterDate
});
getTypeName() => "ListMessages";
TypeContext? context = _ctx;
}
abstract class EntityInfo
{
/**
* The ID of the object
*/
// @ApiMember(Description="The ID of the object")
String? id;
/**
* The date the object was created
*/
// @ApiMember(Description="The date the object was created")
String? dateCreated;
/**
* The date the object was last modified
*/
// @ApiMember(Description="The date the object was last modified")
String? dateLastModified;
/**
* The user that created this object
*/
// @ApiMember(Description="The user that created this object")
String? createdBy;
/**
* The user that last modified this object
*/
// @ApiMember(Description="The user that last modified this object")
String? lastModifiedBy;
EntityInfo({this.id,this.dateCreated,this.dateLastModified,this.createdBy,this.lastModifiedBy});
EntityInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
dateCreated = json['dateCreated'];
dateLastModified = json['dateLastModified'];
createdBy = json['createdBy'];
lastModifiedBy = json['lastModifiedBy'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'dateCreated': dateCreated,
'dateLastModified': dateLastModified,
'createdBy': createdBy,
'lastModifiedBy': lastModifiedBy
};
getTypeName() => "EntityInfo";
TypeContext? context = _ctx;
}
class BillingItem implements IConvertible
{
double? baseCost;
double? rawUnitMultiplier;
double? unitCost;
int? allowance;
BillingItem({this.baseCost,this.rawUnitMultiplier,this.unitCost,this.allowance});
BillingItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
baseCost = JsonConverters.toDouble(json['baseCost']);
rawUnitMultiplier = JsonConverters.toDouble(json['rawUnitMultiplier']);
unitCost = JsonConverters.toDouble(json['unitCost']);
allowance = json['allowance'];
return this;
}
Map<String, dynamic> toJson() => {
'baseCost': baseCost,
'rawUnitMultiplier': rawUnitMultiplier,
'unitCost': unitCost,
'allowance': allowance
};
getTypeName() => "BillingItem";
TypeContext? context = _ctx;
}
class BillingSettings implements IConvertible
{
BillingItem? base;
BillingItem? localNumbers;
BillingItem? tollFreeNumbers;
BillingItem? inboundVoiceCalls;
BillingItem? outboundVoiceCalls;
BillingItem? inboundFaxes;
BillingItem? outboundFaxes;
BillingItem? inboundSmsMessages;
BillingItem? outboundSmsMessages;
BillingItem? aiInsights;
BillingItem? aiLiveMinutes;
BillingSettings({this.base,this.localNumbers,this.tollFreeNumbers,this.inboundVoiceCalls,this.outboundVoiceCalls,this.inboundFaxes,this.outboundFaxes,this.inboundSmsMessages,this.outboundSmsMessages,this.aiInsights,this.aiLiveMinutes});
BillingSettings.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
base = JsonConverters.fromJson(json['base'],'BillingItem',context!);
localNumbers = JsonConverters.fromJson(json['localNumbers'],'BillingItem',context!);
tollFreeNumbers = JsonConverters.fromJson(json['tollFreeNumbers'],'BillingItem',context!);
inboundVoiceCalls = JsonConverters.fromJson(json['inboundVoiceCalls'],'BillingItem',context!);
outboundVoiceCalls = JsonConverters.fromJson(json['outboundVoiceCalls'],'BillingItem',context!);
inboundFaxes = JsonConverters.fromJson(json['inboundFaxes'],'BillingItem',context!);
outboundFaxes = JsonConverters.fromJson(json['outboundFaxes'],'BillingItem',context!);
inboundSmsMessages = JsonConverters.fromJson(json['inboundSmsMessages'],'BillingItem',context!);
outboundSmsMessages = JsonConverters.fromJson(json['outboundSmsMessages'],'BillingItem',context!);
aiInsights = JsonConverters.fromJson(json['aiInsights'],'BillingItem',context!);
aiLiveMinutes = JsonConverters.fromJson(json['aiLiveMinutes'],'BillingItem',context!);
return this;
}
Map<String, dynamic> toJson() => {
'base': JsonConverters.toJson(base,'BillingItem',context!),
'localNumbers': JsonConverters.toJson(localNumbers,'BillingItem',context!),
'tollFreeNumbers': JsonConverters.toJson(tollFreeNumbers,'BillingItem',context!),
'inboundVoiceCalls': JsonConverters.toJson(inboundVoiceCalls,'BillingItem',context!),
'outboundVoiceCalls': JsonConverters.toJson(outboundVoiceCalls,'BillingItem',context!),
'inboundFaxes': JsonConverters.toJson(inboundFaxes,'BillingItem',context!),
'outboundFaxes': JsonConverters.toJson(outboundFaxes,'BillingItem',context!),
'inboundSmsMessages': JsonConverters.toJson(inboundSmsMessages,'BillingItem',context!),
'outboundSmsMessages': JsonConverters.toJson(outboundSmsMessages,'BillingItem',context!),
'aiInsights': JsonConverters.toJson(aiInsights,'BillingItem',context!),
'aiLiveMinutes': JsonConverters.toJson(aiLiveMinutes,'BillingItem',context!)
};
getTypeName() => "BillingSettings";
TypeContext? context = _ctx;
}
class AccountInfo extends EntityInfo implements IConvertible
{
/**
* The name of this account
*/
// @ApiMember(Description="The name of this account")
String? name;
/**
* The ID of this account's parent
*/
// @ApiMember(Description="The ID of this account's parent")
String? parentAccountId;
/**
* The twilio account SID
*/
// @ApiMember(Description="The twilio account SID")
String? twilioAccountSid;
/**
* The ancestors of this account. Useful for breadcrumbs
*/
// @ApiMember(Description="The ancestors of this account. Useful for breadcrumbs")
List<String>? ancestorIds;
/**
* The max number of phone numbers this account can have
*/
// @ApiMember(Description="The max number of phone numbers this account can have")
int? maxPhoneNumbers;
/**
* This account is BYOA
*/
// @ApiMember(Description="This account is BYOA")
bool? isBYOA;
/**
* TrustHub Profile Sid
*/
// @ApiMember(Description="TrustHub Profile Sid")
String? trustHubProfileSid;
/**
* The ID of the logo file
*/
// @ApiMember(Description="The ID of the logo file")
String? logoId;
/**
* The URI of the logo file
*/
// @ApiMember(Description="The URI of the logo file")
String? logoUri;
/**
* The billing settings for this account
*/
// @ApiMember(Description="The billing settings for this account")
BillingSettings? billingSettings;
AccountInfo({this.name,this.parentAccountId,this.twilioAccountSid,this.ancestorIds,this.maxPhoneNumbers,this.isBYOA,this.trustHubProfileSid,this.logoId,this.logoUri,this.billingSettings});
AccountInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
name = json['name'];
parentAccountId = json['parentAccountId'];
twilioAccountSid = json['twilioAccountSid'];
ancestorIds = JsonConverters.fromJson(json['ancestorIds'],'List<String>',context!);
maxPhoneNumbers = json['maxPhoneNumbers'];
isBYOA = json['isBYOA'];
trustHubProfileSid = json['trustHubProfileSid'];
logoId = json['logoId'];
logoUri = json['logoUri'];
billingSettings = JsonConverters.fromJson(json['billingSettings'],'BillingSettings',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'name': name,
'parentAccountId': parentAccountId,
'twilioAccountSid': twilioAccountSid,
'ancestorIds': JsonConverters.toJson(ancestorIds,'List<String>',context!),
'maxPhoneNumbers': maxPhoneNumbers,
'isBYOA': isBYOA,
'trustHubProfileSid': trustHubProfileSid,
'logoId': logoId,
'logoUri': logoUri,
'billingSettings': JsonConverters.toJson(billingSettings,'BillingSettings',context!)
});
getTypeName() => "AccountInfo";
TypeContext? context = _ctx;
}
class ListResponse<T> implements IConvertible
{
/**
* The items
*/
// @ApiMember(Description="The items")
List<AccountInfo>? items;
/**
* The total number of items
*/
// @ApiMember(Description="The total number of items")
int? totalCount;
/**
* The total number of pages
*/
// @ApiMember(Description="The total number of pages")
int? totalPages;
/**
* Are there more pages of items? Used with simplified paging
*/
// @ApiMember(Description="Are there more pages of items? Used with simplified paging")
bool? hasMorePages;
ListResponse({this.items,this.totalCount,this.totalPages,this.hasMorePages});
ListResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
items = JsonConverters.fromJson(json['items'],'List<AccountInfo>',context!);
totalCount = json['totalCount'];
totalPages = json['totalPages'];
hasMorePages = json['hasMorePages'];
return this;
}
Map<String, dynamic> toJson() => {
'items': JsonConverters.toJson(items,'List<AccountInfo>',context!),
'totalCount': totalCount,
'totalPages': totalPages,
'hasMorePages': hasMorePages
};
getTypeName() => "ListResponse<$T>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'team.evovoice.io', types: <String, TypeInfo> {
'SortOrders': TypeInfo(TypeOf.Enum, enumValues:SortOrders.values),
'ListRequest<T>': TypeInfo(TypeOf.GenericDef,create:() => ListRequest()),
'MessageDirections': TypeInfo(TypeOf.Enum, enumValues:MessageDirections.values),
'MessageInfo': TypeInfo(TypeOf.Class, create:() => MessageInfo()),
'ListMessages': TypeInfo(TypeOf.Class, create:() => ListMessages()),
'EntityInfo': TypeInfo(TypeOf.AbstractClass),
'BillingItem': TypeInfo(TypeOf.Class, create:() => BillingItem()),
'BillingSettings': TypeInfo(TypeOf.Class, create:() => BillingSettings()),
'AccountInfo': TypeInfo(TypeOf.Class, create:() => AccountInfo()),
'ListResponse<T>': TypeInfo(TypeOf.Class, create:() => ListResponse<T>()),
'List<AccountInfo>': TypeInfo(TypeOf.Class, create:() => <AccountInfo>[]),
});
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 /messages HTTP/1.1 Host: team.evovoice.io Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"items":[{"id":"String","accountId":"String","customerId":"String","endpointId":"String","endpointDisplayName":"String","date":"String","direction":"Incoming","otherAddress":"String","sender":"String","text":"String","isUnread":false}],"totalCount":0,"totalPages":0,"hasMorePages":false}