Evo Voice

<back to all web services

NewAISession

Creates a new session

Requires Authentication
Requires the role:SystemAdministrator
The following routes are available for this service:
POST/ai/sessions
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;
}

class AISessionInfo extends EntityInfo implements IConvertible
{
    /**
    * The ID of the account associated with this session
    */
    // @ApiMember(Description="The ID of the account associated with this session")
    String? accountId;

    /**
    * The name of the account associated with this customer
    */
    // @ApiMember(Description="The name of the account associated with this customer")
    String? accountName;

    /**
    * The purpose for this AI session
    */
    // @ApiMember(Description="The purpose for this AI session")
    String? purpose;

    AISessionInfo({this.accountId,this.accountName,this.purpose});
    AISessionInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'accountId': accountId,
        'accountName': accountName,
        'purpose': purpose
    });

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

/**
* Creates a new session
*/
// @Api(Description="Creates a new session")
class NewAISession implements IPost, IConvertible
{
    /**
    * The account ID to associate this session with
    */
    // @ApiMember(Description="The account ID to associate this session with")
    String? accountId;

    /**
    * The purpose for this session
    */
    // @ApiMember(Description="The purpose for this session")
    String? purpose;

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

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

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

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

TypeContext _ctx = TypeContext(library: 'evovoice.io', types: <String, TypeInfo> {
    'EntityInfo': TypeInfo(TypeOf.AbstractClass),
    'AISessionInfo': TypeInfo(TypeOf.Class, create:() => AISessionInfo()),
    'NewAISession': TypeInfo(TypeOf.Class, create:() => NewAISession()),
});

Dart NewAISession 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/sessions HTTP/1.1 
Host: evovoice.io 
Accept: application/json
Content-Type: application/json
Content-Length: length

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

{"accountId":"String","accountName":"String","purpose":"String","id":"String","dateCreated":"String","dateLastModified":"String","createdBy":"String","lastModifiedBy":"String"}