| Requires any of the roles: | SystemAdministrator, Manager, Customer |
| POST | /alerts |
|---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
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;
}
enum AlertTriggers
{
CallSpend,
CallCount,
}
enum AlertCustomerSelection
{
AllCustomers,
ExcludeCustomers,
IncludeCustomers,
}
class AlertInfo extends EntityInfo implements IConvertible
{
/**
* The ID of the account associated with this alert
*/
// @ApiMember(Description="The ID of the account associated with this alert")
String? accountId;
/**
* The name of the alert
*/
// @ApiMember(Description="The name of the alert")
String? name;
/**
* The trigger alert
*/
// @ApiMember(Description="The trigger alert")
AlertTriggers? trigger;
/**
* The number of hours for the window over which the alert will trigger
*/
// @ApiMember(Description="The number of hours for the window over which the alert will trigger")
double? windowHours;
/**
* The value at which the alert will trigger
*/
// @ApiMember(Description="The value at which the alert will trigger")
double? threshold;
/**
* The email addresses (one per line) to notify
*/
// @ApiMember(Description="The email addresses (one per line) to notify")
String? notificationEmailAddresses;
/**
* Customer selection for this alert
*/
// @ApiMember(Description="Customer selection for this alert")
AlertCustomerSelection? customerSelection;
/**
* The list of customer IDs for the selection model
*/
// @ApiMember(Description="The list of customer IDs for the selection model")
List<String>? customerIds;
AlertInfo({this.accountId,this.name,this.trigger,this.windowHours,this.threshold,this.notificationEmailAddresses,this.customerSelection,this.customerIds});
AlertInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
accountId = json['accountId'];
name = json['name'];
trigger = JsonConverters.fromJson(json['trigger'],'AlertTriggers',context!);
windowHours = JsonConverters.toDouble(json['windowHours']);
threshold = JsonConverters.toDouble(json['threshold']);
notificationEmailAddresses = json['notificationEmailAddresses'];
customerSelection = JsonConverters.fromJson(json['customerSelection'],'AlertCustomerSelection',context!);
customerIds = JsonConverters.fromJson(json['customerIds'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'accountId': accountId,
'name': name,
'trigger': JsonConverters.toJson(trigger,'AlertTriggers',context!),
'windowHours': windowHours,
'threshold': threshold,
'notificationEmailAddresses': notificationEmailAddresses,
'customerSelection': JsonConverters.toJson(customerSelection,'AlertCustomerSelection',context!),
'customerIds': JsonConverters.toJson(customerIds,'List<String>',context!)
});
getTypeName() => "AlertInfo";
TypeContext? context = _ctx;
}
/**
* Creates a new alert
*/
// @Api(Description="Creates a new alert")
class NewAlert implements IPost, IConvertible
{
/**
* The account ID to associate this alert with
*/
// @ApiMember(Description="The account ID to associate this alert with")
String? accountId;
/**
* The name of the alert
*/
// @ApiMember(Description="The name of the alert")
String? name;
/**
* The trigger alert
*/
// @ApiMember(Description="The trigger alert")
AlertTriggers? trigger;
/**
* The number of hours for the window over which the alert will trigger
*/
// @ApiMember(Description="The number of hours for the window over which the alert will trigger")
double? windowHours;
/**
* The value at which the alert will trigger
*/
// @ApiMember(Description="The value at which the alert will trigger")
double? threshold;
/**
* The email addresses (one per line) to notify
*/
// @ApiMember(Description="The email addresses (one per line) to notify")
String? notificationEmailAddresses;
/**
* Customer selection for this alert
*/
// @ApiMember(Description="Customer selection for this alert")
AlertCustomerSelection? customerSelection;
/**
* The list of customer IDs for the selection model
*/
// @ApiMember(Description="The list of customer IDs for the selection model")
List<String>? customerIds;
NewAlert({this.accountId,this.name,this.trigger,this.windowHours,this.threshold,this.notificationEmailAddresses,this.customerSelection,this.customerIds});
NewAlert.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
accountId = json['accountId'];
name = json['name'];
trigger = JsonConverters.fromJson(json['trigger'],'AlertTriggers',context!);
windowHours = JsonConverters.toDouble(json['windowHours']);
threshold = JsonConverters.toDouble(json['threshold']);
notificationEmailAddresses = json['notificationEmailAddresses'];
customerSelection = JsonConverters.fromJson(json['customerSelection'],'AlertCustomerSelection',context!);
customerIds = JsonConverters.fromJson(json['customerIds'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'accountId': accountId,
'name': name,
'trigger': JsonConverters.toJson(trigger,'AlertTriggers',context!),
'windowHours': windowHours,
'threshold': threshold,
'notificationEmailAddresses': notificationEmailAddresses,
'customerSelection': JsonConverters.toJson(customerSelection,'AlertCustomerSelection',context!),
'customerIds': JsonConverters.toJson(customerIds,'List<String>',context!)
};
getTypeName() => "NewAlert";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'team.evovoice.io', types: <String, TypeInfo> {
'EntityInfo': TypeInfo(TypeOf.AbstractClass),
'AlertTriggers': TypeInfo(TypeOf.Enum, enumValues:AlertTriggers.values),
'AlertCustomerSelection': TypeInfo(TypeOf.Enum, enumValues:AlertCustomerSelection.values),
'AlertInfo': TypeInfo(TypeOf.Class, create:() => AlertInfo()),
'NewAlert': TypeInfo(TypeOf.Class, create:() => NewAlert()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /alerts HTTP/1.1
Host: team.evovoice.io
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<NewAlert xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Alerts">
<AccountId>String</AccountId>
<CustomerIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</CustomerIds>
<CustomerSelection>AllCustomers</CustomerSelection>
<Name>String</Name>
<NotificationEmailAddresses>String</NotificationEmailAddresses>
<Threshold>0</Threshold>
<Trigger>CallSpend</Trigger>
<WindowHours>0</WindowHours>
</NewAlert>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<AlertInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Alerts">
<CreatedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</CreatedBy>
<DateCreated xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateCreated>
<DateLastModified xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateLastModified>
<Id xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</Id>
<LastModifiedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</LastModifiedBy>
<AccountId>String</AccountId>
<CustomerIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</CustomerIds>
<CustomerSelection>AllCustomers</CustomerSelection>
<Name>String</Name>
<NotificationEmailAddresses>String</NotificationEmailAddresses>
<Threshold>0</Threshold>
<Trigger>CallSpend</Trigger>
<WindowHours>0</WindowHours>
</AlertInfo>