| POST | /RestApi/translations/translate/markandsend |
|---|
<?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 MarkForTranslation implements JsonSerializable
{
public function __construct(
/** @var string[]|null */
public ?array $Ids=null,
/** @var string|null */
public ?string $ProviderName=null,
/** @var string|null */
public ?string $ItemType=null,
/** @var string|null */
public ?string $SourceLanguage=null,
/** @var string[]|null */
public ?array $TargetLanguages=null,
/** @var string|null */
public ?string $ActualSourceLanguage=null,
/** @var bool|null */
public ?bool $AllowPartialSuccess=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Ids'])) $this->Ids = JsonConverters::fromArray('string', $o['Ids']);
if (isset($o['ProviderName'])) $this->ProviderName = $o['ProviderName'];
if (isset($o['ItemType'])) $this->ItemType = $o['ItemType'];
if (isset($o['SourceLanguage'])) $this->SourceLanguage = $o['SourceLanguage'];
if (isset($o['TargetLanguages'])) $this->TargetLanguages = JsonConverters::fromArray('string', $o['TargetLanguages']);
if (isset($o['ActualSourceLanguage'])) $this->ActualSourceLanguage = $o['ActualSourceLanguage'];
if (isset($o['AllowPartialSuccess'])) $this->AllowPartialSuccess = $o['AllowPartialSuccess'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Ids)) $o['Ids'] = JsonConverters::toArray('string', $this->Ids);
if (isset($this->ProviderName)) $o['ProviderName'] = $this->ProviderName;
if (isset($this->ItemType)) $o['ItemType'] = $this->ItemType;
if (isset($this->SourceLanguage)) $o['SourceLanguage'] = $this->SourceLanguage;
if (isset($this->TargetLanguages)) $o['TargetLanguages'] = JsonConverters::toArray('string', $this->TargetLanguages);
if (isset($this->ActualSourceLanguage)) $o['ActualSourceLanguage'] = $this->ActualSourceLanguage;
if (isset($this->AllowPartialSuccess)) $o['AllowPartialSuccess'] = $this->AllowPartialSuccess;
return empty($o) ? new class(){} : $o;
}
}
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 MarkAndSendForTranslation extends MarkForTranslation implements JsonSerializable
{
/**
* @param string[]|null $Ids
* @param string|null $ProviderName
* @param string|null $ItemType
* @param string|null $SourceLanguage
* @param string[]|null $TargetLanguages
* @param string|null $ActualSourceLanguage
* @param bool|null $AllowPartialSuccess
*/
public function __construct(
?array $Ids=null,
?string $ProviderName=null,
?string $ItemType=null,
?string $SourceLanguage=null,
?array $TargetLanguages=null,
?string $ActualSourceLanguage=null,
?bool $AllowPartialSuccess=null,
/** @var CreateProject|null */
public ?CreateProject $ProjectData=null
) {
parent::__construct($Ids,$ProviderName,$ItemType,$SourceLanguage,$TargetLanguages,$ActualSourceLanguage,$AllowPartialSuccess);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ProjectData'])) $this->ProjectData = JsonConverters::from('CreateProject', $o['ProjectData']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ProjectData)) $o['ProjectData'] = JsonConverters::to('CreateProject', $this->ProjectData);
return empty($o) ? new class(){} : $o;
}
}
PHP MarkAndSendForTranslation DTOs
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/markandsend 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"},"Ids":["00000000-0000-0000-0000-000000000000"],"ProviderName":"String","ItemType":"String","SourceLanguage":"String","TargetLanguages":["String"],"ActualSourceLanguage":"String","AllowPartialSuccess":false}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{Unable to show example output for type 'IList`1' using the custom 'csv' filter}Cannot create an instance of an interface.