Пример #1
0
 public function get_node($uuid, $nid)
 {
     $data = array("access_token" => $this->access_token, "uuid" => $uuid, "nid" => $nid);
     $url = Config::API_RESOURCE . "/node/get_node";
     $response = Client::post($url, $data, array());
     return $this->do_result($response);
 }
Пример #2
0
 public function get_user_info($uuid)
 {
     $data = array("access_token" => $this->access_token, "uuid" => $uuid);
     $url = Config::API_RESOURCE . "/user/get_user_info";
     $response = Client::post($url, $data, array());
     return $this->do_result($response);
 }
Пример #3
0
 public function get_download_url($uuid, $fid)
 {
     $data = array("access_token" => $this->access_token, "uuid" => $uuid, "fid" => $fid);
     $url = Config::API_RESOURCE . "/secret/get_download_url";
     $response = Client::post($url, $data, array());
     return $this->do_result($response);
 }
Пример #4
0
 public function get_user_info($uuid)
 {
     $data = array("access_token" => ACCESS_TOKEN, "uuid" => $uuid);
     $url = Config::API_RESOURCE . "/user/get_user_info";
     $response = Client::post($url, $data, array("Content-Type" => "application/x-www-form-urlencoded"));
     return $this->do_result($response);
 }
Пример #5
0
 private function password_credentials()
 {
     $data = array("grant_type" => "password", "client_id" => ACCESS_KEY, "client_secret" => ACCESS_SECRET, "username" => Config::USER_NAME, "password" => Config::USER_PASS);
     $url = Config::API_OAUTH . "/PasswordCredentials";
     $response = Client::post($url, $data, array("Content-Type" => "application/json"));
     return $this->do_result($response);
 }
Пример #6
0
 public function rename_file($uuid, $name, $fid)
 {
     $data = array("access_token" => ACCESS_TOKEN, "uuid" => $uuid, "fid" => $fid, "name" => $name);
     $url = Config::API_RESOURCE . "/file/rename_file";
     $response = Client::post($url, $data, array("Content-Type" => "application/x-www-form-urlencoded"));
     return $this->do_result($response);
 }
Пример #7
0
 public function portal($uid, $from = "jue.so", $token = "")
 {
     $data = array("client_id" => ACCESS_KEY, "client_secret" => ACCESS_SECRET, "access_token" => $this->access_token, "uid" => $uid, "from" => $from, "token" => $token);
     $url = Config::API_RESOURCE . "/secret/portal";
     $response = Client::post($url, $data, array());
     return $this->do_result($response);
 }
Пример #8
0
 public function rename_file($uuid, $name, $fid)
 {
     $data = array("access_token" => $this->access_token, "uuid" => $uuid, "fid" => $fid, "name" => $name);
     $url = Config::API_RESOURCE . "/file/rename_file";
     $response = Client::post($url, $data, array());
     return $this->do_result($response);
 }
Пример #9
0
 public function portal($uid, $from = "jue.so", $token = "")
 {
     $data = array("client_id" => ACCESS_KEY, "client_secret" => ACCESS_SECRET, "access_token" => ACCESS_TOKEN, "uid" => $uid, "from" => $from, "token" => $token);
     $url = Config::API_RESOURCE . "/secret/portal";
     $response = Client::post($url, $data, array("Content-Type" => "application/x-www-form-urlencoded"));
     //save user info to cache
     if ($response->ok()) {
         $body = json_decode($response->body, true);
         if ($body["code"] == 1000) {
             $this->memory->store($uid, $body, Config::EXPIRED_LONG);
         }
         return $body;
     }
     if ($response->json() != null) {
         return array($response->json(), null);
     }
     return array($response->body, null);
 }