Skip to content

Commit

Permalink
update SDK from api-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
rebilly-machine-user authored Nov 1, 2023
1 parent e3544b3 commit b311ad5
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 155 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-masks-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Fix DepositRequest.customAmount description Rebilly/api-definitions#1664
5 changes: 5 additions & 0 deletions .changeset/rich-starfishes-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Rename cashier to deposit Rebilly/api-definitions#1661
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Utils;
use Rebilly\Sdk\Collection;
use Rebilly\Sdk\Model\CashierCustomPropertySet;
use Rebilly\Sdk\Model\DepositCustomPropertySet;
use Rebilly\Sdk\Paginator;

class CashierCustomPropertySetsApi
class DepositCustomPropertySetsApi
{
public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return CashierCustomPropertySet
* @return DepositCustomPropertySet
*/
public function create(
CashierCustomPropertySet $cashierCustomPropertySet,
): CashierCustomPropertySet {
$uri = '/cashier-custom-property-sets';
DepositCustomPropertySet $depositCustomPropertySet,
): DepositCustomPropertySet {
$uri = '/deposit-custom-property-sets';

$request = new Request('POST', $uri, body: Utils::jsonEncode($cashierCustomPropertySet));
$request = new Request('POST', $uri, body: Utils::jsonEncode($depositCustomPropertySet));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierCustomPropertySet::from($data);
return DepositCustomPropertySet::from($data);
}

public function delete(
Expand All @@ -48,33 +48,33 @@ public function delete(
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-custom-property-sets/{id}');
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-custom-property-sets/{id}');

$request = new Request('DELETE', $uri);
$this->client->send($request);
}

/**
* @return CashierCustomPropertySet
* @return DepositCustomPropertySet
*/
public function get(
string $id,
): CashierCustomPropertySet {
): DepositCustomPropertySet {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-custom-property-sets/{id}');
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-custom-property-sets/{id}');

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierCustomPropertySet::from($data);
return DepositCustomPropertySet::from($data);
}

/**
* @return Collection<CashierCustomPropertySet>
* @return Collection<DepositCustomPropertySet>
*/
public function getAll(
?int $limit = null,
Expand All @@ -88,14 +88,14 @@ public function getAll(
'filter' => $filter,
'sort' => $sort ? implode(',', $sort) : null,
];
$uri = '/cashier-custom-property-sets?' . http_build_query($queryParams);
$uri = '/deposit-custom-property-sets?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return new Collection(
array_map(fn (array $item): CashierCustomPropertySet => CashierCustomPropertySet::from($item), $data),
array_map(fn (array $item): DepositCustomPropertySet => DepositCustomPropertySet::from($item), $data),
(int) $response->getHeaderLine(Collection::HEADER_LIMIT),
(int) $response->getHeaderLine(Collection::HEADER_OFFSET),
(int) $response->getHeaderLine(Collection::HEADER_TOTAL),
Expand All @@ -122,22 +122,22 @@ public function getAllPaginator(
}

/**
* @return CashierCustomPropertySet
* @return DepositCustomPropertySet
*/
public function update(
string $id,
CashierCustomPropertySet $cashierCustomPropertySet,
): CashierCustomPropertySet {
DepositCustomPropertySet $depositCustomPropertySet,
): DepositCustomPropertySet {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-custom-property-sets/{id}');
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-custom-property-sets/{id}');

$request = new Request('PUT', $uri, body: Utils::jsonEncode($cashierCustomPropertySet));
$request = new Request('PUT', $uri, body: Utils::jsonEncode($depositCustomPropertySet));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierCustomPropertySet::from($data);
return DepositCustomPropertySet::from($data);
}
}
32 changes: 16 additions & 16 deletions src/Api/CashierRequestsApi.php → src/Api/DepositRequestsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,56 @@
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Utils;
use Rebilly\Sdk\Collection;
use Rebilly\Sdk\Model\CashierRequest;
use Rebilly\Sdk\Model\PostCashierRequest;
use Rebilly\Sdk\Model\DepositRequest;
use Rebilly\Sdk\Model\PostDepositRequest;
use Rebilly\Sdk\Paginator;

class CashierRequestsApi
class DepositRequestsApi
{
public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return CashierRequest
* @return DepositRequest
*/
public function create(
PostCashierRequest $postCashierRequest,
): CashierRequest {
$uri = '/cashier-requests';
PostDepositRequest $postDepositRequest,
): DepositRequest {
$uri = '/deposit-requests';

$request = new Request('POST', $uri, body: Utils::jsonEncode($postCashierRequest));
$request = new Request('POST', $uri, body: Utils::jsonEncode($postDepositRequest));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierRequest::from($data);
return DepositRequest::from($data);
}

/**
* @return CashierRequest
* @return DepositRequest
*/
public function get(
string $id,
?string $expand = null,
): CashierRequest {
): DepositRequest {
$pathParams = [
'{id}' => $id,
];

$queryParams = [
'expand' => $expand,
];
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-requests/{id}?') . http_build_query($queryParams);
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-requests/{id}?') . http_build_query($queryParams);

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierRequest::from($data);
return DepositRequest::from($data);
}

/**
* @return Collection<CashierRequest>
* @return Collection<DepositRequest>
*/
public function getAll(
?int $limit = null,
Expand All @@ -80,14 +80,14 @@ public function getAll(
'filter' => $filter,
'sort' => $sort ? implode(',', $sort) : null,
];
$uri = '/cashier-requests?' . http_build_query($queryParams);
$uri = '/deposit-requests?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return new Collection(
array_map(fn (array $item): CashierRequest => CashierRequest::from($item), $data),
array_map(fn (array $item): DepositRequest => DepositRequest::from($item), $data),
(int) $response->getHeaderLine(Collection::HEADER_LIMIT),
(int) $response->getHeaderLine(Collection::HEADER_OFFSET),
(int) $response->getHeaderLine(Collection::HEADER_TOTAL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Utils;
use Rebilly\Sdk\Collection;
use Rebilly\Sdk\Model\CashierStrategy;
use Rebilly\Sdk\Model\DepositStrategy;
use Rebilly\Sdk\Paginator;

class CashierStrategiesApi
class DepositStrategiesApi
{
public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return CashierStrategy
* @return DepositStrategy
*/
public function create(
CashierStrategy $cashierStrategy,
): CashierStrategy {
$uri = '/cashier-strategies';
DepositStrategy $depositStrategy,
): DepositStrategy {
$uri = '/deposit-strategies';

$request = new Request('POST', $uri, body: Utils::jsonEncode($cashierStrategy));
$request = new Request('POST', $uri, body: Utils::jsonEncode($depositStrategy));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierStrategy::from($data);
return DepositStrategy::from($data);
}

public function delete(
Expand All @@ -48,33 +48,33 @@ public function delete(
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-strategies/{id}');
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-strategies/{id}');

$request = new Request('DELETE', $uri);
$this->client->send($request);
}

/**
* @return CashierStrategy
* @return DepositStrategy
*/
public function get(
string $id,
): CashierStrategy {
): DepositStrategy {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-strategies/{id}');
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-strategies/{id}');

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierStrategy::from($data);
return DepositStrategy::from($data);
}

/**
* @return Collection<CashierStrategy>
* @return Collection<DepositStrategy>
*/
public function getAll(
?int $limit = null,
Expand All @@ -88,14 +88,14 @@ public function getAll(
'filter' => $filter,
'sort' => $sort ? implode(',', $sort) : null,
];
$uri = '/cashier-strategies?' . http_build_query($queryParams);
$uri = '/deposit-strategies?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return new Collection(
array_map(fn (array $item): CashierStrategy => CashierStrategy::from($item), $data),
array_map(fn (array $item): DepositStrategy => DepositStrategy::from($item), $data),
(int) $response->getHeaderLine(Collection::HEADER_LIMIT),
(int) $response->getHeaderLine(Collection::HEADER_OFFSET),
(int) $response->getHeaderLine(Collection::HEADER_TOTAL),
Expand All @@ -122,22 +122,22 @@ public function getAllPaginator(
}

/**
* @return CashierStrategy
* @return DepositStrategy
*/
public function update(
string $id,
CashierStrategy $cashierStrategy,
): CashierStrategy {
DepositStrategy $depositStrategy,
): DepositStrategy {
$pathParams = [
'{id}' => $id,
];

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/cashier-strategies/{id}');
$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/deposit-strategies/{id}');

$request = new Request('PUT', $uri, body: Utils::jsonEncode($cashierStrategy));
$request = new Request('PUT', $uri, body: Utils::jsonEncode($depositStrategy));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return CashierStrategy::from($data);
return DepositStrategy::from($data);
}
}
Loading

0 comments on commit b311ad5

Please sign in to comment.