first commit

This commit is contained in:
2024-04-01 09:54:43 +08:00
commit 899d816bc3
795 changed files with 130040 additions and 0 deletions

View File

@@ -0,0 +1,293 @@
<?php
/**
* Oauth2ReportKeyHandshakeResponseResult
* PHP version 5
* @author Swagger Codegen team
* @package Yeepay\Yop\Sdk\
* @category Class
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* 一站式服务套件
* <p class=\"p1\">一站式服务套件</p>
* OpenAPI spec version: 1.0.0
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 3.0.13
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Yeepay\Yop\Sdk\Service\Yop\Model;
use ArrayAccess;
use Yeepay\Yop\Sdk\Model\ModelInterface;
use Yeepay\Yop\Sdk\Utils\ObjectSerializer;
/**
* Oauth2ReportKeyHandshakeResponseResult Class Doc Comment
* @author Swagger Codegen team
* @package Yeepay\Yop\Sdk\
* @category Class
* @link https://github.com/swagger-api/swagger-codegen
*/
class Oauth2ReportKeyHandshakeResponseResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string
*/
protected static $swaggerModelName = 'Oauth2ReportKeyHandshakeResponseResult';
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerTypes = [
'keyType' => 'string',
'key' => 'string',
];
/**
* Array of property to format mappings. Used for (de)serialization
* @var string[]
*/
protected static $swaggerFormats = [
'keyType' => null,
'key' => null,
];
/**
* Array of property to type mappings. Used for (de)serialization
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
* @var string[]
*/
protected static $attributeMap = [
'keyType' => 'keyType',
'key' => 'key',
];
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
protected static $setters = [
'keyType' => 'setKeyType',
'key' => 'setKey',
];
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
protected static $getters = [
'keyType' => 'getKeyType',
'key' => 'getKey',
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['keyType'] = isset($data['keyType']) ? $data['keyType'] : null;
$this->container['key'] = isset($data['key']) ? $data['key'] : null;
}
/**
* Show all the invalid properties with reasons.
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets keyType
* @return string
*/
public function getKeyType()
{
return $this->container['keyType'];
}
/**
* Sets keyType
* @param string $keyType 未命名
* @return $this
*/
public function setKeyType($keyType)
{
$this->container['keyType'] = $keyType;
return $this;
}
/**
* Gets key
* @return string
*/
public function getKey()
{
return $this->container['key'];
}
/**
* Sets key
* @param string $key 未命名
* @return $this
*/
public function setKey($key)
{
$this->container['key'] = $key;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
* @param integer $offset Offset
* @return boolean
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
* @param integer $offset Offset
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
* @param integer $offset Offset
* @param mixed $value Value to be set
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
* @param integer $offset Offset
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Yop\Model;
use Yeepay\Yop\Sdk\Model\BaseRequest;
class Oauth2ReportKeyRequest extends BaseRequest
{
/**
* @var string
*/
private $keyType;
/**
* @var string
*/
private $key;
/**
* Gets keyType
* @return string
*/
public function getKeyType()
{
return $this->keyType;
}
/**
* Sets keyType
* @param string $keyType
* @return Oauth2ReportKeyRequest
*/
public function setKeyType($keyType)
{
$this->keyType = $keyType;
return $this;
}
/**
* Gets key
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* Sets key
* @param string $key
* @return Oauth2ReportKeyRequest
*/
public function setKey($key)
{
$this->key = $key;
return $this;
}
public static function getOperationId()
{
return 'oauth2ReportKey';
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Yop\Model;
use Yeepay\Yop\Sdk\Http\Headers;
use Yeepay\Yop\Sdk\Internal\DefaultRequest;
use Yeepay\Yop\Sdk\Internal\Request;
use Yeepay\Yop\Sdk\Model\Transform\RequestMarshaller;
use Yeepay\Yop\Sdk\Utils\ObjectSerializer;
use Yeepay\Yop\Sdk\Utils\UUIDUtils;
class Oauth2ReportKeyRequestMarshaller implements RequestMarshaller
{
/**
* @var Oauth2ReportKeyRequestMarshaller
*/
private static $instance;
public static function __init()
{
self::$instance = new Oauth2ReportKeyRequestMarshaller();
}
/**
* @return Oauth2ReportKeyRequestMarshaller
*/
public static function getInstance()
{
return self::$instance;
}
/**
* @var string
*/
private $serviceName = 'Yop';
/**
* @var string
*/
private $httpMethod = 'POST';
/**
* @var string
*/
private $resourcePath = '/rest/v1.0/yop/oauth2/report-key';
/**
* @var string
*/
private $contentType = 'application/x-www-form-urlencoded';
/**
* @param Oauth2ReportKeyRequest $request
* @return Request
*/
public function marshal($request)
{
$internalRequest = new DefaultRequest($this->serviceName);
$internalRequest->setResourcePath($this->resourcePath);
$internalRequest->setHttpMethod($this->httpMethod);
if (!empty($request->getRequestConfig()) && !empty($request->getRequestConfig()->getCustomRequestHeaders())) {
foreach ($request->getRequestConfig()->getCustomRequestHeaders() as $name => $value) {
$internalRequest->addHeader($name, $value);
}
}
if (!isset($internalRequest->getHeaders()[Headers::YOP_REQUEST_ID])) {
$internalRequest->addHeader(Headers::YOP_REQUEST_ID, UUIDUtils::uuid());
}
if ($request->getKeyType() != null) {
$internalRequest->addParameter('keyType',
ObjectSerializer::sanitizeForSerialization($request->getKeyType(), 'string'));
}
if ($request->getKey() != null) {
$internalRequest->addParameter('key',
ObjectSerializer::sanitizeForSerialization($request->getKey(), 'string'));
}
$internalRequest->addHeader(Headers::CONTENT_TYPE, $this->contentType);
return $internalRequest;
}
}
Oauth2ReportKeyRequestMarshaller::__init();

View File

@@ -0,0 +1,36 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Yop\Model;
use Yeepay\Yop\Sdk\Model\BaseResponse;
class Oauth2ReportKeyResponse extends BaseResponse
{
/**
* @var Oauth2ReportKeyHandshakeResponseResult
*/
private $result;
function getResultClass()
{
return '\Yeepay\Yop\Sdk\Service\Yop\Model\Oauth2ReportKeyHandshakeResponseResult';
}
/**
* @param Oauth2ReportKeyHandshakeResponseResult $result
*/
function setResult($result)
{
$this->result = $result;
}
/**
* @return Oauth2ReportKeyHandshakeResponseResult
*/
function getResult()
{
return $this->result;
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Yop\Model;
use Yeepay\Yop\Sdk\Model\Transform\BaseResponseUnMarshaller;
class Oauth2ReportKeyResponseUnMarshaller extends BaseResponseUnMarshaller
{
/**
* @var Oauth2ReportKeyResponseUnMarshaller
*/
private static $instance;
public static function __init()
{
self::$instance = new Oauth2ReportKeyResponseUnMarshaller();
}
/**
* @return Oauth2ReportKeyResponseUnMarshaller
*/
public static function getInstance()
{
return self::$instance;
}
/**
* @return Oauth2ReportKeyResponse
*/
protected function getResponseInstance()
{
return new Oauth2ReportKeyResponse();
}
}
Oauth2ReportKeyResponseUnMarshaller::__init();

View File

@@ -0,0 +1,45 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Yop;
use Yeepay\Yop\Sdk\Client\ClientExecutionParams;
use Yeepay\Yop\Sdk\Client\ClientHandler;
use Yeepay\Yop\Sdk\Client\ClientParams;
use Yeepay\Yop\Sdk\Exception\YopClientException;
use Yeepay\Yop\Sdk\Service\Yop\Model as Model;
class YopClient
{
/**
* @var ClientHandler
*/
private $clientHandler;
/**
* YopClient constructor.
* @param ClientParams $clientParams
*/
function __construct(ClientParams $clientParams)
{
$this->clientHandler = new ClientHandler($clientParams);
}
/**
* @param Model\Oauth2ReportKeyRequest $request
* @return Model\Oauth2ReportKeyResponse
* @throws YopClientException
*/
public function oauth2ReportKey(Model\Oauth2ReportKeyRequest $request)
{
if ($request == null) {
throw new YopClientException("request is required.");
}
$clientExecutionParams = new ClientExecutionParams($request,
Model\Oauth2ReportKeyRequestMarshaller::getInstance(),
Model\Oauth2ReportKeyResponseUnMarshaller::getInstance());
return $this->clientHandler->execute($clientExecutionParams);
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace Yeepay\Yop\Sdk\Service\Yop;
use Yeepay\Yop\Sdk\Auth\AuthorityReqRegistryImpl;
use Yeepay\Yop\Sdk\Auth\AuthorizationReqRegistry;
use Yeepay\Yop\Sdk\Client\ClientParams;
use Yeepay\Yop\Sdk\Client\Support\ClientParamsSupport;
use Yeepay\Yop\Sdk\Config\AppSdkConfig;
use Yeepay\Yop\Sdk\Config\AppSdkConfigProvider;
use Yeepay\Yop\Sdk\Config\DefaultAppSdkConfigProvider;
use Yeepay\Yop\Sdk\Exception\YopClientException;
class YopClientBuilder
{
/**
* @var AuthorizationReqRegistry
*/
private static $authorizationReqRegistry;
public static function __init()
{
self::$authorizationReqRegistry = new AuthorityReqRegistryImpl();
}
/**
* @var ClientParams
*/
private $clientParams;
/**
* YopClientBuilder constructor.
* @param ClientParams $clientParams
*/
public function __construct(ClientParams $clientParams)
{
$this->clientParams = $clientParams;
}
public function build()
{
return new YopClient($this->clientParams);
}
/**
* @param $config AppSdkConfig|array|AppSdkConfigProvider
* @return YopClientBuilder
* @throws YopClientException
*/
public static function builder($config)
{
$appSdkConfigProvider = null;
if ($config instanceof AppSdkConfigProvider) {
$appSdkConfigProvider = $config;
} else {
$appSdkConfigProvider = new DefaultAppSdkConfigProvider($config);
}
$clientParams = ClientParamsSupport::generateClientParams($appSdkConfigProvider);
$clientParams->setAuthorizationReqRegistry(self::$authorizationReqRegistry);
return new YopClientBuilder($clientParams);
}
}
YopClientBuilder::__init();