| 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 .jsv suffix or ?format=jsv
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: text/jsv
Content-Type: text/jsv
Content-Length: length
{
AttachmentId: 00000000000000000000000000000000,
RecipientContactId: 0,
RecipientEmail: String,
RecipientPhone: String,
IsAdhoc: False,
SensitivityTier: String,
RequireOtp: False,
OtpChannel: String,
DeliveryChannels: String,
ExpiresInHours: 0,
MaxViews: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
DocumentShare:
[
{
AttachmentName: String,
RecipientDisplayName: String,
RecipientType: String,
CreatedByName: String,
Status: String,
DocumentShareId: 0,
DocumentShareUID: 00000000000000000000000000000000,
TokenHash: String,
AttachmentId: 00000000000000000000000000000000,
SensitivityTier: String,
RequireOtp: False,
OtpChannel: String,
DeliveryChannels: String,
RecipientContactId: 0,
RecipientEmail: String,
RecipientPhone: String,
SmsConsentSnapshot: False,
CreatedByUserId: 00000000000000000000000000000000,
CreatedByAgentId: 0,
CreatedAtUtc: 0001-01-01,
ExpiresAtUtc: 0001-01-01,
MaxViews: 0,
ViewCount: 0,
RevokedAtUtc: 0001-01-01,
RevokedByUserId: 00000000000000000000000000000000
}
],
ShareUrl: String
}