Platform API

<back to all web services

GetPagedContactsInRole

Requires Authentication
The following routes are available for this service:
All Verbs/api/contacts/paged/{RoleId}
<?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 SortOrder : string
{
    case Ascending = 'Ascending';
    case Descending = 'Descending';
}

class PagedModel implements JsonSerializable
{
    public function __construct(
        /** @description Page Number to retrieve */
        // @ApiMember(DataType="int", Description="Page Number to retrieve", Name="PageNumber")
        /** @var int */
        public int $PageNumber=0,

        /** @description Number of records to retrieve */
        // @ApiMember(DataType="int", Description="Number of records to retrieve", Name="PageSize")
        /** @var int */
        public int $PageSize=0,

        /** @description Index of field to sort results by */
        // @ApiMember(DataType="int", Description="Index of field to sort results by", Name="SortIndex")
        /** @var int */
        public int $SortIndex=0,

        /** @description Sort Order - Ascending or Descending */
        // @ApiMember(DataType="int", Description="Sort Order - Ascending or Descending", Name="SortOrder")
        /** @var SortOrder|null */
        public ?SortOrder $SortOrder=null
    ) {
    }

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

class ContactSummaryModel implements JsonSerializable
{
    public function __construct(
        /** @description Contact linked to the profile */
        // @ApiMember(DataType="Guid", Description="Contact linked to the profile", Name="ContactId")
        /** @var string */
        public string $ContactId='',

        /** @description Full name of the contact linked to the profile */
        // @ApiMember(DataType="string", Description="Full name of the contact linked to the profile", Name="ContactFullName")
        /** @var string|null */
        public ?string $ContactFullName=null,

        /** @description Email Address of the contact linked to the profile */
        // @ApiMember(DataType="string", Description="Email Address of the contact linked to the profile", Name="EmailAddress")
        /** @var string|null */
        public ?string $EmailAddress=null,

        /** @description Mobile Number of the contact linked to the profile */
        // @ApiMember(DataType="string", Description="Mobile Number of the contact linked to the profile", Name="MobileNumber")
        /** @var string|null */
        public ?string $MobileNumber=null,

        /** @description Primary Phone Number of the contact linked to the profile */
        // @ApiMember(DataType="string", Description="Primary Phone Number of the contact linked to the profile", Name="PhoneNumber")
        /** @var string|null */
        public ?string $PhoneNumber=null,

        /** @description Type of contact (person, organisation etc.) linked to the profile */
        // @ApiMember(DataType="string", Description="Type of contact (person, organisation etc.) linked to the profile", Name="ContactTypeId")
        /** @var string */
        public string $ContactTypeId='',

        /** @description Profile photo of contact linked to the profile */
        // @ApiMember(DataType="string", Description="Profile photo of contact linked to the profile", Name="ProfilePhotoUrl")
        /** @var string|null */
        public ?string $ProfilePhotoUrl=null,

        /** @description Thumbnail photo of contact linked to the profile */
        // @ApiMember(DataType="string", Description="Thumbnail photo of contact linked to the profile", Name="ProfilePhotoThumbnailUrl")
        /** @var string|null */
        public ?string $ProfilePhotoThumbnailUrl=null,

        /** @description Profile description */
        // @ApiMember(DataType="string", Description="Profile description", Name="Description")
        /** @var string|null */
        public ?string $Description=null,

        /** @description Employment Industry */
        // @ApiMember(DataType="string", Description="Employment Industry", Name="EmploymentIndustry")
        /** @var string|null */
        public ?string $EmploymentIndustry=null,

        /** @description Employment Role */
        // @ApiMember(DataType="string", Description="Employment Role", Name="EmploymentRole")
        /** @var string|null */
        public ?string $EmploymentRole=null,

        /** @description Areas of Work */
        // @ApiMember(DataType="string", Description="Areas of Work", Name="EmploymentGeographicArea")
        /** @var string|null */
        public ?string $EmploymentGeographicArea=null,

        /** @description Timezone Name */
        // @ApiMember(DataType="string", Description="Timezone Name", Name="TimezoneName", ParameterType="query")
        /** @var string|null */
        public ?string $TimezoneName=null,

        /** @description The primary address of the contact */
        // @ApiMember(DataType="string", Description="The primary address of the contact", Name="PrimaryAddress", ParameterType="query")
        /** @var string|null */
        public ?string $PrimaryAddress=null,

        /** @description Have all connections to the contact been removed? */
        // @ApiMember(DataType="bool", Description="Have all connections to the contact been removed?", Name="IsRemovedContact")
        /** @var bool|null */
        public ?bool $IsRemovedContact=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['ContactFullName'])) $this->ContactFullName = $o['ContactFullName'];
        if (isset($o['EmailAddress'])) $this->EmailAddress = $o['EmailAddress'];
        if (isset($o['MobileNumber'])) $this->MobileNumber = $o['MobileNumber'];
        if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
        if (isset($o['ContactTypeId'])) $this->ContactTypeId = $o['ContactTypeId'];
        if (isset($o['ProfilePhotoUrl'])) $this->ProfilePhotoUrl = $o['ProfilePhotoUrl'];
        if (isset($o['ProfilePhotoThumbnailUrl'])) $this->ProfilePhotoThumbnailUrl = $o['ProfilePhotoThumbnailUrl'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['EmploymentIndustry'])) $this->EmploymentIndustry = $o['EmploymentIndustry'];
        if (isset($o['EmploymentRole'])) $this->EmploymentRole = $o['EmploymentRole'];
        if (isset($o['EmploymentGeographicArea'])) $this->EmploymentGeographicArea = $o['EmploymentGeographicArea'];
        if (isset($o['TimezoneName'])) $this->TimezoneName = $o['TimezoneName'];
        if (isset($o['PrimaryAddress'])) $this->PrimaryAddress = $o['PrimaryAddress'];
        if (isset($o['IsRemovedContact'])) $this->IsRemovedContact = $o['IsRemovedContact'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->ContactFullName)) $o['ContactFullName'] = $this->ContactFullName;
        if (isset($this->EmailAddress)) $o['EmailAddress'] = $this->EmailAddress;
        if (isset($this->MobileNumber)) $o['MobileNumber'] = $this->MobileNumber;
        if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
        if (isset($this->ContactTypeId)) $o['ContactTypeId'] = $this->ContactTypeId;
        if (isset($this->ProfilePhotoUrl)) $o['ProfilePhotoUrl'] = $this->ProfilePhotoUrl;
        if (isset($this->ProfilePhotoThumbnailUrl)) $o['ProfilePhotoThumbnailUrl'] = $this->ProfilePhotoThumbnailUrl;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->EmploymentIndustry)) $o['EmploymentIndustry'] = $this->EmploymentIndustry;
        if (isset($this->EmploymentRole)) $o['EmploymentRole'] = $this->EmploymentRole;
        if (isset($this->EmploymentGeographicArea)) $o['EmploymentGeographicArea'] = $this->EmploymentGeographicArea;
        if (isset($this->TimezoneName)) $o['TimezoneName'] = $this->TimezoneName;
        if (isset($this->PrimaryAddress)) $o['PrimaryAddress'] = $this->PrimaryAddress;
        if (isset($this->IsRemovedContact)) $o['IsRemovedContact'] = $this->IsRemovedContact;
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="Contacts connected to contact by criteria, returning minimal number of columns, and response status")
class GetSlimContactsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<ContactSummaryModel>|null */
        public ?array $Contacts=null,
        /** @var int */
        public int $TotalContacts=0,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class GetPagedContactsInRole extends PagedModel implements JsonSerializable
{
    /**
     * @param int $PageNumber
     * @param int $PageSize
     * @param int $SortIndex
     * @param SortOrder|null $SortOrder
     */
    public function __construct(
        int $PageNumber=0,
        int $PageSize=0,
        int $SortIndex=0,
        ?SortOrder $SortOrder=null,
        /** @description Get contacts connected to the current licensee in the specified role */
        // @ApiMember(Description="Get contacts connected to the current licensee in the specified role", Name="RoleId")
        /** @var string */
        public string $RoleId='',

        /** @description Get contacts of the specified type */
        // @ApiMember(Description="Get contacts of the specified type", Name="ContactTypes")
        /** @var array<string>|null */
        public ?array $ContactTypes=null,

        /** @description Contact statuses to search for, i.e. Real and/or Virtual */
        // @ApiMember(DataType="List<Guid>", Description="Contact statuses to search for, i.e. Real and/or Virtual", IsRequired=true, Name="Statuses")
        /** @var array<string>|null */
        public ?array $Statuses=null,

        /** @description Text to filter contacts on. searches for a contact with matches to the string. */
        // @ApiMember(DataType="string", Description="Text to filter contacts on. searches for a contact with matches to the string.", Name="SearchText")
        /** @var string|null */
        public ?string $SearchText=null,

        /** @description If you want just bare-bones contact info set this to false, if not specified it defaults to true. */
        // @ApiMember(DataType="bool?", Description="If you want just bare-bones contact info set this to false, if not specified it defaults to true.", Name="IncludeDetails")
        /** @var bool|null */
        public ?bool $IncludeDetails=null
    ) {
        parent::__construct($PageNumber,$PageSize,$SortIndex,$SortOrder);
    }

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

PHP GetPagedContactsInRole DTOs

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

HTTP + OTHER

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

POST /api/contacts/paged/{RoleId} HTTP/1.1 
Host: pfapi.pstpf.com.au 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"RoleId":"00000000-0000-0000-0000-000000000000","ContactTypes":["00000000-0000-0000-0000-000000000000"],"Statuses":["00000000-0000-0000-0000-000000000000"],"SearchText":"String","IncludeDetails":false,"PageNumber":0,"PageSize":0,"SortIndex":0,"SortOrder":"Ascending"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Contacts":[{"ContactId":"00000000-0000-0000-0000-000000000000","ContactFullName":"String","EmailAddress":"String","MobileNumber":"String","PhoneNumber":"String","ContactTypeId":"00000000-0000-0000-0000-000000000000","ProfilePhotoUrl":"String","ProfilePhotoThumbnailUrl":"String","Description":"String","EmploymentIndustry":"String","EmploymentRole":"String","EmploymentGeographicArea":"String","TimezoneName":"String","PrimaryAddress":"String","IsRemovedContact":false}],"TotalContacts":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}