2022-10-12 23:37:30 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Toloka\PhpApi;
|
|
|
|
|
|
|
|
interface ClientInterface {
|
|
|
|
|
2022-10-13 23:52:21 +03:00
|
|
|
/**
|
|
|
|
* Get Toloka base url.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
* Absolute URL to toloka.
|
|
|
|
*/
|
|
|
|
public function getBaseUrl(): string;
|
|
|
|
|
2022-10-12 23:37:30 +03:00
|
|
|
/**
|
|
|
|
* Login using credentials.
|
|
|
|
*
|
|
|
|
* @param string $login
|
2022-10-13 20:18:48 +03:00
|
|
|
* User login.
|
2022-10-12 23:37:30 +03:00
|
|
|
* @param string $password
|
2022-10-13 20:18:48 +03:00
|
|
|
* User password.
|
2022-10-12 23:37:30 +03:00
|
|
|
*
|
2022-10-13 20:18:48 +03:00
|
|
|
* @throws \Toloka\PhpApi\Exception\Auth\InvalidAuthCredentials
|
|
|
|
* @throws \Toloka\PhpApi\Exception\Auth\TooManyLoginAttempts
|
|
|
|
* @throws \Psr\Http\Client\ClientExceptionInterface
|
2022-10-12 23:37:30 +03:00
|
|
|
*/
|
|
|
|
public function login(string $login, string $password): void;
|
|
|
|
|
2022-10-13 20:18:48 +03:00
|
|
|
/**
|
|
|
|
* Check if user logged in.
|
|
|
|
*
|
|
|
|
* @return bool
|
2022-10-16 23:44:23 +03:00
|
|
|
*
|
|
|
|
* @throws \Psr\Http\Client\ClientExceptionInterface
|
2022-10-13 20:18:48 +03:00
|
|
|
*/
|
|
|
|
public function isLoggedIn(): bool;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform user's logout.
|
|
|
|
*
|
|
|
|
* @throws \Psr\Http\Client\ClientExceptionInterface
|
|
|
|
*/
|
|
|
|
public function logout(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get topic by ID.
|
|
|
|
*
|
|
|
|
* @param int $id
|
|
|
|
* Integer serial number of topic.
|
|
|
|
*
|
|
|
|
* @return TopicInterface
|
|
|
|
* Object with populated topic data.
|
2022-10-16 23:44:23 +03:00
|
|
|
*
|
|
|
|
* @throws \Psr\Http\Client\ClientExceptionInterface
|
2022-10-13 20:18:48 +03:00
|
|
|
*/
|
|
|
|
public function getTopic(int $id): TopicInterface;
|
|
|
|
|
2022-10-12 23:37:30 +03:00
|
|
|
}
|