1from pysearpc import searpc_func, SearpcError, NamedPipeClient
2
3
4class SeafileRpcClient(NamedPipeClient):
5    """RPC used in client"""
6
7    def __init__(self, socket_path, *args, **kwargs):
8         NamedPipeClient.__init__(
9             self,
10             socket_path,
11             "seafile-rpcserver",
12             *args,
13             **kwargs
14         )
15
16    @searpc_func("string", ["int"])
17    def seafile_sync_error_id_to_str():
18        pass
19    sync_error_id_to_str = seafile_sync_error_id_to_str
20
21    @searpc_func("int", ["int"])
22    def seafile_del_file_sync_error_by_id():
23        pass
24    del_file_sync_error_by_id = seafile_del_file_sync_error_by_id
25
26    @searpc_func("int", ["string"])
27    def seafile_calc_dir_size(path):
28        pass
29    calc_dir_size = seafile_calc_dir_size
30
31    @searpc_func("int64", [])
32    def seafile_get_total_block_size():
33        pass
34    get_total_block_size = seafile_get_total_block_size;
35
36    @searpc_func("string", ["string"])
37    def seafile_get_config(key):
38        pass
39    get_config = seafile_get_config
40
41    @searpc_func("int", ["string", "string"])
42    def seafile_set_config(key, value):
43        pass
44    set_config = seafile_set_config
45
46    @searpc_func("int", ["string"])
47    def seafile_get_config_int(key):
48        pass
49    get_config_int = seafile_get_config_int
50
51    @searpc_func("int", ["string", "int"])
52    def seafile_set_config_int(key, value):
53        pass
54    set_config_int = seafile_set_config_int
55
56    @searpc_func("int", ["int"])
57    def seafile_set_upload_rate_limit(limit):
58        pass
59    set_upload_rate_limit = seafile_set_upload_rate_limit
60
61    @searpc_func("int", ["int"])
62    def seafile_set_download_rate_limit(limit):
63        pass
64    set_download_rate_limit = seafile_set_download_rate_limit
65
66    ### repo
67    @searpc_func("objlist", ["int", "int"])
68    def seafile_get_repo_list():
69        pass
70    get_repo_list = seafile_get_repo_list
71
72    @searpc_func("object", ["string"])
73    def seafile_get_repo():
74        pass
75    get_repo = seafile_get_repo
76
77    @searpc_func("string", ["string", "string", "string", "string", "string", "int"])
78    def seafile_create_repo(name, desc, passwd, base, relay_id, keep_history):
79        pass
80    create_repo = seafile_create_repo
81
82    @searpc_func("int", ["string"])
83    def seafile_destroy_repo(repo_id):
84        pass
85    remove_repo = seafile_destroy_repo
86
87    @searpc_func("objlist", ["string", "string", "string", "int"])
88    def seafile_diff():
89        pass
90    get_diff = seafile_diff
91
92    @searpc_func("object", ["string", "int", "string"])
93    def seafile_get_commit(repo_id, version, commit_id):
94        pass
95    get_commit = seafile_get_commit
96
97    @searpc_func("objlist", ["string", "int", "int"])
98    def seafile_get_commit_list():
99        pass
100    get_commit_list = seafile_get_commit_list
101
102    @searpc_func("objlist", ["string"])
103    def seafile_branch_gets(repo_id):
104        pass
105    branch_gets = seafile_branch_gets
106
107    @searpc_func("int", ["string", "string"])
108    def seafile_branch_add(repo_id, branch):
109        pass
110    branch_add = seafile_branch_add
111
112    ##### clone related
113    @searpc_func("string", ["string", "string"])
114    def gen_default_worktree(worktree_parent, repo_name):
115        pass
116
117    @searpc_func("string", ["string", "int", "string", "string", "string", "string", "string", "string", "int", "string"])
118    def seafile_clone(repo_id, repo_version, repo_name, worktree, token, password, magic, email, random_key, enc_version, more_info):
119        pass
120    clone = seafile_clone
121
122    @searpc_func("string", ["string", "int", "string", "string", "string", "string", "string", "string", "int", "string"])
123    def seafile_download(repo_id, repo_version, repo_name, wt_parent, token, password, magic, email, random_key, enc_version, more_info):
124        pass
125    download = seafile_download
126
127    @searpc_func("int", ["string"])
128    def seafile_cancel_clone_task(repo_id):
129        pass
130    cancel_clone_task = seafile_cancel_clone_task
131
132    @searpc_func("objlist", [])
133    def seafile_get_clone_tasks():
134        pass
135    get_clone_tasks = seafile_get_clone_tasks
136
137    @searpc_func("object", ["string"])
138    def seafile_find_transfer_task(repo_id):
139        pass
140    find_transfer_task = seafile_find_transfer_task
141
142    ### sync
143    @searpc_func("int", ["string", "string"])
144    def seafile_sync(repo_id, peer_id):
145        pass
146    sync = seafile_sync
147
148    @searpc_func("object", ["string"])
149    def seafile_get_repo_sync_task():
150        pass
151    get_repo_sync_task = seafile_get_repo_sync_task
152
153    @searpc_func("int", [])
154    def seafile_is_auto_sync_enabled():
155        pass
156    is_auto_sync_enabled = seafile_is_auto_sync_enabled
157
158    @searpc_func("objlist", ["int", "int"])
159    def seafile_get_file_sync_errors():
160        pass
161    get_file_sync_errors = seafile_get_file_sync_errors
162
163    ###### Property Management #########
164
165    @searpc_func("int", ["string", "string"])
166    def seafile_set_repo_passwd(repo_id, passwd):
167        pass
168    set_repo_passwd = seafile_set_repo_passwd
169
170    @searpc_func("int", ["string", "string", "string"])
171    def seafile_set_repo_property(repo_id, key, value):
172        pass
173    set_repo_property = seafile_set_repo_property
174
175    @searpc_func("string", ["string", "string"])
176    def seafile_get_repo_property(repo_id, key):
177        pass
178    get_repo_property = seafile_get_repo_property
179
180    @searpc_func("string", ["string"])
181    def seafile_get_repo_relay_address(repo_id):
182        pass
183    get_repo_relay_address = seafile_get_repo_relay_address
184
185    @searpc_func("string", ["string"])
186    def seafile_get_repo_relay_port(repo_id):
187        pass
188    get_repo_relay_port = seafile_get_repo_relay_port
189
190    @searpc_func("int", ["string", "string", "string"])
191    def seafile_update_repo_relay_info(repo_id, addr, port):
192        pass
193    update_repo_relay_info = seafile_update_repo_relay_info
194
195    @searpc_func("int", ["string", "string"])
196    def seafile_set_repo_token(repo_id, token):
197        pass
198    set_repo_token = seafile_set_repo_token
199
200    @searpc_func("string", ["string"])
201    def seafile_get_repo_token(repo_id):
202        pass
203    get_repo_token = seafile_get_repo_token
204
205    @searpc_func("object", ["int", "string", "string"])
206    def seafile_generate_magic_and_random_key(enc_version, repo_id, password):
207        pass
208    generate_magic_and_random_key = seafile_generate_magic_and_random_key
209
210    @searpc_func("int", [])
211    def seafile_shutdown():
212        pass
213    shutdown = seafile_shutdown
214