| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,48 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Telnyx; |
|
| 4 |
+ |
|
| 5 |
+/** |
|
| 6 |
+ * Class ErrorObject. |
|
| 7 |
+ * |
|
| 8 |
+ * @property string $code - an application-specific error code, expressed as a stringified 5-digit integer [e.g. "10001"]. |
|
| 9 |
+ * @property string $title - a short, human-readable summary of the problem. |
|
| 10 |
+ * @property string $detail - a human-readable explanation specific to this occurrence of the problem. |
|
| 11 |
+ * @property string $source - an object containing references to the source of the error, optionally including any of the following members: |
|
| 12 |
+ * @property string $pointer - a JSON Pointer [RFC6901] to the associated entity in the request document e.g. "/" for a primary object, or "/title" for a specific attribute. |
|
| 13 |
+ * @property string $parameter - a string indicating which URI query parameter caused the error. |
|
| 14 |
+ * @property string $meta - a meta object containing non-standard meta-information about the error. This will likely be a URL to the relevant documentation. |
|
| 15 |
+ */ |
|
| 16 |
+class ErrorObject extends TelnyxObject |
|
| 17 |
+{
|
|
| 18 |
+ /** |
|
| 19 |
+ * Possible string representations of an error's code. |
|
| 20 |
+ * |
|
| 21 |
+ * @see https://developers.telnyx.com/docs/v2/development/api-guide/errors |
|
| 22 |
+ */ |
|
| 23 |
+ |
|
| 24 |
+ /** |
|
| 25 |
+ * Refreshes this object using the provided values. |
|
| 26 |
+ * |
|
| 27 |
+ * @param array $values |
|
| 28 |
+ * @param null|array|string|Util\RequestOptions $opts |
|
| 29 |
+ * @param bool $partial defaults to false |
|
| 30 |
+ */ |
|
| 31 |
+ public function refreshFrom($values, $opts, $partial = false) |
|
| 32 |
+ {
|
|
| 33 |
+ // Unlike most other API resources, the API will omit attributes in |
|
| 34 |
+ // error objects when they have a null value. We manually set default |
|
| 35 |
+ // values here to facilitate generic error handling. |
|
| 36 |
+ $values = \array_merge([ |
|
| 37 |
+ 'code' => null, |
|
| 38 |
+ 'title' => null, |
|
| 39 |
+ 'detail' => null, |
|
| 40 |
+ 'source' => null, |
|
| 41 |
+ 'pointer' => null, |
|
| 42 |
+ 'parameter' => null, |
|
| 43 |
+ 'meta' => null, |
|
| 44 |
+ ], $values); |
|
| 45 |
+ |
|
| 46 |
+ parent::refreshFrom($values, $opts, $partial); |
|
| 47 |
+ } |
|
| 48 |
+} |