Cochrane+ App API

<back to all web services

GetSalesTargetInfo

Requires Authentication
The following routes are available for this service:
GET/dashboard/salestargetinfo
<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, JsonSerializable
{
    public function __construct(
        /** @description The API Key required for authentication */
        // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
        /** @var string */
        public string $apiKey='',

        /** @description Latitude of the user making this request */
        // @ApiMember(DataType="double", Description="Latitude of the user making this request")
        /** @var float */
        public float $latitude=0.0,

        /** @description Longitude of the user making this request */
        // @ApiMember(DataType="double", Description="Longitude of the user making this request")
        /** @var float */
        public float $longitude=0.0
    ) {
    }

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

class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $heading=null,
        /** @var bool|null */
        public ?bool $wasSuccessful=null,
        /** @var Object|null */
        public ?Object $modelState=null
    ) {
    }

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

class GetSalesTargetInfoResponse extends ApiServiceResponse implements JsonSerializable
{
    /**
     * @param string|null $description
     * @param string|null $heading
     * @param bool|null $wasSuccessful
     * @param Object|null $modelState
     */
    public function __construct(
        ?string $description=null,
        ?string $heading=null,
        ?bool $wasSuccessful=null,
        ?Object $modelState=null,
        /** @var float */
        public float $totalMeetings=0.0,
        /** @var string|null */
        public ?string $averageTime=null,
        /** @var float */
        public float $averageQuality=0.0,
        /** @var float */
        public float $averageRating=0.0,
        /** @var int */
        public int $meetingsGoal=0,
        /** @var int */
        public int $averageQualityGoal=0,
        /** @var string|null */
        public ?string $averageTimeGoal=null,
        /** @var int */
        public int $averageRatingGoal=0
    ) {
        parent::__construct($description,$heading,$wasSuccessful,$modelState);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['totalMeetings'])) $this->totalMeetings = $o['totalMeetings'];
        if (isset($o['averageTime'])) $this->averageTime = $o['averageTime'];
        if (isset($o['averageQuality'])) $this->averageQuality = $o['averageQuality'];
        if (isset($o['averageRating'])) $this->averageRating = $o['averageRating'];
        if (isset($o['meetingsGoal'])) $this->meetingsGoal = $o['meetingsGoal'];
        if (isset($o['averageQualityGoal'])) $this->averageQualityGoal = $o['averageQualityGoal'];
        if (isset($o['averageTimeGoal'])) $this->averageTimeGoal = $o['averageTimeGoal'];
        if (isset($o['averageRatingGoal'])) $this->averageRatingGoal = $o['averageRatingGoal'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->totalMeetings)) $o['totalMeetings'] = $this->totalMeetings;
        if (isset($this->averageTime)) $o['averageTime'] = $this->averageTime;
        if (isset($this->averageQuality)) $o['averageQuality'] = $this->averageQuality;
        if (isset($this->averageRating)) $o['averageRating'] = $this->averageRating;
        if (isset($this->meetingsGoal)) $o['meetingsGoal'] = $this->meetingsGoal;
        if (isset($this->averageQualityGoal)) $o['averageQualityGoal'] = $this->averageQualityGoal;
        if (isset($this->averageTimeGoal)) $o['averageTimeGoal'] = $this->averageTimeGoal;
        if (isset($this->averageRatingGoal)) $o['averageRatingGoal'] = $this->averageRatingGoal;
        return empty($o) ? new class(){} : $o;
    }
}

class GetSalesTargetInfo extends ApiServiceRequest implements JsonSerializable
{
    /**
     * @param string $apiKey
     * @param float $latitude
     * @param float $longitude
     */
    public function __construct(
        string $apiKey='',
        float $latitude=0.0,
        float $longitude=0.0
    ) {
        parent::__construct($apiKey,$latitude,$longitude);
    }

    /** @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 GetSalesTargetInfo 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.

GET /dashboard/salestargetinfo HTTP/1.1 
Host: cochraneplus-api-dev.happen.zone 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetSalesTargetInfoResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WebService.ServiceModel">
  <Description xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base">String</Description>
  <Heading xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base">String</Heading>
  <ModelState xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base" />
  <WasSuccessful xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base">false</WasSuccessful>
  <AverageQuality>0</AverageQuality>
  <AverageQualityGoal>0</AverageQualityGoal>
  <AverageRating>0</AverageRating>
  <AverageRatingGoal>0</AverageRatingGoal>
  <AverageTime>String</AverageTime>
  <AverageTimeGoal>String</AverageTimeGoal>
  <MeetingsGoal>0</MeetingsGoal>
  <TotalMeetings>0</TotalMeetings>
</GetSalesTargetInfoResponse>