Tax Filing Service

<back to all web services

BatchRegisterProductsAsync

RegisterProductsBatchAsync

Represents a service request to register one or more products in a batch operation.

Requires Authentication
Required role:AdminRequired permissions:CanAccess, CanAdd
The following routes are available for this service:
POST/async/products/batch
<?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 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 Specifies a base service request to register one or more products in a batch operation. */
// @Api(Description="Specifies a base service request to register one or more products in a batch operation.")
class BatchRegisterProductsBase implements IPost, JsonSerializable
{
    public function __construct(
        /** @description The products to register. */
        // @ApiMember(Description="The products to register.", IsRequired=true)
        /** @var array<Product>|null */
        public ?array $products=null
    ) {
    }

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

/** @description Represents a service request to register one or more products in a batch operation. */
// @Api(Description="Represents a service request to register one or more products in a batch operation.")
class BatchRegisterProductsAsync extends BatchRegisterProductsBase implements JsonSerializable
{
    /**
     * @param array<Product>|null $products
     */
    public function __construct(
        ?array $products=null
    ) {
        parent::__construct($products);
    }

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

PHP BatchRegisterProductsAsync DTOs

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

HTTP + CSV

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

POST /async/products/batch HTTP/1.1 
Host: taxfiling.pwc.de 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"products":[{"id":0,"index":0,"name":"String","version":"String","description":"String","tags":["String"]}]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

[{"product":{"id":0,"index":0,"name":"String","version":"String","description":"String","tags":["String"]},"orders":[{"id":0,"productId":0,"accountId":0,"name":"String","serviceName":"String","requestTimestamp":"\/Date(-62135596800000-0000)\/","responseTimestamp":"\/Date(-62135596800000-0000)\/","requestUri":"String","requestHttpMethod":"String","requestDuration":"PT0S","responseStatusCode":"Continue","clientIPAddress":"String","unitOfMeasurement":"String","processType":"String","dataType":"String","dataName":"String","creationDate":"\/Date(-62135596800000-0000)\/","expiryDate":"\/Date(-62135596800000-0000)\/","isTest":false}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}]