LocationService.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service\Terminal;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class LocationService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of <code>Location</code> objects.
  12. *
  13. * @param null|array $params
  14. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  15. *
  16. * @throws \Stripe\Exception\ApiErrorException if the request fails
  17. *
  18. * @return \Stripe\Collection<\Stripe\Terminal\Location>
  19. */
  20. public function all($params = null, $opts = null)
  21. {
  22. return $this->requestCollection('get', '/v1/terminal/locations', $params, $opts);
  23. }
  24. /**
  25. * Creates a new <code>Location</code> object. For further details, including which
  26. * address fields are required in each country, see the <a
  27. * href="/docs/terminal/fleet/locations">Manage locations</a> guide.
  28. *
  29. * @param null|array $params
  30. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  31. *
  32. * @throws \Stripe\Exception\ApiErrorException if the request fails
  33. *
  34. * @return \Stripe\Terminal\Location
  35. */
  36. public function create($params = null, $opts = null)
  37. {
  38. return $this->request('post', '/v1/terminal/locations', $params, $opts);
  39. }
  40. /**
  41. * Deletes a <code>Location</code> object.
  42. *
  43. * @param string $id
  44. * @param null|array $params
  45. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  46. *
  47. * @throws \Stripe\Exception\ApiErrorException if the request fails
  48. *
  49. * @return \Stripe\Terminal\Location
  50. */
  51. public function delete($id, $params = null, $opts = null)
  52. {
  53. return $this->request('delete', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
  54. }
  55. /**
  56. * Retrieves a <code>Location</code> object.
  57. *
  58. * @param string $id
  59. * @param null|array $params
  60. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  61. *
  62. * @throws \Stripe\Exception\ApiErrorException if the request fails
  63. *
  64. * @return \Stripe\Terminal\Location
  65. */
  66. public function retrieve($id, $params = null, $opts = null)
  67. {
  68. return $this->request('get', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
  69. }
  70. /**
  71. * Updates a <code>Location</code> object by setting the values of the parameters
  72. * passed. Any parameters not provided will be left unchanged.
  73. *
  74. * @param string $id
  75. * @param null|array $params
  76. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  77. *
  78. * @throws \Stripe\Exception\ApiErrorException if the request fails
  79. *
  80. * @return \Stripe\Terminal\Location
  81. */
  82. public function update($id, $params = null, $opts = null)
  83. {
  84. return $this->request('post', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts);
  85. }
  86. }