ScannerVision Web Server

<back to all web services

PostConnections

The following routes are available for this service:
POST/connections
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class PostConnections implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $LoginCommand=null,
        /** @var string|null */
        public ?string $LogoutCommand=null,
        /** @var string|null */
        public ?string $Password=null,
        /** @var string|null */
        public ?string $SaveCommand=null,
        /** @var string|null */
        public ?string $UserName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['LoginCommand'])) $this->LoginCommand = $o['LoginCommand'];
        if (isset($o['LogoutCommand'])) $this->LogoutCommand = $o['LogoutCommand'];
        if (isset($o['Password'])) $this->Password = $o['Password'];
        if (isset($o['SaveCommand'])) $this->SaveCommand = $o['SaveCommand'];
        if (isset($o['UserName'])) $this->UserName = $o['UserName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->LoginCommand)) $o['LoginCommand'] = $this->LoginCommand;
        if (isset($this->LogoutCommand)) $o['LogoutCommand'] = $this->LogoutCommand;
        if (isset($this->Password)) $o['Password'] = $this->Password;
        if (isset($this->SaveCommand)) $o['SaveCommand'] = $this->SaveCommand;
        if (isset($this->UserName)) $o['UserName'] = $this->UserName;
        return empty($o) ? new class(){} : $o;
    }
}

enum PermissionType : string
{
    case Group = 'Group';
    case User = 'User';
}

/**
 * @property bool $Allow
 * @property IConnectorConnection|null $Connection
 * @property PermissionType $Type
 */
interface IConnectionPermission extends IInterface
{
}

enum PropertyType : int
{
    case Binary = 1;
    case Boolean = 2;
    case ConnectionString = 3;
    case Credential = 4;
    case Integer = 5;
    case Picklist = 6;
    case String = 7;
    case OAuth2 = 8;
    case Certificate = 9;
}

/**
 * @property string|null $Description
 * @property string|null $Name
 * @property string $PropertyId
 * @property PropertyType $PropertyType
 */
interface IConnectionPropertyDescription extends IInterface
{
}

/**
 * @property ReadOnlyCollection<IUser>|null $Users
 */
interface IUserGroup extends IIdTemplatesItem, IGroup
{
}

/**
 * @property ReadOnlyCollection<IUserGroup>|null $Groups
 * @property string|null $EmailAddress
 * @property bool $HasPassword
 * @property string|null $HomeFolder
 * @property string|null $Password
 * @property bool|null $SbcUser
 */
interface IUser extends IIdTemplatesItem
{
}

/**
 * @property string $ConnectorId
 * @property string|null $Description
 * @property string|null $Id
 * @property int $MaxConnections
 * @property string|null $Name
 * @property ReadOnlyCollection<IConnectionPermission>|null $Permissions
 * @property ReadOnlyCollection<IConnectionPropertyDescription>|null $PropertyDescriptions
 * @property IUser|null $SetupUser
 */
interface IConnectorConnection extends IStatus
{
}

class GetConnectionsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<IConnectorConnection>|null */
        public ?array $Connections=null,
        /** @var bool|null */
        public ?bool $IsAuthenticated=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Connections'])) $this->Connections = JsonConverters::fromArray('IConnectorConnection', $o['Connections']);
        if (isset($o['IsAuthenticated'])) $this->IsAuthenticated = $o['IsAuthenticated'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Connections)) $o['Connections'] = JsonConverters::toArray('IConnectorConnection', $this->Connections);
        if (isset($this->IsAuthenticated)) $o['IsAuthenticated'] = $this->IsAuthenticated;
        return empty($o) ? new class(){} : $o;
    }
}

PHP PostConnections DTOs

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

HTTP + CSV

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

POST /connections HTTP/1.1 
Host: buildmax.org 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"LoginCommand":"String","LogoutCommand":"String","Password":"String","SaveCommand":"String","UserName":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{Unable to show example output for type 'GetConnectionsResponse' using the custom 'csv' filter}No parameterless constructor defined for this object.