| POST | /v1/workforce/payrules/{PayRulePolicyId} |
|---|
<?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 PayRulePolicy implements JsonSerializable
{
public function __construct(
/** @var int */
public int $PayRulePolicyId=0,
/** @var string */
public string $PayRulePolicyUID='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $ScopeLevel=null,
/** @var string|null */
public ?string $BranchId=null,
/** @var string|null */
public ?string $JurisdictionKey=null,
/** @var string|null */
public ?string $CbaKey=null,
/** @var string|null */
public ?string $WorkTypeKey=null,
/** @var int */
public int $CurrentVersion=0,
/** @var bool|null */
public ?bool $IsActive=null,
/** @var string|null */
public ?string $BranchName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['PayRulePolicyId'])) $this->PayRulePolicyId = $o['PayRulePolicyId'];
if (isset($o['PayRulePolicyUID'])) $this->PayRulePolicyUID = $o['PayRulePolicyUID'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['ScopeLevel'])) $this->ScopeLevel = $o['ScopeLevel'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['JurisdictionKey'])) $this->JurisdictionKey = $o['JurisdictionKey'];
if (isset($o['CbaKey'])) $this->CbaKey = $o['CbaKey'];
if (isset($o['WorkTypeKey'])) $this->WorkTypeKey = $o['WorkTypeKey'];
if (isset($o['CurrentVersion'])) $this->CurrentVersion = $o['CurrentVersion'];
if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->PayRulePolicyId)) $o['PayRulePolicyId'] = $this->PayRulePolicyId;
if (isset($this->PayRulePolicyUID)) $o['PayRulePolicyUID'] = $this->PayRulePolicyUID;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->ScopeLevel)) $o['ScopeLevel'] = $this->ScopeLevel;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->JurisdictionKey)) $o['JurisdictionKey'] = $this->JurisdictionKey;
if (isset($this->CbaKey)) $o['CbaKey'] = $this->CbaKey;
if (isset($this->WorkTypeKey)) $o['WorkTypeKey'] = $this->WorkTypeKey;
if (isset($this->CurrentVersion)) $o['CurrentVersion'] = $this->CurrentVersion;
if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
return empty($o) ? new class(){} : $o;
}
}
class PayRuleDocSection implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $H=null,
/** @var string|null */
public ?string $T=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['H'])) $this->H = $o['H'];
if (isset($o['T'])) $this->T = $o['T'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->H)) $o['H'] = $this->H;
if (isset($this->T)) $o['T'] = $this->T;
return empty($o) ? new class(){} : $o;
}
}
class PayRuleTuneOption implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Label=null,
/** @var string|null */
public ?string $Sub=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Label'])) $this->Label = $o['Label'];
if (isset($o['Sub'])) $this->Sub = $o['Sub'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Label)) $o['Label'] = $this->Label;
if (isset($this->Sub)) $o['Sub'] = $this->Sub;
return empty($o) ? new class(){} : $o;
}
}
class PayRuleTune implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Intro=null,
/** @var array<PayRuleTuneOption>|null */
public ?array $Options=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Intro'])) $this->Intro = $o['Intro'];
if (isset($o['Options'])) $this->Options = JsonConverters::fromArray('PayRuleTuneOption', $o['Options']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Intro)) $o['Intro'] = $this->Intro;
if (isset($this->Options)) $o['Options'] = JsonConverters::toArray('PayRuleTuneOption', $this->Options);
return empty($o) ? new class(){} : $o;
}
}
class PayRuleDef implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $RuleId=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Kind=null,
/** @var string|null */
public ?string $Demand=null,
/** @var string|null */
public ?string $SourcePolicyName=null,
/** @var string|null */
public ?string $CascadeLevel=null,
/** @var string|null */
public ?string $Why=null,
/** @var string|null */
public ?string $Change=null,
/** @var string|null */
public ?string $OverrideWho=null,
/** @var string|null */
public ?string $OverrideConsequence=null,
/** @var string|null */
public ?string $NoNote=null,
/** @var string|null */
public ?string $LegalVerify=null,
/** @var array<string,string>|null */
public ?array $Params=null,
/** @var array<PayRuleDocSection>|null */
public ?array $Doc=null,
/** @var PayRuleTune|null */
public ?PayRuleTune $Tune=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['RuleId'])) $this->RuleId = $o['RuleId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['Demand'])) $this->Demand = $o['Demand'];
if (isset($o['SourcePolicyName'])) $this->SourcePolicyName = $o['SourcePolicyName'];
if (isset($o['CascadeLevel'])) $this->CascadeLevel = $o['CascadeLevel'];
if (isset($o['Why'])) $this->Why = $o['Why'];
if (isset($o['Change'])) $this->Change = $o['Change'];
if (isset($o['OverrideWho'])) $this->OverrideWho = $o['OverrideWho'];
if (isset($o['OverrideConsequence'])) $this->OverrideConsequence = $o['OverrideConsequence'];
if (isset($o['NoNote'])) $this->NoNote = $o['NoNote'];
if (isset($o['LegalVerify'])) $this->LegalVerify = $o['LegalVerify'];
if (isset($o['Params'])) $this->Params = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Params']);
if (isset($o['Doc'])) $this->Doc = JsonConverters::fromArray('PayRuleDocSection', $o['Doc']);
if (isset($o['Tune'])) $this->Tune = JsonConverters::from('PayRuleTune', $o['Tune']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->RuleId)) $o['RuleId'] = $this->RuleId;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->Demand)) $o['Demand'] = $this->Demand;
if (isset($this->SourcePolicyName)) $o['SourcePolicyName'] = $this->SourcePolicyName;
if (isset($this->CascadeLevel)) $o['CascadeLevel'] = $this->CascadeLevel;
if (isset($this->Why)) $o['Why'] = $this->Why;
if (isset($this->Change)) $o['Change'] = $this->Change;
if (isset($this->OverrideWho)) $o['OverrideWho'] = $this->OverrideWho;
if (isset($this->OverrideConsequence)) $o['OverrideConsequence'] = $this->OverrideConsequence;
if (isset($this->NoNote)) $o['NoNote'] = $this->NoNote;
if (isset($this->LegalVerify)) $o['LegalVerify'] = $this->LegalVerify;
if (isset($this->Params)) $o['Params'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Params);
if (isset($this->Doc)) $o['Doc'] = JsonConverters::toArray('PayRuleDocSection', $this->Doc);
if (isset($this->Tune)) $o['Tune'] = JsonConverters::to('PayRuleTune', $this->Tune);
return empty($o) ? new class(){} : $o;
}
}
class PayRulePolicyDoc implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Intro=null,
/** @var string|null */
public ?string $LockLine=null,
/** @var string|null */
public ?string $TemplateName=null,
/** @var array<PayRuleDef>|null */
public ?array $Rules=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Intro'])) $this->Intro = $o['Intro'];
if (isset($o['LockLine'])) $this->LockLine = $o['LockLine'];
if (isset($o['TemplateName'])) $this->TemplateName = $o['TemplateName'];
if (isset($o['Rules'])) $this->Rules = JsonConverters::fromArray('PayRuleDef', $o['Rules']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Intro)) $o['Intro'] = $this->Intro;
if (isset($this->LockLine)) $o['LockLine'] = $this->LockLine;
if (isset($this->TemplateName)) $o['TemplateName'] = $this->TemplateName;
if (isset($this->Rules)) $o['Rules'] = JsonConverters::toArray('PayRuleDef', $this->Rules);
return empty($o) ? new class(){} : $o;
}
}
class PayRulePolicyVersionInfo implements JsonSerializable
{
public function __construct(
/** @var int */
public int $PayRulePolicyVersionId=0,
/** @var int */
public int $VersionNumber=0,
/** @var string|null */
public ?string $ChangeNote=null,
/** @var string|null */
public ?string $ChangedByName=null,
/** @var DateTime */
public DateTime $CreatedAtUtc=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['PayRulePolicyVersionId'])) $this->PayRulePolicyVersionId = $o['PayRulePolicyVersionId'];
if (isset($o['VersionNumber'])) $this->VersionNumber = $o['VersionNumber'];
if (isset($o['ChangeNote'])) $this->ChangeNote = $o['ChangeNote'];
if (isset($o['ChangedByName'])) $this->ChangedByName = $o['ChangedByName'];
if (isset($o['CreatedAtUtc'])) $this->CreatedAtUtc = JsonConverters::from('DateTime', $o['CreatedAtUtc']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->PayRulePolicyVersionId)) $o['PayRulePolicyVersionId'] = $this->PayRulePolicyVersionId;
if (isset($this->VersionNumber)) $o['VersionNumber'] = $this->VersionNumber;
if (isset($this->ChangeNote)) $o['ChangeNote'] = $this->ChangeNote;
if (isset($this->ChangedByName)) $o['ChangedByName'] = $this->ChangedByName;
if (isset($this->CreatedAtUtc)) $o['CreatedAtUtc'] = JsonConverters::to('DateTime', $this->CreatedAtUtc);
return empty($o) ? new class(){} : $o;
}
}
class PayRulesCascadeResponse implements JsonSerializable
{
public function __construct(
/** @var PayRulePolicy|null */
public ?PayRulePolicy $Policy=null,
/** @var PayRulePolicyDoc|null */
public ?PayRulePolicyDoc $Doc=null,
/** @var int */
public int $VersionNumber=0,
/** @var array<PayRulePolicyVersionInfo>|null */
public ?array $Versions=null,
/** @var bool|null */
public ?bool $CanEditRules=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Policy'])) $this->Policy = JsonConverters::from('PayRulePolicy', $o['Policy']);
if (isset($o['Doc'])) $this->Doc = JsonConverters::from('PayRulePolicyDoc', $o['Doc']);
if (isset($o['VersionNumber'])) $this->VersionNumber = $o['VersionNumber'];
if (isset($o['Versions'])) $this->Versions = JsonConverters::fromArray('PayRulePolicyVersionInfo', $o['Versions']);
if (isset($o['CanEditRules'])) $this->CanEditRules = $o['CanEditRules'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Policy)) $o['Policy'] = JsonConverters::to('PayRulePolicy', $this->Policy);
if (isset($this->Doc)) $o['Doc'] = JsonConverters::to('PayRulePolicyDoc', $this->Doc);
if (isset($this->VersionNumber)) $o['VersionNumber'] = $this->VersionNumber;
if (isset($this->Versions)) $o['Versions'] = JsonConverters::toArray('PayRulePolicyVersionInfo', $this->Versions);
if (isset($this->CanEditRules)) $o['CanEditRules'] = $this->CanEditRules;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class PayRuleSaveRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $PayRulePolicyId=0,
/** @var PayRulePolicyDoc|null */
public ?PayRulePolicyDoc $Doc=null,
/** @var string|null */
public ?string $ChangeNote=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['PayRulePolicyId'])) $this->PayRulePolicyId = $o['PayRulePolicyId'];
if (isset($o['Doc'])) $this->Doc = JsonConverters::from('PayRulePolicyDoc', $o['Doc']);
if (isset($o['ChangeNote'])) $this->ChangeNote = $o['ChangeNote'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->PayRulePolicyId)) $o['PayRulePolicyId'] = $this->PayRulePolicyId;
if (isset($this->Doc)) $o['Doc'] = JsonConverters::to('PayRulePolicyDoc', $this->Doc);
if (isset($this->ChangeNote)) $o['ChangeNote'] = $this->ChangeNote;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/workforce/payrules/{PayRulePolicyId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"PayRulePolicyId":0,"Doc":{"Intro":"String","LockLine":"String","TemplateName":"String","Rules":[{"RuleId":"String","Name":"String","Kind":"String","Demand":"String","SourcePolicyName":"String","CascadeLevel":"String","Why":"String","Change":"String","OverrideWho":"String","OverrideConsequence":"String","NoNote":"String","LegalVerify":"String","Params":{"String":"String"},"Doc":[{"H":"String","T":"String"}],"Tune":{"Intro":"String","Options":[{"Label":"String","Sub":"String"}]}}]},"ChangeNote":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"Policy":{"PayRulePolicyId":0,"PayRulePolicyUID":"00000000000000000000000000000000","Name":"String","ScopeLevel":"String","BranchId":"00000000000000000000000000000000","JurisdictionKey":"String","CbaKey":"String","WorkTypeKey":"String","CurrentVersion":0,"IsActive":false,"BranchName":"String"},"Doc":{"Intro":"String","LockLine":"String","TemplateName":"String","Rules":[{"RuleId":"String","Name":"String","Kind":"String","Demand":"String","SourcePolicyName":"String","CascadeLevel":"String","Why":"String","Change":"String","OverrideWho":"String","OverrideConsequence":"String","NoNote":"String","LegalVerify":"String","Params":{"String":"String"},"Doc":[{"H":"String","T":"String"}],"Tune":{"Intro":"String","Options":[{"Label":"String","Sub":"String"}]}}]},"VersionNumber":0,"Versions":[{"PayRulePolicyVersionId":0,"VersionNumber":0,"ChangeNote":"String","ChangedByName":"String","CreatedAtUtc":"0001-01-01T00:00:00.0000000"}],"CanEditRules":false,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}