ScheduledQueryRun.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Sigma;
  4. /**
  5. * If you have <a href="https://stripe.com/docs/sigma/scheduled-queries">scheduled a Sigma query</a>, you'll
  6. * receive a <code>sigma.scheduled_query_run.created</code> webhook each time the query
  7. * runs. The webhook contains a <code>ScheduledQueryRun</code> object, which you can use to
  8. * retrieve the query results.
  9. *
  10. * @property string $id Unique identifier for the object.
  11. * @property string $object String representing the object's type. Objects of the same type share the same value.
  12. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  13. * @property int $data_load_time When the query was run, Sigma contained a snapshot of your Stripe data at this time.
  14. * @property null|\Stripe\StripeObject $error
  15. * @property null|\Stripe\File $file The file object representing the results of the query.
  16. * @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.
  17. * @property int $result_available_until Time at which the result expires and is no longer available for download.
  18. * @property string $sql SQL for the query.
  19. * @property string $status The query's execution status, which will be <code>completed</code> for successful runs, and <code>canceled</code>, <code>failed</code>, or <code>timed_out</code> otherwise.
  20. * @property string $title Title of the query.
  21. */
  22. class ScheduledQueryRun extends \Stripe\ApiResource
  23. {
  24. const OBJECT_NAME = 'scheduled_query_run';
  25. /**
  26. * Returns a list of scheduled query runs.
  27. *
  28. * @param null|array $params
  29. * @param null|array|string $opts
  30. *
  31. * @throws \Stripe\Exception\ApiErrorException if the request fails
  32. *
  33. * @return \Stripe\Collection<\Stripe\Sigma\ScheduledQueryRun> of ApiResources
  34. */
  35. public static function all($params = null, $opts = null)
  36. {
  37. $url = static::classUrl();
  38. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  39. }
  40. /**
  41. * Retrieves the details of an scheduled query run.
  42. *
  43. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  44. * @param null|array|string $opts
  45. *
  46. * @throws \Stripe\Exception\ApiErrorException if the request fails
  47. *
  48. * @return \Stripe\Sigma\ScheduledQueryRun
  49. */
  50. public static function retrieve($id, $opts = null)
  51. {
  52. $opts = \Stripe\Util\RequestOptions::parse($opts);
  53. $instance = new static($id, $opts);
  54. $instance->refresh();
  55. return $instance;
  56. }
  57. public static function classUrl()
  58. {
  59. return '/v1/sigma/scheduled_query_runs';
  60. }
  61. }