function it_gets_my_badges(Client $client) { $client->get('/me/badges', ['site' => 'stackoverflow', 'sort' => 'rank', 'order' => 'desc'])->shouldBeCalled()->willReturn($this->response); $this->getMyBadges()->shouldBeArray(); }
/** * Allows an application to de-authorize itself for a set of users. * * More info: https://api.stackexchange.com/docs/application-de-authenticate * * @param string[] $accessTokens The array which contains the accessTokens delimited by semicolon * @param string[] $params QueryString parameter(s), it admits page and pagesize; by default is null * * @return array<BenatEspina\StackExchangeApiClient\Model\AccessTokenInterface> */ public function getDeAuthenticateAccessTokens($accessTokens, $params = []) { return $this->responseToAccessToken($this->client->get($this->prefix . '/' . implode(';', $accessTokens) . '/de-authenticate', $params)); }
function it_gets_answers_by_id(Client $client) { $client->get('/answers/25652752;25652751', ['site' => 'stackoverflow', 'sort' => 'activity'])->shouldBeCalled()->willReturn(['items' => [['owner' => ['user_id' => 501696, 'reputation' => 42799, 'accept_rate' => 90, 'user_type' => 'registered', 'profile_image' => 'http://i.stack.imgur.com/fDhYT.jpg?s=128&g=1', 'display_name' => 'benatespina', 'link' => 'http://stackoverflow.com/users/2359967/benatespina'], 'is_accepted' => false, 'score' => 0, 'last_activity_date' => 1409845665, 'creation_date' => 1409845665, 'answer_id' => 25652752, 'question_id' => 25669612], ['owner' => ['user_id' => 2359967, 'reputation' => 1003, 'user_type' => 'registered', 'profile_image' => 'http://i.stack.imgur.com/loshM.png?s=128&g=1', 'display_name' => 'benatespina', 'link' => 'http://stackoverflow.com/users/2359967/benatespina'], 'is_accepted' => false, 'score' => 0, 'last_activity_date' => 1409845665, 'creation_date' => 1409845665, 'answer_id' => 25652751, 'question_id' => 25669612]]]); $this->getByIds(['25652752', '25652751'])->shouldBeArray(); }
function it_gets_de_authenticate_access_tokens(Client $client) { $client->get('/access-tokens/access-token-1;access-token-2/de-authenticate', [])->shouldBeCalled()->willReturn($this->response); $this->getDeAuthenticateAccessTokens(['access-token-1', 'access-token-2'])->shouldBeArray(); }
function it_gets_all_errors(Client $client) { $client->get('/errors', [])->shouldBeCalled()->willReturn($this->response); $this->getAll()->shouldBeArray(); }
function it_gets_filters(Client $client) { $client->get('/filters/filter-1;filter-2')->shouldBeCalled()->willReturn($this->response); $this->getFilters(['filter-1', 'filter-2'])->shouldBeArray(); }
/** * Returns the fields included by the given filters, and the "safeness" of those filters. * * More info: https://api.stackexchange.com/docs/read-filter * * @param string[] $filters The array which contains the filters delimited by semicolon * * @return array<BenatEspina\StackExchangeApiClient\Model\Interfaces\FilterInterface> */ public function getFilters($filters) { return $this->responseToFilter($this->client->get($this->prefix . '/' . implode(';', $filters))); }
/** * Returns the comments mentioning the user associated with the given access_token. * * More info: https://api.stackexchange.com/docs/me-mentioned * * @param string[] $params QueryString parameter(s), by default, the basic to work: * array('site' => 'stackoverflow', 'sort' => 'creation', 'order' => 'desc') * * @return array<BenatEspina\StackExchangeApiClient\Model\Interfaces\CommentInterface> */ public function getMyMentions($params = ['site' => 'stackoverflow', 'sort' => 'creation']) { return $this->responseToArray($this->client->get('/me/mentioned', $params)); }
/** * Get all users, in alphabetical order. * * More info: https://api.stackexchange.com/docs/users * * @param string[] $params QueryString parameter(s), by default, the basic to work: * array('site' => 'stackoverflow', 'sort' => 'name', 'order' => 'desc') * * @return array<BenatEspina\StackExchangeApiClient\Model\Interfaces\UserInterface> */ public function getByIds($ids, $params = ['site' => 'stackoverflow', 'sort' => 'name', 'order' => 'desc']) { return $this->client->get($this->prefix . '/' . implode(';', $ids), $params)['items']; }
/** * Get answers identified by a set of ids. * * More info: http://api.stackexchange.com/docs/answers-by-ids * * @param string[] $ids The array which contains the ids delimited by semicolon * @param string[] $params QueryString parameter(s), by default, the basic to work: * array('site' => 'stackoverflow', 'sort' => 'activity') * * @return array<BenatEspina\StackExchangeApiClient\Model\Interfaces\AnswerInterface> */ public function getByIds($ids, $params = ['site' => 'stackoverflow', 'sort' => 'activity']) { return $this->responseToArray($this->client->get($this->prefix . '/' . implode(';', $ids), $params)); }
function it_gets_my_mention_comments(Client $client) { $client->get('/me/mentioned', ['site' => 'stackoverflow', 'sort' => 'creation'])->shouldBeCalled()->willReturn($this->response); $this->getMyMentions(['site' => 'stackoverflow', 'sort' => 'creation'])->shouldBeArray(); }
/** * Get descriptions of all the errors that the API could return. * * More info: https://api.stackexchange.com/docs/errors * * @param string[] $params QueryString parameter(s), it admits page and pagesize; by default is null * * @return array<BenatEspina\StackExchangeApiClient\Model\AccessTokenInterface> */ public function getAll($params = []) { return $this->responseToArray($this->client->get($this->prefix, $params)); }
/** * Returns the badges earned by the user associated with the given access_token. * * More info: https://api.stackexchange.com/docs/me-badges * * @param string[] $params QueryString parameter(s), by default, the basic to work: * array('site' => 'stackoverflow', 'sort' => 'rank', 'order' => 'desc') * * @return array<BenatEspina\StackExchangeApiClient\Model\Interfaces\BadgeInterface> */ public function getMyBadges($params = ['site' => 'stackoverflow', 'sort' => 'rank', 'order' => 'desc']) { return $this->responseToBadge($this->client->get('/me' . $this->prefix, $params)); }