Required role: | SystemAdministrator |
PATCH | /accounts/{accountId} |
---|
<?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 EntityInfo implements JsonSerializable
{
public function __construct(
/** @description The ID of the object */
// @ApiMember(Description="The ID of the object")
/** @var string|null */
public ?string $id=null,
/** @description The date the object was created */
// @ApiMember(Description="The date the object was created")
/** @var string|null */
public ?string $dateCreated=null,
/** @description The date the object was last modified */
// @ApiMember(Description="The date the object was last modified")
/** @var string|null */
public ?string $dateLastModified=null,
/** @description The user that created this object */
// @ApiMember(Description="The user that created this object")
/** @var string|null */
public ?string $createdBy=null,
/** @description The user that last modified this object */
// @ApiMember(Description="The user that last modified this object")
/** @var string|null */
public ?string $lastModifiedBy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['dateCreated'])) $this->dateCreated = $o['dateCreated'];
if (isset($o['dateLastModified'])) $this->dateLastModified = $o['dateLastModified'];
if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
if (isset($o['lastModifiedBy'])) $this->lastModifiedBy = $o['lastModifiedBy'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->dateCreated)) $o['dateCreated'] = $this->dateCreated;
if (isset($this->dateLastModified)) $o['dateLastModified'] = $this->dateLastModified;
if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
if (isset($this->lastModifiedBy)) $o['lastModifiedBy'] = $this->lastModifiedBy;
return empty($o) ? new class(){} : $o;
}
}
class BillingItem implements JsonSerializable
{
public function __construct(
/** @var float */
public float $baseCost=0.0,
/** @var float */
public float $rawUnitMultiplier=0.0,
/** @var float */
public float $unitCost=0.0,
/** @var int */
public int $allowance=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['baseCost'])) $this->baseCost = $o['baseCost'];
if (isset($o['rawUnitMultiplier'])) $this->rawUnitMultiplier = $o['rawUnitMultiplier'];
if (isset($o['unitCost'])) $this->unitCost = $o['unitCost'];
if (isset($o['allowance'])) $this->allowance = $o['allowance'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->baseCost)) $o['baseCost'] = $this->baseCost;
if (isset($this->rawUnitMultiplier)) $o['rawUnitMultiplier'] = $this->rawUnitMultiplier;
if (isset($this->unitCost)) $o['unitCost'] = $this->unitCost;
if (isset($this->allowance)) $o['allowance'] = $this->allowance;
return empty($o) ? new class(){} : $o;
}
}
class BillingSettings implements JsonSerializable
{
public function __construct(
/** @var BillingItem|null */
public ?BillingItem $base=null,
/** @var BillingItem|null */
public ?BillingItem $localNumbers=null,
/** @var BillingItem|null */
public ?BillingItem $tollFreeNumbers=null,
/** @var BillingItem|null */
public ?BillingItem $inboundVoiceCalls=null,
/** @var BillingItem|null */
public ?BillingItem $outboundVoiceCalls=null,
/** @var BillingItem|null */
public ?BillingItem $inboundFaxes=null,
/** @var BillingItem|null */
public ?BillingItem $outboundFaxes=null,
/** @var BillingItem|null */
public ?BillingItem $inboundSmsMessages=null,
/** @var BillingItem|null */
public ?BillingItem $outboundSmsMessages=null,
/** @var BillingItem|null */
public ?BillingItem $aiInsights=null,
/** @var BillingItem|null */
public ?BillingItem $aiLiveMinutes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['base'])) $this->base = JsonConverters::from('BillingItem', $o['base']);
if (isset($o['localNumbers'])) $this->localNumbers = JsonConverters::from('BillingItem', $o['localNumbers']);
if (isset($o['tollFreeNumbers'])) $this->tollFreeNumbers = JsonConverters::from('BillingItem', $o['tollFreeNumbers']);
if (isset($o['inboundVoiceCalls'])) $this->inboundVoiceCalls = JsonConverters::from('BillingItem', $o['inboundVoiceCalls']);
if (isset($o['outboundVoiceCalls'])) $this->outboundVoiceCalls = JsonConverters::from('BillingItem', $o['outboundVoiceCalls']);
if (isset($o['inboundFaxes'])) $this->inboundFaxes = JsonConverters::from('BillingItem', $o['inboundFaxes']);
if (isset($o['outboundFaxes'])) $this->outboundFaxes = JsonConverters::from('BillingItem', $o['outboundFaxes']);
if (isset($o['inboundSmsMessages'])) $this->inboundSmsMessages = JsonConverters::from('BillingItem', $o['inboundSmsMessages']);
if (isset($o['outboundSmsMessages'])) $this->outboundSmsMessages = JsonConverters::from('BillingItem', $o['outboundSmsMessages']);
if (isset($o['aiInsights'])) $this->aiInsights = JsonConverters::from('BillingItem', $o['aiInsights']);
if (isset($o['aiLiveMinutes'])) $this->aiLiveMinutes = JsonConverters::from('BillingItem', $o['aiLiveMinutes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->base)) $o['base'] = JsonConverters::to('BillingItem', $this->base);
if (isset($this->localNumbers)) $o['localNumbers'] = JsonConverters::to('BillingItem', $this->localNumbers);
if (isset($this->tollFreeNumbers)) $o['tollFreeNumbers'] = JsonConverters::to('BillingItem', $this->tollFreeNumbers);
if (isset($this->inboundVoiceCalls)) $o['inboundVoiceCalls'] = JsonConverters::to('BillingItem', $this->inboundVoiceCalls);
if (isset($this->outboundVoiceCalls)) $o['outboundVoiceCalls'] = JsonConverters::to('BillingItem', $this->outboundVoiceCalls);
if (isset($this->inboundFaxes)) $o['inboundFaxes'] = JsonConverters::to('BillingItem', $this->inboundFaxes);
if (isset($this->outboundFaxes)) $o['outboundFaxes'] = JsonConverters::to('BillingItem', $this->outboundFaxes);
if (isset($this->inboundSmsMessages)) $o['inboundSmsMessages'] = JsonConverters::to('BillingItem', $this->inboundSmsMessages);
if (isset($this->outboundSmsMessages)) $o['outboundSmsMessages'] = JsonConverters::to('BillingItem', $this->outboundSmsMessages);
if (isset($this->aiInsights)) $o['aiInsights'] = JsonConverters::to('BillingItem', $this->aiInsights);
if (isset($this->aiLiveMinutes)) $o['aiLiveMinutes'] = JsonConverters::to('BillingItem', $this->aiLiveMinutes);
return empty($o) ? new class(){} : $o;
}
}
class AccountInfo extends EntityInfo implements JsonSerializable
{
/**
* @param string|null $id
* @param string|null $dateCreated
* @param string|null $dateLastModified
* @param string|null $createdBy
* @param string|null $lastModifiedBy
*/
public function __construct(
?string $id=null,
?string $dateCreated=null,
?string $dateLastModified=null,
?string $createdBy=null,
?string $lastModifiedBy=null,
/** @description The name of this account */
// @ApiMember(Description="The name of this account")
/** @var string|null */
public ?string $name=null,
/** @description The ID of this account's parent */
// @ApiMember(Description="The ID of this account's parent")
/** @var string|null */
public ?string $parentAccountId=null,
/** @description The twilio account SID */
// @ApiMember(Description="The twilio account SID")
/** @var string|null */
public ?string $twilioAccountSid=null,
/** @description The ancestors of this account. Useful for breadcrumbs */
// @ApiMember(Description="The ancestors of this account. Useful for breadcrumbs")
/** @var array<string>|null */
public ?array $ancestorIds=null,
/** @description The max number of phone numbers this account can have */
// @ApiMember(Description="The max number of phone numbers this account can have")
/** @var int */
public int $maxPhoneNumbers=0,
/** @description This account is BYOA */
// @ApiMember(Description="This account is BYOA")
/** @var bool|null */
public ?bool $isBYOA=null,
/** @description TrustHub Profile Sid */
// @ApiMember(Description="TrustHub Profile Sid")
/** @var string|null */
public ?string $trustHubProfileSid=null,
/** @description The ID of the logo file */
// @ApiMember(Description="The ID of the logo file")
/** @var string|null */
public ?string $logoId=null,
/** @description The URI of the logo file */
// @ApiMember(Description="The URI of the logo file")
/** @var string|null */
public ?string $logoUri=null,
/** @description The billing settings for this account */
// @ApiMember(Description="The billing settings for this account")
/** @var BillingSettings|null */
public ?BillingSettings $billingSettings=null
) {
parent::__construct($id,$dateCreated,$dateLastModified,$createdBy,$lastModifiedBy);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['parentAccountId'])) $this->parentAccountId = $o['parentAccountId'];
if (isset($o['twilioAccountSid'])) $this->twilioAccountSid = $o['twilioAccountSid'];
if (isset($o['ancestorIds'])) $this->ancestorIds = JsonConverters::fromArray('string', $o['ancestorIds']);
if (isset($o['maxPhoneNumbers'])) $this->maxPhoneNumbers = $o['maxPhoneNumbers'];
if (isset($o['isBYOA'])) $this->isBYOA = $o['isBYOA'];
if (isset($o['trustHubProfileSid'])) $this->trustHubProfileSid = $o['trustHubProfileSid'];
if (isset($o['logoId'])) $this->logoId = $o['logoId'];
if (isset($o['logoUri'])) $this->logoUri = $o['logoUri'];
if (isset($o['billingSettings'])) $this->billingSettings = JsonConverters::from('BillingSettings', $o['billingSettings']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->parentAccountId)) $o['parentAccountId'] = $this->parentAccountId;
if (isset($this->twilioAccountSid)) $o['twilioAccountSid'] = $this->twilioAccountSid;
if (isset($this->ancestorIds)) $o['ancestorIds'] = JsonConverters::toArray('string', $this->ancestorIds);
if (isset($this->maxPhoneNumbers)) $o['maxPhoneNumbers'] = $this->maxPhoneNumbers;
if (isset($this->isBYOA)) $o['isBYOA'] = $this->isBYOA;
if (isset($this->trustHubProfileSid)) $o['trustHubProfileSid'] = $this->trustHubProfileSid;
if (isset($this->logoId)) $o['logoId'] = $this->logoId;
if (isset($this->logoUri)) $o['logoUri'] = $this->logoUri;
if (isset($this->billingSettings)) $o['billingSettings'] = JsonConverters::to('BillingSettings', $this->billingSettings);
return empty($o) ? new class(){} : $o;
}
}
/** @description Update the specified account details */
// @Api(Description="Update the specified account details")
class PatchAccount implements IPatch, JsonSerializable
{
public function __construct(
/** @description The ID of the account you want to update */
// @ApiMember(Description="The ID of the account you want to update")
/** @var string|null */
public ?string $accountId=null,
/** @description The new name for the account */
// @ApiMember(Description="The new name for the account")
/** @var string|null */
public ?string $name=null,
/** @description The max number of phone numbers this account can have */
// @ApiMember(Description="The max number of phone numbers this account can have")
/** @var int|null */
public ?int $maxPhoneNumbers=null,
/** @description The ID of the file to use for a logo on the dashboard */
// @ApiMember(Description="The ID of the file to use for a logo on the dashboard")
/** @var string|null */
public ?string $logoId=null,
/** @description Updated billing settings for this account */
// @ApiMember(Description="Updated billing settings for this account")
/** @var BillingSettings|null */
public ?BillingSettings $billingSettings=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['maxPhoneNumbers'])) $this->maxPhoneNumbers = $o['maxPhoneNumbers'];
if (isset($o['logoId'])) $this->logoId = $o['logoId'];
if (isset($o['billingSettings'])) $this->billingSettings = JsonConverters::from('BillingSettings', $o['billingSettings']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->maxPhoneNumbers)) $o['maxPhoneNumbers'] = $this->maxPhoneNumbers;
if (isset($this->logoId)) $o['logoId'] = $this->logoId;
if (isset($this->billingSettings)) $o['billingSettings'] = JsonConverters::to('BillingSettings', $this->billingSettings);
return empty($o) ? new class(){} : $o;
}
}
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.
PATCH /accounts/{accountId} HTTP/1.1
Host: team.evovoice.io
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PatchAccount xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Accounts">
<AccountId>String</AccountId>
<BillingSettings>
<AIInsights>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</AIInsights>
<AILiveMinutes>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</AILiveMinutes>
<Base>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</Base>
<InboundFaxes>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</InboundFaxes>
<InboundSmsMessages>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</InboundSmsMessages>
<InboundVoiceCalls>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</InboundVoiceCalls>
<LocalNumbers>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</LocalNumbers>
<OutboundFaxes>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</OutboundFaxes>
<OutboundSmsMessages>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</OutboundSmsMessages>
<OutboundVoiceCalls>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</OutboundVoiceCalls>
<TollFreeNumbers>
<Allowance>0</Allowance>
<BaseCost>0</BaseCost>
<RawUnitMultiplier>0</RawUnitMultiplier>
<UnitCost>0</UnitCost>
</TollFreeNumbers>
</BillingSettings>
<LogoId>String</LogoId>
<MaxPhoneNumbers>0</MaxPhoneNumbers>
<Name>String</Name>
</PatchAccount>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <AccountInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Accounts"> <CreatedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</CreatedBy> <DateCreated xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateCreated> <DateLastModified xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateLastModified> <Id xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</Id> <LastModifiedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</LastModifiedBy> <AncestorIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>String</d2p1:string> </AncestorIds> <BillingSettings> <AIInsights> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </AIInsights> <AILiveMinutes> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </AILiveMinutes> <Base> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </Base> <InboundFaxes> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </InboundFaxes> <InboundSmsMessages> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </InboundSmsMessages> <InboundVoiceCalls> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </InboundVoiceCalls> <LocalNumbers> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </LocalNumbers> <OutboundFaxes> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </OutboundFaxes> <OutboundSmsMessages> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </OutboundSmsMessages> <OutboundVoiceCalls> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </OutboundVoiceCalls> <TollFreeNumbers> <Allowance>0</Allowance> <BaseCost>0</BaseCost> <RawUnitMultiplier>0</RawUnitMultiplier> <UnitCost>0</UnitCost> </TollFreeNumbers> </BillingSettings> <IsBYOA>false</IsBYOA> <LogoId>String</LogoId> <LogoUri>String</LogoUri> <MaxPhoneNumbers>0</MaxPhoneNumbers> <Name>String</Name> <ParentAccountId>String</ParentAccountId> <TrustHubProfileSid>String</TrustHubProfileSid> <TwilioAccountSid>String</TwilioAccountSid> </AccountInfo>