Skip to content

Commit

Permalink
Merge pull request #3 from php-etl/feature/update-endpoints
Browse files Browse the repository at this point in the history
Updated the generated client
  • Loading branch information
sebprt authored Oct 24, 2023
2 parents 0beedf3 + b2bc475 commit aebd5ea
Show file tree
Hide file tree
Showing 2,088 changed files with 92,594 additions and 65,929 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "0.2.x-dev"
"dev-main": "0.3.x-dev"
}
}
}
2 changes: 1 addition & 1 deletion jane/gyroscops.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/Authentication/ApiKeyAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public function __construct(string $apiKey)

public function authentication(\Psr\Http\Message\RequestInterface $request): \Psr\Http\Message\RequestInterface
{
return $request->withHeader('Authorization', $this->{'apiKey'});
$request = $request->withHeader('Authorization', $this->{'apiKey'});

return $request;
}

public function getScope(): string
Expand Down
2,629 changes: 1,408 additions & 1,221 deletions src/Client.php

Large diffs are not rendered by default.

32 changes: 23 additions & 9 deletions src/Endpoint/AcceptReferralRequestReferralRequestItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ class AcceptReferralRequestReferralRequestItem extends \Gyroscops\Api\Runtime\Cl
{
use \Gyroscops\Api\Runtime\Client\EndpointTrait;
protected $id;
protected $accept;

/**
* Accepts a referral request.
*
* @param string $id Resource identifier
* @param null $requestBody
* @param array $accept Accept content header application/ld+json|application/json|text/html
*/
public function __construct(string $id, $requestBody = null)
public function __construct(string $id, $requestBody = null, array $accept = [])
{
$this->id = $id;
$this->body = $requestBody;
$this->accept = $accept;
}

public function getMethod(): string
Expand All @@ -44,31 +47,42 @@ public function getBody(\Symfony\Component\Serializer\SerializerInterface $seria

public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
if (empty($this->accept)) {
return ['Accept' => ['application/ld+json', 'application/json']];
}

return $this->accept;
}

/**
* {@inheritdoc}
*
* @return \Gyroscops\Api\Model\ReferralRequestReferralRequestRead|null
* @return \Gyroscops\Api\Model\ReferralRequestJsonldReferralRequestRead|\Gyroscops\Api\Model\ReferralRequestReferralRequestRead|null
*
* @throws \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemBadRequestException
* @throws \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemUnprocessableEntityException
* @throws \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemNotFoundException
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if ((null === $contentType) === false && (200 === $status && false !== mb_strpos($contentType, 'application/json'))) {
return $serializer->deserialize($body, \Gyroscops\Api\Model\ReferralRequestReferralRequestRead::class, 'json');
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (200 === $status) {
if (mb_strpos($contentType, 'application/ld+json') !== false) {
return $serializer->deserialize($body, 'Gyroscops\\Api\\Model\\ReferralRequestJsonldReferralRequestRead', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return $serializer->deserialize($body, 'Gyroscops\\Api\\Model\\ReferralRequestReferralRequestRead', 'json');
}
}
if (400 === $status) {
throw new \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemBadRequestException();
throw new \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemBadRequestException($response);
}
if (422 === $status) {
throw new \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemUnprocessableEntityException();
throw new \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemUnprocessableEntityException($response);
}
if (404 === $status) {
throw new \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemNotFoundException();
throw new \Gyroscops\Api\Exception\AcceptReferralRequestReferralRequestItemNotFoundException($response);
}
}

Expand Down
36 changes: 26 additions & 10 deletions src/Endpoint/AddAfterPipelineStepPipelineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ class AddAfterPipelineStepPipelineItem extends \Gyroscops\Api\Runtime\Client\Bas
{
use \Gyroscops\Api\Runtime\Client\EndpointTrait;
protected $id;
protected $accept;

/**
* Adds a step after another one in a pipeline.
*
* @param string $id Resource identifier
* @param \Gyroscops\Api\Model\PipelineAddAfterPipelineStepCommandInputJsonld|\Gyroscops\Api\Model\PipelineAddAfterPipelineStepCommandInput|null $requestBody
* @param array $accept Accept content header application/ld+json|application/json|text/html
*/
public function __construct(string $id, $requestBody = null)
public function __construct(string $id, $requestBody = null, array $accept = [])
{
$this->id = $id;
$this->body = $requestBody;
$this->accept = $accept;
}

public function getMethod(): string
Expand All @@ -34,13 +37,13 @@ public function getMethod(): string

public function getUri(): string
{
return str_replace(['{id}'], [$this->id], '/runtime/pipeline/{id}/step/{code}/add-after');
return str_replace(['{id}'], [$this->id], '/runtime/pipelines/{id}/steps/{code}/add-after');
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
if ($this->body instanceof \Gyroscops\Api\Model\PipelineAddAfterPipelineStepCommandInputJsonld) {
return [['Content-Type' => ['application/ld+json']], $this->body];
return [['Content-Type' => ['application/ld+json']], $serializer->serialize($this->body, 'json')];
}
if ($this->body instanceof \Gyroscops\Api\Model\PipelineAddAfterPipelineStepCommandInput) {
return [['Content-Type' => ['application/json']], $serializer->serialize($this->body, 'json')];
Expand All @@ -54,29 +57,42 @@ public function getBody(\Symfony\Component\Serializer\SerializerInterface $seria

public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
if (empty($this->accept)) {
return ['Accept' => ['application/ld+json', 'application/json']];
}

return $this->accept;
}

/**
* {@inheritdoc}
*
* @return \Gyroscops\Api\Model\PipelineAddAfterPipelineStepCommandJsonldRead|null
*
* @throws \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemBadRequestException
* @throws \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemUnprocessableEntityException
* @throws \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemNotFoundException
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if ((null === $contentType) === false && (202 === $status && false !== mb_strpos($contentType, 'application/json'))) {
return json_decode($body, null, 512, \JSON_THROW_ON_ERROR);
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (202 === $status) {
if (mb_strpos($contentType, 'application/ld+json') !== false) {
return $serializer->deserialize($body, 'Gyroscops\\Api\\Model\\PipelineAddAfterPipelineStepCommandJsonldRead', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return json_decode($body);
}
}
if (400 === $status) {
throw new \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemBadRequestException();
throw new \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemBadRequestException($response);
}
if (422 === $status) {
throw new \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemUnprocessableEntityException();
throw new \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemUnprocessableEntityException($response);
}
if (404 === $status) {
throw new \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemNotFoundException();
throw new \Gyroscops\Api\Exception\AddAfterPipelineStepPipelineItemNotFoundException($response);
}
}

Expand Down
36 changes: 26 additions & 10 deletions src/Endpoint/AddBeforePipelineStepPipelineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ class AddBeforePipelineStepPipelineItem extends \Gyroscops\Api\Runtime\Client\Ba
{
use \Gyroscops\Api\Runtime\Client\EndpointTrait;
protected $id;
protected $accept;

/**
* Adds a step before another one in a pipeline.
*
* @param string $id Resource identifier
* @param \Gyroscops\Api\Model\PipelineAddBeforePipelineStepCommandInputJsonld|\Gyroscops\Api\Model\PipelineAddBeforePipelineStepCommandInput|null $requestBody
* @param array $accept Accept content header application/ld+json|application/json|text/html
*/
public function __construct(string $id, $requestBody = null)
public function __construct(string $id, $requestBody = null, array $accept = [])
{
$this->id = $id;
$this->body = $requestBody;
$this->accept = $accept;
}

public function getMethod(): string
Expand All @@ -34,13 +37,13 @@ public function getMethod(): string

public function getUri(): string
{
return str_replace(['{id}'], [$this->id], '/runtime/pipeline/{id}/step/{code}/add-before');
return str_replace(['{id}'], [$this->id], '/runtime/pipelines/{id}/steps/{code}/add-before');
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
if ($this->body instanceof \Gyroscops\Api\Model\PipelineAddBeforePipelineStepCommandInputJsonld) {
return [['Content-Type' => ['application/ld+json']], $this->body];
return [['Content-Type' => ['application/ld+json']], $serializer->serialize($this->body, 'json')];
}
if ($this->body instanceof \Gyroscops\Api\Model\PipelineAddBeforePipelineStepCommandInput) {
return [['Content-Type' => ['application/json']], $serializer->serialize($this->body, 'json')];
Expand All @@ -54,29 +57,42 @@ public function getBody(\Symfony\Component\Serializer\SerializerInterface $seria

public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
if (empty($this->accept)) {
return ['Accept' => ['application/ld+json', 'application/json']];
}

return $this->accept;
}

/**
* {@inheritdoc}
*
* @return \Gyroscops\Api\Model\PipelineAddBeforePipelineStepCommandJsonldRead|null
*
* @throws \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemBadRequestException
* @throws \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemUnprocessableEntityException
* @throws \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemNotFoundException
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if ((null === $contentType) === false && (202 === $status && false !== mb_strpos($contentType, 'application/json'))) {
return json_decode($body, null, 512, \JSON_THROW_ON_ERROR);
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (202 === $status) {
if (mb_strpos($contentType, 'application/ld+json') !== false) {
return $serializer->deserialize($body, 'Gyroscops\\Api\\Model\\PipelineAddBeforePipelineStepCommandJsonldRead', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return json_decode($body);
}
}
if (400 === $status) {
throw new \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemBadRequestException();
throw new \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemBadRequestException($response);
}
if (422 === $status) {
throw new \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemUnprocessableEntityException();
throw new \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemUnprocessableEntityException($response);
}
if (404 === $status) {
throw new \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemNotFoundException();
throw new \Gyroscops\Api\Exception\AddBeforePipelineStepPipelineItemNotFoundException($response);
}
}

Expand Down
36 changes: 26 additions & 10 deletions src/Endpoint/AddComposerAuthPipelinePipelineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ class AddComposerAuthPipelinePipelineItem extends \Gyroscops\Api\Runtime\Client\
{
use \Gyroscops\Api\Runtime\Client\EndpointTrait;
protected $id;
protected $accept;

/**
* Adds a composer auth to a pipeline.
*
* @param string $id Resource identifier
* @param \Gyroscops\Api\Model\PipelineAddPipelineComposerAuthCommandInputJsonld|\Gyroscops\Api\Model\PipelineAddPipelineComposerAuthCommandInput|null $requestBody
* @param array $accept Accept content header application/ld+json|application/json|text/html
*/
public function __construct(string $id, $requestBody = null)
public function __construct(string $id, $requestBody = null, array $accept = [])
{
$this->id = $id;
$this->body = $requestBody;
$this->accept = $accept;
}

public function getMethod(): string
Expand All @@ -34,13 +37,13 @@ public function getMethod(): string

public function getUri(): string
{
return str_replace(['{id}'], [$this->id], '/runtime/pipeline/{id}/add-composer-auth');
return str_replace(['{id}'], [$this->id], '/runtime/pipelines/{id}/add-composer-auth');
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
if ($this->body instanceof \Gyroscops\Api\Model\PipelineAddPipelineComposerAuthCommandInputJsonld) {
return [['Content-Type' => ['application/ld+json']], $this->body];
return [['Content-Type' => ['application/ld+json']], $serializer->serialize($this->body, 'json')];
}
if ($this->body instanceof \Gyroscops\Api\Model\PipelineAddPipelineComposerAuthCommandInput) {
return [['Content-Type' => ['application/json']], $serializer->serialize($this->body, 'json')];
Expand All @@ -54,29 +57,42 @@ public function getBody(\Symfony\Component\Serializer\SerializerInterface $seria

public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
if (empty($this->accept)) {
return ['Accept' => ['application/ld+json', 'application/json']];
}

return $this->accept;
}

/**
* {@inheritdoc}
*
* @return \Gyroscops\Api\Model\PipelineAddPipelineComposerAuthCommandJsonldRead|null
*
* @throws \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemBadRequestException
* @throws \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemUnprocessableEntityException
* @throws \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemNotFoundException
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if ((null === $contentType) === false && (202 === $status && false !== mb_strpos($contentType, 'application/json'))) {
return json_decode($body, null, 512, \JSON_THROW_ON_ERROR);
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (202 === $status) {
if (mb_strpos($contentType, 'application/ld+json') !== false) {
return $serializer->deserialize($body, 'Gyroscops\\Api\\Model\\PipelineAddPipelineComposerAuthCommandJsonldRead', 'json');
}
if (mb_strpos($contentType, 'application/json') !== false) {
return json_decode($body);
}
}
if (400 === $status) {
throw new \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemBadRequestException();
throw new \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemBadRequestException($response);
}
if (422 === $status) {
throw new \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemUnprocessableEntityException();
throw new \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemUnprocessableEntityException($response);
}
if (404 === $status) {
throw new \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemNotFoundException();
throw new \Gyroscops\Api\Exception\AddComposerAuthPipelinePipelineItemNotFoundException($response);
}
}

Expand Down
Loading

0 comments on commit aebd5ea

Please sign in to comment.