tamar-file-hub-client 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- file_hub_client/__init__.py +88 -0
- file_hub_client/client.py +414 -0
- file_hub_client/enums/__init__.py +12 -0
- file_hub_client/enums/export_format.py +16 -0
- file_hub_client/enums/role.py +7 -0
- file_hub_client/enums/upload_mode.py +11 -0
- file_hub_client/errors/__init__.py +30 -0
- file_hub_client/errors/exceptions.py +93 -0
- file_hub_client/py.typed +1 -0
- file_hub_client/rpc/__init__.py +10 -0
- file_hub_client/rpc/async_client.py +312 -0
- file_hub_client/rpc/gen/__init__.py +1 -0
- file_hub_client/rpc/gen/file_service_pb2.py +74 -0
- file_hub_client/rpc/gen/file_service_pb2_grpc.py +533 -0
- file_hub_client/rpc/gen/folder_service_pb2.py +53 -0
- file_hub_client/rpc/gen/folder_service_pb2_grpc.py +269 -0
- file_hub_client/rpc/generate_grpc.py +76 -0
- file_hub_client/rpc/protos/file_service.proto +147 -0
- file_hub_client/rpc/protos/folder_service.proto +65 -0
- file_hub_client/rpc/sync_client.py +313 -0
- file_hub_client/schemas/__init__.py +43 -0
- file_hub_client/schemas/context.py +160 -0
- file_hub_client/schemas/file.py +89 -0
- file_hub_client/schemas/folder.py +29 -0
- file_hub_client/services/__init__.py +17 -0
- file_hub_client/services/file/__init__.py +14 -0
- file_hub_client/services/file/async_blob_service.py +482 -0
- file_hub_client/services/file/async_file_service.py +257 -0
- file_hub_client/services/file/base_file_service.py +103 -0
- file_hub_client/services/file/sync_blob_service.py +478 -0
- file_hub_client/services/file/sync_file_service.py +255 -0
- file_hub_client/services/folder/__init__.py +10 -0
- file_hub_client/services/folder/async_folder_service.py +206 -0
- file_hub_client/services/folder/sync_folder_service.py +205 -0
- file_hub_client/utils/__init__.py +48 -0
- file_hub_client/utils/converter.py +108 -0
- file_hub_client/utils/download_helper.py +355 -0
- file_hub_client/utils/file_utils.py +105 -0
- file_hub_client/utils/retry.py +69 -0
- file_hub_client/utils/upload_helper.py +527 -0
- tamar_file_hub_client-0.0.1.dist-info/METADATA +874 -0
- tamar_file_hub_client-0.0.1.dist-info/RECORD +44 -0
- tamar_file_hub_client-0.0.1.dist-info/WHEEL +5 -0
- tamar_file_hub_client-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,312 @@
|
|
1
|
+
"""
|
2
|
+
异步gRPC客户端
|
3
|
+
"""
|
4
|
+
from enum import Enum
|
5
|
+
|
6
|
+
import grpc
|
7
|
+
import asyncio
|
8
|
+
import uuid
|
9
|
+
import platform
|
10
|
+
import socket
|
11
|
+
from typing import Optional, Dict, List, Tuple
|
12
|
+
|
13
|
+
from ..enums import Role
|
14
|
+
from ..errors import ConnectionError
|
15
|
+
from ..schemas.context import UserContext, RequestContext, FullContext
|
16
|
+
|
17
|
+
|
18
|
+
class AsyncGrpcClient:
|
19
|
+
"""异步gRPC客户端基类"""
|
20
|
+
|
21
|
+
def __init__(
|
22
|
+
self,
|
23
|
+
host: str = "localhost",
|
24
|
+
port: int = 50051,
|
25
|
+
secure: bool = False,
|
26
|
+
credentials: Optional[dict] = None,
|
27
|
+
options: Optional[list] = None,
|
28
|
+
retry_count: int = 3,
|
29
|
+
retry_delay: float = 1.0,
|
30
|
+
default_metadata: Optional[Dict[str, str]] = None,
|
31
|
+
user_context: Optional[UserContext] = None,
|
32
|
+
request_context: Optional[RequestContext] = None,
|
33
|
+
):
|
34
|
+
"""
|
35
|
+
初始化异步gRPC客户端
|
36
|
+
|
37
|
+
Args:
|
38
|
+
host: 服务器地址
|
39
|
+
port: 服务器端口
|
40
|
+
secure: 是否使用安全连接(TLS)
|
41
|
+
credentials: 认证凭据字典(如 {'api_key': 'xxx'})
|
42
|
+
options: gRPC通道选项
|
43
|
+
retry_count: 连接重试次数
|
44
|
+
retry_delay: 重试延迟(秒)
|
45
|
+
default_metadata: 默认的元数据(如 org_id, user_id 等)
|
46
|
+
user_context: 用户上下文
|
47
|
+
request_context: 请求上下文
|
48
|
+
"""
|
49
|
+
self.host = host
|
50
|
+
self.port = port
|
51
|
+
self.address = f"{host}:{port}"
|
52
|
+
self.secure = secure
|
53
|
+
self.credentials = credentials
|
54
|
+
self.options = options or []
|
55
|
+
self.retry_count = retry_count
|
56
|
+
self.retry_delay = retry_delay
|
57
|
+
self.default_metadata = default_metadata or {}
|
58
|
+
self._channel: Optional[grpc.aio.Channel] = None
|
59
|
+
self._stubs = {}
|
60
|
+
self._stub_lock = asyncio.Lock()
|
61
|
+
|
62
|
+
# 上下文管理
|
63
|
+
self._user_context = user_context
|
64
|
+
self._request_context = request_context or self._create_default_request_context()
|
65
|
+
|
66
|
+
# 如果提供了user_context,将其添加到default_metadata
|
67
|
+
if self._user_context:
|
68
|
+
self.default_metadata.update(self._user_context.to_metadata())
|
69
|
+
|
70
|
+
# 添加请求上下文到default_metadata
|
71
|
+
self.default_metadata.update(self._request_context.to_metadata())
|
72
|
+
|
73
|
+
def _create_default_request_context(self) -> RequestContext:
|
74
|
+
"""创建默认的请求上下文"""
|
75
|
+
# 尝试获取客户端IP
|
76
|
+
client_ip = None
|
77
|
+
try:
|
78
|
+
# 获取本机IP(适用于内网环境)
|
79
|
+
hostname = socket.gethostname()
|
80
|
+
client_ip = socket.gethostbyname(hostname)
|
81
|
+
except:
|
82
|
+
pass
|
83
|
+
|
84
|
+
# 获取客户端信息
|
85
|
+
return RequestContext(
|
86
|
+
client_ip=client_ip,
|
87
|
+
client_type="python-sdk",
|
88
|
+
client_version="1.0.0", # TODO: 从包版本获取
|
89
|
+
user_agent=f"FileHubClient/1.0.0 Python/{platform.python_version()} {platform.system()}/{platform.release()}"
|
90
|
+
)
|
91
|
+
|
92
|
+
def _create_channel_credentials(self) -> Optional[grpc.ChannelCredentials]:
|
93
|
+
"""创建通道凭据"""
|
94
|
+
if not self.secure:
|
95
|
+
return None
|
96
|
+
|
97
|
+
# 使用默认的SSL凭据
|
98
|
+
channel_credentials = grpc.ssl_channel_credentials()
|
99
|
+
|
100
|
+
# 如果有API密钥,创建组合凭据
|
101
|
+
if self.credentials and 'api_key' in self.credentials:
|
102
|
+
# 创建元数据凭据
|
103
|
+
def metadata_callback(context, callback):
|
104
|
+
metadata = [('authorization', f"Bearer {self.credentials['api_key']}")]
|
105
|
+
callback(metadata, None)
|
106
|
+
|
107
|
+
call_credentials = grpc.metadata_call_credentials(metadata_callback)
|
108
|
+
channel_credentials = grpc.composite_channel_credentials(
|
109
|
+
channel_credentials,
|
110
|
+
call_credentials
|
111
|
+
)
|
112
|
+
|
113
|
+
return channel_credentials
|
114
|
+
|
115
|
+
async def connect(self):
|
116
|
+
"""连接到gRPC服务器(带重试)"""
|
117
|
+
if self._channel is not None:
|
118
|
+
return
|
119
|
+
|
120
|
+
last_error = None
|
121
|
+
for attempt in range(self.retry_count):
|
122
|
+
try:
|
123
|
+
if attempt > 0:
|
124
|
+
await asyncio.sleep(self.retry_delay)
|
125
|
+
|
126
|
+
channel_credentials = self._create_channel_credentials()
|
127
|
+
|
128
|
+
if channel_credentials:
|
129
|
+
self._channel = grpc.aio.secure_channel(
|
130
|
+
self.address,
|
131
|
+
channel_credentials,
|
132
|
+
options=self.options
|
133
|
+
)
|
134
|
+
else:
|
135
|
+
self._channel = grpc.aio.insecure_channel(
|
136
|
+
self.address,
|
137
|
+
options=self.options
|
138
|
+
)
|
139
|
+
|
140
|
+
# 连接
|
141
|
+
try:
|
142
|
+
await asyncio.wait_for(self._channel.channel_ready(), timeout=5.0)
|
143
|
+
except asyncio.TimeoutError:
|
144
|
+
raise ConnectionError(f"连接超时:{self.address}")
|
145
|
+
|
146
|
+
# 连接成功
|
147
|
+
return
|
148
|
+
|
149
|
+
except Exception as e:
|
150
|
+
last_error = e
|
151
|
+
if attempt < self.retry_count - 1:
|
152
|
+
print(f"连接失败 (尝试 {attempt + 1}/{self.retry_count}): {str(e)}")
|
153
|
+
if self._channel:
|
154
|
+
await self._channel.close()
|
155
|
+
self._channel = None
|
156
|
+
else:
|
157
|
+
# 最后一次尝试失败
|
158
|
+
if self._channel:
|
159
|
+
await self._channel.close()
|
160
|
+
self._channel = None
|
161
|
+
|
162
|
+
# 所有重试都失败
|
163
|
+
raise ConnectionError(
|
164
|
+
f"无法连接到gRPC服务器 {self.address} (尝试了 {self.retry_count} 次): {str(last_error)}"
|
165
|
+
)
|
166
|
+
|
167
|
+
async def close(self):
|
168
|
+
"""关闭连接"""
|
169
|
+
if self._channel:
|
170
|
+
await self._channel.close()
|
171
|
+
self._channel = None
|
172
|
+
self._stubs.clear()
|
173
|
+
|
174
|
+
async def get_stub(self, stub_class):
|
175
|
+
"""
|
176
|
+
获取gRPC stub实例
|
177
|
+
|
178
|
+
Args:
|
179
|
+
stub_class: Stub类
|
180
|
+
|
181
|
+
Returns:
|
182
|
+
Stub实例
|
183
|
+
"""
|
184
|
+
if not self._channel:
|
185
|
+
raise ConnectionError("未连接到gRPC服务器")
|
186
|
+
|
187
|
+
stub_name = stub_class.__name__
|
188
|
+
async with self._stub_lock:
|
189
|
+
if stub_name not in self._stubs:
|
190
|
+
self._stubs[stub_name] = stub_class(self._channel)
|
191
|
+
return self._stubs[stub_name]
|
192
|
+
|
193
|
+
def build_metadata(self, **kwargs) -> List[Tuple[str, str]]:
|
194
|
+
"""
|
195
|
+
构建请求元数据
|
196
|
+
|
197
|
+
Args:
|
198
|
+
**kwargs: 要覆盖或添加的元数据
|
199
|
+
|
200
|
+
Returns:
|
201
|
+
元数据列表
|
202
|
+
"""
|
203
|
+
metadata = {}
|
204
|
+
|
205
|
+
# 添加默认元数据
|
206
|
+
metadata.update(self.default_metadata)
|
207
|
+
|
208
|
+
# 添加/覆盖传入的元数据
|
209
|
+
metadata.update(kwargs)
|
210
|
+
|
211
|
+
# 如果没有 request_id,自动生成一个
|
212
|
+
if 'x-request-id' not in metadata:
|
213
|
+
metadata['x-request-id'] = (
|
214
|
+
self._request_context.extra.get("request_id") or str(uuid.uuid4())
|
215
|
+
)
|
216
|
+
|
217
|
+
# 转换为 gRPC 需要的格式
|
218
|
+
result = []
|
219
|
+
for k, v in metadata.items():
|
220
|
+
if v is None:
|
221
|
+
continue
|
222
|
+
if isinstance(v, Enum):
|
223
|
+
v = v.value
|
224
|
+
result.append((k, str(v)))
|
225
|
+
|
226
|
+
return result
|
227
|
+
|
228
|
+
def update_default_metadata(self, **kwargs):
|
229
|
+
"""
|
230
|
+
更新默认元数据
|
231
|
+
|
232
|
+
Args:
|
233
|
+
**kwargs: 要更新的元数据键值对
|
234
|
+
"""
|
235
|
+
self.default_metadata.update(kwargs)
|
236
|
+
|
237
|
+
def set_user_context(self, org_id: str, user_id: str, role: Role = Role.ACCOUNT, actor_id: Optional[str] = None):
|
238
|
+
"""
|
239
|
+
设置用户上下文信息
|
240
|
+
|
241
|
+
Args:
|
242
|
+
org_id: 组织ID
|
243
|
+
user_id: 用户ID
|
244
|
+
role: 用户角色(默认为 ACCOUNT)
|
245
|
+
actor_id: 操作者ID(如果不同于 user_id)
|
246
|
+
"""
|
247
|
+
self._user_context = UserContext(
|
248
|
+
org_id=org_id,
|
249
|
+
user_id=user_id,
|
250
|
+
role=role,
|
251
|
+
actor_id=actor_id
|
252
|
+
)
|
253
|
+
# 更新到默认元数据
|
254
|
+
self.update_default_metadata(**self._user_context.to_metadata())
|
255
|
+
|
256
|
+
def get_user_context(self) -> Optional[UserContext]:
|
257
|
+
"""获取当前用户上下文"""
|
258
|
+
return self._user_context
|
259
|
+
|
260
|
+
def clear_user_context(self):
|
261
|
+
"""清除用户上下文信息"""
|
262
|
+
self._user_context = None
|
263
|
+
for key in ['x-org-id', 'x-user-id', 'x-role', 'x-actor-id']:
|
264
|
+
self.default_metadata.pop(key, None)
|
265
|
+
|
266
|
+
def set_request_context(self, request_context: RequestContext):
|
267
|
+
"""设置请求上下文"""
|
268
|
+
self._request_context = request_context
|
269
|
+
# 更新到默认元数据
|
270
|
+
self.update_default_metadata(**self._request_context.to_metadata())
|
271
|
+
|
272
|
+
def get_request_context(self) -> RequestContext:
|
273
|
+
"""获取当前请求上下文"""
|
274
|
+
return self._request_context
|
275
|
+
|
276
|
+
def update_request_context(self, **kwargs):
|
277
|
+
"""
|
278
|
+
更新请求上下文的部分字段
|
279
|
+
|
280
|
+
Args:
|
281
|
+
**kwargs: 要更新的字段
|
282
|
+
"""
|
283
|
+
if kwargs.get('client_ip'):
|
284
|
+
self._request_context.client_ip = kwargs['client_ip']
|
285
|
+
if kwargs.get('client_version'):
|
286
|
+
self._request_context.client_version = kwargs['client_version']
|
287
|
+
if kwargs.get('client_type'):
|
288
|
+
self._request_context.client_type = kwargs['client_type']
|
289
|
+
if kwargs.get('user_agent'):
|
290
|
+
self._request_context.user_agent = kwargs['user_agent']
|
291
|
+
|
292
|
+
# 处理extra字段
|
293
|
+
extra = kwargs.get('extra')
|
294
|
+
if extra and isinstance(extra, dict):
|
295
|
+
self._request_context.extra.update(extra)
|
296
|
+
|
297
|
+
# 更新到默认元数据
|
298
|
+
self.update_default_metadata(**self._request_context.to_metadata())
|
299
|
+
|
300
|
+
def get_full_context(self) -> FullContext:
|
301
|
+
"""获取完整的上下文信息"""
|
302
|
+
return FullContext(
|
303
|
+
user_context=self._user_context,
|
304
|
+
request_context=self._request_context
|
305
|
+
)
|
306
|
+
|
307
|
+
async def __aenter__(self) -> "AsyncGrpcClient":
|
308
|
+
await self.connect()
|
309
|
+
return self
|
310
|
+
|
311
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
312
|
+
await self.close()
|
@@ -0,0 +1 @@
|
|
1
|
+
# Auto-generated init file for gRPC package
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
4
|
+
# source: file_service.proto
|
5
|
+
# Protobuf Python Version: 5.27.2
|
6
|
+
"""Generated protocol buffer code."""
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
11
|
+
from google.protobuf.internal import builder as _builder
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
14
|
+
5,
|
15
|
+
27,
|
16
|
+
2,
|
17
|
+
'',
|
18
|
+
'file_service.proto'
|
19
|
+
)
|
20
|
+
# @@protoc_insertion_point(imports)
|
21
|
+
|
22
|
+
_sym_db = _symbol_database.Default()
|
23
|
+
|
24
|
+
|
25
|
+
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
26
|
+
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
27
|
+
|
28
|
+
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x66ile_service.proto\x12\x04\x66ile\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xab\x01\n\x04\x46ile\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tfolder_id\x18\x02 \x01(\t\x12\x11\n\tfile_name\x18\x03 \x01(\t\x12\x11\n\tfile_type\x18\x04 \x01(\t\x12.\n\ncreated_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xb7\x02\n\nUploadFile\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tfolder_id\x18\x02 \x01(\t\x12\x0f\n\x07\x66ile_id\x18\x03 \x01(\t\x12\x14\n\x0cstorage_type\x18\x04 \x01(\t\x12\x13\n\x0bstored_name\x18\x05 \x01(\t\x12\x13\n\x0bstored_path\x18\x06 \x01(\t\x12\x11\n\tfile_name\x18\x07 \x01(\t\x12\x11\n\tfile_size\x18\x08 \x01(\x03\x12\x10\n\x08\x66ile_ext\x18\t \x01(\t\x12\x11\n\tmime_type\x18\n \x01(\t\x12\x0e\n\x06status\x18\x0b \x01(\t\x12.\n\ncreated_at\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\r \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xdf\x01\n\x11UploadFileRequest\x12\x16\n\tfolder_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\tfile_name\x18\x02 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x03 \x01(\x0c\x12\x11\n\tfile_type\x18\x04 \x01(\t\x12\x11\n\tmime_type\x18\x05 \x01(\t\x12\x19\n\x0cis_temporary\x18\x06 \x01(\x08H\x01\x88\x01\x01\x12\x1b\n\x0e\x65xpire_seconds\x18\x07 \x01(\x05H\x02\x88\x01\x01\x42\x0c\n\n_folder_idB\x0f\n\r_is_temporaryB\x11\n\x0f_expire_seconds\"\xf3\x01\n\x10UploadUrlRequest\x12\x16\n\tfolder_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\tfile_name\x18\x02 \x01(\t\x12\x11\n\tfile_type\x18\x03 \x01(\t\x12\x11\n\tmime_type\x18\x04 \x01(\t\x12\x11\n\tfile_size\x18\x05 \x01(\x03\x12\x11\n\tfile_hash\x18\x06 \x01(\t\x12\x19\n\x0cis_temporary\x18\x07 \x01(\x08H\x01\x88\x01\x01\x12\x1b\n\x0e\x65xpire_seconds\x18\x08 \x01(\x05H\x02\x88\x01\x01\x42\x0c\n\n_folder_idB\x0f\n\r_is_temporaryB\x11\n\x0f_expire_seconds\")\n\x16UploadCompletedRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\"U\n\x12\x44ownloadUrlRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x1b\n\x0e\x65xpire_seconds\x18\x02 \x01(\x05H\x00\x88\x01\x01\x42\x11\n\x0f_expire_seconds\"\xd4\x01\n\x10ShareLinkRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x11\n\tis_public\x18\x02 \x01(\x08\x12\x14\n\x0c\x61\x63\x63\x65ss_scope\x18\x03 \x01(\t\x12\x1b\n\x0e\x65xpire_seconds\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\nmax_access\x18\x05 \x01(\x05H\x01\x88\x01\x01\x12\x1b\n\x0eshare_password\x18\x06 \x01(\tH\x02\x88\x01\x01\x42\x11\n\x0f_expire_secondsB\r\n\x0b_max_accessB\x11\n\x0f_share_password\"\x82\x01\n\x10\x46ileVisitRequest\x12\x15\n\rfile_share_id\x18\x01 \x01(\t\x12\x13\n\x0b\x61\x63\x63\x65ss_type\x18\x02 \x01(\t\x12\x17\n\x0f\x61\x63\x63\x65ss_duration\x18\x03 \x01(\x05\x12)\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\"!\n\x0eGetFileRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\"6\n\x11RenameFileRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x10\n\x08new_name\x18\x02 \x01(\t\"$\n\x11\x44\x65leteFileRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\"\x8d\x02\n\x10ListFilesRequest\x12\x16\n\tfolder_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tfile_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\tfile_type\x18\x03 \x03(\t\x12\x1c\n\x0f\x63reated_by_role\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x17\n\ncreated_by\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\x16\n\tpage_size\x18\x06 \x01(\x05H\x04\x88\x01\x01\x12\x11\n\x04page\x18\x07 \x01(\x05H\x05\x88\x01\x01\x42\x0c\n\n_folder_idB\x0c\n\n_file_nameB\x12\n\x10_created_by_roleB\r\n\x0b_created_byB\x0c\n\n_page_sizeB\x07\n\x05_page\"U\n\x12UploadFileResponse\x12\x18\n\x04\x66ile\x18\x01 \x01(\x0b\x32\n.file.File\x12%\n\x0bupload_file\x18\x02 \x01(\x0b\x32\x10.file.UploadFile\"a\n\x11UploadUrlResponse\x12\x18\n\x04\x66ile\x18\x01 \x01(\x0b\x32\n.file.File\x12%\n\x0bupload_file\x18\x02 \x01(\x0b\x32\x10.file.UploadFile\x12\x0b\n\x03url\x18\x03 \x01(\t\"\"\n\x13\x44ownloadUrlResponse\x12\x0b\n\x03url\x18\x01 \x01(\t\"*\n\x11ShareLinkResponse\x12\x15\n\rfile_share_id\x18\x01 \x01(\t\"-\n\x10\x46ileListResponse\x12\x19\n\x05\x66iles\x18\x01 \x03(\x0b\x32\n.file.File\"\x07\n\x05\x45mpty2\xbd\x05\n\x0b\x46ileService\x12?\n\nUploadFile\x12\x17.file.UploadFileRequest\x1a\x18.file.UploadFileResponse\x12\x44\n\x11GenerateUploadUrl\x12\x16.file.UploadUrlRequest\x1a\x17.file.UploadUrlResponse\x12M\n\x1aGenerateResumableUploadUrl\x12\x16.file.UploadUrlRequest\x1a\x17.file.UploadUrlResponse\x12\x43\n\x16\x43onfirmUploadCompleted\x12\x1c.file.UploadCompletedRequest\x1a\x0b.file.Empty\x12J\n\x13GenerateDownloadUrl\x12\x18.file.DownloadUrlRequest\x1a\x19.file.DownloadUrlResponse\x12\x44\n\x11GenerateShareLink\x12\x16.file.ShareLinkRequest\x1a\x17.file.ShareLinkResponse\x12\x30\n\tVisitFile\x12\x16.file.FileVisitRequest\x1a\x0b.file.Empty\x12+\n\x07GetFile\x12\x14.file.GetFileRequest\x1a\n.file.File\x12\x31\n\nRenameFile\x12\x17.file.RenameFileRequest\x1a\n.file.File\x12\x32\n\nDeleteFile\x12\x17.file.DeleteFileRequest\x1a\x0b.file.Empty\x12;\n\tListFiles\x12\x16.file.ListFilesRequest\x1a\x16.file.FileListResponseb\x06proto3')
|
30
|
+
|
31
|
+
_globals = globals()
|
32
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
33
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'file_service_pb2', _globals)
|
34
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
35
|
+
DESCRIPTOR._loaded_options = None
|
36
|
+
_globals['_FILE']._serialized_start=92
|
37
|
+
_globals['_FILE']._serialized_end=263
|
38
|
+
_globals['_UPLOADFILE']._serialized_start=266
|
39
|
+
_globals['_UPLOADFILE']._serialized_end=577
|
40
|
+
_globals['_UPLOADFILEREQUEST']._serialized_start=580
|
41
|
+
_globals['_UPLOADFILEREQUEST']._serialized_end=803
|
42
|
+
_globals['_UPLOADURLREQUEST']._serialized_start=806
|
43
|
+
_globals['_UPLOADURLREQUEST']._serialized_end=1049
|
44
|
+
_globals['_UPLOADCOMPLETEDREQUEST']._serialized_start=1051
|
45
|
+
_globals['_UPLOADCOMPLETEDREQUEST']._serialized_end=1092
|
46
|
+
_globals['_DOWNLOADURLREQUEST']._serialized_start=1094
|
47
|
+
_globals['_DOWNLOADURLREQUEST']._serialized_end=1179
|
48
|
+
_globals['_SHARELINKREQUEST']._serialized_start=1182
|
49
|
+
_globals['_SHARELINKREQUEST']._serialized_end=1394
|
50
|
+
_globals['_FILEVISITREQUEST']._serialized_start=1397
|
51
|
+
_globals['_FILEVISITREQUEST']._serialized_end=1527
|
52
|
+
_globals['_GETFILEREQUEST']._serialized_start=1529
|
53
|
+
_globals['_GETFILEREQUEST']._serialized_end=1562
|
54
|
+
_globals['_RENAMEFILEREQUEST']._serialized_start=1564
|
55
|
+
_globals['_RENAMEFILEREQUEST']._serialized_end=1618
|
56
|
+
_globals['_DELETEFILEREQUEST']._serialized_start=1620
|
57
|
+
_globals['_DELETEFILEREQUEST']._serialized_end=1656
|
58
|
+
_globals['_LISTFILESREQUEST']._serialized_start=1659
|
59
|
+
_globals['_LISTFILESREQUEST']._serialized_end=1928
|
60
|
+
_globals['_UPLOADFILERESPONSE']._serialized_start=1930
|
61
|
+
_globals['_UPLOADFILERESPONSE']._serialized_end=2015
|
62
|
+
_globals['_UPLOADURLRESPONSE']._serialized_start=2017
|
63
|
+
_globals['_UPLOADURLRESPONSE']._serialized_end=2114
|
64
|
+
_globals['_DOWNLOADURLRESPONSE']._serialized_start=2116
|
65
|
+
_globals['_DOWNLOADURLRESPONSE']._serialized_end=2150
|
66
|
+
_globals['_SHARELINKRESPONSE']._serialized_start=2152
|
67
|
+
_globals['_SHARELINKRESPONSE']._serialized_end=2194
|
68
|
+
_globals['_FILELISTRESPONSE']._serialized_start=2196
|
69
|
+
_globals['_FILELISTRESPONSE']._serialized_end=2241
|
70
|
+
_globals['_EMPTY']._serialized_start=2243
|
71
|
+
_globals['_EMPTY']._serialized_end=2250
|
72
|
+
_globals['_FILESERVICE']._serialized_start=2253
|
73
|
+
_globals['_FILESERVICE']._serialized_end=2954
|
74
|
+
# @@protoc_insertion_point(module_scope)
|