| Required role: | Admin |
| POST | /Outbound/Campaigns |
|---|
import 'package:servicestack/servicestack.dart';
class OutboundCampaignResult implements IConvertible
{
int? campaignId;
Map<String,int?>? decisions;
Map<String,int?>? queuedByChannel;
Map<String,int?>? messageStatuses;
int? duplicates;
int? noIdentity;
int? statusCode;
String? message;
OutboundCampaignResult({this.campaignId,this.decisions,this.queuedByChannel,this.messageStatuses,this.duplicates,this.noIdentity,this.statusCode,this.message});
OutboundCampaignResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
campaignId = json['campaignId'];
decisions = JsonConverters.fromJson(json['decisions'],'Map<String,int?>',context!);
queuedByChannel = JsonConverters.fromJson(json['queuedByChannel'],'Map<String,int?>',context!);
messageStatuses = JsonConverters.fromJson(json['messageStatuses'],'Map<String,int?>',context!);
duplicates = json['duplicates'];
noIdentity = json['noIdentity'];
statusCode = json['statusCode'];
message = json['message'];
return this;
}
Map<String, dynamic> toJson() => {
'campaignId': campaignId,
'decisions': JsonConverters.toJson(decisions,'Map<String,int?>',context!),
'queuedByChannel': JsonConverters.toJson(queuedByChannel,'Map<String,int?>',context!),
'messageStatuses': JsonConverters.toJson(messageStatuses,'Map<String,int?>',context!),
'duplicates': duplicates,
'noIdentity': noIdentity,
'statusCode': statusCode,
'message': message
};
getTypeName() => "OutboundCampaignResult";
TypeContext? context = _ctx;
}
class OutboundCampaignDevice implements IConvertible
{
String? token;
String? platform;
OutboundCampaignDevice({this.token,this.platform});
OutboundCampaignDevice.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
token = json['token'];
platform = json['platform'];
return this;
}
Map<String, dynamic> toJson() => {
'token': token,
'platform': platform
};
getTypeName() => "OutboundCampaignDevice";
TypeContext? context = _ctx;
}
class OutboundCampaignPerson implements IConvertible
{
String? phone;
String? email;
List<OutboundCampaignDevice>? devices;
bool? pushConsent;
bool? smsConsent;
bool? emailConsent;
String? payloadJson;
OutboundCampaignPerson({this.phone,this.email,this.devices,this.pushConsent,this.smsConsent,this.emailConsent,this.payloadJson});
OutboundCampaignPerson.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
phone = json['phone'];
email = json['email'];
devices = JsonConverters.fromJson(json['devices'],'List<OutboundCampaignDevice>',context!);
pushConsent = json['pushConsent'];
smsConsent = json['smsConsent'];
emailConsent = json['emailConsent'];
payloadJson = json['payloadJson'];
return this;
}
Map<String, dynamic> toJson() => {
'phone': phone,
'email': email,
'devices': JsonConverters.toJson(devices,'List<OutboundCampaignDevice>',context!),
'pushConsent': pushConsent,
'smsConsent': smsConsent,
'emailConsent': emailConsent,
'payloadJson': payloadJson
};
getTypeName() => "OutboundCampaignPerson";
TypeContext? context = _ctx;
}
class OutboundCampaignCreateRequest implements IConvertible
{
int? ownerId;
String? name;
String? lane;
String? templateKey;
String? payloadJson;
String? channelOrder;
int? holdoutPercent;
String? guardKey;
String? guardSubject;
DateTime? sendAt;
DateTime? expiresAt;
String? audienceSource;
List<OutboundCampaignPerson>? people;
OutboundCampaignCreateRequest({this.ownerId,this.name,this.lane,this.templateKey,this.payloadJson,this.channelOrder,this.holdoutPercent,this.guardKey,this.guardSubject,this.sendAt,this.expiresAt,this.audienceSource,this.people});
OutboundCampaignCreateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ownerId = json['ownerId'];
name = json['name'];
lane = json['lane'];
templateKey = json['templateKey'];
payloadJson = json['payloadJson'];
channelOrder = json['channelOrder'];
holdoutPercent = json['holdoutPercent'];
guardKey = json['guardKey'];
guardSubject = json['guardSubject'];
sendAt = JsonConverters.fromJson(json['sendAt'],'DateTime',context!);
expiresAt = JsonConverters.fromJson(json['expiresAt'],'DateTime',context!);
audienceSource = json['audienceSource'];
people = JsonConverters.fromJson(json['people'],'List<OutboundCampaignPerson>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ownerId': ownerId,
'name': name,
'lane': lane,
'templateKey': templateKey,
'payloadJson': payloadJson,
'channelOrder': channelOrder,
'holdoutPercent': holdoutPercent,
'guardKey': guardKey,
'guardSubject': guardSubject,
'sendAt': JsonConverters.toJson(sendAt,'DateTime',context!),
'expiresAt': JsonConverters.toJson(expiresAt,'DateTime',context!),
'audienceSource': audienceSource,
'people': JsonConverters.toJson(people,'List<OutboundCampaignPerson>',context!)
};
getTypeName() => "OutboundCampaignCreateRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'stubbur_app.azurewebsites.net', types: <String, TypeInfo> {
'OutboundCampaignResult': TypeInfo(TypeOf.Class, create:() => OutboundCampaignResult()),
'Map<String,int?>': TypeInfo(TypeOf.Class, create:() => Map<String,int?>()),
'OutboundCampaignDevice': TypeInfo(TypeOf.Class, create:() => OutboundCampaignDevice()),
'OutboundCampaignPerson': TypeInfo(TypeOf.Class, create:() => OutboundCampaignPerson()),
'List<OutboundCampaignDevice>': TypeInfo(TypeOf.Class, create:() => <OutboundCampaignDevice>[]),
'OutboundCampaignCreateRequest': TypeInfo(TypeOf.Class, create:() => OutboundCampaignCreateRequest()),
'List<OutboundCampaignPerson>': TypeInfo(TypeOf.Class, create:() => <OutboundCampaignPerson>[]),
});
Dart OutboundCampaignCreateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /Outbound/Campaigns HTTP/1.1
Host: stubbur-app.azurewebsites.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ownerId: 0,
name: String,
lane: String,
templateKey: String,
payloadJson: String,
channelOrder: String,
holdoutPercent: 0,
guardKey: String,
guardSubject: String,
sendAt: 0001-01-01,
expiresAt: 0001-01-01,
audienceSource: String,
people:
[
{
phone: String,
email: String,
devices:
[
{
token: String,
platform: String
}
],
pushConsent: False,
smsConsent: False,
emailConsent: False,
payloadJson: String
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
campaignId: 0,
decisions:
{
String: 0
},
queuedByChannel:
{
String: 0
},
messageStatuses:
{
String: 0
},
duplicates: 0,
noIdentity: 0,
statusCode: 0,
message: String
}