| POST | /v1/c/thread/{Kind}/{RefId} |
|---|
import 'package:servicestack/servicestack.dart';
class JobThreadMessageView implements IConvertible
{
int? Id;
String? Party;
bool? Mine;
String? Who;
String? Body;
bool? ViaVoice;
bool? IsStatusChip;
String? ChipKey;
DateTime? SentUtc;
String? SentLocal;
bool? Seen;
JobThreadMessageView({this.Id,this.Party,this.Mine,this.Who,this.Body,this.ViaVoice,this.IsStatusChip,this.ChipKey,this.SentUtc,this.SentLocal,this.Seen});
JobThreadMessageView.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Party = json['Party'];
Mine = json['Mine'];
Who = json['Who'];
Body = json['Body'];
ViaVoice = json['ViaVoice'];
IsStatusChip = json['IsStatusChip'];
ChipKey = json['ChipKey'];
SentUtc = JsonConverters.fromJson(json['SentUtc'],'DateTime',context!);
SentLocal = json['SentLocal'];
Seen = json['Seen'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Party': Party,
'Mine': Mine,
'Who': Who,
'Body': Body,
'ViaVoice': ViaVoice,
'IsStatusChip': IsStatusChip,
'ChipKey': ChipKey,
'SentUtc': JsonConverters.toJson(SentUtc,'DateTime',context!),
'SentLocal': SentLocal,
'Seen': Seen
};
getTypeName() => "JobThreadMessageView";
TypeContext? context = _ctx;
}
class JobThreadView implements IConvertible
{
int? Id;
String? Kind;
int? RefId;
String? RefCode;
int? WorkerContactId;
String? Who;
bool? Closed;
String? ClosesLocal;
int? Unread;
String? Note;
List<String>? QuickReplies = [];
List<JobThreadMessageView>? Messages = [];
JobThreadView({this.Id,this.Kind,this.RefId,this.RefCode,this.WorkerContactId,this.Who,this.Closed,this.ClosesLocal,this.Unread,this.Note,this.QuickReplies,this.Messages});
JobThreadView.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Kind = json['Kind'];
RefId = json['RefId'];
RefCode = json['RefCode'];
WorkerContactId = json['WorkerContactId'];
Who = json['Who'];
Closed = json['Closed'];
ClosesLocal = json['ClosesLocal'];
Unread = json['Unread'];
Note = json['Note'];
QuickReplies = JsonConverters.fromJson(json['QuickReplies'],'List<String>',context!);
Messages = JsonConverters.fromJson(json['Messages'],'List<JobThreadMessageView>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Kind': Kind,
'RefId': RefId,
'RefCode': RefCode,
'WorkerContactId': WorkerContactId,
'Who': Who,
'Closed': Closed,
'ClosesLocal': ClosesLocal,
'Unread': Unread,
'Note': Note,
'QuickReplies': JsonConverters.toJson(QuickReplies,'List<String>',context!),
'Messages': JsonConverters.toJson(Messages,'List<JobThreadMessageView>',context!)
};
getTypeName() => "JobThreadView";
TypeContext? context = _ctx;
}
class ProblemReasonView implements IConvertible
{
String? Key;
String? Label;
ProblemReasonView({this.Key,this.Label});
ProblemReasonView.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Key = json['Key'];
Label = json['Label'];
return this;
}
Map<String, dynamic> toJson() => {
'Key': Key,
'Label': Label
};
getTypeName() => "ProblemReasonView";
TypeContext? context = _ctx;
}
class CustomerThreadResponse implements IConvertible
{
List<JobThreadView>? Threads = [];
List<ProblemReasonView>? ProblemReasons = [];
String? Message;
ResponseStatus? ResponseStatus;
CustomerThreadResponse({this.Threads,this.ProblemReasons,this.Message,this.ResponseStatus});
CustomerThreadResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Threads = JsonConverters.fromJson(json['Threads'],'List<JobThreadView>',context!);
ProblemReasons = JsonConverters.fromJson(json['ProblemReasons'],'List<ProblemReasonView>',context!);
Message = json['Message'];
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Threads': JsonConverters.toJson(Threads,'List<JobThreadView>',context!),
'ProblemReasons': JsonConverters.toJson(ProblemReasons,'List<ProblemReasonView>',context!),
'Message': Message,
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
};
getTypeName() => "CustomerThreadResponse";
TypeContext? context = _ctx;
}
class CustomerThreadPostRequest implements IConvertible
{
String? Kind;
int? RefId;
int? WorkerContactId;
String? Body;
CustomerThreadPostRequest({this.Kind,this.RefId,this.WorkerContactId,this.Body});
CustomerThreadPostRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Kind = json['Kind'];
RefId = json['RefId'];
WorkerContactId = json['WorkerContactId'];
Body = json['Body'];
return this;
}
Map<String, dynamic> toJson() => {
'Kind': Kind,
'RefId': RefId,
'WorkerContactId': WorkerContactId,
'Body': Body
};
getTypeName() => "CustomerThreadPostRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
'JobThreadMessageView': TypeInfo(TypeOf.Class, create:() => JobThreadMessageView()),
'JobThreadView': TypeInfo(TypeOf.Class, create:() => JobThreadView()),
'List<JobThreadMessageView>': TypeInfo(TypeOf.Class, create:() => <JobThreadMessageView>[]),
'ProblemReasonView': TypeInfo(TypeOf.Class, create:() => ProblemReasonView()),
'CustomerThreadResponse': TypeInfo(TypeOf.Class, create:() => CustomerThreadResponse()),
'List<JobThreadView>': TypeInfo(TypeOf.Class, create:() => <JobThreadView>[]),
'List<ProblemReasonView>': TypeInfo(TypeOf.Class, create:() => <ProblemReasonView>[]),
'CustomerThreadPostRequest': TypeInfo(TypeOf.Class, create:() => CustomerThreadPostRequest()),
});
Dart CustomerThreadPostRequest DTOs
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.
POST /v1/c/thread/{Kind}/{RefId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"Kind":"String","RefId":0,"WorkerContactId":0,"Body":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"Threads":[{"Id":0,"Kind":"String","RefId":0,"RefCode":"String","WorkerContactId":0,"Who":"String","Closed":false,"ClosesLocal":"String","Unread":0,"Note":"String","QuickReplies":["String"],"Messages":[{"Id":0,"Party":"String","Mine":false,"Who":"String","Body":"String","ViaVoice":false,"IsStatusChip":false,"ChipKey":"String","SentUtc":"0001-01-01T00:00:00.0000000","SentLocal":"String","Seen":false}]}],"ProblemReasons":[{"Key":"String","Label":"String"}],"Message":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}