Skip to content

Commit

Permalink
chore: update SDK from api-definitions (#683)
Browse files Browse the repository at this point in the history
Co-authored-by: rebilly-machine-user <[email protected]>
Co-authored-by: Arif Kurkchi <[email protected]>
Co-authored-by: Arif Kurkchi <[email protected]>
  • Loading branch information
4 people authored Apr 11, 2024
1 parent 8647367 commit 5f15fd3
Show file tree
Hide file tree
Showing 78 changed files with 1,487 additions and 1,351 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-houses-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Improve type hints for API classes
21 changes: 12 additions & 9 deletions src/Api/AllowlistsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ public function delete(
$this->client->send($request);
}

/**
* @return Allowlist
*/
public function getAllowlist(
string $id,
): Allowlist {
Expand All @@ -51,7 +48,9 @@ public function getAllowlist(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/allowlists/{id}');

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -75,7 +74,9 @@ public function getAllowlistCollection(
];
$uri = '/allowlists?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -87,6 +88,9 @@ public function getAllowlistCollection(
);
}

/**
* @return Paginator<Allowlist>
*/
public function getAllowlistCollectionPaginator(
?string $filter = null,
?array $sort = null,
Expand All @@ -106,15 +110,14 @@ public function getAllowlistCollectionPaginator(
);
}

/**
* @return Allowlist
*/
public function storeAllowlist(
Allowlist $allowlist,
): Allowlist {
$uri = '/allowlists';

$request = new Request('POST', $uri, body: Utils::jsonEncode($allowlist));
$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($allowlist));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
35 changes: 18 additions & 17 deletions src/Api/AmlChecksApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return AmlCheck
*/
public function get(
string $id,
): AmlCheck {
Expand All @@ -39,7 +36,9 @@ public function get(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/aml-checks/{id}');

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -65,7 +64,9 @@ public function getAll(
];
$uri = '/aml-checks?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -77,6 +78,9 @@ public function getAll(
);
}

/**
* @return Paginator<AmlCheck>
*/
public function getAllPaginator(
?int $limit = null,
?int $offset = null,
Expand All @@ -98,9 +102,6 @@ public function getAllPaginator(
);
}

/**
* @return AmlCheck
*/
public function review(
string $id,
AmlCheckReview $amlCheckReview,
Expand All @@ -111,16 +112,15 @@ public function review(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/aml-checks/{id}/review');

$request = new Request('POST', $uri, body: Utils::jsonEncode($amlCheckReview));
$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($amlCheckReview));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return AmlCheck::from($data);
}

/**
* @return AmlCheck
*/
public function startReview(
string $id,
): AmlCheck {
Expand All @@ -130,16 +130,15 @@ public function startReview(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/aml-checks/{id}/start-review');

$request = new Request('POST', $uri);
$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return AmlCheck::from($data);
}

/**
* @return AmlCheck
*/
public function stopReview(
string $id,
): AmlCheck {
Expand All @@ -149,7 +148,9 @@ public function stopReview(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/aml-checks/{id}/stop-review');

$request = new Request('POST', $uri);
$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
14 changes: 6 additions & 8 deletions src/Api/AmlSettingsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,27 @@ public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return AmlSettings
*/
public function getAmlSettings(): AmlSettings
{
$uri = '/aml-settings';

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return AmlSettings::from($data);
}

/**
* @return AmlSettings
*/
public function putAmlSettings(
AmlSettings $amlSettings,
): AmlSettings {
$uri = '/aml-settings';

$request = new Request('PUT', $uri, body: Utils::jsonEncode($amlSettings));
$request = new Request('PUT', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($amlSettings));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
28 changes: 15 additions & 13 deletions src/Api/ApiKeysApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ public function __construct(protected ?ClientInterface $client)
{
}

/**
* @return ApiKey
*/
public function create(
ApiKey $apiKey,
): ApiKey {
$uri = '/api-keys';

$request = new Request('POST', $uri, body: Utils::jsonEncode($apiKey));
$request = new Request('POST', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($apiKey));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -54,9 +53,6 @@ public function delete(
$this->client->send($request);
}

/**
* @return ApiKey
*/
public function get(
string $id,
): ApiKey {
Expand All @@ -66,7 +62,9 @@ public function get(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/api-keys/{id}');

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -88,7 +86,9 @@ public function getAll(
];
$uri = '/api-keys?' . http_build_query($queryParams);

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand All @@ -100,6 +100,9 @@ public function getAll(
);
}

/**
* @return Paginator<ApiKey>
*/
public function getAllPaginator(
?int $limit = null,
?int $offset = null,
Expand All @@ -117,9 +120,6 @@ public function getAllPaginator(
);
}

/**
* @return ApiKey
*/
public function update(
string $id,
ApiKey $apiKey,
Expand All @@ -130,7 +130,9 @@ public function update(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/api-keys/{id}');

$request = new Request('PUT', $uri, body: Utils::jsonEncode($apiKey));
$request = new Request('PUT', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($apiKey));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
28 changes: 12 additions & 16 deletions src/Api/ApplicationInstancesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public function delete(
$this->client->send($request);
}

/**
* @return ApplicationInstance
*/
public function get(
string $applicationId,
): ApplicationInstance {
Expand All @@ -50,16 +47,15 @@ public function get(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/application-instances/{applicationId}');

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return ApplicationInstance::from($data);
}

/**
* @return ApplicationInstanceConfiguration
*/
public function getConfiguration(
string $applicationId,
): ApplicationInstanceConfiguration {
Expand All @@ -69,16 +65,15 @@ public function getConfiguration(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/application-instances/{applicationId}/configuration');

$request = new Request('GET', $uri);
$request = new Request('GET', $uri, headers: [
'Accept' => 'application/json',
]);
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return ApplicationInstanceConfiguration::from($data);
}

/**
* @return ApplicationInstance
*/
public function upsert(
string $applicationId,
ApplicationInstance $applicationInstance,
Expand All @@ -89,16 +84,15 @@ public function upsert(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/application-instances/{applicationId}');

$request = new Request('PUT', $uri, body: Utils::jsonEncode($applicationInstance));
$request = new Request('PUT', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($applicationInstance));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

return ApplicationInstance::from($data);
}

/**
* @return ApplicationInstanceConfiguration
*/
public function upsertConfiguration(
string $applicationId,
ApplicationInstanceConfiguration $applicationInstanceConfiguration,
Expand All @@ -109,7 +103,9 @@ public function upsertConfiguration(

$uri = str_replace(array_keys($pathParams), array_values($pathParams), '/application-instances/{applicationId}/configuration');

$request = new Request('PUT', $uri, body: Utils::jsonEncode($applicationInstanceConfiguration));
$request = new Request('PUT', $uri, headers: [
'Accept' => 'application/json',
], body: Utils::jsonEncode($applicationInstanceConfiguration));
$response = $this->client->send($request);
$data = Utils::jsonDecode((string) $response->getBody(), true);

Expand Down
Loading

0 comments on commit 5f15fd3

Please sign in to comment.