ValueListItem.php
96 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace ProfilePressVendor\Stripe\Radar; |
| 5 | |
| 6 | /** |
| 7 | * Value list items allow you to add specific values to a given Radar value list, which can then be used in rules. |
| 8 | * |
| 9 | * Related guide: <a href="https://stripe.com/docs/radar/lists#managing-list-items">Managing list items</a> |
| 10 | * |
| 11 | * @property string $id Unique identifier for the object. |
| 12 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 13 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 14 | * @property string $created_by The name or email address of the user who added this item to the value list. |
| 15 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 16 | * @property string $value The value of the item. |
| 17 | * @property string $value_list The identifier of the value list this item belongs to. |
| 18 | */ |
| 19 | class ValueListItem extends \ProfilePressVendor\Stripe\ApiResource |
| 20 | { |
| 21 | const OBJECT_NAME = 'radar.value_list_item'; |
| 22 | /** |
| 23 | * Creates a new <code>ValueListItem</code> object, which is added to the specified |
| 24 | * parent value list. |
| 25 | * |
| 26 | * @param null|array $params |
| 27 | * @param null|array|string $options |
| 28 | * |
| 29 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 30 | * |
| 31 | * @return \Stripe\Radar\ValueListItem the created resource |
| 32 | */ |
| 33 | public static function create($params = null, $options = null) |
| 34 | { |
| 35 | self::_validateParams($params); |
| 36 | $url = static::classUrl(); |
| 37 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 38 | $obj = \ProfilePressVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 39 | $obj->setLastResponse($response); |
| 40 | return $obj; |
| 41 | } |
| 42 | /** |
| 43 | * Deletes a <code>ValueListItem</code> object, removing it from its parent value |
| 44 | * list. |
| 45 | * |
| 46 | * @param null|array $params |
| 47 | * @param null|array|string $opts |
| 48 | * |
| 49 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 50 | * |
| 51 | * @return \Stripe\Radar\ValueListItem the deleted resource |
| 52 | */ |
| 53 | public function delete($params = null, $opts = null) |
| 54 | { |
| 55 | self::_validateParams($params); |
| 56 | $url = $this->instanceUrl(); |
| 57 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 58 | $this->refreshFrom($response, $opts); |
| 59 | return $this; |
| 60 | } |
| 61 | /** |
| 62 | * Returns a list of <code>ValueListItem</code> objects. The objects are sorted in |
| 63 | * descending order by creation date, with the most recently created object |
| 64 | * appearing first. |
| 65 | * |
| 66 | * @param null|array $params |
| 67 | * @param null|array|string $opts |
| 68 | * |
| 69 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 70 | * |
| 71 | * @return \Stripe\Collection<\Stripe\Radar\ValueListItem> of ApiResources |
| 72 | */ |
| 73 | public static function all($params = null, $opts = null) |
| 74 | { |
| 75 | $url = static::classUrl(); |
| 76 | return static::_requestPage($url, \ProfilePressVendor\Stripe\Collection::class, $params, $opts); |
| 77 | } |
| 78 | /** |
| 79 | * Retrieves a <code>ValueListItem</code> object. |
| 80 | * |
| 81 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 82 | * @param null|array|string $opts |
| 83 | * |
| 84 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 85 | * |
| 86 | * @return \Stripe\Radar\ValueListItem |
| 87 | */ |
| 88 | public static function retrieve($id, $opts = null) |
| 89 | { |
| 90 | $opts = \ProfilePressVendor\Stripe\Util\RequestOptions::parse($opts); |
| 91 | $instance = new static($id, $opts); |
| 92 | $instance->refresh(); |
| 93 | return $instance; |
| 94 | } |
| 95 | } |
| 96 |