| All Verbs | /api/roles/connection/{FromContactId} |
|---|
<?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 RoleModel implements JsonSerializable
{
public function __construct(
/** @description Role Id */
// @ApiMember(DataType="Guid", Description="Role Id", IsRequired=true, Name="RoleId")
/** @var string */
public string $RoleId='',
/** @description Role Name */
// @ApiMember(DataType="string", Description="Role Name", Name="RoleName")
/** @var string|null */
public ?string $RoleName=null,
/** @description Is the role a licensee role? */
// @ApiMember(DataType="bool", Description="Is the role a licensee role?", Name="IsLicensee")
/** @var bool|null */
public ?bool $IsLicenseeRole=null,
/** @description Is manage contacts role? */
// @ApiMember(DataType="bool", Description="Is manage contacts role?", Name="IsManageContacts")
/** @var bool|null */
public ?bool $IsManageContacts=null,
/** @description Is the role a Platform role? */
// @ApiMember(DataType="bool", Description="Is the role a Platform role?", Name="IsPlatformRole")
/** @var bool|null */
public ?bool $IsPlatformRole=null,
/** @description Is the role a services role? */
// @ApiMember(DataType="bool", Description="Is the role a services role?", Name="IsServiceRole")
/** @var bool|null */
public ?bool $IsServiceRole=null,
/** @description Is the role a customer role? */
// @ApiMember(DataType="bool", Description="Is the role a customer role?", Name="IsCustomerRole")
/** @var bool|null */
public ?bool $IsCustomerRole=null,
/** @description Is the role a functional role? */
// @ApiMember(DataType="bool", Description="Is the role a functional role?", Name="IsFunctionalRole")
/** @var bool|null */
public ?bool $IsFunctionalRole=null,
/** @description Is the role an auto-accept role? */
// @ApiMember(DataType="bool", Description="Is the role an auto-accept role?", Name="IsRequestAutoAccepted")
/** @var bool|null */
public ?bool $IsRequestAutoAccepted=null,
/** @description Suite that the role belongs to */
// @ApiMember(DataType="Guid", Description="Suite that the role belongs to", Name="SuiteId")
/** @var string */
public string $SuiteId='',
/** @description Suite that the role belongs to */
// @ApiMember(DataType="string", Description="Suite that the role belongs to", Name="SuiteName")
/** @var string|null */
public ?string $SuiteName=null,
/** @description 'A' (Active) or 'I' (Inactive) */
// @ApiMember(DataType="string", Description="'A' (Active) or 'I' (Inactive)", Name="RecordStatus")
/** @var string|null */
public ?string $RecordStatus=null,
/** @description Object Connection Id, which is populated when the roles are returned based on those that are connected to an object. */
// @ApiMember(DataType="Guid", Description="Object Connection Id, which is populated when the roles are returned based on those that are connected to an object.", Name="ObjectConnectionId")
/** @var string */
public string $ObjectConnectionId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['RoleId'])) $this->RoleId = $o['RoleId'];
if (isset($o['RoleName'])) $this->RoleName = $o['RoleName'];
if (isset($o['IsLicenseeRole'])) $this->IsLicenseeRole = $o['IsLicenseeRole'];
if (isset($o['IsManageContacts'])) $this->IsManageContacts = $o['IsManageContacts'];
if (isset($o['IsPlatformRole'])) $this->IsPlatformRole = $o['IsPlatformRole'];
if (isset($o['IsServiceRole'])) $this->IsServiceRole = $o['IsServiceRole'];
if (isset($o['IsCustomerRole'])) $this->IsCustomerRole = $o['IsCustomerRole'];
if (isset($o['IsFunctionalRole'])) $this->IsFunctionalRole = $o['IsFunctionalRole'];
if (isset($o['IsRequestAutoAccepted'])) $this->IsRequestAutoAccepted = $o['IsRequestAutoAccepted'];
if (isset($o['SuiteId'])) $this->SuiteId = $o['SuiteId'];
if (isset($o['SuiteName'])) $this->SuiteName = $o['SuiteName'];
if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
if (isset($o['ObjectConnectionId'])) $this->ObjectConnectionId = $o['ObjectConnectionId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->RoleId)) $o['RoleId'] = $this->RoleId;
if (isset($this->RoleName)) $o['RoleName'] = $this->RoleName;
if (isset($this->IsLicenseeRole)) $o['IsLicenseeRole'] = $this->IsLicenseeRole;
if (isset($this->IsManageContacts)) $o['IsManageContacts'] = $this->IsManageContacts;
if (isset($this->IsPlatformRole)) $o['IsPlatformRole'] = $this->IsPlatformRole;
if (isset($this->IsServiceRole)) $o['IsServiceRole'] = $this->IsServiceRole;
if (isset($this->IsCustomerRole)) $o['IsCustomerRole'] = $this->IsCustomerRole;
if (isset($this->IsFunctionalRole)) $o['IsFunctionalRole'] = $this->IsFunctionalRole;
if (isset($this->IsRequestAutoAccepted)) $o['IsRequestAutoAccepted'] = $this->IsRequestAutoAccepted;
if (isset($this->SuiteId)) $o['SuiteId'] = $this->SuiteId;
if (isset($this->SuiteName)) $o['SuiteName'] = $this->SuiteName;
if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
if (isset($this->ObjectConnectionId)) $o['ObjectConnectionId'] = $this->ObjectConnectionId;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="List of roles available for connection from the specified contact for specified contact types")
class GetRolesForConnectionResponse implements JsonSerializable
{
public function __construct(
/** @var array<RoleModel>|null */
public ?array $Roles=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Roles'])) $this->Roles = JsonConverters::fromArray('RoleModel', $o['Roles']);
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('RoleModel', $this->Roles);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Get roles for the specified contact */
// @Api(Description="Get roles for the specified contact")
class GetRolesForConnection implements JsonSerializable
{
public function __construct(
/** @description Get roles available for connection from this contact */
// @ApiMember(Description="Get roles available for connection from this contact", IsRequired=true, Name="FromContactId")
/** @var string */
public string $FromContactId='',
/** @description Get roles available for connection to this contact */
// @ApiMember(Description="Get roles available for connection to this contact", Name="ContactId")
/** @var string|null */
public ?string $ContactId=null,
/** @description Get roles available for connection for the specified contact type */
// @ApiMember(Description="Get roles available for connection for the specified contact type", IsRequired=true, Name="ContactTypeId")
/** @var string */
public string $ContactTypeId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['FromContactId'])) $this->FromContactId = $o['FromContactId'];
if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
if (isset($o['ContactTypeId'])) $this->ContactTypeId = $o['ContactTypeId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->FromContactId)) $o['FromContactId'] = $this->FromContactId;
if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
if (isset($this->ContactTypeId)) $o['ContactTypeId'] = $this->ContactTypeId;
return empty($o) ? new class(){} : $o;
}
}
PHP GetRolesForConnection DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/roles/connection/{FromContactId} HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetRolesForConnection xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Subtle.Canvara.WebAPIModel.ServiceModel">
<ContactId>00000000-0000-0000-0000-000000000000</ContactId>
<ContactTypeId>00000000-0000-0000-0000-000000000000</ContactTypeId>
<FromContactId>00000000-0000-0000-0000-000000000000</FromContactId>
</GetRolesForConnection>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetRolesForConnectionResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eros.Subtle.Canvara.WebAPIModel.ServiceModel">
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<Roles xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eros.Saguna.Common.WebAPIModel.Models">
<d2p1:RoleModel>
<d2p1:IsCustomerRole>false</d2p1:IsCustomerRole>
<d2p1:IsFunctionalRole>false</d2p1:IsFunctionalRole>
<d2p1:IsLicenseeRole>false</d2p1:IsLicenseeRole>
<d2p1:IsManageContacts>false</d2p1:IsManageContacts>
<d2p1:IsPlatformRole>false</d2p1:IsPlatformRole>
<d2p1:IsRequestAutoAccepted>false</d2p1:IsRequestAutoAccepted>
<d2p1:IsServiceRole>false</d2p1:IsServiceRole>
<d2p1:ObjectConnectionId>00000000-0000-0000-0000-000000000000</d2p1:ObjectConnectionId>
<d2p1:RecordStatus>String</d2p1:RecordStatus>
<d2p1:RoleId>00000000-0000-0000-0000-000000000000</d2p1:RoleId>
<d2p1:RoleName>String</d2p1:RoleName>
<d2p1:SuiteId>00000000-0000-0000-0000-000000000000</d2p1:SuiteId>
<d2p1:SuiteName>String</d2p1:SuiteName>
</d2p1:RoleModel>
</Roles>
</GetRolesForConnectionResponse>