OpenPlatform.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. // This file is auto-generated, don't edit it. Thanks.
  3. namespace AlibabaCloud\SDK\OpenPlatform\V20191219;
  4. use AlibabaCloud\Endpoint\Endpoint;
  5. use AlibabaCloud\SDK\OpenPlatform\V20191219\Models\AuthorizeFileUploadRequest;
  6. use AlibabaCloud\SDK\OpenPlatform\V20191219\Models\AuthorizeFileUploadResponse;
  7. use AlibabaCloud\Tea\Rpc\Rpc;
  8. use AlibabaCloud\Tea\Tea;
  9. use AlibabaCloud\Tea\Utils\Utils;
  10. use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
  11. class OpenPlatform extends Rpc
  12. {
  13. public function __construct($config)
  14. {
  15. parent::__construct($config);
  16. $this->_endpointRule = '';
  17. $this->checkConfig($config);
  18. $this->_endpoint = $this->getEndpoint('openplatform', $this->_regionId, $this->_endpointRule, $this->_network, $this->_suffix, $this->_endpointMap, $this->_endpoint);
  19. }
  20. /**
  21. * @param AuthorizeFileUploadRequest $request
  22. * @param RuntimeOptions $runtime
  23. *
  24. * @return AuthorizeFileUploadResponse
  25. */
  26. public function authorizeFileUploadWithOptions($request, $runtime)
  27. {
  28. Utils::validateModel($request);
  29. return AuthorizeFileUploadResponse::fromMap($this->doRequest('AuthorizeFileUpload', 'HTTPS', 'GET', '2019-12-19', 'AK', Tea::merge($request), null, $runtime));
  30. }
  31. /**
  32. * @param AuthorizeFileUploadRequest $request
  33. *
  34. * @return AuthorizeFileUploadResponse
  35. */
  36. public function authorizeFileUpload($request)
  37. {
  38. $runtime = new RuntimeOptions([]);
  39. return $this->authorizeFileUploadWithOptions($request, $runtime);
  40. }
  41. /**
  42. * @param string $productId
  43. * @param string $regionId
  44. * @param string $endpointRule
  45. * @param string $network
  46. * @param string $suffix
  47. * @param string[] $endpointMap
  48. * @param string $endpoint
  49. *
  50. * @return string
  51. */
  52. public function getEndpoint($productId, $regionId, $endpointRule, $network, $suffix, $endpointMap, $endpoint)
  53. {
  54. if (!Utils::empty_($endpoint)) {
  55. return $endpoint;
  56. }
  57. if (!Utils::isUnset($endpointMap) && !Utils::empty_(@$endpointMap[$regionId])) {
  58. return @$endpointMap[$regionId];
  59. }
  60. return Endpoint::getEndpointRules($productId, $regionId, $endpointRule, $network, $suffix);
  61. }
  62. }