first commit

This commit is contained in:
2026-01-14 16:40:33 +03:00
commit f803480f7b
184 changed files with 5573 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace Gemini\AlfaBank\Requests\Auth;
use Gemini\AlfaBank\Data\Auth\TokenData;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasFormBody;
use Saloon\Contracts\Body\HasBody;
class GetTokenRequest extends Request implements HasBody
{
use HasFormBody;
protected Method $method = Method::POST;
public function __construct(
protected string $clientId,
protected string $clientSecret,
protected string $code,
protected string $redirectUri,
protected string $grantType = 'authorization_code'
) {}
public function resolveEndpoint(): string
{
return '/oidc/token';
}
protected function defaultBody(): array
{
return [
'grant_type' => $this->grantType,
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'code' => $this->code,
'redirect_uri' => $this->redirectUri,
];
}
public function createDtoFromResponse(Response $response): TokenData
{
return TokenData::from($response->json());
}
}