| All Verbs | /api/contacts/{ContactId}/links |
|---|
<?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 UserRoleModel implements JsonSerializable
{
public function __construct(
/** @description The Contact Role Id, that links the Contact to their role. */
// @ApiMember(DataType="Guid", Description="The Contact Role Id, that links the Contact to their role.", Name="ContactRoleId", ParameterType="query")
/** @var string */
public string $ContactRoleId='',
/** @description The Role Id. */
// @ApiMember(DataType="Guid", Description="The Role Id.", Name="RoleId", ParameterType="query")
/** @var string */
public string $RoleId='',
/** @description The role name. */
// @ApiMember(DataType="string", Description="The role name.", Name="RoleName", ParameterType="query")
/** @var string|null */
public ?string $RoleName=null,
/** @description The URL of the role's image icon. */
// @ApiMember(DataType="string", Description="The URL of the role's image icon.", Name="RolePrimaryImageURL", ParameterType="query")
/** @var string|null */
public ?string $RolePrimaryImageURL=null,
/** @description The URL of the role's thumbnail image icon. */
// @ApiMember(DataType="string", Description="The URL of the role's thumbnail image icon.", Name="RolePrimaryImageThumbnailURL", ParameterType="query")
/** @var string|null */
public ?string $RolePrimaryImageThumbnailURL=null,
/** @description The Guid of the role's media file containing the image icon details. */
// @ApiMember(DataType="string", Description="The Guid of the role's media file containing the image icon details.", Name="RolePrimaryImageId", ParameterType="query")
/** @var string */
public string $RolePrimaryImageId='',
/** @description The date the contact started having this role. */
// @ApiMember(DataType="DateTime", Description="The date the contact started having this role.", Name="StartDate", ParameterType="query")
/** @var DateTime */
public DateTime $StartDate=new DateTime(),
/** @description The date the contact will end having this role. */
// @ApiMember(DataType="DateTime?", Description="The date the contact will end having this role.", Name="EndDate", ParameterType="query")
/** @var DateTime|null */
public ?DateTime $EndDate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactRoleId'])) $this->ContactRoleId = $o['ContactRoleId'];
if (isset($o['RoleId'])) $this->RoleId = $o['RoleId'];
if (isset($o['RoleName'])) $this->RoleName = $o['RoleName'];
if (isset($o['RolePrimaryImageURL'])) $this->RolePrimaryImageURL = $o['RolePrimaryImageURL'];
if (isset($o['RolePrimaryImageThumbnailURL'])) $this->RolePrimaryImageThumbnailURL = $o['RolePrimaryImageThumbnailURL'];
if (isset($o['RolePrimaryImageId'])) $this->RolePrimaryImageId = $o['RolePrimaryImageId'];
if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
if (isset($o['EndDate'])) $this->EndDate = JsonConverters::from('DateTime', $o['EndDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactRoleId)) $o['ContactRoleId'] = $this->ContactRoleId;
if (isset($this->RoleId)) $o['RoleId'] = $this->RoleId;
if (isset($this->RoleName)) $o['RoleName'] = $this->RoleName;
if (isset($this->RolePrimaryImageURL)) $o['RolePrimaryImageURL'] = $this->RolePrimaryImageURL;
if (isset($this->RolePrimaryImageThumbnailURL)) $o['RolePrimaryImageThumbnailURL'] = $this->RolePrimaryImageThumbnailURL;
if (isset($this->RolePrimaryImageId)) $o['RolePrimaryImageId'] = $this->RolePrimaryImageId;
if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
if (isset($this->EndDate)) $o['EndDate'] = JsonConverters::to('DateTime', $this->EndDate);
return empty($o) ? new class(){} : $o;
}
}
class UserContactConnectionModel implements JsonSerializable
{
public function __construct(
/** @description The Contact Role Id, that links the Contact to their role. */
// @ApiMember(DataType="Guid", Description="The Contact Role Id, that links the Contact to their role.", Name="ContactRoleId", ParameterType="query")
/** @var string */
public string $ContactRoleId='',
/** @description The role name. */
// @ApiMember(DataType="string", Description="The role name.", Name="ContactRoleName", ParameterType="query")
/** @var string|null */
public ?string $ContactRoleName=null,
/** @description The list item role Id. */
// @ApiMember(DataType="Guid", Description="The list item role Id.", Name="ContactListItemRoleId", ParameterType="query")
/** @var string */
public string $ContactListItemRoleId='',
/** @description The URL of the contact role's image icon. */
// @ApiMember(DataType="string", Description="The URL of the contact role's image icon.", Name="ContactRolePrimaryImageURL", ParameterType="query")
/** @var string|null */
public ?string $ContactRolePrimaryImageURL=null,
/** @description The URL of the contact role's thumbnail image icon. */
// @ApiMember(DataType="string", Description="The URL of the contact role's thumbnail image icon.", Name="ContactRolePrimaryImageThumbnailURL", ParameterType="query")
/** @var string|null */
public ?string $ContactRolePrimaryImageThumbnailURL=null,
/** @description The Guid of the contact role's media file containing the image icon details. */
// @ApiMember(DataType="string", Description="The Guid of the contact role's media file containing the image icon details.", Name="ContactRolePrimaryImageId", ParameterType="query")
/** @var string */
public string $ContactRolePrimaryImageId='',
/** @description The connected contacts Id. (licensee) */
// @ApiMember(DataType="string", Description="The connected contacts Id. (licensee)", Name="ConnectionContactId", ParameterType="query")
/** @var string */
public string $ConnectionContactId='',
/** @description The connected contacts Full Name. */
// @ApiMember(DataType="string", Description="The connected contacts Full Name.", Name="ConnectionContactName", ParameterType="query")
/** @var string|null */
public ?string $ConnectionContactName=null,
/** @description The connected contacts role. */
// @ApiMember(DataType="string", Description="The connected contacts role.", Name="ConnectionContactRoleName", ParameterType="query")
/** @var string|null */
public ?string $ConnectionContactRoleName=null,
/** @description The connected contacts role Id. */
// @ApiMember(DataType="Guid", Description="The connected contacts role Id.", Name="ConnectionContactRoleId", ParameterType="query")
/** @var string */
public string $ConnectionContactRoleId='',
/** @description The connected contacts list item role Id. */
// @ApiMember(DataType="Guid", Description="The connected contacts list item role Id.", Name="ConnectionContactListItemRoleId", ParameterType="query")
/** @var string */
public string $ConnectionContactListItemRoleId='',
/** @description The Contacts Type. */
// @ApiMember(DataType="string", Description="The Contacts Type.", Name="ContactTypeName", ParameterType="query")
/** @var string|null */
public ?string $ContactTypeName=null,
/** @description The URL to the Connected Contacts Photo. */
// @ApiMember(DataType="string", Description="The URL to the Connected Contacts Photo.", Name="ConnectionContactPhotoURL", ParameterType="query")
/** @var string|null */
public ?string $ConnectionContactPhotoURL=null,
/** @description . */
// @ApiMember(DataType="bool", Description=".", Name="IsContactLicenseeRole", ParameterType="query")
/** @var bool|null */
public ?bool $IsContactLicenseeRole=null,
/** @description If the connection is as a licensee this is true. */
// @ApiMember(DataType="bool", Description="If the connection is as a licensee this is true.", Name="IsConnectionLicenseeRole", ParameterType="query")
/** @var bool|null */
public ?bool $IsConnectionLicenseeRole=null,
/** @description The status of the connection with the contact. */
// @ApiMember(DataType="string", Description="The status of the connection with the contact.", Name="ConnectionStatusName", ParameterType="query")
/** @var string|null */
public ?string $ConnectionStatusName=null,
/** @description The status Id of the connection with the contact. */
// @ApiMember(DataType="Guid", Description="The status Id of the connection with the contact.", Name="ConnectionStatusId", ParameterType="query")
/** @var string */
public string $ConnectionStatusId='',
/** @description The ContactRoleConnectionId of an active connection with the contact. */
// @ApiMember(DataType="Guid", Description="The ContactRoleConnectionId of an active connection with the contact.", Name="ConnectionId", ParameterType="query")
/** @var string */
public string $ConnectionId='',
/** @description The ContactRoleConnectionRequest of a pending connection with the contact. */
// @ApiMember(DataType="Guid", Description="The ContactRoleConnectionRequest of a pending connection with the contact.", Name="ConnectionRequestId", ParameterType="query")
/** @var string */
public string $ConnectionRequestId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactRoleId'])) $this->ContactRoleId = $o['ContactRoleId'];
if (isset($o['ContactRoleName'])) $this->ContactRoleName = $o['ContactRoleName'];
if (isset($o['ContactListItemRoleId'])) $this->ContactListItemRoleId = $o['ContactListItemRoleId'];
if (isset($o['ContactRolePrimaryImageURL'])) $this->ContactRolePrimaryImageURL = $o['ContactRolePrimaryImageURL'];
if (isset($o['ContactRolePrimaryImageThumbnailURL'])) $this->ContactRolePrimaryImageThumbnailURL = $o['ContactRolePrimaryImageThumbnailURL'];
if (isset($o['ContactRolePrimaryImageId'])) $this->ContactRolePrimaryImageId = $o['ContactRolePrimaryImageId'];
if (isset($o['ConnectionContactId'])) $this->ConnectionContactId = $o['ConnectionContactId'];
if (isset($o['ConnectionContactName'])) $this->ConnectionContactName = $o['ConnectionContactName'];
if (isset($o['ConnectionContactRoleName'])) $this->ConnectionContactRoleName = $o['ConnectionContactRoleName'];
if (isset($o['ConnectionContactRoleId'])) $this->ConnectionContactRoleId = $o['ConnectionContactRoleId'];
if (isset($o['ConnectionContactListItemRoleId'])) $this->ConnectionContactListItemRoleId = $o['ConnectionContactListItemRoleId'];
if (isset($o['ContactTypeName'])) $this->ContactTypeName = $o['ContactTypeName'];
if (isset($o['ConnectionContactPhotoURL'])) $this->ConnectionContactPhotoURL = $o['ConnectionContactPhotoURL'];
if (isset($o['IsContactLicenseeRole'])) $this->IsContactLicenseeRole = $o['IsContactLicenseeRole'];
if (isset($o['IsConnectionLicenseeRole'])) $this->IsConnectionLicenseeRole = $o['IsConnectionLicenseeRole'];
if (isset($o['ConnectionStatusName'])) $this->ConnectionStatusName = $o['ConnectionStatusName'];
if (isset($o['ConnectionStatusId'])) $this->ConnectionStatusId = $o['ConnectionStatusId'];
if (isset($o['ConnectionId'])) $this->ConnectionId = $o['ConnectionId'];
if (isset($o['ConnectionRequestId'])) $this->ConnectionRequestId = $o['ConnectionRequestId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactRoleId)) $o['ContactRoleId'] = $this->ContactRoleId;
if (isset($this->ContactRoleName)) $o['ContactRoleName'] = $this->ContactRoleName;
if (isset($this->ContactListItemRoleId)) $o['ContactListItemRoleId'] = $this->ContactListItemRoleId;
if (isset($this->ContactRolePrimaryImageURL)) $o['ContactRolePrimaryImageURL'] = $this->ContactRolePrimaryImageURL;
if (isset($this->ContactRolePrimaryImageThumbnailURL)) $o['ContactRolePrimaryImageThumbnailURL'] = $this->ContactRolePrimaryImageThumbnailURL;
if (isset($this->ContactRolePrimaryImageId)) $o['ContactRolePrimaryImageId'] = $this->ContactRolePrimaryImageId;
if (isset($this->ConnectionContactId)) $o['ConnectionContactId'] = $this->ConnectionContactId;
if (isset($this->ConnectionContactName)) $o['ConnectionContactName'] = $this->ConnectionContactName;
if (isset($this->ConnectionContactRoleName)) $o['ConnectionContactRoleName'] = $this->ConnectionContactRoleName;
if (isset($this->ConnectionContactRoleId)) $o['ConnectionContactRoleId'] = $this->ConnectionContactRoleId;
if (isset($this->ConnectionContactListItemRoleId)) $o['ConnectionContactListItemRoleId'] = $this->ConnectionContactListItemRoleId;
if (isset($this->ContactTypeName)) $o['ContactTypeName'] = $this->ContactTypeName;
if (isset($this->ConnectionContactPhotoURL)) $o['ConnectionContactPhotoURL'] = $this->ConnectionContactPhotoURL;
if (isset($this->IsContactLicenseeRole)) $o['IsContactLicenseeRole'] = $this->IsContactLicenseeRole;
if (isset($this->IsConnectionLicenseeRole)) $o['IsConnectionLicenseeRole'] = $this->IsConnectionLicenseeRole;
if (isset($this->ConnectionStatusName)) $o['ConnectionStatusName'] = $this->ConnectionStatusName;
if (isset($this->ConnectionStatusId)) $o['ConnectionStatusId'] = $this->ConnectionStatusId;
if (isset($this->ConnectionId)) $o['ConnectionId'] = $this->ConnectionId;
if (isset($this->ConnectionRequestId)) $o['ConnectionRequestId'] = $this->ConnectionRequestId;
return empty($o) ? new class(){} : $o;
}
}
class ContactEmailAddress implements JsonSerializable
{
public function __construct(
/** @description The Contact Id of the contact. */
// @ApiMember(DataType="Guid", Description="The Contact Id of the contact.", Name="ContactId", ParameterType="query")
/** @var string */
public string $ContactId='',
/** @description The Contact Full Name */
// @ApiMember(DataType="string", Description="The Contact Full Name", Name="ContactName", ParameterType="query")
/** @var string|null */
public ?string $ContactName=null,
/** @description The Contact Email Address. */
// @ApiMember(DataType="string", Description="The Contact Email Address.", Name="EmailAddress", ParameterType="query")
/** @var string|null */
public ?string $EmailAddress=null,
/** @description The Contact Photo URL */
// @ApiMember(DataType="string", Description="The Contact Photo URL", Name="ContactPhotoURL", ParameterType="query")
/** @var string|null */
public ?string $ContactPhotoURL=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
if (isset($o['EmailAddress'])) $this->EmailAddress = $o['EmailAddress'];
if (isset($o['ContactPhotoURL'])) $this->ContactPhotoURL = $o['ContactPhotoURL'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
if (isset($this->EmailAddress)) $o['EmailAddress'] = $this->EmailAddress;
if (isset($this->ContactPhotoURL)) $o['ContactPhotoURL'] = $this->ContactPhotoURL;
return empty($o) ? new class(){} : $o;
}
}
class ContactConnectedLinksResponse implements JsonSerializable
{
public function __construct(
/** @description A list of roles assigned to the contact/user. */
// @ApiMember(DataType="List<UserRoleModel>", Description="A list of roles assigned to the contact/user.", Name="Roles", ParameterType="query")
/** @var array<UserRoleModel>|null */
public ?array $Roles=null,
/** @description A list of contact connections assigned to the contact/user. */
// @ApiMember(DataType="List<UserContactConnectionModel>", Description="A list of contact connections assigned to the contact/user.", Name="ContactConnections", ParameterType="query")
/** @var array<UserContactConnectionModel>|null */
public ?array $ContactConnections=null,
/** @description A list of connected contacts and their email addresses. */
// @ApiMember(DataType="List<ContactEmailAddressBook>", Description="A list of connected contacts and their email addresses.", Name="EmailAddressBook", ParameterType="query")
/** @var array<ContactEmailAddress>|null */
public ?array $EmailAddressBook=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Roles'])) $this->Roles = JsonConverters::fromArray('UserRoleModel', $o['Roles']);
if (isset($o['ContactConnections'])) $this->ContactConnections = JsonConverters::fromArray('UserContactConnectionModel', $o['ContactConnections']);
if (isset($o['EmailAddressBook'])) $this->EmailAddressBook = JsonConverters::fromArray('ContactEmailAddress', $o['EmailAddressBook']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Roles)) $o['Roles'] = JsonConverters::toArray('UserRoleModel', $this->Roles);
if (isset($this->ContactConnections)) $o['ContactConnections'] = JsonConverters::toArray('UserContactConnectionModel', $this->ContactConnections);
if (isset($this->EmailAddressBook)) $o['EmailAddressBook'] = JsonConverters::toArray('ContactEmailAddress', $this->EmailAddressBook);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Retrieve links to a contact (connections/roles/emailAddressBook */
// @Api(Description="Retrieve links to a contact (connections/roles/emailAddressBook")
class ContactConnectedLinks implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ContactId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
return empty($o) ? new class(){} : $o;
}
}
PHP ContactConnectedLinks DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/contacts/{ContactId}/links HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Roles:
[
{
RoleName: String,
RolePrimaryImageURL: String,
RolePrimaryImageThumbnailURL: String,
StartDate: 0001-01-01,
EndDate: 0001-01-01
}
],
ContactConnections:
[
{
ContactRoleName: String,
ContactRolePrimaryImageURL: String,
ContactRolePrimaryImageThumbnailURL: String,
ConnectionContactName: String,
ConnectionContactRoleName: String,
ContactTypeName: String,
ConnectionContactPhotoURL: String,
IsContactLicenseeRole: False,
IsConnectionLicenseeRole: False,
ConnectionStatusName: String
}
],
EmailAddressBook:
[
{
ContactName: String,
EmailAddress: String,
ContactPhotoURL: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}