sfgboxapi

<back to all web services

UsersBoxesAutoQueryEdit

<?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 UsersBoxes implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        // @Required()
        /** @var int */
        public int $id=0,

        // @DataMember(Order=2)
        // @Required()
        // @References("typeof(sfgboxapi.ServiceModel.Types.AppUser)")
        /** @var int */
        public int $appUserId=0,

        // @DataMember(Order=3)
        // @Required()
        // @References("typeof(sfgboxapi.ServiceModel.Types.AppUser)")
        /** @var int */
        public int $authAppUserId=0,

        // @DataMember(Order=4)
        // @Required()
        /** @var DateTime */
        public DateTime $deploymentDate=new DateTime(),

        // @DataMember(Order=5)
        // @Required()
        /** @var int */
        public int $numberBoxes=0,

        // @DataMember(Order=6)
        // @Required()
        /** @var string */
        public string $recipientType='',

        // @DataMember(Order=7)
        /** @var int|null */
        public ?int $foodGardensId=null,

        // @DataMember(Order=8)
        /** @var string|null */
        public ?string $otherDescription=null,

        // @DataMember(Order=9)
        /** @var string */
        public string $publicAccessGuid=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['appUserId'])) $this->appUserId = $o['appUserId'];
        if (isset($o['authAppUserId'])) $this->authAppUserId = $o['authAppUserId'];
        if (isset($o['deploymentDate'])) $this->deploymentDate = JsonConverters::from('DateTime', $o['deploymentDate']);
        if (isset($o['numberBoxes'])) $this->numberBoxes = $o['numberBoxes'];
        if (isset($o['recipientType'])) $this->recipientType = $o['recipientType'];
        if (isset($o['foodGardensId'])) $this->foodGardensId = $o['foodGardensId'];
        if (isset($o['otherDescription'])) $this->otherDescription = $o['otherDescription'];
        if (isset($o['publicAccessGuid'])) $this->publicAccessGuid = $o['publicAccessGuid'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->appUserId)) $o['appUserId'] = $this->appUserId;
        if (isset($this->authAppUserId)) $o['authAppUserId'] = $this->authAppUserId;
        if (isset($this->deploymentDate)) $o['deploymentDate'] = JsonConverters::to('DateTime', $this->deploymentDate);
        if (isset($this->numberBoxes)) $o['numberBoxes'] = $this->numberBoxes;
        if (isset($this->recipientType)) $o['recipientType'] = $this->recipientType;
        if (isset($this->foodGardensId)) $o['foodGardensId'] = $this->foodGardensId;
        if (isset($this->otherDescription)) $o['otherDescription'] = $this->otherDescription;
        if (isset($this->publicAccessGuid)) $o['publicAccessGuid'] = $this->publicAccessGuid;
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template IUpdateDb of UsersBoxes
 */
class UsersBoxesAutoQueryEdit extends UsersBoxes implements IUpdateDb, JsonSerializable
{
    /**
     * @param int $id
     * @param int $appUserId
     * @param int $authAppUserId
     * @param DateTime $deploymentDate
     * @param int $numberBoxes
     * @param string $recipientType
     * @param int|null $foodGardensId
     * @param string|null $otherDescription
     * @param string $publicAccessGuid
     */
    public function __construct(
        int $id=0,
        int $appUserId=0,
        int $authAppUserId=0,
        DateTime $deploymentDate=new DateTime(),
        int $numberBoxes=0,
        string $recipientType='',
        ?int $foodGardensId=null,
        ?string $otherDescription=null,
        string $publicAccessGuid=''
    ) {
        parent::__construct($id,$appUserId,$authAppUserId,$deploymentDate,$numberBoxes,$recipientType,$foodGardensId,$otherDescription,$publicAccessGuid);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

PHP UsersBoxesAutoQueryEdit DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /xml/reply/UsersBoxesAutoQueryEdit HTTP/1.1 
Host: api-stage.smartfarmertech.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UsersBoxesAutoQueryEdit xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel">
  <AppUserId xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">0</AppUserId>
  <AuthAppUserId xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">0</AuthAppUserId>
  <DeploymentDate xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">0001-01-01T00:00:00</DeploymentDate>
  <FoodGardensId xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">0</FoodGardensId>
  <Id xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">0</Id>
  <NumberBoxes xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">0</NumberBoxes>
  <OtherDescription xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">String</OtherDescription>
  <PublicAccessGuid xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">00000000-0000-0000-0000-000000000000</PublicAccessGuid>
  <RecipientType xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">String</RecipientType>
</UsersBoxesAutoQueryEdit>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<UsersBoxes xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/sfgboxapi.ServiceModel.Types">
  <AppUserId>0</AppUserId>
  <AuthAppUserId>0</AuthAppUserId>
  <DeploymentDate>0001-01-01T00:00:00</DeploymentDate>
  <FoodGardensId>0</FoodGardensId>
  <Id>0</Id>
  <NumberBoxes>0</NumberBoxes>
  <OtherDescription>String</OtherDescription>
  <PublicAccessGuid>00000000-0000-0000-0000-000000000000</PublicAccessGuid>
  <RecipientType>String</RecipientType>
</UsersBoxes>