Required role: | User |
GET | /app/contacts |
---|
<?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 AppContactTypes : string
{
case User = 'User';
case Team = 'Team';
case Contact = 'Contact';
}
class AppContact implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $displayName=null,
/** @var string|null */
public ?string $address=null,
/** @var AppContactTypes|null */
public ?AppContactTypes $type=null,
/** @var string|null */
public ?string $customerName=null,
/** @var bool|null */
public ?bool $canCall=null,
/** @var bool|null */
public ?bool $canChat=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['displayName'])) $this->displayName = $o['displayName'];
if (isset($o['address'])) $this->address = $o['address'];
if (isset($o['type'])) $this->type = JsonConverters::from('AppContactTypes', $o['type']);
if (isset($o['customerName'])) $this->customerName = $o['customerName'];
if (isset($o['canCall'])) $this->canCall = $o['canCall'];
if (isset($o['canChat'])) $this->canChat = $o['canChat'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->displayName)) $o['displayName'] = $this->displayName;
if (isset($this->address)) $o['address'] = $this->address;
if (isset($this->type)) $o['type'] = JsonConverters::to('AppContactTypes', $this->type);
if (isset($this->customerName)) $o['customerName'] = $this->customerName;
if (isset($this->canCall)) $o['canCall'] = $this->canCall;
if (isset($this->canChat)) $o['canChat'] = $this->canChat;
return empty($o) ? new class(){} : $o;
}
}
class GetMyContactsResponse implements JsonSerializable
{
public function __construct(
/** @var array<AppContact>|null */
public ?array $contacts=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['contacts'])) $this->contacts = JsonConverters::fromArray('AppContact', $o['contacts']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->contacts)) $o['contacts'] = JsonConverters::toArray('AppContact', $this->contacts);
return empty($o) ? new class(){} : $o;
}
}
/** @description Gets the contacts associated with the authenticated user */
// @Api(Description="Gets the contacts associated with the authenticated user")
class GetMyContacts implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /app/contacts HTTP/1.1 Host: team.evovoice.io Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"contacts":[{"displayName":"String","address":"String","type":"User","customerName":"String","canCall":false,"canChat":false}]}