Product.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Climate;
  4. /**
  5. * A Climate product represents a type of carbon removal unit available for reservation.
  6. * You can retrieve it to see the current price and availability.
  7. *
  8. * @property string $id Unique identifier for the object. For convenience, Climate product IDs are human-readable strings that start with <code>climsku_</code>. See <a href="https://stripe.com/docs/climate/orders/carbon-removal-inventory">carbon removal inventory</a> for a list of available carbon removal products.
  9. * @property string $object String representing the object's type. Objects of the same type share the same value.
  10. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  11. * @property \Stripe\StripeObject $current_prices_per_metric_ton Current prices for a metric ton of carbon removal in a currency's smallest unit.
  12. * @property null|int $delivery_year The year in which the carbon removal is expected to be delivered.
  13. * @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.
  14. * @property string $metric_tons_available The quantity of metric tons available for reservation.
  15. * @property string $name The Climate product's name.
  16. * @property \Stripe\Climate\Supplier[] $suppliers The carbon removal suppliers that fulfill orders for this Climate product.
  17. */
  18. class Product extends \Stripe\ApiResource
  19. {
  20. const OBJECT_NAME = 'climate.product';
  21. /**
  22. * Lists all available Climate product objects.
  23. *
  24. * @param null|array $params
  25. * @param null|array|string $opts
  26. *
  27. * @throws \Stripe\Exception\ApiErrorException if the request fails
  28. *
  29. * @return \Stripe\Collection<\Stripe\Climate\Product> of ApiResources
  30. */
  31. public static function all($params = null, $opts = null)
  32. {
  33. $url = static::classUrl();
  34. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  35. }
  36. /**
  37. * Retrieves the details of a Climate product with the given ID.
  38. *
  39. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  40. * @param null|array|string $opts
  41. *
  42. * @throws \Stripe\Exception\ApiErrorException if the request fails
  43. *
  44. * @return \Stripe\Climate\Product
  45. */
  46. public static function retrieve($id, $opts = null)
  47. {
  48. $opts = \Stripe\Util\RequestOptions::parse($opts);
  49. $instance = new static($id, $opts);
  50. $instance->refresh();
  51. return $instance;
  52. }
  53. }