Trendsic Platform Service

<back to all web services

FormInviteCreateRequest

Requires Authentication
The following routes are available for this service:
POST/v1/forms/{FormUID}/invites
<?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 FormFillReceiptLine implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Channel=null,
        /** @var string|null */
        public ?string $To=null,
        /** @var string|null */
        public ?string $Outcome=null
    ) {
    }

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

class FormInviteView implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $InviteUID='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var string|null */
        public ?string $Phone=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $ExpiresAt=null,
        /** @var DateTime|null */
        public ?DateTime $SentAt=null,
        /** @var DateTime|null */
        public ?DateTime $LastSentAt=null,
        /** @var int */
        public int $SendCount=0,
        /** @var DateTime|null */
        public ?DateTime $OpenedAt=null,
        /** @var DateTime|null */
        public ?DateTime $RevokedAt=null,
        /** @var string|null */
        public ?string $Number=null,
        /** @var string|null */
        public ?string $State=null,
        /** @var string|null */
        public ?string $Link=null,
        /** @var array<FormFillReceiptLine>|null */
        public ?array $Sends=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InviteUID'])) $this->InviteUID = $o['InviteUID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Phone'])) $this->Phone = $o['Phone'];
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['ExpiresAt'])) $this->ExpiresAt = JsonConverters::from('DateTime', $o['ExpiresAt']);
        if (isset($o['SentAt'])) $this->SentAt = JsonConverters::from('DateTime', $o['SentAt']);
        if (isset($o['LastSentAt'])) $this->LastSentAt = JsonConverters::from('DateTime', $o['LastSentAt']);
        if (isset($o['SendCount'])) $this->SendCount = $o['SendCount'];
        if (isset($o['OpenedAt'])) $this->OpenedAt = JsonConverters::from('DateTime', $o['OpenedAt']);
        if (isset($o['RevokedAt'])) $this->RevokedAt = JsonConverters::from('DateTime', $o['RevokedAt']);
        if (isset($o['Number'])) $this->Number = $o['Number'];
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['Link'])) $this->Link = $o['Link'];
        if (isset($o['Sends'])) $this->Sends = JsonConverters::fromArray('FormFillReceiptLine', $o['Sends']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InviteUID)) $o['InviteUID'] = $this->InviteUID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Phone)) $o['Phone'] = $this->Phone;
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->ExpiresAt)) $o['ExpiresAt'] = JsonConverters::to('DateTime', $this->ExpiresAt);
        if (isset($this->SentAt)) $o['SentAt'] = JsonConverters::to('DateTime', $this->SentAt);
        if (isset($this->LastSentAt)) $o['LastSentAt'] = JsonConverters::to('DateTime', $this->LastSentAt);
        if (isset($this->SendCount)) $o['SendCount'] = $this->SendCount;
        if (isset($this->OpenedAt)) $o['OpenedAt'] = JsonConverters::to('DateTime', $this->OpenedAt);
        if (isset($this->RevokedAt)) $o['RevokedAt'] = JsonConverters::to('DateTime', $this->RevokedAt);
        if (isset($this->Number)) $o['Number'] = $this->Number;
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->Link)) $o['Link'] = $this->Link;
        if (isset($this->Sends)) $o['Sends'] = JsonConverters::toArray('FormFillReceiptLine', $this->Sends);
        return empty($o) ? new class(){} : $o;
    }
}

class FormInvitesResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<FormInviteView>|null */
        public ?array $Invites=null,
        /** @var array<FormInviteView>|null */
        public ?array $Created=null,
        /** @var int */
        public int $Emails=0,
        /** @var int */
        public int $Texts=0,
        /** @var string|null */
        public ?string $Consequence=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Invites'])) $this->Invites = JsonConverters::fromArray('FormInviteView', $o['Invites']);
        if (isset($o['Created'])) $this->Created = JsonConverters::fromArray('FormInviteView', $o['Created']);
        if (isset($o['Emails'])) $this->Emails = $o['Emails'];
        if (isset($o['Texts'])) $this->Texts = $o['Texts'];
        if (isset($o['Consequence'])) $this->Consequence = $o['Consequence'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Invites)) $o['Invites'] = JsonConverters::toArray('FormInviteView', $this->Invites);
        if (isset($this->Created)) $o['Created'] = JsonConverters::toArray('FormInviteView', $this->Created);
        if (isset($this->Emails)) $o['Emails'] = $this->Emails;
        if (isset($this->Texts)) $o['Texts'] = $this->Texts;
        if (isset($this->Consequence)) $o['Consequence'] = $this->Consequence;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class FormInvitePerson implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var string|null */
        public ?string $Phone=null
    ) {
    }

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

class FormInviteCreateRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $FormUID='',
        /** @var array<FormInvitePerson>|null */
        public ?array $People=null,
        /** @var bool|null */
        public ?bool $Preview=null
    ) {
    }

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

PHP FormInviteCreateRequest 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 /v1/forms/{FormUID}/invites HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"FormUID":"00000000000000000000000000000000","People":[{"Name":"String","Email":"String","Phone":"String"}],"Preview":false}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Invites":[{"InviteUID":"00000000000000000000000000000000","Name":"String","Email":"String","Phone":"String","CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","ExpiresAt":"0001-01-01T00:00:00.0000000","SentAt":"0001-01-01T00:00:00.0000000","LastSentAt":"0001-01-01T00:00:00.0000000","SendCount":0,"OpenedAt":"0001-01-01T00:00:00.0000000","RevokedAt":"0001-01-01T00:00:00.0000000","Number":"String","State":"String","Link":"String","Sends":[{"Channel":"String","To":"String","Outcome":"String"}]}],"Created":[{"InviteUID":"00000000000000000000000000000000","Name":"String","Email":"String","Phone":"String","CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","ExpiresAt":"0001-01-01T00:00:00.0000000","SentAt":"0001-01-01T00:00:00.0000000","LastSentAt":"0001-01-01T00:00:00.0000000","SendCount":0,"OpenedAt":"0001-01-01T00:00:00.0000000","RevokedAt":"0001-01-01T00:00:00.0000000","Number":"String","State":"String","Link":"String","Sends":[{"Channel":"String","To":"String","Outcome":"String"}]}],"Emails":0,"Texts":0,"Consequence":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}