示例#1
0
文件: test.c 项目: Thinkscape/pfs
int main(){
  apisock *sock;
  binresult *res;
  sock=api_connect();
  if (!sock){
    fprintf(stderr, "Cannot connect to server\n");
    return 1;
  }
  res=send_command(sock, "userinfo", P_STR("auth", "Ec7QkEjFUnzZ7Z8W2YH1qLgxY7gGvTe09AH0i7V3kX"));
  if (!res){
    fprintf(stderr, "Command failed\n");
    return 1;
  }
  print_tree(res, 0);
  free(res);
  res=send_command(sock, "diff", P_NUM("folderid", 0), P_BOOL("recursive", 1), P_STR("timeformat", "timestamp"));
  if (!res){
    fprintf(stderr, "Command failed\n");
    return 1;
  }
  print_tree(res, 0);
  free(res);
  return 0;
  send_command_nb(sock, "diff", P_NUM("diffid", 0));
  res=get_result(sock);
  if (!res){
    fprintf(stderr, "Command failed\n");
    return 1;
  }
  print_tree(res, 0);
//  printf("%u %llu\n", res->type, res->num);
  free(res);
  api_close(sock);
  return 0;
}
示例#2
0
apisock *PCloudApp::getAPISock(){
    if (settings->geti("usessl"))
        return api_connect_ssl();
    else
        return api_connect();
}