| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,149 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Telnyx; |
|
| 4 |
+ |
|
| 5 |
+/** |
|
| 6 |
+ * Class SimCard |
|
| 7 |
+ * |
|
| 8 |
+ * @package Telnyx |
|
| 9 |
+ */ |
|
| 10 |
+class SimCard extends ApiResource |
|
| 11 |
+{
|
|
| 12 |
+ |
|
| 13 |
+ const OBJECT_NAME = "sim_card"; |
|
| 14 |
+ |
|
| 15 |
+ use ApiOperations\All; |
|
| 16 |
+ use ApiOperations\Retrieve; |
|
| 17 |
+ use ApiOperations\Update; |
|
| 18 |
+ |
|
| 19 |
+ /** |
|
| 20 |
+ * Request a SIM card activation (DEPRECATED) |
|
| 21 |
+ * |
|
| 22 |
+ * @param array|null $params |
|
| 23 |
+ * @param array|string|null $options |
|
| 24 |
+ * |
|
| 25 |
+ * @return |
|
| 26 |
+ */ |
|
| 27 |
+ public function activate($params = null, $options = null) |
|
| 28 |
+ {
|
|
| 29 |
+ $url = $this->instanceUrl() . '/actions/activate'; |
|
| 30 |
+ list($response, $opts) = $this->_request('post', $url, $params, $options);
|
|
| 31 |
+ $this->refreshFrom($response, $opts); |
|
| 32 |
+ return $this; |
|
| 33 |
+ } |
|
| 34 |
+ |
|
| 35 |
+ /** |
|
| 36 |
+ * Request a SIM card deactivation (DEPRECATED) |
|
| 37 |
+ * |
|
| 38 |
+ * @param array|null $params |
|
| 39 |
+ * @param array|string|null $options |
|
| 40 |
+ * |
|
| 41 |
+ * @return |
|
| 42 |
+ */ |
|
| 43 |
+ public function deactivate($params = null, $options = null) |
|
| 44 |
+ {
|
|
| 45 |
+ $url = $this->instanceUrl() . '/actions/deactivate'; |
|
| 46 |
+ list($response, $opts) = $this->_request('post', $url, $params, $options);
|
|
| 47 |
+ $this->refreshFrom($response, $opts); |
|
| 48 |
+ return $this; |
|
| 49 |
+ } |
|
| 50 |
+ |
|
| 51 |
+ /** |
|
| 52 |
+ * Request a SIM card enable |
|
| 53 |
+ * |
|
| 54 |
+ * @param array|null $params |
|
| 55 |
+ * @param array|string|null $options |
|
| 56 |
+ * |
|
| 57 |
+ * @return |
|
| 58 |
+ */ |
|
| 59 |
+ public function enable($params = null, $options = null) |
|
| 60 |
+ {
|
|
| 61 |
+ $url = $this->instanceUrl() . '/actions/enable'; |
|
| 62 |
+ list($response, $opts) = $this->_request('post', $url, $params, $options);
|
|
| 63 |
+ $this->refreshFrom($response, $opts); |
|
| 64 |
+ return $this; |
|
| 65 |
+ } |
|
| 66 |
+ |
|
| 67 |
+ /** |
|
| 68 |
+ * Request a SIM card disable |
|
| 69 |
+ * |
|
| 70 |
+ * @param array|null $params |
|
| 71 |
+ * @param array|string|null $options |
|
| 72 |
+ * |
|
| 73 |
+ * @return |
|
| 74 |
+ */ |
|
| 75 |
+ public function disable($params = null, $options = null) |
|
| 76 |
+ {
|
|
| 77 |
+ $url = $this->instanceUrl() . '/actions/disable'; |
|
| 78 |
+ list($response, $opts) = $this->_request('post', $url, $params, $options);
|
|
| 79 |
+ $this->refreshFrom($response, $opts); |
|
| 80 |
+ return $this; |
|
| 81 |
+ } |
|
| 82 |
+ |
|
| 83 |
+ /** |
|
| 84 |
+ * Register the SIM cards associated with the provided registration codes to |
|
| 85 |
+ * the current user's account. |
|
| 86 |
+ * |
|
| 87 |
+ * @param array|null $params |
|
| 88 |
+ * @param array|string|null $options |
|
| 89 |
+ * |
|
| 90 |
+ * @return |
|
| 91 |
+ */ |
|
| 92 |
+ public static function register($params = null, $options = null) |
|
| 93 |
+ {
|
|
| 94 |
+ self::_validateParams($params); |
|
| 95 |
+ $url = '/v2/actions/register/sim_cards'; |
|
| 96 |
+ |
|
| 97 |
+ list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
|
|
| 98 |
+ $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); |
|
| 99 |
+ return $obj; |
|
| 100 |
+ } |
|
| 101 |
+ |
|
| 102 |
+ /** |
|
| 103 |
+ * Deletes the network preferences currently applied in the SIM card. |
|
| 104 |
+ * |
|
| 105 |
+ * @param string|null $id |
|
| 106 |
+ * |
|
| 107 |
+ * @return |
|
| 108 |
+ */ |
|
| 109 |
+ public static function delete_network_preferences($id) |
|
| 110 |
+ {
|
|
| 111 |
+ $url = '/v2/sim_cards/' . $id . '/network_preferences'; |
|
| 112 |
+ |
|
| 113 |
+ list($response, $opts) = static::_staticRequest('delete', $url, null, null);
|
|
| 114 |
+ $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); |
|
| 115 |
+ return $obj; |
|
| 116 |
+ } |
|
| 117 |
+ |
|
| 118 |
+ /** |
|
| 119 |
+ * Sets the network preferences currently applied in the SIM card. |
|
| 120 |
+ * |
|
| 121 |
+ * @param string|null $id |
|
| 122 |
+ * |
|
| 123 |
+ * @return |
|
| 124 |
+ */ |
|
| 125 |
+ public static function get_network_preferences($id) |
|
| 126 |
+ {
|
|
| 127 |
+ $url = '/v2/sim_cards/' . $id . '/network_preferences'; |
|
| 128 |
+ |
|
| 129 |
+ list($response, $opts) = static::_staticRequest('get', $url, null, null);
|
|
| 130 |
+ $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); |
|
| 131 |
+ return $obj; |
|
| 132 |
+ } |
|
| 133 |
+ |
|
| 134 |
+ /** |
|
| 135 |
+ * Returns the network preferences currently applied in the SIM card. |
|
| 136 |
+ * |
|
| 137 |
+ * @param string|null $id |
|
| 138 |
+ * |
|
| 139 |
+ * @return |
|
| 140 |
+ */ |
|
| 141 |
+ public static function set_network_preferences($id, $params = null, $options = null) |
|
| 142 |
+ {
|
|
| 143 |
+ $url = '/v2/sim_cards/' . $id . '/network_preferences'; |
|
| 144 |
+ |
|
| 145 |
+ list($response, $opts) = static::_staticRequest('put', $url, $params, $options);
|
|
| 146 |
+ $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); |
|
| 147 |
+ return $obj; |
|
| 148 |
+ } |
|
| 149 |
+} |