Browse code

Added README.md appinfo/info.xml appinfo/signature.json lib/Controller/AuthorApiController.php and the providers directory

DoubleBastionAdmin authored on 20/08/2022 16:33:00
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,47 @@
1
+<?php
2
+
3
+namespace Telnyx\ApiOperations;
4
+
5
+/**
6
+ * Trait for deletable resources. Adds a `delete()` method to the class.
7
+ *
8
+ * This trait should only be applied to classes that derive from TelnyxObject.
9
+ */
10
+trait Delete
11
+{
12
+    /**
13
+     * @param array|null $params
14
+     * @param array|string|null $opts
15
+     *
16
+     * @return \Telnyx\ApiResource The deleted resource.
17
+     */
18
+    public function delete($params = null, $opts = null)
19
+    {
20
+        self::_validateParams($params);
21
+
22
+        $url = $this->instanceUrl();
23
+        list($response, $opts) = $this->_request('delete', $url, $params, $opts);
24
+        $this->refreshFrom($response, $opts);
25
+        return $this;
26
+    }
27
+    
28
+    /**
29
+     * @param string $id The ID of the resource to delete.
30
+     * @param array|null $params
31
+     * @param array|string|null $opts
32
+     *
33
+     * @return \Telnyx\ApiResource The updated resource.
34
+     */
35
+    public static function remove($id, $params = null, $opts = null)
36
+    {
37
+        self::_validateParams($params);
38
+
39
+        $url = static::resourceUrl($id);
40
+
41
+        list($response, $opts) = static::_staticRequest('delete', $url, $params, $opts);
42
+        $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts);
43
+        $obj->setLastResponse($response);
44
+
45
+        return $obj;
46
+    }
47
+}