Files
alfa-bank-sdk/src/Requests/NominalAccounts/Deals/Steps/GetStepRequest.php
Anatoliy Poloz b15d29f8e9 fix(formating)
2026-01-28 03:36:26 +03:00

55 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
/*
// MODULE_CONTRACT: Represents the API call to retrieve a single step for a specific deal.
// RESPONSIBILITY: To define the GET request for fetching details of a particular deal step.
// INPUTS: Deal ID, step ID.
// OUTPUTS: StepData (DTO).
*/
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Deals\Steps;
// <SECTION name="module_imports" intent="Import DTO and Saloon components.">
// <BELIEF_STATE "This request requires the `StepData` DTO for its response.">
use Apoloz\AlfaBank\Data\NominalAccounts\Deals\Steps\StepData;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get a single deal step.">
// <BELIEF_STATE "A dedicated class provides a clean and reusable way to fetch details of a specific step within a deal.">
class GetStepRequest extends Request
{
// <SECTION name="http_method" intent="Declare the HTTP verb.">
// <BELIEF_STATE "Retrieving a specific resource by its ID is a read-only operation, making GET the correct RESTful verb.">
protected Method $method = Method::GET;
// </SECTION>
// <SECTION name="constructor" intent="Inject the deal ID and step ID.">
// <BELIEF_STATE "Both `dealId` and `stepId` are mandatory path parameters to identify the specific step being queried.">
public function __construct(
protected string $dealId,
protected string $stepId
) {}
// </SECTION>
// <SECTION name="endpoint_resolver" intent="Construct the request URI for a specific deal step.">
// <BELIEF_STATE "The endpoint is dynamically constructed with both `dealId` and `stepId` to target the precise step resource.">
public function resolveEndpoint(): string
{
return "/api/na/jp/v1/deals/{$this->dealId}/steps/{$this->stepId}";
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a StepData DTO.">
// <BELIEF_STATE "Automated casting to a `StepData` DTO ensures a type-safe and comprehensive object representation of the deal step.">
public function createDtoFromResponse(Response $response): StepData
{
return StepData::from($response->json());
}
// </SECTION>
}