GET | /billing |
---|
<?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 BillingCustomerInfo implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $customerId=null,
/** @var float */
public float $internationalCosts=0.0,
/** @var bool|null */
public ?bool $hasCallRecording=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['customerId'])) $this->customerId = $o['customerId'];
if (isset($o['internationalCosts'])) $this->internationalCosts = $o['internationalCosts'];
if (isset($o['hasCallRecording'])) $this->hasCallRecording = $o['hasCallRecording'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->customerId)) $o['customerId'] = $this->customerId;
if (isset($this->internationalCosts)) $o['internationalCosts'] = $this->internationalCosts;
if (isset($this->hasCallRecording)) $o['hasCallRecording'] = $this->hasCallRecording;
return empty($o) ? new class(){} : $o;
}
}
class BillingInfo implements JsonSerializable
{
public function __construct(
/** @var array<BillingCustomerInfo>|null */
public ?array $customers=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['customers'])) $this->customers = JsonConverters::fromArray('BillingCustomerInfo', $o['customers']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->customers)) $o['customers'] = JsonConverters::toArray('BillingCustomerInfo', $this->customers);
return empty($o) ? new class(){} : $o;
}
}
/** @description Get the billing totals for the specified date range. Please note that we do not support getting billing at the hourly time granularity. */
// @Api(Description="Get the billing totals for the specified date range. Please note that we do not support getting billing at the hourly time granularity.")
class GetBilling implements JsonSerializable
{
public function __construct(
/** @description Your Evo Voice Account ID */
// @ApiMember(Description="Your Evo Voice Account ID", IsRequired=true)
/** @var string */
public string $accountId='',
/** @description The start of the date range that you want to query for (we will only use the date portion, so it will include the entire day even if you specify a time as well) */
// @ApiMember(Description="The start of the date range that you want to query for (we will only use the date portion, so it will include the entire day even if you specify a time as well)", IsRequired=true)
/** @var string */
public string $startDate='',
/** @description The end of the date range you want to query for (we will include this entire day in the billing) */
// @ApiMember(Description="The end of the date range you want to query for (we will include this entire day in the billing)", IsRequired=true)
/** @var string */
public string $endDate='',
/** @description Specify this to filter to a specific customer. */
// @ApiMember(Description="Specify this to filter to a specific customer.")
/** @var string|null */
public ?string $customerId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
if (isset($o['startDate'])) $this->startDate = $o['startDate'];
if (isset($o['endDate'])) $this->endDate = $o['endDate'];
if (isset($o['customerId'])) $this->customerId = $o['customerId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
if (isset($this->startDate)) $o['startDate'] = $this->startDate;
if (isset($this->endDate)) $o['endDate'] = $this->endDate;
if (isset($this->customerId)) $o['customerId'] = $this->customerId;
return empty($o) ? new class(){} : $o;
}
}
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.
GET /billing HTTP/1.1 Host: team.evovoice.io Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { customers: [ { customerId: String, internationalCosts: 0, hasCallRecording: False } ] }