modern-events-calendar-lite/app/api/Twilio/Rest/Pricing/V2/NumberContext.php

91 lines
2.6 KiB
PHP
Executable file

<?php
/**
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace Twilio\Rest\Pricing\V2;
use Twilio\Exceptions\TwilioException;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
use Twilio\InstanceContext;
class NumberContext extends InstanceContext
{
/**
* Initialize the NumberContext
*
* @param Version $version Version that contains the resource
* @param string $destinationNumber The destination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number.
*/
public function __construct(
Version $version,
$destinationNumber
) {
parent::__construct($version);
// Path Solution
$this->solution = [
'destinationNumber' =>
$destinationNumber,
];
$this->uri = '/Trunking/Numbers/' . \rawurlencode($destinationNumber)
.'';
}
/**
* Fetch the NumberInstance
*
* @param array|Options $options Optional Arguments
* @return NumberInstance Fetched NumberInstance
* @throws TwilioException When an HTTP error occurs.
*/
public function fetch(array $options = []): NumberInstance
{
$options = new Values($options);
$params = Values::of([
'OriginationNumber' =>
$options['originationNumber'],
]);
$payload = $this->version->fetch('GET', $this->uri, $params);
return new NumberInstance(
$this->version,
$payload,
$this->solution['destinationNumber']
);
}
/**
* Provide a friendly representation
*
* @return string Machine friendly representation
*/
public function __toString(): string
{
$context = [];
foreach ($this->solution as $key => $value) {
$context[] = "$key=$value";
}
return '[Twilio.Pricing.V2.NumberContext ' . \implode(' ', $context) . ']';
}
}