| All Verbs | /api/media/file |
|---|
<?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 SaveMediaResponse implements JsonSerializable
{
public function __construct(
/** @description Media File Guid */
// @ApiMember(DataType="Guid", Description="Media File Guid", Name="ErosMediaFileId", ParameterType="query")
/** @var string */
public string $ErosMediaFileId='',
/** @description Media File Name */
// @ApiMember(DataType="string", Description="Media File Name", Name="MediaName", ParameterType="query")
/** @var string|null */
public ?string $MediaName=null,
/** @description The original name of the media being saved. */
// @ApiMember(DataType="string", Description="The original name of the media being saved.", Name="OriginalFileName", ParameterType="query")
/** @var string|null */
public ?string $OriginalFileName=null,
/** @description Url of the media file. */
// @ApiMember(DataType="string", Description="Url of the media file.", Name="MediaFileUrl", ParameterType="query")
/** @var string|null */
public ?string $MediaFileUrl=null,
/** @description Url of the media file thumbnail. */
// @ApiMember(DataType="string", Description="Url of the media file thumbnail.", Name="MediaFileThumbnailUrl", ParameterType="query")
/** @var string|null */
public ?string $MediaFileThumbnailUrl=null,
/** @description Service Stack Response Status. */
// @ApiMember(DataType="ResponseStatus", Description="Service Stack Response Status.", Name="ResponseStatus", ParameterType="query")
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ErosMediaFileId'])) $this->ErosMediaFileId = $o['ErosMediaFileId'];
if (isset($o['MediaName'])) $this->MediaName = $o['MediaName'];
if (isset($o['OriginalFileName'])) $this->OriginalFileName = $o['OriginalFileName'];
if (isset($o['MediaFileUrl'])) $this->MediaFileUrl = $o['MediaFileUrl'];
if (isset($o['MediaFileThumbnailUrl'])) $this->MediaFileThumbnailUrl = $o['MediaFileThumbnailUrl'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ErosMediaFileId)) $o['ErosMediaFileId'] = $this->ErosMediaFileId;
if (isset($this->MediaName)) $o['MediaName'] = $this->MediaName;
if (isset($this->OriginalFileName)) $o['OriginalFileName'] = $this->OriginalFileName;
if (isset($this->MediaFileUrl)) $o['MediaFileUrl'] = $this->MediaFileUrl;
if (isset($this->MediaFileThumbnailUrl)) $o['MediaFileThumbnailUrl'] = $this->MediaFileThumbnailUrl;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class UploadFile implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Path=null,
/** @var DateTime */
public DateTime $MediaCaptured=new DateTime(),
/** @var string */
public string $ContactId='',
/** @var string */
public string $ApplianceId='',
/** @var int|null */
public ?int $ImageWidth=null,
/** @var int|null */
public ?int $ImageHeight=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Path'])) $this->Path = $o['Path'];
if (isset($o['MediaCaptured'])) $this->MediaCaptured = JsonConverters::from('DateTime', $o['MediaCaptured']);
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['ApplianceId'])) $this->ApplianceId = $o['ApplianceId'];
if (isset($o['ImageWidth'])) $this->ImageWidth = $o['ImageWidth'];
if (isset($o['ImageHeight'])) $this->ImageHeight = $o['ImageHeight'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Path)) $o['Path'] = $this->Path;
if (isset($this->MediaCaptured)) $o['MediaCaptured'] = JsonConverters::to('DateTime', $this->MediaCaptured);
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->ApplianceId)) $o['ApplianceId'] = $this->ApplianceId;
if (isset($this->ImageWidth)) $o['ImageWidth'] = $this->ImageWidth;
if (isset($this->ImageHeight)) $o['ImageHeight'] = $this->ImageHeight;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/media/file HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"Path":"String","MediaCaptured":"0001-01-01T00:00:00.0000000","ContactId":"00000000-0000-0000-0000-000000000000","ApplianceId":"00000000-0000-0000-0000-000000000000","ImageWidth":0,"ImageHeight":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"ErosMediaFileId":"00000000-0000-0000-0000-000000000000","MediaName":"String","OriginalFileName":"String","MediaFileUrl":"String","MediaFileThumbnailUrl":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}