1 2 #ifndef _SEAFILE_RPC_H 3 #define _SEAFILE_RPC_H 4 5 #include <jansson.h> 6 #include "seafile-object.h" 7 8 /** 9 * seafile_get_repo_list: 10 * 11 * Returns repository list. 12 */ 13 GList* seafile_get_repo_list (int start, int limit, GError **error); 14 15 /** 16 * seafile_get_repo: 17 * 18 * Returns: repo 19 */ 20 GObject* seafile_get_repo (const gchar* id, GError **error); 21 22 GObject * 23 seafile_get_repo_sync_task (const char *repo_id, GError **error); 24 25 /* [seafile_get_config] returns the value of the config entry whose name is 26 * [key] in config.db 27 */ 28 char *seafile_get_config (const char *key, GError **error); 29 30 /* [seafile_set_config] set the value of config key in config.db; old value 31 * would be overwritten. */ 32 int seafile_set_config (const char *key, const char *value, GError **error); 33 34 int 35 seafile_set_config_int (const char *key, int value, GError **error); 36 37 int 38 seafile_get_config_int (const char *key, GError **error); 39 40 int 41 seafile_set_upload_rate_limit (int limit, GError **error); 42 43 int 44 seafile_set_download_rate_limit (int limit, GError **error); 45 46 /** 47 * seafile_destroy_repo: 48 * @repo_id: repository id. 49 */ 50 int seafile_destroy_repo (const gchar *repo_id, GError **error); 51 52 int 53 seafile_unsync_repos_by_account (const char *server_url, const char *email, GError **error); 54 55 int 56 seafile_remove_repo_tokens_by_account (const char *server_url, const char *email, GError **error); 57 58 int 59 seafile_set_repo_token (const char *repo_id, const char *token, GError **error); 60 61 int 62 seafile_get_download_rate(GError **error); 63 64 int 65 seafile_get_upload_rate(GError **error); 66 67 int 68 seafile_set_repo_property (const char *repo_id, 69 const char *key, 70 const char *value, 71 GError **error); 72 73 gchar * 74 seafile_get_repo_property (const char *repo_id, 75 const char *key, 76 GError **error); 77 78 int 79 seafile_update_repos_server_host (const char *old_server_url, 80 const char *new_server_url, 81 GError **error); 82 83 int seafile_disable_auto_sync (GError **error); 84 85 int seafile_enable_auto_sync (GError **error); 86 87 int seafile_is_auto_sync_enabled (GError **error); 88 89 char * 90 seafile_get_path_sync_status (const char *repo_id, 91 const char *path, 92 int is_dir, 93 GError **error); 94 95 int 96 seafile_mark_file_locked (const char *repo_id, const char *path, GError **error); 97 98 int 99 seafile_mark_file_unlocked (const char *repo_id, const char *path, GError **error); 100 101 char * 102 seafile_get_server_property (const char *server_url, const char *key, GError **error); 103 104 int 105 seafile_set_server_property (const char *server_url, 106 const char *key, 107 const char *value, 108 GError **error); 109 110 GList * 111 seafile_get_file_sync_errors (int offset, int limit, GError **error); 112 113 int 114 seafile_del_file_sync_error_by_id (int id, GError **error); 115 116 char * 117 seafile_gen_default_worktree (const char *worktree_parent, 118 const char *repo_name, 119 GError **error); 120 int 121 seafile_check_path_for_clone(const char *path, GError **error); 122 123 /** 124 * seafile_clone: 125 * 126 * Fetch a new repo and then check it out. 127 */ 128 char * 129 seafile_clone (const char *repo_id, 130 int repo_version, 131 const char *repo_name, 132 const char *worktree, 133 const char *token, 134 const char *passwd, 135 const char *magic, 136 const char *email, 137 const char *random_key, 138 int enc_version, 139 const char *more_info, 140 GError **error); 141 142 char * 143 seafile_download (const char *repo_id, 144 int repo_version, 145 const char *repo_name, 146 const char *wt_parent, 147 const char *token, 148 const char *passwd, 149 const char *magic, 150 const char *email, 151 const char *random_key, 152 int enc_version, 153 const char *more_info, 154 GError **error); 155 156 int 157 seafile_cancel_clone_task (const char *repo_id, GError **error); 158 159 /** 160 * seafile_get_clone_tasks: 161 * 162 * Get a list of clone tasks. 163 */ 164 GList * 165 seafile_get_clone_tasks (GError **error); 166 167 /** 168 * seafile_sync: 169 * 170 * Sync a repo with relay. 171 */ 172 int seafile_sync (const char *repo_id, const char *peer_id, GError **error); 173 174 /* ----------------- Task Related -------------- */ 175 176 /** 177 * seafile_find_transfer: 178 * 179 * Find a non finished task of a repo 180 */ 181 GObject * 182 seafile_find_transfer_task (const char *repo_id, GError *error); 183 184 185 int seafile_cancel_task (const gchar *task_id, int task_type, GError **error); 186 187 /** 188 * Remove finished upload task 189 */ 190 int seafile_remove_task (const char *task_id, int task_type, GError **error); 191 192 193 /* ------------------ Relay specific RPC calls. ------------ */ 194 195 /** 196 * seafile_diff: 197 * 198 * Show the difference between @old commit and @new commit. If @old is NULL, then 199 * show the difference between @new commit and its parent. 200 * 201 * @old and @new can also be branch name. 202 */ 203 GList * 204 seafile_diff (const char *repo_id, const char *old, const char *new, 205 int fold_dir_diff, GError **error); 206 207 GObject * 208 seafile_generate_magic_and_random_key(int enc_version, 209 const char* repo_id, 210 const char *passwd, 211 GError **error); 212 json_t * seafile_get_sync_notification (GError **error); 213 214 int 215 seafile_shutdown (GError **error); 216 217 char* 218 seafile_sync_error_id_to_str (int error_id, GError **error); 219 #endif 220