php-api/src/ClientInterface.php

52 lines
1.1 KiB
PHP

<?php
namespace Toloka\PhpApi;
interface ClientInterface {
/**
* Login using credentials.
*
* @param string $login
* User login.
* @param string $password
* User password.
*
* @throws \Toloka\PhpApi\Exception\Auth\InvalidAuthCredentials
* @throws \Toloka\PhpApi\Exception\Auth\TooManyLoginAttempts
* @throws \Toloka\PhpApi\Exception\Auth\AuthException
* @throws \Psr\Http\Client\ClientExceptionInterface
*/
public function login(string $login, string $password): void;
/**
* Check if user logged in.
*
* @return bool
*
* @throws \Psr\Http\Client\ClientExceptionInterface
*/
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.
*
* @throws \Psr\Http\Client\ClientExceptionInterface
*/
public function getTopic(int $id): TopicInterface;
}