Evo Voice

<back to all web services

PatchAlert

Update a specific alert

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

/**
* Update a specific alert
*/
// @Api(Description="Update a specific alert")
class PatchAlert implements IPatch, IConvertible
{
    /**
    * The ID of the alert you want to update
    */
    // @ApiMember(Description="The ID of the alert you want to update")
    String? alertId;

    /**
    * The name for the alert
    */
    // @ApiMember(Description="The name for 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;

    PatchAlert({this.alertId,this.name,this.trigger,this.windowHours,this.threshold,this.notificationEmailAddresses});
    PatchAlert.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        alertId = json['alertId'];
        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() => {
        'alertId': alertId,
        'name': name,
        'trigger': JsonConverters.toJson(trigger,'AlertTriggers',context!),
        'windowHours': windowHours,
        'threshold': threshold,
        'notificationEmailAddresses': notificationEmailAddresses
    };

    getTypeName() => "PatchAlert";
    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()),
    'PatchAlert': TypeInfo(TypeOf.Class, create:() => PatchAlert()),
});

Dart PatchAlert DTOs

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

HTTP + XML

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

PATCH /alerts/{alertId} HTTP/1.1 
Host: evovoice.io 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PatchAlert xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Alerts">
  <AlertId>String</AlertId>
  <Name>String</Name>
  <NotificationEmailAddresses>String</NotificationEmailAddresses>
  <Threshold>0</Threshold>
  <Trigger>CallSpend</Trigger>
  <WindowHours>0</WindowHours>
</PatchAlert>
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>
  <Name>String</Name>
  <NotificationEmailAddresses>String</NotificationEmailAddresses>
  <Threshold>0</Threshold>
  <Trigger>CallSpend</Trigger>
  <WindowHours>0</WindowHours>
</AlertInfo>