/
githubmirror
/
ydb-php-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-php-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.5.2
src/Operations.php
108 строк
2 KB
Ilya Kharev
Fixed refresh token when it expired
17 май 2023, 20:02
17 май 2023, 20:02
017261c
Код
Авторство
О чём код?
<?php namespace YdbPlatform\Ydb; use Psr\Log\LoggerInterface; use Ydb\Operations\V1\OperationServiceClient as ServiceClient; class Operations { use Traits\RequestTrait; use Traits\ParseResultTrait; use Traits\LoggerTrait; /** * @var ServiceClient */ protected $client; /** * @var array */ protected $meta; /** * @var LoggerInterface */ protected $logger; /** * @var Iam */ protected $credentials; /** * @param Ydb $ydb * @param LoggerInterface|null $logger */ public function __construct(Ydb $ydb, LoggerInterface $logger = null) { $this->client = new ServiceClient($ydb->endpoint(), [ 'credentials' => $ydb->iam()->getCredentials(), ]); $this->meta = $ydb->meta(); $this->credentials = $ydb->iam(); $this->logger = $logger; } /** * @param string $id * @return bool|mixed|void */ public function get(string $id) { return $this->request('GetOperation', [ 'id' => $id, ]); } /** * @param string $id * @return bool|mixed|void */ public function cancel(string $id) { return $this->request('CancelOperation', [ 'id' => $id, ]); } /** * @param string $id * @return bool|mixed|void */ public function forget(string $id) { return $this->request('ForgetOperation', [ 'id' => $id, ]); } /** * @param $kind * @param int $page_size * @param string $page_token * @return bool|mixed|void */ public function list($kind, int $page_size = 0, string $page_token = '') { return $this->request('ListOperations', [ 'kind' => $kind, 'page_size' => $page_size, 'page_token' => $page_token, ]); } /** * @param string $method * @param array $data * @return bool|mixed|void */ protected function request(string $method, array $data = []) { return $this->doRequest('Operations', $method, $data); } }