DX STF Client API

<back to all web services

SearchCustomerMaster

Customer Master Requests

Customer Master

Requires Authentication
The following routes are available for this service:
POST/api/customerMaster/search/ownerSearch customer master based on search parameters
<?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};


enum ORDER : string
{
    case ASC = 'ASC';
    case DESC = 'DESC';
}

class SearchCustomerMasterQuery implements ISearchCustomerMaster, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $continuationToken='',
        /** @var string|null */
        public ?string $payByEntityIdentification=null,
        /** @var int */
        public int $requestedPage=0,
        /** @var int */
        public int $numberOfRecordsPerPage=0,
        /** @var string */
        public string $orderBy='',
        /** @var ORDER|null */
        public ?ORDER $order=null
    ) {
    }

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

/** @description Customer Master */
// @Api(Description="Customer Master")
// @ApiResponse(Description="Paged Customer Master data", IsDefaultResponse=true, ResponseType="typeof(DX.STF.Models.Queries.QueryResult.PagedQueryResponseWithToken`1[[DX.Framework.Core.Querying.ResultItem`1[[DX.STF.Models.Dto.MasterData.CustomerMasterMessage, DX.STF.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], DX.Framework.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])", StatusCode=200)
class SearchCustomerMaster implements JsonSerializable
{
    public function __construct(
        /** @description Search query */
        // @ApiMember(Description="Search query", ParameterType="model")
        /** @var SearchCustomerMasterQuery|null */
        public ?SearchCustomerMasterQuery $query=null
    ) {
    }

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

/**
 * @template T
 */
class PagedQueryResult implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): PagedQueryResult {
        $to = new PagedQueryResult();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        /** @var int */
        public mixed $startIndex=0,
        /** @var int */
        public mixed $endIndex=0,
        /** @var int */
        public mixed $numberOfRecordsReturned=0,
        /** @var int */
        public mixed $totalNumberOfPages=0,
        /** @var int */
        public mixed $totalNumberOfRecords=0,
        /** @var array<ResultItem<ClaimMessage>>|null */
        public mixed $results=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['startIndex'])) $this->startIndex = $o['startIndex'];
        if (isset($o['endIndex'])) $this->endIndex = $o['endIndex'];
        if (isset($o['numberOfRecordsReturned'])) $this->numberOfRecordsReturned = $o['numberOfRecordsReturned'];
        if (isset($o['totalNumberOfPages'])) $this->totalNumberOfPages = $o['totalNumberOfPages'];
        if (isset($o['totalNumberOfRecords'])) $this->totalNumberOfRecords = $o['totalNumberOfRecords'];
        if (isset($o['results'])) $this->results = JsonConverters::fromArray('ResultItem<ClaimMessage>', $o['results']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->startIndex)) $o['startIndex'] = $this->startIndex;
        if (isset($this->endIndex)) $o['endIndex'] = $this->endIndex;
        if (isset($this->numberOfRecordsReturned)) $o['numberOfRecordsReturned'] = $this->numberOfRecordsReturned;
        if (isset($this->totalNumberOfPages)) $o['totalNumberOfPages'] = $this->totalNumberOfPages;
        if (isset($this->totalNumberOfRecords)) $o['totalNumberOfRecords'] = $this->totalNumberOfRecords;
        if (isset($this->results)) $o['results'] = JsonConverters::toArray('ResultItem<ClaimMessage>', $this->results);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template T
 * @template PagedQueryResult of ResultItem<InvoiceMessage>
 */
class PagedQueryResponseWithToken extends PagedQueryResult implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): PagedQueryResponseWithToken {
        $to = new PagedQueryResponseWithToken();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    /**
     * @param int $startIndex
     * @param int $endIndex
     * @param int $numberOfRecordsReturned
     * @param int $totalNumberOfPages
     * @param int $totalNumberOfRecords
     * @param array<ResultItem<ClaimMessage>>|null $results
     */
    public function __construct(
        mixed $startIndex=0,
        mixed $endIndex=0,
        mixed $numberOfRecordsReturned=0,
        mixed $totalNumberOfPages=0,
        mixed $totalNumberOfRecords=0,
        mixed $results=null,
        /** @var string */
        public mixed $continuationToken=''
    ) {
        parent::__construct($startIndex,$endIndex,$numberOfRecordsReturned,$totalNumberOfPages,$totalNumberOfRecords,$results);
    }

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

PHP SearchCustomerMaster 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 /api/customerMaster/search/owner HTTP/1.1 
Host: stf-api-uat.data-xchange.co.za 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"query":{"continuationToken":"String","payByEntityIdentification":"String","requestedPage":0,"numberOfRecordsPerPage":0,"orderBy":"String","order":"ASC"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"continuationToken":"String","startIndex":0,"endIndex":0,"numberOfRecordsReturned":0,"totalNumberOfPages":0,"totalNumberOfRecords":0,"results":[{}]}