Evo Voice

<back to all web services

GetAIUsage

Requires Authentication
Required role:SystemAdministrator
The following routes are available for this service:
All Verbs/ai/usage
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class AIAccountUsage implements IConvertible
{
    /**
    * The account ID this customer belongs to
    */
    // @ApiMember(Description="The account ID this customer belongs to")
    String? accountId;

    /**
    * The total number of AI minutes used in the date range
    */
    // @ApiMember(Description="The total number of AI minutes used in the date range")
    int? aiMinutes;

    AIAccountUsage({this.accountId,this.aiMinutes});
    AIAccountUsage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        accountId = json['accountId'];
        aiMinutes = json['aiMinutes'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'accountId': accountId,
        'aiMinutes': aiMinutes
    };

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

class AICustomerUsage implements IConvertible
{
    /**
    * The account ID this customer belongs to
    */
    // @ApiMember(Description="The account ID this customer belongs to")
    String? accountId;

    /**
    * The customer ID for this uage
    */
    // @ApiMember(Description="The customer ID for this uage")
    String? customerId;

    /**
    * The total number of AI minutes used in the date range
    */
    // @ApiMember(Description="The total number of AI minutes used in the date range")
    int? aiMinutes;

    AICustomerUsage({this.accountId,this.customerId,this.aiMinutes});
    AICustomerUsage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        accountId = json['accountId'];
        customerId = json['customerId'];
        aiMinutes = json['aiMinutes'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'accountId': accountId,
        'customerId': customerId,
        'aiMinutes': aiMinutes
    };

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

class AIUsage implements IConvertible
{
    List<AIAccountUsage>? accountUsage;
    List<AICustomerUsage>? customerUsage;

    AIUsage({this.accountUsage,this.customerUsage});
    AIUsage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        accountUsage = JsonConverters.fromJson(json['accountUsage'],'List<AIAccountUsage>',context!);
        customerUsage = JsonConverters.fromJson(json['customerUsage'],'List<AICustomerUsage>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'accountUsage': JsonConverters.toJson(accountUsage,'List<AIAccountUsage>',context!),
        'customerUsage': JsonConverters.toJson(customerUsage,'List<AICustomerUsage>',context!)
    };

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

class GetAIUsage implements IGet, IConvertible
{
    /**
    * Filter by account ID. If not specified will return entries for all customers in all accounts in the date range
    */
    // @ApiMember(Description="Filter by account ID. If not specified will return entries for all customers in all accounts in the date range")
    String? accountId;

    /**
    * Filter by customer ID. If not specified, will return all customers for the accounts considered
    */
    // @ApiMember(Description="Filter by customer ID. If not specified, will return all customers for the accounts considered")
    String? customerId;

    /**
    * The start of the date range to consider
    */
    // @ApiMember(Description="The start of the date range to consider")
    String? startDate;

    /**
    * The end of the date range to consider
    */
    // @ApiMember(Description="The end of the date range to consider")
    String? endDate;

    GetAIUsage({this.accountId,this.customerId,this.startDate,this.endDate});
    GetAIUsage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        accountId = json['accountId'];
        customerId = json['customerId'];
        startDate = json['startDate'];
        endDate = json['endDate'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'accountId': accountId,
        'customerId': customerId,
        'startDate': startDate,
        'endDate': endDate
    };

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

TypeContext _ctx = TypeContext(library: 'team.evovoice.io', types: <String, TypeInfo> {
    'AIAccountUsage': TypeInfo(TypeOf.Class, create:() => AIAccountUsage()),
    'AICustomerUsage': TypeInfo(TypeOf.Class, create:() => AICustomerUsage()),
    'AIUsage': TypeInfo(TypeOf.Class, create:() => AIUsage()),
    'List<AIAccountUsage>': TypeInfo(TypeOf.Class, create:() => <AIAccountUsage>[]),
    'List<AICustomerUsage>': TypeInfo(TypeOf.Class, create:() => <AICustomerUsage>[]),
    'GetAIUsage': TypeInfo(TypeOf.Class, create:() => GetAIUsage()),
});

Dart GetAIUsage DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /ai/usage HTTP/1.1 
Host: team.evovoice.io 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"accountId":"String","customerId":"String","startDate":"String","endDate":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"accountUsage":[{"accountId":"String","aiMinutes":0}],"customerUsage":[{"accountId":"String","customerId":"String","aiMinutes":0}]}