refactor(core): enhance SDK structure and documentation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-01-18 21:48:25 +03:00
parent 3da69c03e1
commit d214eecebe
378 changed files with 10514 additions and 496 deletions

View File

@@ -1,28 +1,51 @@
<?php
/*
// MODULE_CONTRACT: Represents the API call to retrieve all requisites for a specific beneficiary.
// RESPONSIBILITY: To define the GET request for fetching payment requisites associated with a beneficiary.
// INPUTS: Beneficiary ID (string).
// OUTPUTS: A collection of RequisiteData DTOs.
*/
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Beneficiaries\Requisites;
// <SECTION name="module_imports" intent="Import DTO and Saloon components.">
// <BELIEF_STATE "This request returns a collection of `RequisiteData` DTOs.">
use Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries\Requisites\RequisiteData;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Spatie\LaravelData\DataCollection;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get requisites for a beneficiary.">
// <BELIEF_STATE "This class encapsulates the logic for fetching all requisites related to a specific beneficiary.">
class GetRequisitesRequest extends Request
{
// <SECTION name="http_method" intent="Declare the HTTP verb.">
// <BELIEF_STATE "GET is the correct verb for retrieving a collection of resources.">
protected Method $method = Method::GET;
// </SECTION>
// <SECTION name="constructor" intent="Inject the beneficiary's unique identifier.">
// <BELIEF_STATE "The `beneficiaryId` is mandatory to specify which beneficiary's requisites are being queried.">
public function __construct(
protected string $beneficiaryId
) {}
// </SECTION>
// <SECTION name="endpoint_resolver" intent="Construct the request URI for beneficiary requisites.">
// <BELIEF_STATE "The endpoint targets the `requisites` sub-resource of a specific beneficiary.">
public function resolveEndpoint(): string
{
return "/api/na/jp/v1/beneficiaries/{$this->beneficiaryId}/requisites";
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON array response to a collection of DTOs.">
// <BELIEF_STATE "The API returns a JSON array. Using `RequisiteData::collect` automatically converts this array into a type-safe, iterable `DataCollection` of `RequisiteData` objects.">
public function createDtoFromResponse(Response $response): DataCollection
{
return RequisiteData::collect($response->json(), DataCollection::class);
}
// </SECTION>
}