| POST,OPTIONS | /v1/documentshare |
|---|
<?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 DocumentShare implements JsonSerializable
{
public function __construct(
/** @var int */
public int $DocumentShareId=0,
/** @var string */
public string $DocumentShareUID='',
/** @var string|null */
public ?string $TokenHash=null,
/** @var string */
public string $AttachmentId='',
/** @var string|null */
public ?string $SensitivityTier=null,
/** @var bool|null */
public ?bool $RequireOtp=null,
/** @var string|null */
public ?string $OtpChannel=null,
/** @var string|null */
public ?string $DeliveryChannels=null,
/** @var int|null */
public ?int $RecipientContactId=null,
/** @var string|null */
public ?string $RecipientEmail=null,
/** @var string|null */
public ?string $RecipientPhone=null,
/** @var bool|null */
public ?bool $SmsConsentSnapshot=null,
/** @var string */
public string $CreatedByUserId='',
/** @var int|null */
public ?int $CreatedByAgentId=null,
/** @var DateTime */
public DateTime $CreatedAtUtc=new DateTime(),
/** @var DateTime */
public DateTime $ExpiresAtUtc=new DateTime(),
/** @var int|null */
public ?int $MaxViews=null,
/** @var int */
public int $ViewCount=0,
/** @var DateTime|null */
public ?DateTime $RevokedAtUtc=null,
/** @var string|null */
public ?string $RevokedByUserId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DocumentShareId'])) $this->DocumentShareId = $o['DocumentShareId'];
if (isset($o['DocumentShareUID'])) $this->DocumentShareUID = $o['DocumentShareUID'];
if (isset($o['TokenHash'])) $this->TokenHash = $o['TokenHash'];
if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
if (isset($o['SensitivityTier'])) $this->SensitivityTier = $o['SensitivityTier'];
if (isset($o['RequireOtp'])) $this->RequireOtp = $o['RequireOtp'];
if (isset($o['OtpChannel'])) $this->OtpChannel = $o['OtpChannel'];
if (isset($o['DeliveryChannels'])) $this->DeliveryChannels = $o['DeliveryChannels'];
if (isset($o['RecipientContactId'])) $this->RecipientContactId = $o['RecipientContactId'];
if (isset($o['RecipientEmail'])) $this->RecipientEmail = $o['RecipientEmail'];
if (isset($o['RecipientPhone'])) $this->RecipientPhone = $o['RecipientPhone'];
if (isset($o['SmsConsentSnapshot'])) $this->SmsConsentSnapshot = $o['SmsConsentSnapshot'];
if (isset($o['CreatedByUserId'])) $this->CreatedByUserId = $o['CreatedByUserId'];
if (isset($o['CreatedByAgentId'])) $this->CreatedByAgentId = $o['CreatedByAgentId'];
if (isset($o['CreatedAtUtc'])) $this->CreatedAtUtc = JsonConverters::from('DateTime', $o['CreatedAtUtc']);
if (isset($o['ExpiresAtUtc'])) $this->ExpiresAtUtc = JsonConverters::from('DateTime', $o['ExpiresAtUtc']);
if (isset($o['MaxViews'])) $this->MaxViews = $o['MaxViews'];
if (isset($o['ViewCount'])) $this->ViewCount = $o['ViewCount'];
if (isset($o['RevokedAtUtc'])) $this->RevokedAtUtc = JsonConverters::from('DateTime', $o['RevokedAtUtc']);
if (isset($o['RevokedByUserId'])) $this->RevokedByUserId = $o['RevokedByUserId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DocumentShareId)) $o['DocumentShareId'] = $this->DocumentShareId;
if (isset($this->DocumentShareUID)) $o['DocumentShareUID'] = $this->DocumentShareUID;
if (isset($this->TokenHash)) $o['TokenHash'] = $this->TokenHash;
if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
if (isset($this->SensitivityTier)) $o['SensitivityTier'] = $this->SensitivityTier;
if (isset($this->RequireOtp)) $o['RequireOtp'] = $this->RequireOtp;
if (isset($this->OtpChannel)) $o['OtpChannel'] = $this->OtpChannel;
if (isset($this->DeliveryChannels)) $o['DeliveryChannels'] = $this->DeliveryChannels;
if (isset($this->RecipientContactId)) $o['RecipientContactId'] = $this->RecipientContactId;
if (isset($this->RecipientEmail)) $o['RecipientEmail'] = $this->RecipientEmail;
if (isset($this->RecipientPhone)) $o['RecipientPhone'] = $this->RecipientPhone;
if (isset($this->SmsConsentSnapshot)) $o['SmsConsentSnapshot'] = $this->SmsConsentSnapshot;
if (isset($this->CreatedByUserId)) $o['CreatedByUserId'] = $this->CreatedByUserId;
if (isset($this->CreatedByAgentId)) $o['CreatedByAgentId'] = $this->CreatedByAgentId;
if (isset($this->CreatedAtUtc)) $o['CreatedAtUtc'] = JsonConverters::to('DateTime', $this->CreatedAtUtc);
if (isset($this->ExpiresAtUtc)) $o['ExpiresAtUtc'] = JsonConverters::to('DateTime', $this->ExpiresAtUtc);
if (isset($this->MaxViews)) $o['MaxViews'] = $this->MaxViews;
if (isset($this->ViewCount)) $o['ViewCount'] = $this->ViewCount;
if (isset($this->RevokedAtUtc)) $o['RevokedAtUtc'] = JsonConverters::to('DateTime', $this->RevokedAtUtc);
if (isset($this->RevokedByUserId)) $o['RevokedByUserId'] = $this->RevokedByUserId;
return empty($o) ? new class(){} : $o;
}
}
class DocumentShareExtended extends DocumentShare implements JsonSerializable
{
/**
* @param int $DocumentShareId
* @param string $DocumentShareUID
* @param string|null $TokenHash
* @param string $AttachmentId
* @param string|null $SensitivityTier
* @param bool|null $RequireOtp
* @param string|null $OtpChannel
* @param string|null $DeliveryChannels
* @param int|null $RecipientContactId
* @param string|null $RecipientEmail
* @param string|null $RecipientPhone
* @param bool|null $SmsConsentSnapshot
* @param string $CreatedByUserId
* @param int|null $CreatedByAgentId
* @param DateTime $CreatedAtUtc
* @param DateTime $ExpiresAtUtc
* @param int|null $MaxViews
* @param int $ViewCount
* @param DateTime|null $RevokedAtUtc
* @param string|null $RevokedByUserId
*/
public function __construct(
int $DocumentShareId=0,
string $DocumentShareUID='',
?string $TokenHash=null,
string $AttachmentId='',
?string $SensitivityTier=null,
?bool $RequireOtp=null,
?string $OtpChannel=null,
?string $DeliveryChannels=null,
?int $RecipientContactId=null,
?string $RecipientEmail=null,
?string $RecipientPhone=null,
?bool $SmsConsentSnapshot=null,
string $CreatedByUserId='',
?int $CreatedByAgentId=null,
DateTime $CreatedAtUtc=new DateTime(),
DateTime $ExpiresAtUtc=new DateTime(),
?int $MaxViews=null,
int $ViewCount=0,
?DateTime $RevokedAtUtc=null,
?string $RevokedByUserId=null,
/** @var string|null */
public ?string $AttachmentName=null,
/** @var string|null */
public ?string $RecipientDisplayName=null,
/** @var string|null */
public ?string $RecipientType=null,
/** @var string|null */
public ?string $CreatedByName=null,
/** @var string|null */
public ?string $Status=null
) {
parent::__construct($DocumentShareId,$DocumentShareUID,$TokenHash,$AttachmentId,$SensitivityTier,$RequireOtp,$OtpChannel,$DeliveryChannels,$RecipientContactId,$RecipientEmail,$RecipientPhone,$SmsConsentSnapshot,$CreatedByUserId,$CreatedByAgentId,$CreatedAtUtc,$ExpiresAtUtc,$MaxViews,$ViewCount,$RevokedAtUtc,$RevokedByUserId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['AttachmentName'])) $this->AttachmentName = $o['AttachmentName'];
if (isset($o['RecipientDisplayName'])) $this->RecipientDisplayName = $o['RecipientDisplayName'];
if (isset($o['RecipientType'])) $this->RecipientType = $o['RecipientType'];
if (isset($o['CreatedByName'])) $this->CreatedByName = $o['CreatedByName'];
if (isset($o['Status'])) $this->Status = $o['Status'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->AttachmentName)) $o['AttachmentName'] = $this->AttachmentName;
if (isset($this->RecipientDisplayName)) $o['RecipientDisplayName'] = $this->RecipientDisplayName;
if (isset($this->RecipientType)) $o['RecipientType'] = $this->RecipientType;
if (isset($this->CreatedByName)) $o['CreatedByName'] = $this->CreatedByName;
if (isset($this->Status)) $o['Status'] = $this->Status;
return empty($o) ? new class(){} : $o;
}
}
class DocumentShareResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<DocumentShareExtended>|null */
public ?array $DocumentShare=null,
/** @var string|null */
public ?string $ShareUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['DocumentShare'])) $this->DocumentShare = JsonConverters::fromArray('DocumentShareExtended', $o['DocumentShare']);
if (isset($o['ShareUrl'])) $this->ShareUrl = $o['ShareUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->DocumentShare)) $o['DocumentShare'] = JsonConverters::toArray('DocumentShareExtended', $this->DocumentShare);
if (isset($this->ShareUrl)) $o['ShareUrl'] = $this->ShareUrl;
return empty($o) ? new class(){} : $o;
}
}
class DocumentShareCreateRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $AttachmentId='',
/** @var int */
public int $RecipientContactId=0,
/** @var string|null */
public ?string $RecipientEmail=null,
/** @var string|null */
public ?string $RecipientPhone=null,
/** @var bool|null */
public ?bool $IsAdhoc=null,
/** @var string|null */
public ?string $SensitivityTier=null,
/** @var bool|null */
public ?bool $RequireOtp=null,
/** @var string|null */
public ?string $OtpChannel=null,
/** @var string|null */
public ?string $DeliveryChannels=null,
/** @var int */
public int $ExpiresInHours=0,
/** @var int */
public int $MaxViews=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
if (isset($o['RecipientContactId'])) $this->RecipientContactId = $o['RecipientContactId'];
if (isset($o['RecipientEmail'])) $this->RecipientEmail = $o['RecipientEmail'];
if (isset($o['RecipientPhone'])) $this->RecipientPhone = $o['RecipientPhone'];
if (isset($o['IsAdhoc'])) $this->IsAdhoc = $o['IsAdhoc'];
if (isset($o['SensitivityTier'])) $this->SensitivityTier = $o['SensitivityTier'];
if (isset($o['RequireOtp'])) $this->RequireOtp = $o['RequireOtp'];
if (isset($o['OtpChannel'])) $this->OtpChannel = $o['OtpChannel'];
if (isset($o['DeliveryChannels'])) $this->DeliveryChannels = $o['DeliveryChannels'];
if (isset($o['ExpiresInHours'])) $this->ExpiresInHours = $o['ExpiresInHours'];
if (isset($o['MaxViews'])) $this->MaxViews = $o['MaxViews'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
if (isset($this->RecipientContactId)) $o['RecipientContactId'] = $this->RecipientContactId;
if (isset($this->RecipientEmail)) $o['RecipientEmail'] = $this->RecipientEmail;
if (isset($this->RecipientPhone)) $o['RecipientPhone'] = $this->RecipientPhone;
if (isset($this->IsAdhoc)) $o['IsAdhoc'] = $this->IsAdhoc;
if (isset($this->SensitivityTier)) $o['SensitivityTier'] = $this->SensitivityTier;
if (isset($this->RequireOtp)) $o['RequireOtp'] = $this->RequireOtp;
if (isset($this->OtpChannel)) $o['OtpChannel'] = $this->OtpChannel;
if (isset($this->DeliveryChannels)) $o['DeliveryChannels'] = $this->DeliveryChannels;
if (isset($this->ExpiresInHours)) $o['ExpiresInHours'] = $this->ExpiresInHours;
if (isset($this->MaxViews)) $o['MaxViews'] = $this->MaxViews;
return empty($o) ? new class(){} : $o;
}
}
PHP DocumentShareCreateRequest 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/documentshare HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<DocumentShareCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<AttachmentId>00000000-0000-0000-0000-000000000000</AttachmentId>
<DeliveryChannels>String</DeliveryChannels>
<ExpiresInHours>0</ExpiresInHours>
<IsAdhoc>false</IsAdhoc>
<MaxViews>0</MaxViews>
<OtpChannel>String</OtpChannel>
<RecipientContactId>0</RecipientContactId>
<RecipientEmail>String</RecipientEmail>
<RecipientPhone>String</RecipientPhone>
<RequireOtp>false</RequireOtp>
<SensitivityTier>String</SensitivityTier>
</DocumentShareCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<DocumentShareResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<DocumentShare>
<DocumentShareExtended>
<AttachmentId>00000000-0000-0000-0000-000000000000</AttachmentId>
<CreatedAtUtc>0001-01-01T00:00:00</CreatedAtUtc>
<CreatedByAgentId>0</CreatedByAgentId>
<CreatedByUserId>00000000-0000-0000-0000-000000000000</CreatedByUserId>
<DeliveryChannels>String</DeliveryChannels>
<DocumentShareId>0</DocumentShareId>
<DocumentShareUID>00000000-0000-0000-0000-000000000000</DocumentShareUID>
<ExpiresAtUtc>0001-01-01T00:00:00</ExpiresAtUtc>
<MaxViews>0</MaxViews>
<OtpChannel>String</OtpChannel>
<RecipientContactId>0</RecipientContactId>
<RecipientEmail>String</RecipientEmail>
<RecipientPhone>String</RecipientPhone>
<RequireOtp>false</RequireOtp>
<RevokedAtUtc>0001-01-01T00:00:00</RevokedAtUtc>
<RevokedByUserId>00000000-0000-0000-0000-000000000000</RevokedByUserId>
<SensitivityTier>String</SensitivityTier>
<SmsConsentSnapshot>false</SmsConsentSnapshot>
<TokenHash>String</TokenHash>
<ViewCount>0</ViewCount>
<AttachmentName>String</AttachmentName>
<CreatedByName>String</CreatedByName>
<RecipientDisplayName>String</RecipientDisplayName>
<RecipientType>String</RecipientType>
<Status>String</Status>
</DocumentShareExtended>
</DocumentShare>
<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>
<ShareUrl>String</ShareUrl>
</DocumentShareResponse>