| POST | /RestApi/translations/translate |
|---|
<?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 CreateProject implements IProjectInfo, JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Title=null,
/** @var DateTime|null */
public ?DateTime $StartDate=null,
/** @var DateTime|null */
public ?DateTime $EndDate=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Connector=null,
/** @var string|null */
public ?string $PoReference=null,
/** @var string|null */
public ?string $ActualSourceLanguage=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Title'])) $this->Title = $o['Title'];
if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
if (isset($o['EndDate'])) $this->EndDate = JsonConverters::from('DateTime', $o['EndDate']);
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Connector'])) $this->Connector = $o['Connector'];
if (isset($o['PoReference'])) $this->PoReference = $o['PoReference'];
if (isset($o['ActualSourceLanguage'])) $this->ActualSourceLanguage = $o['ActualSourceLanguage'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Title)) $o['Title'] = $this->Title;
if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
if (isset($this->EndDate)) $o['EndDate'] = JsonConverters::to('DateTime', $this->EndDate);
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Connector)) $o['Connector'] = $this->Connector;
if (isset($this->PoReference)) $o['PoReference'] = $this->PoReference;
if (isset($this->ActualSourceLanguage)) $o['ActualSourceLanguage'] = $this->ActualSourceLanguage;
return empty($o) ? new class(){} : $o;
}
}
class SendForTranslation implements JsonSerializable
{
public function __construct(
/** @var array<string>|null */
public ?array $Ids=null,
/** @var CreateProject|null */
public ?CreateProject $ProjectData=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Ids'])) $this->Ids = JsonConverters::fromArray('Guid', $o['Ids']);
if (isset($o['ProjectData'])) $this->ProjectData = JsonConverters::from('CreateProject', $o['ProjectData']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Ids)) $o['Ids'] = JsonConverters::toArray('Guid', $this->Ids);
if (isset($this->ProjectData)) $o['ProjectData'] = JsonConverters::to('CreateProject', $this->ProjectData);
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 /RestApi/translations/translate HTTP/1.1
Host: www.imglobal.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"ProjectData":{"Title":"String","StartDate":"\/Date(-62135596800000-0000)\/","EndDate":"\/Date(-62135596800000-0000)\/","Description":"String","Connector":"String","PoReference":"String","ActualSourceLanguage":"String"}}