-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: provide application/json support in request body #799
Changes from 6 commits
13c00ea
ec54151
6982897
8e03df6
b52e21d
f55d5db
ed77032
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Twilio\Rest; | ||
|
||
use Twilio\Rest\PreviewMessaging\V1; | ||
|
||
class PreviewMessaging extends PreviewMessagingBase { | ||
/** | ||
* @deprecated Use v1->oauth instead. | ||
*/ | ||
protected function getMessages(): \Twilio\Rest\PreviewMessaging\V1\MessageList { | ||
return $this->v1->messages; | ||
} | ||
|
||
/** | ||
* @deprecated Use v1->oauth() instead. | ||
*/ | ||
protected function getBroadcasts(): \Twilio\Rest\PreviewMessaging\V1\BroadcastList { | ||
return $this->v1->broadcasts; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
/** | ||
* This code was generated by | ||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ | ||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | ||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ | ||
* | ||
* Bulk Messaging and Broadcast | ||
* Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator. | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
namespace Twilio\Rest\PreviewMessaging; | ||
|
||
use Twilio\Domain; | ||
use Twilio\Exceptions\TwilioException; | ||
use Twilio\InstanceContext; | ||
use Twilio\Rest\PreviewMessaging\V1\BroadcastList; | ||
use Twilio\Rest\PreviewMessaging\V1\MessageList; | ||
use Twilio\Version; | ||
|
||
/** | ||
* @property BroadcastList $broadcasts | ||
* @property MessageList $messages | ||
*/ | ||
class V1 extends Version | ||
{ | ||
protected $_broadcasts; | ||
protected $_messages; | ||
|
||
/** | ||
* Construct the V1 version of PreviewMessaging | ||
* | ||
* @param Domain $domain Domain that contains the version | ||
*/ | ||
public function __construct(Domain $domain) | ||
{ | ||
parent::__construct($domain); | ||
$this->version = 'v1'; | ||
} | ||
|
||
protected function getBroadcasts(): BroadcastList | ||
{ | ||
if (!$this->_broadcasts) { | ||
$this->_broadcasts = new BroadcastList($this); | ||
} | ||
return $this->_broadcasts; | ||
} | ||
|
||
protected function getMessages(): MessageList | ||
{ | ||
if (!$this->_messages) { | ||
$this->_messages = new MessageList($this); | ||
} | ||
return $this->_messages; | ||
} | ||
|
||
/** | ||
* Magic getter to lazy load root resources | ||
* | ||
* @param string $name Resource to return | ||
* @return \Twilio\ListResource The requested resource | ||
* @throws TwilioException For unknown resource | ||
*/ | ||
public function __get(string $name) | ||
{ | ||
$method = 'get' . \ucfirst($name); | ||
if (\method_exists($this, $method)) { | ||
return $this->$method(); | ||
} | ||
|
||
throw new TwilioException('Unknown resource ' . $name); | ||
} | ||
|
||
/** | ||
* Magic caller to get resource contexts | ||
* | ||
* @param string $name Resource to return | ||
* @param array $arguments Context parameters | ||
* @return InstanceContext The requested resource context | ||
* @throws TwilioException For unknown resource | ||
*/ | ||
public function __call(string $name, array $arguments): InstanceContext | ||
{ | ||
$property = $this->$name; | ||
if (\method_exists($property, 'getContext')) { | ||
return \call_user_func_array(array($property, 'getContext'), $arguments); | ||
} | ||
|
||
throw new TwilioException('Resource does not have a context'); | ||
} | ||
|
||
/** | ||
* Provide a friendly representation | ||
* | ||
* @return string Machine friendly representation | ||
*/ | ||
public function __toString(): string | ||
{ | ||
return '[Twilio.PreviewMessaging.V1]'; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we are generating these files ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding them for the first time so that tests do not fail, similar to what we did in case of python. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suppose if a new API is added from api-definitions, Do we need to do this at that time ? |
||
|
||
/** | ||
* This code was generated by | ||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ | ||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | ||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ | ||
* | ||
* Bulk Messaging and Broadcast | ||
* Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator. | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
namespace Twilio\Rest\PreviewMessaging\V1; | ||
|
||
use Twilio\Exceptions\TwilioException; | ||
use Twilio\ListResource; | ||
use Twilio\InstanceResource; | ||
use Twilio\Options; | ||
use Twilio\Stream; | ||
use Twilio\Values; | ||
use Twilio\Version; | ||
use Twilio\InstanceContext; | ||
use Twilio\Deserialize; | ||
use Twilio\Serialize; | ||
use Twilio\Base\PhoneNumberCapabilities; | ||
|
||
|
||
/** | ||
* @property string $broadcastSid | ||
* @property \DateTime $createdDate | ||
* @property \DateTime $updatedDate | ||
* @property string $broadcastStatus | ||
* @property string $executionDetails | ||
* @property string $resultsFile | ||
*/ | ||
class BroadcastInstance extends InstanceResource | ||
{ | ||
/** | ||
* Initialize the BroadcastInstance | ||
* | ||
* @param Version $version Version that contains the resource | ||
* @param mixed[] $payload The response payload | ||
*/ | ||
public function __construct(Version $version, array $payload) | ||
{ | ||
parent::__construct($version); | ||
|
||
// Marshaled Properties | ||
$this->properties = [ | ||
'broadcastSid' => Values::array_get($payload, 'broadcast_sid'), | ||
'createdDate' => Deserialize::dateTime(Values::array_get($payload, 'created_date')), | ||
'updatedDate' => Deserialize::dateTime(Values::array_get($payload, 'updated_date')), | ||
'broadcastStatus' => Values::array_get($payload, 'broadcast_status'), | ||
'executionDetails' => Values::array_get($payload, 'execution_details'), | ||
'resultsFile' => Values::array_get($payload, 'results_file'), | ||
]; | ||
|
||
$this->solution = []; | ||
} | ||
|
||
/** | ||
* Magic getter to access properties | ||
* | ||
* @param string $name Property to access | ||
* @return mixed The requested property | ||
* @throws TwilioException For unknown properties | ||
*/ | ||
public function __get(string $name) | ||
{ | ||
if (\array_key_exists($name, $this->properties)) { | ||
return $this->properties[$name]; | ||
} | ||
|
||
if (\property_exists($this, '_' . $name)) { | ||
$method = 'get' . \ucfirst($name); | ||
return $this->$method(); | ||
} | ||
|
||
throw new TwilioException('Unknown property: ' . $name); | ||
} | ||
|
||
/** | ||
* Provide a friendly representation | ||
* | ||
* @return string Machine friendly representation | ||
*/ | ||
public function __toString(): string | ||
{ | ||
return '[Twilio.PreviewMessaging.V1.BroadcastInstance]'; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
|
||
/** | ||
* This code was generated by | ||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ | ||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | ||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ | ||
* | ||
* Bulk Messaging and Broadcast | ||
* Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator. | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
namespace Twilio\Rest\PreviewMessaging\V1; | ||
|
||
use Twilio\Exceptions\TwilioException; | ||
use Twilio\ListResource; | ||
use Twilio\InstanceResource; | ||
use Twilio\Options; | ||
use Twilio\Stream; | ||
use Twilio\Values; | ||
use Twilio\Version; | ||
use Twilio\InstanceContext; | ||
use Twilio\Deserialize; | ||
use Twilio\Serialize; | ||
use Twilio\Base\PhoneNumberCapabilities; | ||
|
||
|
||
class BroadcastList extends ListResource | ||
{ | ||
/** | ||
* Construct the BroadcastList | ||
* | ||
* @param Version $version Version that contains the resource | ||
*/ | ||
public function __construct( | ||
Version $version | ||
) { | ||
parent::__construct($version); | ||
|
||
// Path Solution | ||
$this->solution = [ | ||
]; | ||
|
||
$this->uri = '/Broadcasts'; | ||
} | ||
|
||
/** | ||
* Create the BroadcastInstance | ||
* | ||
* @param array|Options $options Optional Arguments | ||
* @return BroadcastInstance Created BroadcastInstance | ||
* @throws TwilioException When an HTTP error occurs. | ||
*/ | ||
public function create(array $options = []): BroadcastInstance | ||
{ | ||
|
||
$options = new Values($options); | ||
|
||
$headers = Values::of(['X-Twilio-Request-Key' => $options['xTwilioRequestKey']]); | ||
|
||
$payload = $this->version->create('POST', $this->uri, [], [], $headers); | ||
|
||
return new BroadcastInstance( | ||
$this->version, | ||
$payload | ||
); | ||
} | ||
|
||
|
||
/** | ||
* Provide a friendly representation | ||
* | ||
* @return string Machine friendly representation | ||
*/ | ||
public function __toString(): string | ||
{ | ||
return '[Twilio.PreviewMessaging.V1.BroadcastList]'; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be 8.0.0-rc.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes correct, I'll do this