Evo Voice

<back to all web services

NewAlert

Creates a new alert

Requires Authentication
Requires any of the roles:SystemAdministrator, Manager, Customer
The following routes are available for this service:
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,
}

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;

    AlertInfo({this.accountId,this.name,this.trigger,this.windowHours,this.threshold,this.notificationEmailAddresses});
    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'];
        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
    });

    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;

    NewAlert({this.accountId,this.name,this.trigger,this.windowHours,this.threshold,this.notificationEmailAddresses});
    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'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'accountId': accountId,
        'name': name,
        'trigger': JsonConverters.toJson(trigger,'AlertTriggers',context!),
        'windowHours': windowHours,
        'threshold': threshold,
        'notificationEmailAddresses': notificationEmailAddresses
    };

    getTypeName() => "NewAlert";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'evovoice.io', types: <String, TypeInfo> {
    'EntityInfo': TypeInfo(TypeOf.AbstractClass),
    'AlertTriggers': TypeInfo(TypeOf.Enum, enumValues:AlertTriggers.values),
    'AlertInfo': TypeInfo(TypeOf.Class, create:() => AlertInfo()),
    'NewAlert': TypeInfo(TypeOf.Class, create:() => NewAlert()),
});

Dart NewAlert DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /alerts HTTP/1.1 
Host: evovoice.io 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	accountId: String,
	name: String,
	trigger: CallSpend,
	windowHours: 0,
	threshold: 0,
	notificationEmailAddresses: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	accountId: String,
	name: String,
	trigger: CallSpend,
	windowHours: 0,
	threshold: 0,
	notificationEmailAddresses: String,
	id: String,
	dateCreated: String,
	dateLastModified: String,
	createdBy: String,
	lastModifiedBy: String
}