Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Client by latest generator And Modified Laravel version scope #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"require": {
"php": ">=8.0.2",
"laravel/framework": ">=6.20 <10",
"laravel/framework": ">=9 <12",
"guzzlehttp/guzzle": "^7.4",
"guzzlehttp/psr7": "^1.7.0|^2.0",
"guzzlehttp/promises": "^1.4.0",
Expand Down
4 changes: 2 additions & 2 deletions generated/ApiLog/Authentication/BearerAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public function __construct(string $token)
{
$this->{'token'} = $token;
}
public function authentication(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\RequestInterface
public function authentication(\Psr\Http\Message\RequestInterface $request): \Psr\Http\Message\RequestInterface
{
$header = sprintf('Bearer %s', $this->{'token'});
$request = $request->withHeader('Authorization', $header);
return $request;
}
public function getScope() : string
public function getScope(): string
{
return 'Bearer';
}
Expand Down
24 changes: 16 additions & 8 deletions generated/ApiLog/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@
class Client extends \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\Client
{
/**
* Retrieve the log of all API executions.
*
* @param array $queryParameters {
* @var string $created_date The date, in format of YYYY-MM-DD, to retrieve the log.
* @var string $created_at The datetime, in ISO 8601 format, to retrieve the log.
* @var int $limit Maximum number of logs to retrieve.
* @var string $cursor Cursor for cursor pagination.
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\GetLogsInternalServerErrorException
*
* @return null|\AntiPatternInc\Saasus\Sdk\ApiLog\Model\ApiLogs|\Psr\Http\Message\ResponseInterface
*/
public function getLogs(string $fetch = self::FETCH_OBJECT)
public function getLogs(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \AntiPatternInc\Saasus\Sdk\ApiLog\Endpoint\GetLogs(), $fetch);
return $this->executeEndpoint(new \AntiPatternInc\Saasus\Sdk\ApiLog\Endpoint\GetLogs($queryParameters), $fetch);
}
/**
* 指定したIDのAPI実行のログ登録を取得します。
* Retrieve the log of the API execution with the specified ID.
*
* @param string $apiLogId APIログID(API Log ID)
* @param string $apiLogId API Log ID
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
* @throws \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\GetLogInternalServerErrorException
*
Expand All @@ -37,11 +45,11 @@ public function returnInternalServerError(string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new \AntiPatternInc\Saasus\Sdk\ApiLog\Endpoint\ReturnInternalServerError(), $fetch);
}
public static function create($httpClient = null, array $additionalPlugins = array(), array $additionalNormalizers = array())
public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = [])
{
if (null === $httpClient) {
$httpClient = \Http\Discovery\Psr18ClientDiscovery::find();
$plugins = array();
$plugins = [];
$uri = \Http\Discovery\Psr17FactoryDiscovery::findUriFactory()->createUri('https://api.saasus.io/v1/apilog');
$plugins[] = new \Http\Client\Common\Plugin\AddHostPlugin($uri);
$plugins[] = new \Http\Client\Common\Plugin\AddPathPlugin($uri);
Expand All @@ -52,11 +60,11 @@ public static function create($httpClient = null, array $additionalPlugins = arr
}
$requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();
$streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory();
$normalizers = array(new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \AntiPatternInc\Saasus\Sdk\ApiLog\Normalizer\JaneObjectNormalizer());
$normalizers = [new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \AntiPatternInc\Saasus\Sdk\ApiLog\Normalizer\JaneObjectNormalizer()];
if (count($additionalNormalizers) > 0) {
$normalizers = array_merge($normalizers, $additionalNormalizers);
}
$serializer = new \Symfony\Component\Serializer\Serializer($normalizers, array(new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(array('json_decode_associative' => true)))));
$serializer = new \Symfony\Component\Serializer\Serializer($normalizers, [new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(['json_decode_associative' => true]))]);
return new static($httpClient, $requestFactory, $serializer, $streamFactory);
}
}
24 changes: 12 additions & 12 deletions generated/ApiLog/Endpoint/GetLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ class GetLog extends \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\BaseEndpoi
{
protected $api_log_id;
/**
* 指定したIDのAPI実行のログ登録を取得します。
* Retrieve the log of the API execution with the specified ID.
*
* @param string $apiLogId APIログID(API Log ID)
* @param string $apiLogId API Log ID
*/
public function __construct(string $apiLogId)
{
$this->api_log_id = $apiLogId;
}
use \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\EndpointTrait;
public function getMethod() : string
public function getMethod(): string
{
return 'GET';
}
public function getUri() : string
public function getUri(): string
{
return str_replace(array('{api_log_id}'), array($this->api_log_id), '/logs/{api_log_id}');
return str_replace(['{api_log_id}'], [$this->api_log_id], '/logs/{api_log_id}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return array(array(), null);
return [[], null];
}
public function getExtraHeaders() : array
public function getExtraHeaders(): array
{
return array('Accept' => array('application/json'));
return ['Accept' => ['application/json']];
}
/**
* {@inheritdoc}
Expand All @@ -46,11 +46,11 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
return json_decode($body);
}
if (is_null($contentType) === false && (500 === $status && mb_strpos($contentType, 'application/json') !== false)) {
throw new \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\GetLogInternalServerErrorException($serializer->deserialize($body, 'AntiPatternInc\\Saasus\\Sdk\\ApiLog\\Model\\Error', 'json'), $response);
throw new \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\GetLogInternalServerErrorException($serializer->deserialize($body, 'AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error', 'json'), $response);
}
}
public function getAuthenticationScopes() : array
public function getAuthenticationScopes(): array
{
return array('Bearer');
return ['Bearer'];
}
}
46 changes: 36 additions & 10 deletions generated/ApiLog/Endpoint/GetLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,48 @@

class GetLogs extends \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\BaseEndpoint implements \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\Endpoint
{
/**
* Retrieve the log of all API executions.
*
* @param array $queryParameters {
* @var string $created_date The date, in format of YYYY-MM-DD, to retrieve the log.
* @var string $created_at The datetime, in ISO 8601 format, to retrieve the log.
* @var int $limit Maximum number of logs to retrieve.
* @var string $cursor Cursor for cursor pagination.
* }
*/
public function __construct(array $queryParameters = [])
{
$this->queryParameters = $queryParameters;
}
use \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\EndpointTrait;
public function getMethod() : string
public function getMethod(): string
{
return 'GET';
}
public function getUri() : string
public function getUri(): string
{
return '/logs';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return [[], null];
}
public function getExtraHeaders(): array
{
return array(array(), null);
return ['Accept' => ['application/json']];
}
public function getExtraHeaders() : array
protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
return array('Accept' => array('application/json'));
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(['created_date', 'created_at', 'limit', 'cursor']);
$optionsResolver->setRequired([]);
$optionsResolver->setDefaults([]);
$optionsResolver->addAllowedTypes('created_date', ['string']);
$optionsResolver->addAllowedTypes('created_at', ['string']);
$optionsResolver->addAllowedTypes('limit', ['int']);
$optionsResolver->addAllowedTypes('cursor', ['string']);
return $optionsResolver;
}
/**
* {@inheritdoc}
Expand All @@ -33,14 +59,14 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
return $serializer->deserialize($body, 'AntiPatternInc\\Saasus\\Sdk\\ApiLog\\Model\\ApiLogs', 'json');
return $serializer->deserialize($body, 'AntiPatternInc\Saasus\Sdk\ApiLog\Model\ApiLogs', 'json');
}
if (is_null($contentType) === false && (500 === $status && mb_strpos($contentType, 'application/json') !== false)) {
throw new \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\GetLogsInternalServerErrorException($serializer->deserialize($body, 'AntiPatternInc\\Saasus\\Sdk\\ApiLog\\Model\\Error', 'json'), $response);
throw new \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\GetLogsInternalServerErrorException($serializer->deserialize($body, 'AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error', 'json'), $response);
}
}
public function getAuthenticationScopes() : array
public function getAuthenticationScopes(): array
{
return array('Bearer');
return ['Bearer'];
}
}
18 changes: 9 additions & 9 deletions generated/ApiLog/Endpoint/ReturnInternalServerError.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
class ReturnInternalServerError extends \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\BaseEndpoint implements \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\Endpoint
{
use \AntiPatternInc\Saasus\Sdk\ApiLog\Runtime\Client\EndpointTrait;
public function getMethod() : string
public function getMethod(): string
{
return 'GET';
}
public function getUri() : string
public function getUri(): string
{
return '/errors/internal-server-error';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return array(array(), null);
return [[], null];
}
public function getExtraHeaders() : array
public function getExtraHeaders(): array
{
return array('Accept' => array('application/json'));
return ['Accept' => ['application/json']];
}
/**
* {@inheritdoc}
Expand All @@ -33,11 +33,11 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (is_null($contentType) === false && (500 === $status && mb_strpos($contentType, 'application/json') !== false)) {
throw new \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\ReturnInternalServerErrorInternalServerErrorException($serializer->deserialize($body, 'AntiPatternInc\\Saasus\\Sdk\\ApiLog\\Model\\Error', 'json'), $response);
throw new \AntiPatternInc\Saasus\Sdk\ApiLog\Exception\ReturnInternalServerErrorInternalServerErrorException($serializer->deserialize($body, 'AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error', 'json'), $response);
}
}
public function getAuthenticationScopes() : array
public function getAuthenticationScopes(): array
{
return array('Bearer');
return ['Bearer'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public function __construct(\AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error $error
$this->error = $error;
$this->response = $response;
}
public function getError() : \AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error
public function getError(): \AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error
{
return $this->error;
}
public function getResponse() : \Psr\Http\Message\ResponseInterface
public function getResponse(): \Psr\Http\Message\ResponseInterface
{
return $this->response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public function __construct(\AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error $error
$this->error = $error;
$this->response = $response;
}
public function getError() : \AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error
public function getError(): \AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error
{
return $this->error;
}
public function getResponse() : \Psr\Http\Message\ResponseInterface
public function getResponse(): \Psr\Http\Message\ResponseInterface
{
return $this->response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public function __construct(\AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error $error
$this->error = $error;
$this->response = $response;
}
public function getError() : \AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error
public function getError(): \AntiPatternInc\Saasus\Sdk\ApiLog\Model\Error
{
return $this->error;
}
public function getResponse() : \Psr\Http\Message\ResponseInterface
public function getResponse(): \Psr\Http\Message\ResponseInterface
{
return $this->response;
}
Expand Down
42 changes: 35 additions & 7 deletions generated/ApiLog/Model/ApiLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,65 @@ class ApiLogs extends \ArrayObject
/**
* @var array
*/
protected $initialized = array();
public function isInitialized($property) : bool
protected $initialized = [];
public function isInitialized($property): bool
{
return array_key_exists($property, $this->initialized);
}
/**
*
*
* @var array<string, mixed>[]|null
* @var list<array<string, mixed>>|null
*/
protected $apiLogs;
/**
* Cursor for cursor pagination
*
* @var string|null
*/
protected $cursor;
/**
*
*
* @return array<string, mixed>[]|null
* @return list<array<string, mixed>>|null
*/
public function getApiLogs() : ?array
public function getApiLogs(): ?array
{
return $this->apiLogs;
}
/**
*
*
* @param array<string, mixed>[]|null $apiLogs
* @param list<array<string, mixed>>|null $apiLogs
*
* @return self
*/
public function setApiLogs(?array $apiLogs) : self
public function setApiLogs(?array $apiLogs): self
{
$this->initialized['apiLogs'] = true;
$this->apiLogs = $apiLogs;
return $this;
}
/**
* Cursor for cursor pagination
*
* @return string|null
*/
public function getCursor(): ?string
{
return $this->cursor;
}
/**
* Cursor for cursor pagination
*
* @param string|null $cursor
*
* @return self
*/
public function setCursor(?string $cursor): self
{
$this->initialized['cursor'] = true;
$this->cursor = $cursor;
return $this;
}
}
Loading