/** * @param array $params * * @return array|bool|float|int|string * @throws \Exception */ public function get(array $params) { $response = $this->client->getClient()->get('/stat/geo.json', null, $params)->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } return $response->json(); }
/** * @param $delegateLogin * * @return array|bool|float|int|string * @throws \Exception */ public function deleteDelegate($delegateLogin) { $response = $this->client->getClient()->delete('/delegate/' . $delegateLogin . '.json')->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $delegates = $response->json(); return $delegates; }
/** * @param $login * * @return array|bool|float|int|string * @throws \Exception */ public function deleteAccount($login) { $response = $this->client->getClient()->delete('/account/' . $login . '.json')->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $accounts = $response->json(); return $accounts; }
public function refreshToken($refresh_token) { $options = array('auth' => array($this->clientId, $this->secretKey)); $body = array('grant_type' => 'refresh_token', 'client_id' => $this->clientId, 'refresh_token' => $refresh_token); $url = 'https://o2.mail.ru/token'; try { $response = $this->client->getClient()->post($url, null, $body, $options)->send(); } catch (\Exception $e) { return $e->getMessage() . $e->getCode() . $e->getLine(); } /*$postBody = $response->getBody();*/ return $response->json(); }
/** * @param FilterModel $filter * * @return FilterModel * @throws \Exception */ public function deleteFilter(FilterModel $filter) { $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/filter/" . $filter->getId() . ".json")->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $filter = $response->json(); return new FilterModel($filter); }
/** * @param OperationModel $operation * * @return OperationModel * @throws \Exception */ public function deleteOperation(OperationModel $operation) { $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/operation/" . $operation->getid() . ".json")->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $operation = $response->json(); return new OperationModel($operation['operation']); }
/** * @param GrantModel $grant * * @return GrantModel * @throws \Exception */ public function deleteGrant(GrantModel $grant) { $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/grant/" . $grant->getId() . ".json", null, $body)->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $grant = $response->json(); return new GrantModel($grant['grant']); }
/** * @param CounterModel $counter * * @return array|bool|float|int|string * @throws \Exception */ public function checkCounter(CounterModel $counter) { $response = $this->client->getClient()->get("/counter/" . $counter->getId() . "/check.json")->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $result = $response->json(); return $result; }
/** * @param GoalModel $goal * * @return GoalModel * @throws \Exception */ public function deleteGoal(GoalModel $goal) { $response = $this->client->getClient()->delete("/counter/" . $this->counterId . "/goal/" . $goal->getId() . ".json")->send(); if ($response->getStatusCode() != 200) { throw new \Exception('invalid status code'); } $goal = $response->json(); return new GoalModel($goal['goal']); }