Tax Filing Service

<back to all web services

UpdateProductAsync

UpdateProductsAsync

Represents a service request to update product data in an asynchronous operation.

Requires Authentication
Required role:AdminRequired permissions:CanAccess, CanEdit
The following routes are available for this service:
PUT/async/products/{Id}
<?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};


/** @description Specifies a service request to update product data. */
// @Api(Description="Specifies a service request to update product data.")
class UpdateProductBase implements IPut, JsonSerializable
{
    public function __construct(
        /** @description The unique identifier of the product. */
        // @ApiMember(Description="The unique identifier of the product.")
        /** @var int */
        public int $id=0,

        /** @description The name of the product. */
        // @ApiMember(Description="The name of the product.")
        /** @var string|null */
        public ?string $name=null,

        /** @description The description of the product. */
        // @ApiMember(Description="The description of the product.")
        /** @var string|null */
        public ?string $description=null,

        /** @description The version of the product. */
        // @ApiMember(Description="The version of the product.")
        /** @var string|null */
        public ?string $version=null,

        /** @description Tags associated with the product. */
        // @ApiMember(Description="Tags associated with the product.")
        /** @var array<string>|null */
        public ?array $tags=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('string', $o['tags']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('string', $this->tags);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Specifies a base service response class that contains a structured error information. */
// @Api(Description="Specifies a base service response class that contains a structured error information.")
class ServiceResponseBase implements JsonSerializable
{
    public function __construct(
        /** @description Data structure that holds error information from a service operation. */
        // @ApiMember(Description="Data structure that holds error information from a service operation.")
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Represents a product. */
// @Api(Description="Represents a product.")
class Product implements IHasName, JsonSerializable
{
    public function __construct(
        /** @description The unique identifier of the product. */
        // @ApiMember(Description="The unique identifier of the product.", IsRequired=true)
        /** @var int */
        public int $id=0,

        /** @description The position of this instance in a collection of 'Product' instances */
        // @ApiMember(Description="The position of this instance in a collection of 'Product' instances", IsRequired=true)
        /** @var int */
        public int $index=0,

        /** @description The name of the product. */
        // @ApiMember(Description="The name of the product.", IsRequired=true)
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $name='',

        /** @description The version of the product. */
        // @ApiMember(Description="The version of the product.", IsRequired=true)
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $version='',

        /** @description The version of the product. */
        // @ApiMember(Description="The version of the product.")
        /** @var string|null */
        public ?string $description=null,

        /** @description Tags associated with the product. */
        // @ApiMember(Description="Tags associated with the product.")
        /** @var array<string>|null */
        public ?array $tags=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['index'])) $this->index = $o['index'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('string', $o['tags']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->index)) $o['index'] = $this->index;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('string', $this->tags);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Represents a commission to consume services. */
// @Api(Description="Represents a commission to consume services.")
class Order implements IHasName, JsonSerializable
{
    public function __construct(
        /** @description The unique identifier of the order. */
        // @ApiMember(Description="The unique identifier of the order.", IsRequired=true)
        /** @var int */
        public int $id=0,

        /** @description The unique identifier of the product, for which the order is made. */
        // @ApiMember(Description="The unique identifier of the product, for which the order is made.", IsRequired=true)
        /** @var int */
        public int $productId=0,

        /** @description The unique identifier of the user account, who placed the order. */
        // @ApiMember(Description="The unique identifier of the user account, who placed the order.", IsRequired=true)
        /** @var int */
        public int $accountId=0,

        /** @description A name to identify the order. */
        // @ApiMember(Description="A name to identify the order.", IsRequired=true)
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $name='',

        /** @description The name of the service, for which the order was made. */
        // @ApiMember(Description="The name of the service, for which the order was made.")
        /** @var string|null */
        public ?string $serviceName=null,

        /** @description The time stamp at which the order was initiated. */
        // @ApiMember(Description="The time stamp at which the order was initiated.")
        /** @var DateTime|null */
        public ?DateTime $requestTimestamp=null,

        /** @description The time stamp at which the order was completed. */
        // @ApiMember(Description="The time stamp at which the order was completed.")
        /** @var DateTime|null */
        public ?DateTime $responseTimestamp=null,

        /** @description The URI from which the order was initiated. */
        // @ApiMember(Description="The URI from which the order was initiated.")
        /** @var string|null */
        public ?string $requestUri=null,

        /** @description The HTTP method of the order request. */
        // @ApiMember(Description="The HTTP method of the order request.")
        /** @var string|null */
        public ?string $requestHttpMethod=null,

        /** @description The duration of the order request. */
        // @ApiMember(Description="The duration of the order request.")
        /** @var DateInterval|null */
        public ?DateInterval $requestDuration=null,

        /** @description The HTTP status code of the order request. */
        // @ApiMember(Description="The HTTP status code of the order request.")
        /** @var HttpStatusCode|null */
        public ?HttpStatusCode $responseStatusCode=null,

        /** @description The IP address of client, who placed the order. */
        // @ApiMember(Description="The IP address of client, who placed the order.")
        /** @var string|null */
        public ?string $clientIPAddress=null,

        /** @description The unit of measurement for the order. */
        // @ApiMember(Description="The unit of measurement for the order.")
        /** @var string|null */
        public ?string $unitOfMeasurement=null,

        /** @description The type of process, for which the order is charged. */
        // @ApiMember(Description="The type of process, for which the order is charged.")
        /** @var string|null */
        public ?string $processType=null,

        /** @description The type of data, for which the order is charged. */
        // @ApiMember(Description="The type of data, for which the order is charged.")
        /** @var string|null */
        public ?string $dataType=null,

        /** @description The name of the data, for which the order is charged. */
        // @ApiMember(Description="The name of the data, for which the order is charged.")
        /** @var string|null */
        public ?string $dataName=null,

        /** @description The date of creation of the order. */
        // @ApiMember(Description="The date of creation of the order.")
        /** @var DateTime */
        public DateTime $creationDate=new DateTime(),

        /** @description The final date to retain the order in the records. After this date, the order is expunged from the records. */
        // @ApiMember(Description="The final date to retain the order in the records. After this date, the order is expunged from the records.")
        /** @var DateTime|null */
        public ?DateTime $expiryDate=null,

        /** @description Indicates whether the order is simulated for test purposes. True if the order is simulated for test purposes; otherwise it is a false order for production purposes. */
        // @ApiMember(Description="Indicates whether the order is simulated for test purposes. True if the order is simulated for test purposes; otherwise it is a false order for production purposes.")
        /** @var bool|null */
        public ?bool $isTest=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['productId'])) $this->productId = $o['productId'];
        if (isset($o['accountId'])) $this->accountId = $o['accountId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['serviceName'])) $this->serviceName = $o['serviceName'];
        if (isset($o['requestTimestamp'])) $this->requestTimestamp = JsonConverters::from('DateTime', $o['requestTimestamp']);
        if (isset($o['responseTimestamp'])) $this->responseTimestamp = JsonConverters::from('DateTime', $o['responseTimestamp']);
        if (isset($o['requestUri'])) $this->requestUri = $o['requestUri'];
        if (isset($o['requestHttpMethod'])) $this->requestHttpMethod = $o['requestHttpMethod'];
        if (isset($o['requestDuration'])) $this->requestDuration = JsonConverters::from('TimeSpan', $o['requestDuration']);
        if (isset($o['responseStatusCode'])) $this->responseStatusCode = JsonConverters::from('HttpStatusCode', $o['responseStatusCode']);
        if (isset($o['clientIPAddress'])) $this->clientIPAddress = $o['clientIPAddress'];
        if (isset($o['unitOfMeasurement'])) $this->unitOfMeasurement = $o['unitOfMeasurement'];
        if (isset($o['processType'])) $this->processType = $o['processType'];
        if (isset($o['dataType'])) $this->dataType = $o['dataType'];
        if (isset($o['dataName'])) $this->dataName = $o['dataName'];
        if (isset($o['creationDate'])) $this->creationDate = JsonConverters::from('DateTime', $o['creationDate']);
        if (isset($o['expiryDate'])) $this->expiryDate = JsonConverters::from('DateTime', $o['expiryDate']);
        if (isset($o['isTest'])) $this->isTest = $o['isTest'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->productId)) $o['productId'] = $this->productId;
        if (isset($this->accountId)) $o['accountId'] = $this->accountId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->serviceName)) $o['serviceName'] = $this->serviceName;
        if (isset($this->requestTimestamp)) $o['requestTimestamp'] = JsonConverters::to('DateTime', $this->requestTimestamp);
        if (isset($this->responseTimestamp)) $o['responseTimestamp'] = JsonConverters::to('DateTime', $this->responseTimestamp);
        if (isset($this->requestUri)) $o['requestUri'] = $this->requestUri;
        if (isset($this->requestHttpMethod)) $o['requestHttpMethod'] = $this->requestHttpMethod;
        if (isset($this->requestDuration)) $o['requestDuration'] = JsonConverters::to('TimeSpan', $this->requestDuration);
        if (isset($this->responseStatusCode)) $o['responseStatusCode'] = JsonConverters::to('HttpStatusCode', $this->responseStatusCode);
        if (isset($this->clientIPAddress)) $o['clientIPAddress'] = $this->clientIPAddress;
        if (isset($this->unitOfMeasurement)) $o['unitOfMeasurement'] = $this->unitOfMeasurement;
        if (isset($this->processType)) $o['processType'] = $this->processType;
        if (isset($this->dataType)) $o['dataType'] = $this->dataType;
        if (isset($this->dataName)) $o['dataName'] = $this->dataName;
        if (isset($this->creationDate)) $o['creationDate'] = JsonConverters::to('DateTime', $this->creationDate);
        if (isset($this->expiryDate)) $o['expiryDate'] = JsonConverters::to('DateTime', $this->expiryDate);
        if (isset($this->isTest)) $o['isTest'] = $this->isTest;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Represents a service response that encapsulates product data. */
// @Api(Description="Represents a service response that encapsulates product data.")
class ProductResponse extends ServiceResponseBase implements JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        /** @description The product data of the response. */
        // @ApiMember(Description="The product data of the response.")
        /** @var Product|null */
        public ?Product $product=null,

        /** @description The list of orders associated with the encapsulated product. */
        // @ApiMember(Description="The list of orders associated with the encapsulated product.")
        /** @var array<Order>|null */
        public ?array $orders=null
    ) {
        parent::__construct($responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['product'])) $this->product = JsonConverters::from('Product', $o['product']);
        if (isset($o['orders'])) $this->orders = JsonConverters::fromArray('Order', $o['orders']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->product)) $o['product'] = JsonConverters::to('Product', $this->product);
        if (isset($this->orders)) $o['orders'] = JsonConverters::toArray('Order', $this->orders);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Represents a service request to update product data in an asynchronous operation. */
// @Api(Description="Represents a service request to update product data in an asynchronous operation.")
class UpdateProductAsync extends UpdateProductBase implements JsonSerializable
{
    /**
     * @param int $id
     * @param string|null $name
     * @param string|null $description
     * @param string|null $version
     * @param array<string>|null $tags
     */
    public function __construct(
        int $id=0,
        ?string $name=null,
        ?string $description=null,
        ?string $version=null,
        ?array $tags=null
    ) {
        parent::__construct($id,$name,$description,$version,$tags);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('string', $o['tags']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('string', $this->tags);
        return empty($o) ? new class(){} : $o;
    }
}

PHP UpdateProductAsync 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.

PUT /async/products/{Id} HTTP/1.1 
Host: taxfiling.pwc.de 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UpdateProductAsync xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Services.Contracts.Requests">
  <Description>String</Description>
  <Id>0</Id>
  <Name>String</Name>
  <Tags xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </Tags>
  <Version>String</Version>
</UpdateProductAsync>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ProductResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Services.Contracts.Responses">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Orders xmlns:d2p1="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Domain.Concretes.Models">
    <d2p1:Order>
      <d2p1:AccountId>0</d2p1:AccountId>
      <d2p1:ClientIPAddress>String</d2p1:ClientIPAddress>
      <d2p1:CreationDate>0001-01-01T00:00:00</d2p1:CreationDate>
      <d2p1:DataName>String</d2p1:DataName>
      <d2p1:DataType>String</d2p1:DataType>
      <d2p1:ExpiryDate>0001-01-01T00:00:00</d2p1:ExpiryDate>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:IsTest>false</d2p1:IsTest>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:ProcessType>String</d2p1:ProcessType>
      <d2p1:ProductId>0</d2p1:ProductId>
      <d2p1:RequestDuration>PT0S</d2p1:RequestDuration>
      <d2p1:RequestHttpMethod>String</d2p1:RequestHttpMethod>
      <d2p1:RequestTimestamp>0001-01-01T00:00:00</d2p1:RequestTimestamp>
      <d2p1:RequestUri>String</d2p1:RequestUri>
      <d2p1:ResponseStatusCode>Continue</d2p1:ResponseStatusCode>
      <d2p1:ResponseTimestamp>0001-01-01T00:00:00</d2p1:ResponseTimestamp>
      <d2p1:ServiceName>String</d2p1:ServiceName>
      <d2p1:UnitOfMeasurement>String</d2p1:UnitOfMeasurement>
    </d2p1:Order>
  </Orders>
  <Product xmlns:d2p1="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Domain.Concretes.Models">
    <d2p1:Description>String</d2p1:Description>
    <d2p1:Id>0</d2p1:Id>
    <d2p1:Index>0</d2p1:Index>
    <d2p1:Name>String</d2p1:Name>
    <d2p1:Tags xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </d2p1:Tags>
    <d2p1:Version>String</d2p1:Version>
  </Product>
</ProductResponse>