| All Verbs | /api/attachments/{ConnectedObjectId} |
|---|
<?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 MediaModel implements JsonSerializable
{
public function __construct(
/** @var string */
public string $MediaFileId='',
/** @var string|null */
public ?string $MediaName=null,
/** @var string|null */
public ?string $FileContent=null,
/** @var string|null */
public ?string $FileContentType=null,
/** @var string|null */
public ?string $FilePath=null,
/** @var string|null */
public ?string $OriginalFileName=null,
/** @var int */
public int $ImageWidth=0,
/** @var int */
public int $ImageHeight=0,
/** @var int */
public int $FileSizeKB=0,
/** @var string|null */
public ?string $BlobUriRaw=null,
/** @var string|null */
public ?string $BlobUriFull=null,
/** @var string|null */
public ?string $BlobUriThumbnail=null,
/** @var string|null */
public ?string $WatermarkUri=null,
/** @var DateTime */
public DateTime $CapturedDate=new DateTime(),
/** @var string|null */
public ?string $CapturedByContactId=null,
/** @var string|null */
public ?string $CapturedByContactName=null,
/** @var string|null */
public ?string $CapturedByContactThumbnailUrl=null,
/** @var string|null */
public ?string $Notes=null,
/** @var string|null */
public ?string $ResourceActionName=null,
/** @var string|null */
public ?string $LocationVerified=null,
/** @var string */
public string $TrafficLightLocationVerified='',
/** @var string|null */
public ?string $AudienceLevel=null,
/** @var string|null */
public ?string $WorksFor=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['MediaFileId'])) $this->MediaFileId = $o['MediaFileId'];
if (isset($o['MediaName'])) $this->MediaName = $o['MediaName'];
if (isset($o['FileContent'])) $this->FileContent = $o['FileContent'];
if (isset($o['FileContentType'])) $this->FileContentType = $o['FileContentType'];
if (isset($o['FilePath'])) $this->FilePath = $o['FilePath'];
if (isset($o['OriginalFileName'])) $this->OriginalFileName = $o['OriginalFileName'];
if (isset($o['ImageWidth'])) $this->ImageWidth = $o['ImageWidth'];
if (isset($o['ImageHeight'])) $this->ImageHeight = $o['ImageHeight'];
if (isset($o['FileSizeKB'])) $this->FileSizeKB = $o['FileSizeKB'];
if (isset($o['BlobUriRaw'])) $this->BlobUriRaw = $o['BlobUriRaw'];
if (isset($o['BlobUriFull'])) $this->BlobUriFull = $o['BlobUriFull'];
if (isset($o['BlobUriThumbnail'])) $this->BlobUriThumbnail = $o['BlobUriThumbnail'];
if (isset($o['WatermarkUri'])) $this->WatermarkUri = $o['WatermarkUri'];
if (isset($o['CapturedDate'])) $this->CapturedDate = JsonConverters::from('DateTime', $o['CapturedDate']);
if (isset($o['CapturedByContactId'])) $this->CapturedByContactId = $o['CapturedByContactId'];
if (isset($o['CapturedByContactName'])) $this->CapturedByContactName = $o['CapturedByContactName'];
if (isset($o['CapturedByContactThumbnailUrl'])) $this->CapturedByContactThumbnailUrl = $o['CapturedByContactThumbnailUrl'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['ResourceActionName'])) $this->ResourceActionName = $o['ResourceActionName'];
if (isset($o['LocationVerified'])) $this->LocationVerified = $o['LocationVerified'];
if (isset($o['TrafficLightLocationVerified'])) $this->TrafficLightLocationVerified = $o['TrafficLightLocationVerified'];
if (isset($o['AudienceLevel'])) $this->AudienceLevel = $o['AudienceLevel'];
if (isset($o['WorksFor'])) $this->WorksFor = $o['WorksFor'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->MediaFileId)) $o['MediaFileId'] = $this->MediaFileId;
if (isset($this->MediaName)) $o['MediaName'] = $this->MediaName;
if (isset($this->FileContent)) $o['FileContent'] = $this->FileContent;
if (isset($this->FileContentType)) $o['FileContentType'] = $this->FileContentType;
if (isset($this->FilePath)) $o['FilePath'] = $this->FilePath;
if (isset($this->OriginalFileName)) $o['OriginalFileName'] = $this->OriginalFileName;
if (isset($this->ImageWidth)) $o['ImageWidth'] = $this->ImageWidth;
if (isset($this->ImageHeight)) $o['ImageHeight'] = $this->ImageHeight;
if (isset($this->FileSizeKB)) $o['FileSizeKB'] = $this->FileSizeKB;
if (isset($this->BlobUriRaw)) $o['BlobUriRaw'] = $this->BlobUriRaw;
if (isset($this->BlobUriFull)) $o['BlobUriFull'] = $this->BlobUriFull;
if (isset($this->BlobUriThumbnail)) $o['BlobUriThumbnail'] = $this->BlobUriThumbnail;
if (isset($this->WatermarkUri)) $o['WatermarkUri'] = $this->WatermarkUri;
if (isset($this->CapturedDate)) $o['CapturedDate'] = JsonConverters::to('DateTime', $this->CapturedDate);
if (isset($this->CapturedByContactId)) $o['CapturedByContactId'] = $this->CapturedByContactId;
if (isset($this->CapturedByContactName)) $o['CapturedByContactName'] = $this->CapturedByContactName;
if (isset($this->CapturedByContactThumbnailUrl)) $o['CapturedByContactThumbnailUrl'] = $this->CapturedByContactThumbnailUrl;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->ResourceActionName)) $o['ResourceActionName'] = $this->ResourceActionName;
if (isset($this->LocationVerified)) $o['LocationVerified'] = $this->LocationVerified;
if (isset($this->TrafficLightLocationVerified)) $o['TrafficLightLocationVerified'] = $this->TrafficLightLocationVerified;
if (isset($this->AudienceLevel)) $o['AudienceLevel'] = $this->AudienceLevel;
if (isset($this->WorksFor)) $o['WorksFor'] = $this->WorksFor;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="Returns list of attachments linked to an object.")
class GetAttachmentsResponse implements JsonSerializable
{
public function __construct(
/** @var array<MediaModel>|null */
public ?array $Attachments=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Attachments'])) $this->Attachments = JsonConverters::fromArray('MediaModel', $o['Attachments']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Attachments)) $o['Attachments'] = JsonConverters::toArray('MediaModel', $this->Attachments);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class GetAttachments implements JsonSerializable
{
public function __construct(
/** @description Object for which primary image is to be uploaded. */
// @ApiMember(DataType="Guid", Description="Object for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectId")
/** @var string */
public string $ConnectedObjectId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ConnectedObjectId'])) $this->ConnectedObjectId = $o['ConnectedObjectId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ConnectedObjectId)) $o['ConnectedObjectId'] = $this->ConnectedObjectId;
return empty($o) ? new class(){} : $o;
}
}
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 /api/attachments/{ConnectedObjectId} HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetAttachments xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Saguna.Common.WebAPIModel.ServiceModels">
<ConnectedObjectId>00000000-0000-0000-0000-000000000000</ConnectedObjectId>
</GetAttachments>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetAttachmentsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Saguna.Common.WebAPIModel.ServiceModels">
<Attachments xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eros.Saguna.Common.WebAPIModel.Models">
<d2p1:MediaModel>
<d2p1:AudienceLevel>String</d2p1:AudienceLevel>
<d2p1:BlobUriFull>String</d2p1:BlobUriFull>
<d2p1:BlobUriRaw>String</d2p1:BlobUriRaw>
<d2p1:BlobUriThumbnail>String</d2p1:BlobUriThumbnail>
<d2p1:CapturedByContactId>00000000-0000-0000-0000-000000000000</d2p1:CapturedByContactId>
<d2p1:CapturedByContactName>String</d2p1:CapturedByContactName>
<d2p1:CapturedByContactThumbnailUrl>String</d2p1:CapturedByContactThumbnailUrl>
<d2p1:CapturedDate>0001-01-01T00:00:00</d2p1:CapturedDate>
<d2p1:FileContent>String</d2p1:FileContent>
<d2p1:FileContentType>String</d2p1:FileContentType>
<d2p1:FilePath>String</d2p1:FilePath>
<d2p1:FileSizeKB>0</d2p1:FileSizeKB>
<d2p1:ImageHeight>0</d2p1:ImageHeight>
<d2p1:ImageWidth>0</d2p1:ImageWidth>
<d2p1:LocationVerified>String</d2p1:LocationVerified>
<d2p1:MediaFileId>00000000-0000-0000-0000-000000000000</d2p1:MediaFileId>
<d2p1:MediaName>String</d2p1:MediaName>
<d2p1:Notes>String</d2p1:Notes>
<d2p1:OriginalFileName>String</d2p1:OriginalFileName>
<d2p1:ResourceActionName>String</d2p1:ResourceActionName>
<d2p1:TrafficLightLocationVerified>00000000-0000-0000-0000-000000000000</d2p1:TrafficLightLocationVerified>
<d2p1:WatermarkUri>String</d2p1:WatermarkUri>
<d2p1:WorksFor>String</d2p1:WorksFor>
</d2p1:MediaModel>
</Attachments>
<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>
</GetAttachmentsResponse>