| 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 .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<FormInviteCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<FormUID>00000000-0000-0000-0000-000000000000</FormUID>
<People>
<FormInvitePerson>
<Email>String</Email>
<Name>String</Name>
<Phone>String</Phone>
</FormInvitePerson>
</People>
<Preview>false</Preview>
</FormInviteCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<FormInvitesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Consequence>String</Consequence>
<Created>
<FormInviteView>
<CreatedAt>0001-01-01T00:00:00</CreatedAt>
<CreatedBy>String</CreatedBy>
<Email>String</Email>
<ExpiresAt>0001-01-01T00:00:00</ExpiresAt>
<InviteUID>00000000-0000-0000-0000-000000000000</InviteUID>
<LastSentAt>0001-01-01T00:00:00</LastSentAt>
<Link>String</Link>
<Name>String</Name>
<Number>String</Number>
<OpenedAt>0001-01-01T00:00:00</OpenedAt>
<Phone>String</Phone>
<RevokedAt>0001-01-01T00:00:00</RevokedAt>
<SendCount>0</SendCount>
<Sends>
<FormFillReceiptLine>
<Channel>String</Channel>
<Outcome>String</Outcome>
<To>String</To>
</FormFillReceiptLine>
</Sends>
<SentAt>0001-01-01T00:00:00</SentAt>
<State>String</State>
</FormInviteView>
</Created>
<Emails>0</Emails>
<Invites>
<FormInviteView>
<CreatedAt>0001-01-01T00:00:00</CreatedAt>
<CreatedBy>String</CreatedBy>
<Email>String</Email>
<ExpiresAt>0001-01-01T00:00:00</ExpiresAt>
<InviteUID>00000000-0000-0000-0000-000000000000</InviteUID>
<LastSentAt>0001-01-01T00:00:00</LastSentAt>
<Link>String</Link>
<Name>String</Name>
<Number>String</Number>
<OpenedAt>0001-01-01T00:00:00</OpenedAt>
<Phone>String</Phone>
<RevokedAt>0001-01-01T00:00:00</RevokedAt>
<SendCount>0</SendCount>
<Sends>
<FormFillReceiptLine>
<Channel>String</Channel>
<Outcome>String</Outcome>
<To>String</To>
</FormFillReceiptLine>
</Sends>
<SentAt>0001-01-01T00:00:00</SentAt>
<State>String</State>
</FormInviteView>
</Invites>
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<Texts>0</Texts>
</FormInvitesResponse>