| Requires any of the roles: | Agent, Administrator |
| POST | /v1/project/rfp/attachment |
|---|
<?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 UploadAttachmentResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var string|null */
public ?string $AttachmentId=null,
/** @var int */
public int $ProjectId=0,
/** @var string|null */
public ?string $FileType=null,
/** @var string|null */
public ?string $FileName=null,
/** @var string|null */
public ?string $ContentType=null,
/** @var int */
public int $ContentLength=0,
/** @var DateTime */
public DateTime $CreatedUtc=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
if (isset($o['ProjectId'])) $this->ProjectId = $o['ProjectId'];
if (isset($o['FileType'])) $this->FileType = $o['FileType'];
if (isset($o['FileName'])) $this->FileName = $o['FileName'];
if (isset($o['ContentType'])) $this->ContentType = $o['ContentType'];
if (isset($o['ContentLength'])) $this->ContentLength = $o['ContentLength'];
if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
if (isset($this->ProjectId)) $o['ProjectId'] = $this->ProjectId;
if (isset($this->FileType)) $o['FileType'] = $this->FileType;
if (isset($this->FileName)) $o['FileName'] = $this->FileName;
if (isset($this->ContentType)) $o['ContentType'] = $this->ContentType;
if (isset($this->ContentLength)) $o['ContentLength'] = $this->ContentLength;
if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
return empty($o) ? new class(){} : $o;
}
}
class HttpFile implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Name='',
/** @var string */
public string $FileName='',
/** @var int */
public int $ContentLength=0,
/** @var string */
public string $ContentType='',
/** @var ByteArray|null */
public ?ByteArray $InputStream=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['FileName'])) $this->FileName = $o['FileName'];
if (isset($o['ContentLength'])) $this->ContentLength = $o['ContentLength'];
if (isset($o['ContentType'])) $this->ContentType = $o['ContentType'];
if (isset($o['InputStream'])) $this->InputStream = JsonConverters::from('ByteArray', $o['InputStream']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->FileName)) $o['FileName'] = $this->FileName;
if (isset($this->ContentLength)) $o['ContentLength'] = $this->ContentLength;
if (isset($this->ContentType)) $o['ContentType'] = $this->ContentType;
if (isset($this->InputStream)) $o['InputStream'] = JsonConverters::to('ByteArray', $this->InputStream);
return empty($o) ? new class(){} : $o;
}
}
class UploadRfpAttachment implements JsonSerializable
{
public function __construct(
/** @var HttpFile|null */
public ?HttpFile $File=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['File'])) $this->File = JsonConverters::from('HttpFile', $o['File']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->File)) $o['File'] = JsonConverters::to('HttpFile', $this->File);
return empty($o) ? new class(){} : $o;
}
}
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/project/rfp/attachment HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
File:
{
Name: String,
FileName: String,
ContentLength: 0,
ContentType: String
}
}
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
}
},
AttachmentId: String,
ProjectId: 0,
FileType: String,
FileName: String,
ContentType: String,
ContentLength: 0,
CreatedUtc: 0001-01-01
}