Trendsic Platform Service

<back to all web services

SurveyAdminRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/SurveyAdmin/GiftCard
<?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 SurveyResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ContactFullName=null,
        /** @var int */
        public int $SurveyId=0,
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $ContactName=null,
        /** @var int */
        public int $AgentId=0,
        /** @var string|null */
        public ?string $AgentName=null,
        /** @var string|null */
        public ?string $Response=null,
        /** @var string|null */
        public ?string $ResponseCode=null,
        /** @var DateTime */
        public DateTime $DateAnswered=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactFullName'])) $this->ContactFullName = $o['ContactFullName'];
        if (isset($o['SurveyId'])) $this->SurveyId = $o['SurveyId'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
        if (isset($o['Response'])) $this->Response = $o['Response'];
        if (isset($o['ResponseCode'])) $this->ResponseCode = $o['ResponseCode'];
        if (isset($o['DateAnswered'])) $this->DateAnswered = JsonConverters::from('DateTime', $o['DateAnswered']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactFullName)) $o['ContactFullName'] = $this->ContactFullName;
        if (isset($this->SurveyId)) $o['SurveyId'] = $this->SurveyId;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
        if (isset($this->Response)) $o['Response'] = $this->Response;
        if (isset($this->ResponseCode)) $o['ResponseCode'] = $this->ResponseCode;
        if (isset($this->DateAnswered)) $o['DateAnswered'] = JsonConverters::to('DateTime', $this->DateAnswered);
        return empty($o) ? new class(){} : $o;
    }
}

class SurveyAdminResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<SurveyResponse>|null */
        public ?array $Answers=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class SurveyAdminRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $SurveyId=0,
        /** @var array<SurveyResponse>|null */
        public ?array $Answers=null
    ) {
    }

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

PHP SurveyAdminRequest DTOs

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

HTTP + JSV

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

GET /v1/SurveyAdmin/GiftCard HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Answers: 
	[
		{
			ContactFullName: String,
			SurveyId: 0,
			ContactId: 0,
			ContactName: String,
			AgentId: 0,
			AgentName: String,
			Response: String,
			ResponseCode: String,
			DateAnswered: 0001-01-01
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}