Trendsic Platform Service

<back to all web services

FormListRequest

Requires Authentication
The following routes are available for this service:
GET/v1/forms
<?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 FormStats implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Total=0,
        /** @var int */
        public int $NeedDecision=0,
        /** @var int */
        public int $Waiting=0,
        /** @var int */
        public int $Overdue=0
    ) {
    }

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

class FormCard implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $FormUID='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Slug=null,
        /** @var string|null */
        public ?string $Noun=null,
        /** @var string|null */
        public ?string $NumberPrefix=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $Tone=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var int|null */
        public ?int $PublishedVersionNo=null,
        /** @var DateTime|null */
        public ?DateTime $PublishedAt=null,
        /** @var string|null */
        public ?string $PublishedBy=null,
        /** @var bool|null */
        public ?bool $DraftDirty=null,
        /** @var DateTime|null */
        public ?DateTime $DraftUpdatedAt=null,
        /** @var string|null */
        public ?string $DraftUpdatedBy=null,
        /** @var string|null */
        public ?string $PackLabel=null,
        /** @var string|null */
        public ?string $SettingsJson=null,
        /** @var FormStats|null */
        public ?FormStats $Stats=null,
        /** @var array<string>|null */
        public ?array $Offered=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['FormUID'])) $this->FormUID = $o['FormUID'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Slug'])) $this->Slug = $o['Slug'];
        if (isset($o['Noun'])) $this->Noun = $o['Noun'];
        if (isset($o['NumberPrefix'])) $this->NumberPrefix = $o['NumberPrefix'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Tone'])) $this->Tone = $o['Tone'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['PublishedVersionNo'])) $this->PublishedVersionNo = $o['PublishedVersionNo'];
        if (isset($o['PublishedAt'])) $this->PublishedAt = JsonConverters::from('DateTime', $o['PublishedAt']);
        if (isset($o['PublishedBy'])) $this->PublishedBy = $o['PublishedBy'];
        if (isset($o['DraftDirty'])) $this->DraftDirty = $o['DraftDirty'];
        if (isset($o['DraftUpdatedAt'])) $this->DraftUpdatedAt = JsonConverters::from('DateTime', $o['DraftUpdatedAt']);
        if (isset($o['DraftUpdatedBy'])) $this->DraftUpdatedBy = $o['DraftUpdatedBy'];
        if (isset($o['PackLabel'])) $this->PackLabel = $o['PackLabel'];
        if (isset($o['SettingsJson'])) $this->SettingsJson = $o['SettingsJson'];
        if (isset($o['Stats'])) $this->Stats = JsonConverters::from('FormStats', $o['Stats']);
        if (isset($o['Offered'])) $this->Offered = JsonConverters::fromArray('string', $o['Offered']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->FormUID)) $o['FormUID'] = $this->FormUID;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Slug)) $o['Slug'] = $this->Slug;
        if (isset($this->Noun)) $o['Noun'] = $this->Noun;
        if (isset($this->NumberPrefix)) $o['NumberPrefix'] = $this->NumberPrefix;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Tone)) $o['Tone'] = $this->Tone;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->PublishedVersionNo)) $o['PublishedVersionNo'] = $this->PublishedVersionNo;
        if (isset($this->PublishedAt)) $o['PublishedAt'] = JsonConverters::to('DateTime', $this->PublishedAt);
        if (isset($this->PublishedBy)) $o['PublishedBy'] = $this->PublishedBy;
        if (isset($this->DraftDirty)) $o['DraftDirty'] = $this->DraftDirty;
        if (isset($this->DraftUpdatedAt)) $o['DraftUpdatedAt'] = JsonConverters::to('DateTime', $this->DraftUpdatedAt);
        if (isset($this->DraftUpdatedBy)) $o['DraftUpdatedBy'] = $this->DraftUpdatedBy;
        if (isset($this->PackLabel)) $o['PackLabel'] = $this->PackLabel;
        if (isset($this->SettingsJson)) $o['SettingsJson'] = $this->SettingsJson;
        if (isset($this->Stats)) $o['Stats'] = JsonConverters::to('FormStats', $this->Stats);
        if (isset($this->Offered)) $o['Offered'] = JsonConverters::toArray('string', $this->Offered);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class FormListRequest implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP FormListRequest 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/forms HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Forms: 
	[
		{
			FormUID: 00000000000000000000000000000000,
			Name: String,
			Slug: String,
			Noun: String,
			NumberPrefix: String,
			Description: String,
			Tone: String,
			Status: String,
			PublishedVersionNo: 0,
			PublishedAt: 0001-01-01,
			PublishedBy: String,
			DraftDirty: False,
			DraftUpdatedAt: 0001-01-01,
			DraftUpdatedBy: String,
			PackLabel: String,
			SettingsJson: String,
			Stats: 
			{
				Total: 0,
				NeedDecision: 0,
				Waiting: 0,
				Overdue: 0
			},
			Offered: 
			[
				String
			],
			CreatedBy: String,
			CreatedAt: 0001-01-01,
			UpdatedAt: 0001-01-01
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}