| POST,OPTIONS | /v1/field/application |
|---|
<?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 ApplicationView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ChemicalApplicationID=0,
/** @var DateTime|null */
public ?DateTime $AppliedAt=null,
/** @var string|null */
public ?string $AreaTreated=null,
/** @var string|null */
public ?string $ProductName=null,
/** @var string|null */
public ?string $EpaRegistrationNumber=null,
/** @var float|null */
public ?float $AmountApplied=null,
/** @var string|null */
public ?string $AmountUnit=null,
/** @var string|null */
public ?string $Concentration=null,
/** @var float|null */
public ?float $TreatedQuantity=null,
/** @var string|null */
public ?string $TreatedUnit=null,
/** @var string|null */
public ?string $TargetPest=null,
/** @var string|null */
public ?string $ApplicatorName=null,
/** @var string|null */
public ?string $ApplicatorLicence=null,
/** @var float|null */
public ?float $WindSpeedMph=null,
/** @var string|null */
public ?string $WindDirection=null,
/** @var float|null */
public ?float $TemperatureF=null,
/** @var string|null */
public ?string $Notes=null,
/** @var DateTime|null */
public ?DateTime $SubmittedAt=null,
/** @var int|null */
public ?int $AmendsApplicationID=null,
/** @var bool|null */
public ?bool $IsAmended=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ChemicalApplicationID'])) $this->ChemicalApplicationID = $o['ChemicalApplicationID'];
if (isset($o['AppliedAt'])) $this->AppliedAt = JsonConverters::from('DateTime', $o['AppliedAt']);
if (isset($o['AreaTreated'])) $this->AreaTreated = $o['AreaTreated'];
if (isset($o['ProductName'])) $this->ProductName = $o['ProductName'];
if (isset($o['EpaRegistrationNumber'])) $this->EpaRegistrationNumber = $o['EpaRegistrationNumber'];
if (isset($o['AmountApplied'])) $this->AmountApplied = $o['AmountApplied'];
if (isset($o['AmountUnit'])) $this->AmountUnit = $o['AmountUnit'];
if (isset($o['Concentration'])) $this->Concentration = $o['Concentration'];
if (isset($o['TreatedQuantity'])) $this->TreatedQuantity = $o['TreatedQuantity'];
if (isset($o['TreatedUnit'])) $this->TreatedUnit = $o['TreatedUnit'];
if (isset($o['TargetPest'])) $this->TargetPest = $o['TargetPest'];
if (isset($o['ApplicatorName'])) $this->ApplicatorName = $o['ApplicatorName'];
if (isset($o['ApplicatorLicence'])) $this->ApplicatorLicence = $o['ApplicatorLicence'];
if (isset($o['WindSpeedMph'])) $this->WindSpeedMph = $o['WindSpeedMph'];
if (isset($o['WindDirection'])) $this->WindDirection = $o['WindDirection'];
if (isset($o['TemperatureF'])) $this->TemperatureF = $o['TemperatureF'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['SubmittedAt'])) $this->SubmittedAt = JsonConverters::from('DateTime', $o['SubmittedAt']);
if (isset($o['AmendsApplicationID'])) $this->AmendsApplicationID = $o['AmendsApplicationID'];
if (isset($o['IsAmended'])) $this->IsAmended = $o['IsAmended'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ChemicalApplicationID)) $o['ChemicalApplicationID'] = $this->ChemicalApplicationID;
if (isset($this->AppliedAt)) $o['AppliedAt'] = JsonConverters::to('DateTime', $this->AppliedAt);
if (isset($this->AreaTreated)) $o['AreaTreated'] = $this->AreaTreated;
if (isset($this->ProductName)) $o['ProductName'] = $this->ProductName;
if (isset($this->EpaRegistrationNumber)) $o['EpaRegistrationNumber'] = $this->EpaRegistrationNumber;
if (isset($this->AmountApplied)) $o['AmountApplied'] = $this->AmountApplied;
if (isset($this->AmountUnit)) $o['AmountUnit'] = $this->AmountUnit;
if (isset($this->Concentration)) $o['Concentration'] = $this->Concentration;
if (isset($this->TreatedQuantity)) $o['TreatedQuantity'] = $this->TreatedQuantity;
if (isset($this->TreatedUnit)) $o['TreatedUnit'] = $this->TreatedUnit;
if (isset($this->TargetPest)) $o['TargetPest'] = $this->TargetPest;
if (isset($this->ApplicatorName)) $o['ApplicatorName'] = $this->ApplicatorName;
if (isset($this->ApplicatorLicence)) $o['ApplicatorLicence'] = $this->ApplicatorLicence;
if (isset($this->WindSpeedMph)) $o['WindSpeedMph'] = $this->WindSpeedMph;
if (isset($this->WindDirection)) $o['WindDirection'] = $this->WindDirection;
if (isset($this->TemperatureF)) $o['TemperatureF'] = $this->TemperatureF;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->SubmittedAt)) $o['SubmittedAt'] = JsonConverters::to('DateTime', $this->SubmittedAt);
if (isset($this->AmendsApplicationID)) $o['AmendsApplicationID'] = $this->AmendsApplicationID;
if (isset($this->IsAmended)) $o['IsAmended'] = $this->IsAmended;
return empty($o) ? new class(){} : $o;
}
}
class ApplicationResponse implements JsonSerializable
{
public function __construct(
/** @var array<ApplicationView>|null */
public ?array $Applications=null,
/** @var int */
public int $ChemicalApplicationID=0,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Applications'])) $this->Applications = JsonConverters::fromArray('ApplicationView', $o['Applications']);
if (isset($o['ChemicalApplicationID'])) $this->ChemicalApplicationID = $o['ChemicalApplicationID'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Applications)) $o['Applications'] = JsonConverters::toArray('ApplicationView', $this->Applications);
if (isset($this->ChemicalApplicationID)) $o['ChemicalApplicationID'] = $this->ChemicalApplicationID;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class ApplicationCreateRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $WorkerScheduleItemID=0,
/** @var int */
public int $AgreementJobID=0,
/** @var int */
public int $JobID=0,
/** @var int */
public int $ProjectID=0,
/** @var string|null */
public ?string $AppliedAt=null,
/** @var string|null */
public ?string $AreaTreated=null,
/** @var int */
public int $MaterialID=0,
/** @var float|null */
public ?float $AmountApplied=null,
/** @var string|null */
public ?string $AmountUnit=null,
/** @var string|null */
public ?string $Concentration=null,
/** @var float|null */
public ?float $TreatedQuantity=null,
/** @var string|null */
public ?string $TreatedUnit=null,
/** @var string|null */
public ?string $TargetPest=null,
/** @var float|null */
public ?float $WindSpeedMph=null,
/** @var string|null */
public ?string $WindDirection=null,
/** @var float|null */
public ?float $TemperatureF=null,
/** @var string|null */
public ?string $WeatherSource=null,
/** @var string|null */
public ?string $Notes=null,
/** @var int */
public int $AmendsApplicationID=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['WorkerScheduleItemID'])) $this->WorkerScheduleItemID = $o['WorkerScheduleItemID'];
if (isset($o['AgreementJobID'])) $this->AgreementJobID = $o['AgreementJobID'];
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
if (isset($o['AppliedAt'])) $this->AppliedAt = $o['AppliedAt'];
if (isset($o['AreaTreated'])) $this->AreaTreated = $o['AreaTreated'];
if (isset($o['MaterialID'])) $this->MaterialID = $o['MaterialID'];
if (isset($o['AmountApplied'])) $this->AmountApplied = $o['AmountApplied'];
if (isset($o['AmountUnit'])) $this->AmountUnit = $o['AmountUnit'];
if (isset($o['Concentration'])) $this->Concentration = $o['Concentration'];
if (isset($o['TreatedQuantity'])) $this->TreatedQuantity = $o['TreatedQuantity'];
if (isset($o['TreatedUnit'])) $this->TreatedUnit = $o['TreatedUnit'];
if (isset($o['TargetPest'])) $this->TargetPest = $o['TargetPest'];
if (isset($o['WindSpeedMph'])) $this->WindSpeedMph = $o['WindSpeedMph'];
if (isset($o['WindDirection'])) $this->WindDirection = $o['WindDirection'];
if (isset($o['TemperatureF'])) $this->TemperatureF = $o['TemperatureF'];
if (isset($o['WeatherSource'])) $this->WeatherSource = $o['WeatherSource'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['AmendsApplicationID'])) $this->AmendsApplicationID = $o['AmendsApplicationID'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->WorkerScheduleItemID)) $o['WorkerScheduleItemID'] = $this->WorkerScheduleItemID;
if (isset($this->AgreementJobID)) $o['AgreementJobID'] = $this->AgreementJobID;
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
if (isset($this->AppliedAt)) $o['AppliedAt'] = $this->AppliedAt;
if (isset($this->AreaTreated)) $o['AreaTreated'] = $this->AreaTreated;
if (isset($this->MaterialID)) $o['MaterialID'] = $this->MaterialID;
if (isset($this->AmountApplied)) $o['AmountApplied'] = $this->AmountApplied;
if (isset($this->AmountUnit)) $o['AmountUnit'] = $this->AmountUnit;
if (isset($this->Concentration)) $o['Concentration'] = $this->Concentration;
if (isset($this->TreatedQuantity)) $o['TreatedQuantity'] = $this->TreatedQuantity;
if (isset($this->TreatedUnit)) $o['TreatedUnit'] = $this->TreatedUnit;
if (isset($this->TargetPest)) $o['TargetPest'] = $this->TargetPest;
if (isset($this->WindSpeedMph)) $o['WindSpeedMph'] = $this->WindSpeedMph;
if (isset($this->WindDirection)) $o['WindDirection'] = $this->WindDirection;
if (isset($this->TemperatureF)) $o['TemperatureF'] = $this->TemperatureF;
if (isset($this->WeatherSource)) $o['WeatherSource'] = $this->WeatherSource;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->AmendsApplicationID)) $o['AmendsApplicationID'] = $this->AmendsApplicationID;
return empty($o) ? new class(){} : $o;
}
}
PHP ApplicationCreateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/field/application HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"WorkerScheduleItemID":0,"AgreementJobID":0,"JobID":0,"ProjectID":0,"AppliedAt":"String","AreaTreated":"String","MaterialID":0,"AmountApplied":0,"AmountUnit":"String","Concentration":"String","TreatedQuantity":0,"TreatedUnit":"String","TargetPest":"String","WindSpeedMph":0,"WindDirection":"String","TemperatureF":0,"WeatherSource":"String","Notes":"String","AmendsApplicationID":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"Applications":[{"ChemicalApplicationID":0,"AppliedAt":"0001-01-01T00:00:00.0000000","AreaTreated":"String","ProductName":"String","EpaRegistrationNumber":"String","AmountApplied":0,"AmountUnit":"String","Concentration":"String","TreatedQuantity":0,"TreatedUnit":"String","TargetPest":"String","ApplicatorName":"String","ApplicatorLicence":"String","WindSpeedMph":0,"WindDirection":"String","TemperatureF":0,"Notes":"String","SubmittedAt":"0001-01-01T00:00:00.0000000","AmendsApplicationID":0,"IsAmended":false}],"ChemicalApplicationID":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}