Skip to content

Commit

Permalink
T1745 - Method archive call (#7)
Browse files Browse the repository at this point in the history
* Generate

* Put refresh back

* Auto add files to git

* Generate

* New line

* Regen after rebase
  • Loading branch information
Jleagle authored May 26, 2021
1 parent 8b3efea commit 6874448
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 0 deletions.
13 changes: 13 additions & 0 deletions generated/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,19 @@ public function methodUpdate(string $token, \ChargeHive\Php\Sdk\Generated\Model\
{
return $this->executePsr7Endpoint(new \ChargeHive\Php\Sdk\Generated\Endpoint\MethodUpdate($token, $body), $fetch);
}
/**
*
*
* @param string $token
* @param \ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveRequest $body
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return null|\ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveResponse|\ChargeHive\Php\Sdk\Generated\Model\RuntimeError|\Psr\Http\Message\ResponseInterface
*/
public function methodArchive(string $token, \ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveRequest $body, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \ChargeHive\Php\Sdk\Generated\Endpoint\MethodArchive($token, $body), $fetch);
}
/**
*
*
Expand Down
49 changes: 49 additions & 0 deletions generated/Endpoint/MethodArchive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace ChargeHive\Php\Sdk\Generated\Endpoint;

class MethodArchive extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7HttplugEndpoint
{
protected $token;
/**
*
*
* @param string $token
* @param \ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveRequest $body
*/
public function __construct(string $token, \ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveRequest $body)
{
$this->token = $token;
$this->body = $body;
}
use \Jane\OpenApiRuntime\Client\Psr7HttplugEndpointTrait;
public function getMethod() : string
{
return 'POST';
}
public function getUri() : string
{
return str_replace(array('{token}'), array($this->token), '/v1/method/{token}/archive');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, \Http\Message\StreamFactory $streamFactory = null) : array
{
return $this->getSerializedBody($serializer);
}
public function getExtraHeaders() : array
{
return array('Accept' => array('application/json'));
}
/**
* {@inheritdoc}
*
*
* @return null|\ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveResponse|\ChargeHive\Php\Sdk\Generated\Model\RuntimeError
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
if (200 === $status) {
return $serializer->deserialize($body, 'ChargeHive\\Php\\Sdk\\Generated\\Model\\ChargehiveMethodArchiveResponse', 'json');
}
return $serializer->deserialize($body, 'ChargeHive\\Php\\Sdk\\Generated\\Model\\RuntimeError', 'json');
}
}
38 changes: 38 additions & 0 deletions generated/Model/ChargehiveMethodArchiveRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace ChargeHive\Php\Sdk\Generated\Model;

class ChargehiveMethodArchiveRequest implements \JsonSerializable
{
/**
*
*
* @var string
*/
protected $token;
/**
*
*
* @return string
*/
public function getToken()
{
return $this->token;
}
/**
*
*
* @param string $token
*
* @return self
*/
public function setToken(string $token)
{
$this->token = $token;
return $this;
}
public function jsonSerialize()
{
return ['token' => $this->token];
}
}
38 changes: 38 additions & 0 deletions generated/Model/ChargehiveMethodArchiveResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace ChargeHive\Php\Sdk\Generated\Model;

class ChargehiveMethodArchiveResponse implements \JsonSerializable
{
/**
*
*
* @var bool
*/
protected $success;
/**
*
*
* @return bool
*/
public function getSuccess()
{
return $this->success;
}
/**
*
*
* @param bool $success
*
* @return self
*/
public function setSuccess(bool $success)
{
$this->success = $success;
return $this;
}
public function jsonSerialize()
{
return ['success' => $this->success];
}
}
44 changes: 44 additions & 0 deletions generated/Normalizer/ChargehiveMethodArchiveRequestNormalizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace ChargeHive\Php\Sdk\Generated\Normalizer;

use Jane\JsonSchemaRuntime\Reference;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class ChargehiveMethodArchiveRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
public function supportsDenormalization($data, $type, $format = null)
{
return $type === 'ChargeHive\\Php\\Sdk\\Generated\\Model\\ChargehiveMethodArchiveRequest';
}
public function supportsNormalization($data, $format = null)
{
return get_class($data) === 'ChargeHive\\Php\\Sdk\\Generated\\Model\\ChargehiveMethodArchiveRequest';
}
public function denormalize($data, $class, $format = null, array $context = array())
{
if (!is_object($data)) {
throw new InvalidArgumentException();
}
$object = new \ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveRequest();
if (property_exists($data, 'token')) {
$object->setToken($data->{'token'});
}
return $object;
}
public function normalize($object, $format = null, array $context = array())
{
$data = new \stdClass();
if (null !== $object->getToken()) {
$data->{'token'} = $object->getToken();
}
return $data;
}
}
44 changes: 44 additions & 0 deletions generated/Normalizer/ChargehiveMethodArchiveResponseNormalizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace ChargeHive\Php\Sdk\Generated\Normalizer;

use Jane\JsonSchemaRuntime\Reference;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class ChargehiveMethodArchiveResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
public function supportsDenormalization($data, $type, $format = null)
{
return $type === 'ChargeHive\\Php\\Sdk\\Generated\\Model\\ChargehiveMethodArchiveResponse';
}
public function supportsNormalization($data, $format = null)
{
return get_class($data) === 'ChargeHive\\Php\\Sdk\\Generated\\Model\\ChargehiveMethodArchiveResponse';
}
public function denormalize($data, $class, $format = null, array $context = array())
{
if (!is_object($data)) {
throw new InvalidArgumentException();
}
$object = new \ChargeHive\Php\Sdk\Generated\Model\ChargehiveMethodArchiveResponse();
if (property_exists($data, 'success')) {
$object->setSuccess($data->{'success'});
}
return $object;
}
public function normalize($object, $format = null, array $context = array())
{
$data = new \stdClass();
if (null !== $object->getSuccess()) {
$data->{'success'} = $object->getSuccess();
}
return $data;
}
}
2 changes: 2 additions & 0 deletions generated/Normalizer/NormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public static function create()
$normalizers[] = new ChargehiveConnectionConfirmRequestNormalizer();
$normalizers[] = new ChargehiveConnectionValidateRequestNormalizer();
$normalizers[] = new ChargehiveConnectionValidateResponseNormalizer();
$normalizers[] = new ChargehiveMethodArchiveRequestNormalizer();
$normalizers[] = new ChargehiveMethodArchiveResponseNormalizer();
$normalizers[] = new ChargehiveMethodRefreshRequestNormalizer();
$normalizers[] = new ChargehiveMethodRefreshResponseNormalizer();
$normalizers[] = new ChargehiveMethodSuspendRequestNormalizer();
Expand Down
1 change: 1 addition & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
rm -rf ./generated
vendor/bin/jane-openapi generate
git add ./generated/*

0 comments on commit 6874448

Please sign in to comment.