ValueList.php
132 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace AmeliaVendor\Stripe\Radar; |
| 5 | |
| 6 | /** |
| 7 | * Value lists allow you to group values together which can then be referenced in rules. |
| 8 | * |
| 9 | * Related guide: <a href="https://stripe.com/docs/radar/lists#managing-list-items">Default Stripe lists</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 string $alias The name of the value list for use in rules. |
| 14 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 15 | * @property string $created_by The name or email address of the user who created this value list. |
| 16 | * @property string $item_type The type of items in the value list. One of <code>card_fingerprint</code>, <code>us_bank_account_fingerprint</code>, <code>sepa_debit_fingerprint</code>, <code>card_bin</code>, <code>email</code>, <code>ip_address</code>, <code>country</code>, <code>string</code>, <code>case_sensitive_string</code>, or <code>customer_id</code>. |
| 17 | * @property \AmeliaVendor\Stripe\Collection<ValueListItem> $list_items List of items contained within this value list. |
| 18 | * @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. |
| 19 | * @property \AmeliaVendor\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 20 | * @property string $name The name of the value list. |
| 21 | */ |
| 22 | class ValueList extends \AmeliaVendor\Stripe\ApiResource |
| 23 | { |
| 24 | const OBJECT_NAME = 'radar.value_list'; |
| 25 | use \AmeliaVendor\Stripe\ApiOperations\Update; |
| 26 | const ITEM_TYPE_CARD_BIN = 'card_bin'; |
| 27 | const ITEM_TYPE_CARD_FINGERPRINT = 'card_fingerprint'; |
| 28 | const ITEM_TYPE_CASE_SENSITIVE_STRING = 'case_sensitive_string'; |
| 29 | const ITEM_TYPE_COUNTRY = 'country'; |
| 30 | const ITEM_TYPE_CUSTOMER_ID = 'customer_id'; |
| 31 | const ITEM_TYPE_EMAIL = 'email'; |
| 32 | const ITEM_TYPE_IP_ADDRESS = 'ip_address'; |
| 33 | const ITEM_TYPE_SEPA_DEBIT_FINGERPRINT = 'sepa_debit_fingerprint'; |
| 34 | const ITEM_TYPE_STRING = 'string'; |
| 35 | const ITEM_TYPE_US_BANK_ACCOUNT_FINGERPRINT = 'us_bank_account_fingerprint'; |
| 36 | /** |
| 37 | * Creates a new <code>ValueList</code> object, which can then be referenced in |
| 38 | * rules. |
| 39 | * |
| 40 | * @param null|array{alias: string, expand?: string[], item_type?: string, metadata?: array<string, string>, name: string} $params |
| 41 | * @param null|array|string $options |
| 42 | * |
| 43 | * @return ValueList the created resource |
| 44 | * |
| 45 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 46 | */ |
| 47 | public static function create($params = null, $options = null) |
| 48 | { |
| 49 | self::_validateParams($params); |
| 50 | $url = static::classUrl(); |
| 51 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 52 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 53 | $obj->setLastResponse($response); |
| 54 | return $obj; |
| 55 | } |
| 56 | /** |
| 57 | * Deletes a <code>ValueList</code> object, also deleting any items contained |
| 58 | * within the value list. To be deleted, a value list must not be referenced in any |
| 59 | * rules. |
| 60 | * |
| 61 | * @param null|array $params |
| 62 | * @param null|array|string $opts |
| 63 | * |
| 64 | * @return ValueList the deleted resource |
| 65 | * |
| 66 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 67 | */ |
| 68 | public function delete($params = null, $opts = null) |
| 69 | { |
| 70 | self::_validateParams($params); |
| 71 | $url = $this->instanceUrl(); |
| 72 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 73 | $this->refreshFrom($response, $opts); |
| 74 | return $this; |
| 75 | } |
| 76 | /** |
| 77 | * Returns a list of <code>ValueList</code> objects. The objects are sorted in |
| 78 | * descending order by creation date, with the most recently created object |
| 79 | * appearing first. |
| 80 | * |
| 81 | * @param null|array{alias?: string, contains?: string, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params |
| 82 | * @param null|array|string $opts |
| 83 | * |
| 84 | * @return \AmeliaVendor\Stripe\Collection<ValueList> of ApiResources |
| 85 | * |
| 86 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 87 | */ |
| 88 | public static function all($params = null, $opts = null) |
| 89 | { |
| 90 | $url = static::classUrl(); |
| 91 | return static::_requestPage($url, \AmeliaVendor\Stripe\Collection::class, $params, $opts); |
| 92 | } |
| 93 | /** |
| 94 | * Retrieves a <code>ValueList</code> object. |
| 95 | * |
| 96 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 97 | * @param null|array|string $opts |
| 98 | * |
| 99 | * @return ValueList |
| 100 | * |
| 101 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 102 | */ |
| 103 | public static function retrieve($id, $opts = null) |
| 104 | { |
| 105 | $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts); |
| 106 | $instance = new static($id, $opts); |
| 107 | $instance->refresh(); |
| 108 | return $instance; |
| 109 | } |
| 110 | /** |
| 111 | * Updates a <code>ValueList</code> object by setting the values of the parameters |
| 112 | * passed. Any parameters not provided will be left unchanged. Note that |
| 113 | * <code>item_type</code> is immutable. |
| 114 | * |
| 115 | * @param string $id the ID of the resource to update |
| 116 | * @param null|array{alias?: string, expand?: string[], metadata?: array<string, string>, name?: string} $params |
| 117 | * @param null|array|string $opts |
| 118 | * |
| 119 | * @return ValueList the updated resource |
| 120 | * |
| 121 | * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails |
| 122 | */ |
| 123 | public static function update($id, $params = null, $opts = null) |
| 124 | { |
| 125 | self::_validateParams($params); |
| 126 | $url = static::resourceUrl($id); |
| 127 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 128 | $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 129 | $obj->setLastResponse($response); |
| 130 | return $obj; |
| 131 | } |
| 132 | } |