File.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * This is an object representing a file hosted on Stripe's servers. The file may
  6. * have been uploaded by yourself using the <a
  7. * href="https://stripe.com/docs/api#create_file">create file</a> request (for
  8. * example, when uploading dispute evidence) or it may have been created by Stripe
  9. * (for example, the results of a <a href="#scheduled_queries">Sigma scheduled
  10. * query</a>).
  11. *
  12. * Related guide: <a href="https://stripe.com/docs/file-upload">File Upload
  13. * Guide</a>.
  14. *
  15. * @property string $id Unique identifier for the object.
  16. * @property string $object String representing the object's type. Objects of the same type share the same value.
  17. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  18. * @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds.
  19. * @property null|string $filename A filename for the file, suitable for saving to a filesystem.
  20. * @property null|\Stripe\Collection<\Stripe\FileLink> $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
  21. * @property string $purpose The <a href="https://stripe.com/docs/file-upload#uploading-a-file">purpose</a> of the uploaded file.
  22. * @property int $size The size in bytes of the file object.
  23. * @property null|string $title A user friendly title for the document.
  24. * @property null|string $type The type of the file returned (e.g., <code>csv</code>, <code>pdf</code>, <code>jpg</code>, or <code>png</code>).
  25. * @property null|string $url The URL from which the file can be downloaded using your live secret API key.
  26. */
  27. class File extends ApiResource
  28. {
  29. const OBJECT_NAME = 'file';
  30. use ApiOperations\All;
  31. use ApiOperations\Retrieve;
  32. const PURPOSE_ACCOUNT_REQUIREMENT = 'account_requirement';
  33. const PURPOSE_ADDITIONAL_VERIFICATION = 'additional_verification';
  34. const PURPOSE_BUSINESS_ICON = 'business_icon';
  35. const PURPOSE_BUSINESS_LOGO = 'business_logo';
  36. const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature';
  37. const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence';
  38. const PURPOSE_DOCUMENT_PROVIDER_IDENTITY_DOCUMENT = 'document_provider_identity_document';
  39. const PURPOSE_FINANCE_REPORT_RUN = 'finance_report_run';
  40. const PURPOSE_IDENTITY_DOCUMENT = 'identity_document';
  41. const PURPOSE_IDENTITY_DOCUMENT_DOWNLOADABLE = 'identity_document_downloadable';
  42. const PURPOSE_PCI_DOCUMENT = 'pci_document';
  43. const PURPOSE_SELFIE = 'selfie';
  44. const PURPOSE_SIGMA_SCHEDULED_QUERY = 'sigma_scheduled_query';
  45. const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload';
  46. // This resource can have two different object names. In latter API
  47. // versions, only `file` is used, but since stripe-php may be used with
  48. // any API version, we need to support deserializing the older
  49. // `file_upload` object into the same class.
  50. const OBJECT_NAME_ALT = 'file_upload';
  51. use ApiOperations\Create {
  52. create as protected _create;
  53. }
  54. public static function classUrl()
  55. {
  56. return '/v1/files';
  57. }
  58. /**
  59. * @param null|array $params
  60. * @param null|array|string $opts
  61. *
  62. * @throws \Stripe\Exception\ApiErrorException if the request fails
  63. *
  64. * @return \Stripe\File the created file
  65. */
  66. public static function create($params = null, $opts = null)
  67. {
  68. $opts = \Stripe\Util\RequestOptions::parse($opts);
  69. if (null === $opts->apiBase) {
  70. $opts->apiBase = Stripe::$apiUploadBase;
  71. }
  72. // Manually flatten params, otherwise curl's multipart encoder will
  73. // choke on nested arrays.
  74. $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0);
  75. return static::_create($flatParams, $opts);
  76. }
  77. }