tamar-file-hub-client 0.1.0__tar.gz → 0.1.2__tar.gz

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.
Files changed (62) hide show
  1. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/PKG-INFO +138 -1
  2. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/README.md +137 -0
  3. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/file_service_pb2.py +33 -17
  4. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/file_service_pb2_grpc.py +129 -0
  5. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/protos/file_service.proto +43 -0
  6. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/schemas/__init__.py +10 -0
  7. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/schemas/file.py +31 -0
  8. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/file/async_blob_service.py +125 -2
  9. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/file/sync_blob_service.py +125 -2
  10. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/setup.py +1 -1
  11. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/tamar_file_hub_client.egg-info/PKG-INFO +138 -1
  12. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/MANIFEST.in +0 -0
  13. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/__init__.py +0 -0
  14. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/client.py +0 -0
  15. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/enums/__init__.py +0 -0
  16. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/enums/export_format.py +0 -0
  17. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/enums/role.py +0 -0
  18. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/enums/upload_mode.py +0 -0
  19. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/errors/__init__.py +0 -0
  20. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/errors/exceptions.py +0 -0
  21. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/py.typed +0 -0
  22. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/__init__.py +0 -0
  23. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/async_client.py +0 -0
  24. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/__init__.py +0 -0
  25. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/folder_service_pb2.py +0 -0
  26. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/folder_service_pb2_grpc.py +0 -0
  27. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/taple_service_pb2.py +0 -0
  28. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/gen/taple_service_pb2_grpc.py +0 -0
  29. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/interceptors.py +0 -0
  30. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/protos/folder_service.proto +0 -0
  31. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/protos/taple_service.proto +0 -0
  32. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/rpc/sync_client.py +0 -0
  33. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/schemas/context.py +0 -0
  34. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/schemas/folder.py +0 -0
  35. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/schemas/taple.py +0 -0
  36. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/__init__.py +0 -0
  37. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/file/__init__.py +0 -0
  38. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/file/async_file_service.py +0 -0
  39. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/file/base_file_service.py +0 -0
  40. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/file/sync_file_service.py +0 -0
  41. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/folder/__init__.py +0 -0
  42. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/folder/async_folder_service.py +0 -0
  43. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/folder/sync_folder_service.py +0 -0
  44. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/taple/__init__.py +0 -0
  45. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/taple/async_taple_service.py +0 -0
  46. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/taple/base_taple_service.py +0 -0
  47. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/taple/idempotent_taple_mixin.py +0 -0
  48. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/services/taple/sync_taple_service.py +0 -0
  49. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/__init__.py +0 -0
  50. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/converter.py +0 -0
  51. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/download_helper.py +0 -0
  52. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/file_utils.py +0 -0
  53. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/idempotency.py +0 -0
  54. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/logging.py +0 -0
  55. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/retry.py +0 -0
  56. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/smart_retry.py +0 -0
  57. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/file_hub_client/utils/upload_helper.py +0 -0
  58. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/setup.cfg +0 -0
  59. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/tamar_file_hub_client.egg-info/SOURCES.txt +0 -0
  60. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/tamar_file_hub_client.egg-info/dependency_links.txt +0 -0
  61. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/tamar_file_hub_client.egg-info/requires.txt +0 -0
  62. {tamar_file_hub_client-0.1.0 → tamar_file_hub_client-0.1.2}/tamar_file_hub_client.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tamar-file-hub-client
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A Python SDK for gRPC-based file management system
5
5
  Home-page: https://github.com/Tamar-Edge-AI/file-hub-client
6
6
  Author: Oscar Ou
@@ -682,6 +682,137 @@ async with AsyncTamarFileHubClient() as client:
682
682
  print(f"文件已保存到: {save_path}")
683
683
  ```
684
684
 
685
+ #### 高级下载功能
686
+
687
+ File Hub Client 提供了高级的下载URL管理功能,支持批量操作和直接获取GCS URL:
688
+
689
+ ##### 批量生成下载URL
690
+
691
+ 当需要为多个文件生成下载URL时,使用批量接口可以显著提高效率:
692
+
693
+ ```python
694
+ from file_hub_client import AsyncTamarFileHubClient
695
+
696
+ async with AsyncTamarFileHubClient() as client:
697
+ # 设置用户上下文
698
+ client.set_user_context(org_id="123", user_id="456")
699
+
700
+ # 批量生成下载URL
701
+ file_ids = ["file-001", "file-002", "file-003"]
702
+
703
+ result = await client.blobs.batch_generate_download_url(
704
+ file_ids=file_ids,
705
+ is_cdn=True, # 使用CDN加速(可选,默认为True)
706
+ expire_seconds=3600 # URL有效期1小时(可选)
707
+ )
708
+
709
+ # 处理结果
710
+ for url_info in result.download_urls:
711
+ if url_info.error:
712
+ print(f"文件 {url_info.file_id} 生成URL失败: {url_info.error}")
713
+ else:
714
+ print(f"文件 {url_info.file_id} 的下载URL: {url_info.url}")
715
+ ```
716
+
717
+ 同步客户端示例:
718
+
719
+ ```python
720
+ from file_hub_client import TamarFileHubClient
721
+
722
+ with TamarFileHubClient() as client:
723
+ client.set_user_context(org_id="123", user_id="456")
724
+
725
+ result = client.blobs.batch_generate_download_url(
726
+ file_ids=["file-001", "file-002"],
727
+ is_cdn=False # 不使用CDN,直接返回源站URL
728
+ )
729
+ ```
730
+
731
+ ##### 获取GCS URL
732
+
733
+ 对于需要直接访问Google Cloud Storage的场景,可以获取文件的GCS URL和MIME类型信息:
734
+
735
+ ```python
736
+ # 异步客户端 - 获取单个文件的GCS URL
737
+ async with AsyncTamarFileHubClient() as client:
738
+ client.set_user_context(org_id="123", user_id="456")
739
+
740
+ gcs_response = await client.blobs.get_gcs_url(file_id="file-001")
741
+ print(f"GCS URL: {gcs_response.gcs_url}")
742
+ print(f"MIME类型: {gcs_response.mime_type}")
743
+ # 输出示例:
744
+ # GCS URL: gs://bucket-name/path/to/file.pdf
745
+ # MIME类型: application/pdf
746
+ ```
747
+
748
+ **注意**:`get_gcs_url` 方法现在返回一个 `GetGcsUrlResponse` 对象,包含:
749
+ - `gcs_url`: Google Cloud Storage 的完整路径
750
+ - `mime_type`: 文件的MIME类型,便于正确处理文件内容
751
+
752
+ ##### 批量获取GCS URL
753
+
754
+ 批量获取多个文件的GCS URL和MIME类型信息:
755
+
756
+ ```python
757
+ # 异步客户端 - 批量获取GCS URL
758
+ async with AsyncTamarFileHubClient() as client:
759
+ client.set_user_context(org_id="123", user_id="456")
760
+
761
+ file_ids = ["file-001", "file-002", "file-003"]
762
+ result = await client.blobs.batch_get_gcs_url(file_ids)
763
+
764
+ # 处理结果
765
+ for url_info in result.gcs_urls:
766
+ if url_info.error:
767
+ print(f"文件 {url_info.file_id} 获取GCS URL失败: {url_info.error}")
768
+ else:
769
+ print(f"文件 {url_info.file_id}:")
770
+ print(f" GCS URL: {url_info.gcs_url}")
771
+ print(f" MIME类型: {url_info.mime_type}")
772
+ # 根据MIME类型处理文件
773
+ if url_info.mime_type.startswith('image/'):
774
+ print(f" 这是一个图片文件")
775
+ elif url_info.mime_type == 'application/pdf':
776
+ print(f" 这是一个PDF文件")
777
+ ```
778
+
779
+ 同步客户端示例:
780
+
781
+ ```python
782
+ # 同步客户端 - 批量获取GCS URL
783
+ with TamarFileHubClient() as client:
784
+ client.set_user_context(org_id="123", user_id="456")
785
+
786
+ # 获取单个GCS URL
787
+ gcs_response = client.blobs.get_gcs_url(file_id="file-001")
788
+ print(f"GCS URL: {gcs_response.gcs_url}")
789
+ print(f"MIME类型: {gcs_response.mime_type}")
790
+
791
+ # 批量获取GCS URL
792
+ result = client.blobs.batch_get_gcs_url(["file-001", "file-002"])
793
+ ```
794
+
795
+ ##### 使用场景说明
796
+
797
+ 1. **批量下载URL生成**:
798
+ - 适用于需要同时下载多个文件的场景
799
+ - 支持CDN加速,提供更好的下载体验
800
+ - 可设置URL有效期,增强安全性
801
+ - 批量操作减少网络往返,提高效率
802
+
803
+ 2. **GCS URL获取**:
804
+ - 适用于需要与Google Cloud服务集成的场景
805
+ - 可用于数据分析、批处理等后端处理
806
+ - 支持使用GCS工具进行文件操作
807
+ - 返回的是永久有效的存储路径
808
+ - 同时返回MIME类型信息,便于正确处理不同类型的文件
809
+ - 可根据MIME类型选择合适的处理方式(如图片处理、文档解析等)
810
+
811
+ 3. **错误处理**:
812
+ - 每个文件独立处理,部分失败不影响其他文件
813
+ - 错误信息通过 `error` 字段返回
814
+ - 建议在批量操作时做好错误处理和重试逻辑
815
+
685
816
  ### 文件管理操作
686
817
 
687
818
  File Hub Client 提供了完整的文件管理功能,通过 `files` 服务访问:
@@ -2019,6 +2150,12 @@ MIT License
2019
2150
 
2020
2151
  ## 更新日志
2021
2152
 
2153
+ ### v0.0.5 (2025-01)
2154
+ - 新增批量下载URL生成接口 (batch_generate_download_url)
2155
+ - 新增GCS URL获取接口 (get_gcs_url, batch_get_gcs_url)
2156
+ - GCS URL接口返回MIME类型信息,便于文件类型识别
2157
+ - 更新相关文档和测试用例
2158
+
2022
2159
  ### v0.0.4 (2025-01)
2023
2160
  - 新增从URL上传文件功能
2024
2161
  - 支持自动下载URL内容并上传到GCS
@@ -636,6 +636,137 @@ async with AsyncTamarFileHubClient() as client:
636
636
  print(f"文件已保存到: {save_path}")
637
637
  ```
638
638
 
639
+ #### 高级下载功能
640
+
641
+ File Hub Client 提供了高级的下载URL管理功能,支持批量操作和直接获取GCS URL:
642
+
643
+ ##### 批量生成下载URL
644
+
645
+ 当需要为多个文件生成下载URL时,使用批量接口可以显著提高效率:
646
+
647
+ ```python
648
+ from file_hub_client import AsyncTamarFileHubClient
649
+
650
+ async with AsyncTamarFileHubClient() as client:
651
+ # 设置用户上下文
652
+ client.set_user_context(org_id="123", user_id="456")
653
+
654
+ # 批量生成下载URL
655
+ file_ids = ["file-001", "file-002", "file-003"]
656
+
657
+ result = await client.blobs.batch_generate_download_url(
658
+ file_ids=file_ids,
659
+ is_cdn=True, # 使用CDN加速(可选,默认为True)
660
+ expire_seconds=3600 # URL有效期1小时(可选)
661
+ )
662
+
663
+ # 处理结果
664
+ for url_info in result.download_urls:
665
+ if url_info.error:
666
+ print(f"文件 {url_info.file_id} 生成URL失败: {url_info.error}")
667
+ else:
668
+ print(f"文件 {url_info.file_id} 的下载URL: {url_info.url}")
669
+ ```
670
+
671
+ 同步客户端示例:
672
+
673
+ ```python
674
+ from file_hub_client import TamarFileHubClient
675
+
676
+ with TamarFileHubClient() as client:
677
+ client.set_user_context(org_id="123", user_id="456")
678
+
679
+ result = client.blobs.batch_generate_download_url(
680
+ file_ids=["file-001", "file-002"],
681
+ is_cdn=False # 不使用CDN,直接返回源站URL
682
+ )
683
+ ```
684
+
685
+ ##### 获取GCS URL
686
+
687
+ 对于需要直接访问Google Cloud Storage的场景,可以获取文件的GCS URL和MIME类型信息:
688
+
689
+ ```python
690
+ # 异步客户端 - 获取单个文件的GCS URL
691
+ async with AsyncTamarFileHubClient() as client:
692
+ client.set_user_context(org_id="123", user_id="456")
693
+
694
+ gcs_response = await client.blobs.get_gcs_url(file_id="file-001")
695
+ print(f"GCS URL: {gcs_response.gcs_url}")
696
+ print(f"MIME类型: {gcs_response.mime_type}")
697
+ # 输出示例:
698
+ # GCS URL: gs://bucket-name/path/to/file.pdf
699
+ # MIME类型: application/pdf
700
+ ```
701
+
702
+ **注意**:`get_gcs_url` 方法现在返回一个 `GetGcsUrlResponse` 对象,包含:
703
+ - `gcs_url`: Google Cloud Storage 的完整路径
704
+ - `mime_type`: 文件的MIME类型,便于正确处理文件内容
705
+
706
+ ##### 批量获取GCS URL
707
+
708
+ 批量获取多个文件的GCS URL和MIME类型信息:
709
+
710
+ ```python
711
+ # 异步客户端 - 批量获取GCS URL
712
+ async with AsyncTamarFileHubClient() as client:
713
+ client.set_user_context(org_id="123", user_id="456")
714
+
715
+ file_ids = ["file-001", "file-002", "file-003"]
716
+ result = await client.blobs.batch_get_gcs_url(file_ids)
717
+
718
+ # 处理结果
719
+ for url_info in result.gcs_urls:
720
+ if url_info.error:
721
+ print(f"文件 {url_info.file_id} 获取GCS URL失败: {url_info.error}")
722
+ else:
723
+ print(f"文件 {url_info.file_id}:")
724
+ print(f" GCS URL: {url_info.gcs_url}")
725
+ print(f" MIME类型: {url_info.mime_type}")
726
+ # 根据MIME类型处理文件
727
+ if url_info.mime_type.startswith('image/'):
728
+ print(f" 这是一个图片文件")
729
+ elif url_info.mime_type == 'application/pdf':
730
+ print(f" 这是一个PDF文件")
731
+ ```
732
+
733
+ 同步客户端示例:
734
+
735
+ ```python
736
+ # 同步客户端 - 批量获取GCS URL
737
+ with TamarFileHubClient() as client:
738
+ client.set_user_context(org_id="123", user_id="456")
739
+
740
+ # 获取单个GCS URL
741
+ gcs_response = client.blobs.get_gcs_url(file_id="file-001")
742
+ print(f"GCS URL: {gcs_response.gcs_url}")
743
+ print(f"MIME类型: {gcs_response.mime_type}")
744
+
745
+ # 批量获取GCS URL
746
+ result = client.blobs.batch_get_gcs_url(["file-001", "file-002"])
747
+ ```
748
+
749
+ ##### 使用场景说明
750
+
751
+ 1. **批量下载URL生成**:
752
+ - 适用于需要同时下载多个文件的场景
753
+ - 支持CDN加速,提供更好的下载体验
754
+ - 可设置URL有效期,增强安全性
755
+ - 批量操作减少网络往返,提高效率
756
+
757
+ 2. **GCS URL获取**:
758
+ - 适用于需要与Google Cloud服务集成的场景
759
+ - 可用于数据分析、批处理等后端处理
760
+ - 支持使用GCS工具进行文件操作
761
+ - 返回的是永久有效的存储路径
762
+ - 同时返回MIME类型信息,便于正确处理不同类型的文件
763
+ - 可根据MIME类型选择合适的处理方式(如图片处理、文档解析等)
764
+
765
+ 3. **错误处理**:
766
+ - 每个文件独立处理,部分失败不影响其他文件
767
+ - 错误信息通过 `error` 字段返回
768
+ - 建议在批量操作时做好错误处理和重试逻辑
769
+
639
770
  ### 文件管理操作
640
771
 
641
772
  File Hub Client 提供了完整的文件管理功能,通过 `files` 服务访问:
@@ -1973,6 +2104,12 @@ MIT License
1973
2104
 
1974
2105
  ## 更新日志
1975
2106
 
2107
+ ### v0.0.5 (2025-01)
2108
+ - 新增批量下载URL生成接口 (batch_generate_download_url)
2109
+ - 新增GCS URL获取接口 (get_gcs_url, batch_get_gcs_url)
2110
+ - GCS URL接口返回MIME类型信息,便于文件类型识别
2111
+ - 更新相关文档和测试用例
2112
+
1976
2113
  ### v0.0.4 (2025-01)
1977
2114
  - 新增从URL上传文件功能
1978
2115
  - 支持自动下载URL内容并上传到GCS
@@ -26,7 +26,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__
26
26
  from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
27
27
 
28
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\x13\n\x06is_cdn\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0e\x65xpire_seconds\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\t\n\x07_is_cdnB\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\"g\n\x0fGetFileResponse\x12\x18\n\x04\x66ile\x18\x01 \x01(\x0b\x32\n.file.File\x12*\n\x0bupload_file\x18\x02 \x01(\x0b\x32\x10.file.UploadFileH\x00\x88\x01\x01\x42\x0e\n\x0c_upload_file\"\x07\n\x05\x45mpty2\xc8\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\x36\n\x07GetFile\x12\x14.file.GetFileRequest\x1a\x15.file.GetFileResponse\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')
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\x13\n\x06is_cdn\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0e\x65xpire_seconds\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\t\n\x07_is_cdnB\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\"{\n\x17\x42\x61tchDownloadUrlRequest\x12\x10\n\x08\x66ile_ids\x18\x01 \x03(\t\x12\x13\n\x06is_cdn\x18\x02 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0e\x65xpire_seconds\x18\x03 \x01(\x05H\x01\x88\x01\x01\x42\t\n\x07_is_cdnB\x11\n\x0f_expire_seconds\"#\n\x10GetGcsUrlRequest\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\")\n\x15\x42\x61tchGetGcsUrlRequest\x12\x10\n\x08\x66ile_ids\x18\x01 \x03(\t\"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\"g\n\x0fGetFileResponse\x12\x18\n\x04\x66ile\x18\x01 \x01(\x0b\x32\n.file.File\x12*\n\x0bupload_file\x18\x02 \x01(\x0b\x32\x10.file.UploadFileH\x00\x88\x01\x01\x42\x0e\n\x0c_upload_file\"H\n\x18\x42\x61tchDownloadUrlResponse\x12,\n\rdownload_urls\x18\x01 \x03(\x0b\x32\x15.file.DownloadUrlInfo\"M\n\x0f\x44ownloadUrlInfo\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12\x12\n\x05\x65rror\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_error\"7\n\x11GetGcsUrlResponse\x12\x0f\n\x07gcs_url\x18\x01 \x01(\t\x12\x11\n\tmime_type\x18\x02 \x01(\t\"<\n\x16\x42\x61tchGetGcsUrlResponse\x12\"\n\x08gcs_urls\x18\x01 \x03(\x0b\x32\x10.file.GcsUrlInfo\"_\n\nGcsUrlInfo\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x0f\n\x07gcs_url\x18\x02 \x01(\t\x12\x11\n\tmime_type\x18\x03 \x01(\t\x12\x12\n\x05\x65rror\x18\x04 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_error\"\x07\n\x05\x45mpty2\xae\x07\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\x12Y\n\x18\x42\x61tchGenerateDownloadUrl\x12\x1d.file.BatchDownloadUrlRequest\x1a\x1e.file.BatchDownloadUrlResponse\x12<\n\tGetGcsUrl\x12\x16.file.GetGcsUrlRequest\x1a\x17.file.GetGcsUrlResponse\x12K\n\x0e\x42\x61tchGetGcsUrl\x12\x1b.file.BatchGetGcsUrlRequest\x1a\x1c.file.BatchGetGcsUrlResponse\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\x36\n\x07GetFile\x12\x14.file.GetFileRequest\x1a\x15.file.GetFileResponse\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
30
 
31
31
  _globals = globals()
32
32
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -57,20 +57,36 @@ if not _descriptor._USE_C_DESCRIPTORS:
57
57
  _globals['_DELETEFILEREQUEST']._serialized_end=1688
58
58
  _globals['_LISTFILESREQUEST']._serialized_start=1691
59
59
  _globals['_LISTFILESREQUEST']._serialized_end=1960
60
- _globals['_UPLOADFILERESPONSE']._serialized_start=1962
61
- _globals['_UPLOADFILERESPONSE']._serialized_end=2047
62
- _globals['_UPLOADURLRESPONSE']._serialized_start=2049
63
- _globals['_UPLOADURLRESPONSE']._serialized_end=2146
64
- _globals['_DOWNLOADURLRESPONSE']._serialized_start=2148
65
- _globals['_DOWNLOADURLRESPONSE']._serialized_end=2182
66
- _globals['_SHARELINKRESPONSE']._serialized_start=2184
67
- _globals['_SHARELINKRESPONSE']._serialized_end=2226
68
- _globals['_FILELISTRESPONSE']._serialized_start=2228
69
- _globals['_FILELISTRESPONSE']._serialized_end=2273
70
- _globals['_GETFILERESPONSE']._serialized_start=2275
71
- _globals['_GETFILERESPONSE']._serialized_end=2378
72
- _globals['_EMPTY']._serialized_start=2380
73
- _globals['_EMPTY']._serialized_end=2387
74
- _globals['_FILESERVICE']._serialized_start=2390
75
- _globals['_FILESERVICE']._serialized_end=3102
60
+ _globals['_BATCHDOWNLOADURLREQUEST']._serialized_start=1962
61
+ _globals['_BATCHDOWNLOADURLREQUEST']._serialized_end=2085
62
+ _globals['_GETGCSURLREQUEST']._serialized_start=2087
63
+ _globals['_GETGCSURLREQUEST']._serialized_end=2122
64
+ _globals['_BATCHGETGCSURLREQUEST']._serialized_start=2124
65
+ _globals['_BATCHGETGCSURLREQUEST']._serialized_end=2165
66
+ _globals['_UPLOADFILERESPONSE']._serialized_start=2167
67
+ _globals['_UPLOADFILERESPONSE']._serialized_end=2252
68
+ _globals['_UPLOADURLRESPONSE']._serialized_start=2254
69
+ _globals['_UPLOADURLRESPONSE']._serialized_end=2351
70
+ _globals['_DOWNLOADURLRESPONSE']._serialized_start=2353
71
+ _globals['_DOWNLOADURLRESPONSE']._serialized_end=2387
72
+ _globals['_SHARELINKRESPONSE']._serialized_start=2389
73
+ _globals['_SHARELINKRESPONSE']._serialized_end=2431
74
+ _globals['_FILELISTRESPONSE']._serialized_start=2433
75
+ _globals['_FILELISTRESPONSE']._serialized_end=2478
76
+ _globals['_GETFILERESPONSE']._serialized_start=2480
77
+ _globals['_GETFILERESPONSE']._serialized_end=2583
78
+ _globals['_BATCHDOWNLOADURLRESPONSE']._serialized_start=2585
79
+ _globals['_BATCHDOWNLOADURLRESPONSE']._serialized_end=2657
80
+ _globals['_DOWNLOADURLINFO']._serialized_start=2659
81
+ _globals['_DOWNLOADURLINFO']._serialized_end=2736
82
+ _globals['_GETGCSURLRESPONSE']._serialized_start=2738
83
+ _globals['_GETGCSURLRESPONSE']._serialized_end=2793
84
+ _globals['_BATCHGETGCSURLRESPONSE']._serialized_start=2795
85
+ _globals['_BATCHGETGCSURLRESPONSE']._serialized_end=2855
86
+ _globals['_GCSURLINFO']._serialized_start=2857
87
+ _globals['_GCSURLINFO']._serialized_end=2952
88
+ _globals['_EMPTY']._serialized_start=2954
89
+ _globals['_EMPTY']._serialized_end=2961
90
+ _globals['_FILESERVICE']._serialized_start=2964
91
+ _globals['_FILESERVICE']._serialized_end=3906
76
92
  # @@protoc_insertion_point(module_scope)
@@ -61,6 +61,21 @@ class FileServiceStub(object):
61
61
  request_serializer=file__service__pb2.DownloadUrlRequest.SerializeToString,
62
62
  response_deserializer=file__service__pb2.DownloadUrlResponse.FromString,
63
63
  _registered_method=True)
64
+ self.BatchGenerateDownloadUrl = channel.unary_unary(
65
+ '/file.FileService/BatchGenerateDownloadUrl',
66
+ request_serializer=file__service__pb2.BatchDownloadUrlRequest.SerializeToString,
67
+ response_deserializer=file__service__pb2.BatchDownloadUrlResponse.FromString,
68
+ _registered_method=True)
69
+ self.GetGcsUrl = channel.unary_unary(
70
+ '/file.FileService/GetGcsUrl',
71
+ request_serializer=file__service__pb2.GetGcsUrlRequest.SerializeToString,
72
+ response_deserializer=file__service__pb2.GetGcsUrlResponse.FromString,
73
+ _registered_method=True)
74
+ self.BatchGetGcsUrl = channel.unary_unary(
75
+ '/file.FileService/BatchGetGcsUrl',
76
+ request_serializer=file__service__pb2.BatchGetGcsUrlRequest.SerializeToString,
77
+ response_deserializer=file__service__pb2.BatchGetGcsUrlResponse.FromString,
78
+ _registered_method=True)
64
79
  self.GenerateShareLink = channel.unary_unary(
65
80
  '/file.FileService/GenerateShareLink',
66
81
  request_serializer=file__service__pb2.ShareLinkRequest.SerializeToString,
@@ -128,6 +143,24 @@ class FileServiceServicer(object):
128
143
  context.set_details('Method not implemented!')
129
144
  raise NotImplementedError('Method not implemented!')
130
145
 
146
+ def BatchGenerateDownloadUrl(self, request, context):
147
+ """Missing associated documentation comment in .proto file."""
148
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
149
+ context.set_details('Method not implemented!')
150
+ raise NotImplementedError('Method not implemented!')
151
+
152
+ def GetGcsUrl(self, request, context):
153
+ """Missing associated documentation comment in .proto file."""
154
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
155
+ context.set_details('Method not implemented!')
156
+ raise NotImplementedError('Method not implemented!')
157
+
158
+ def BatchGetGcsUrl(self, request, context):
159
+ """Missing associated documentation comment in .proto file."""
160
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
161
+ context.set_details('Method not implemented!')
162
+ raise NotImplementedError('Method not implemented!')
163
+
131
164
  def GenerateShareLink(self, request, context):
132
165
  """Missing associated documentation comment in .proto file."""
133
166
  context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -192,6 +225,21 @@ def add_FileServiceServicer_to_server(servicer, server):
192
225
  request_deserializer=file__service__pb2.DownloadUrlRequest.FromString,
193
226
  response_serializer=file__service__pb2.DownloadUrlResponse.SerializeToString,
194
227
  ),
228
+ 'BatchGenerateDownloadUrl': grpc.unary_unary_rpc_method_handler(
229
+ servicer.BatchGenerateDownloadUrl,
230
+ request_deserializer=file__service__pb2.BatchDownloadUrlRequest.FromString,
231
+ response_serializer=file__service__pb2.BatchDownloadUrlResponse.SerializeToString,
232
+ ),
233
+ 'GetGcsUrl': grpc.unary_unary_rpc_method_handler(
234
+ servicer.GetGcsUrl,
235
+ request_deserializer=file__service__pb2.GetGcsUrlRequest.FromString,
236
+ response_serializer=file__service__pb2.GetGcsUrlResponse.SerializeToString,
237
+ ),
238
+ 'BatchGetGcsUrl': grpc.unary_unary_rpc_method_handler(
239
+ servicer.BatchGetGcsUrl,
240
+ request_deserializer=file__service__pb2.BatchGetGcsUrlRequest.FromString,
241
+ response_serializer=file__service__pb2.BatchGetGcsUrlResponse.SerializeToString,
242
+ ),
195
243
  'GenerateShareLink': grpc.unary_unary_rpc_method_handler(
196
244
  servicer.GenerateShareLink,
197
245
  request_deserializer=file__service__pb2.ShareLinkRequest.FromString,
@@ -370,6 +418,87 @@ class FileService(object):
370
418
  metadata,
371
419
  _registered_method=True)
372
420
 
421
+ @staticmethod
422
+ def BatchGenerateDownloadUrl(request,
423
+ target,
424
+ options=(),
425
+ channel_credentials=None,
426
+ call_credentials=None,
427
+ insecure=False,
428
+ compression=None,
429
+ wait_for_ready=None,
430
+ timeout=None,
431
+ metadata=None):
432
+ return grpc.experimental.unary_unary(
433
+ request,
434
+ target,
435
+ '/file.FileService/BatchGenerateDownloadUrl',
436
+ file__service__pb2.BatchDownloadUrlRequest.SerializeToString,
437
+ file__service__pb2.BatchDownloadUrlResponse.FromString,
438
+ options,
439
+ channel_credentials,
440
+ insecure,
441
+ call_credentials,
442
+ compression,
443
+ wait_for_ready,
444
+ timeout,
445
+ metadata,
446
+ _registered_method=True)
447
+
448
+ @staticmethod
449
+ def GetGcsUrl(request,
450
+ target,
451
+ options=(),
452
+ channel_credentials=None,
453
+ call_credentials=None,
454
+ insecure=False,
455
+ compression=None,
456
+ wait_for_ready=None,
457
+ timeout=None,
458
+ metadata=None):
459
+ return grpc.experimental.unary_unary(
460
+ request,
461
+ target,
462
+ '/file.FileService/GetGcsUrl',
463
+ file__service__pb2.GetGcsUrlRequest.SerializeToString,
464
+ file__service__pb2.GetGcsUrlResponse.FromString,
465
+ options,
466
+ channel_credentials,
467
+ insecure,
468
+ call_credentials,
469
+ compression,
470
+ wait_for_ready,
471
+ timeout,
472
+ metadata,
473
+ _registered_method=True)
474
+
475
+ @staticmethod
476
+ def BatchGetGcsUrl(request,
477
+ target,
478
+ options=(),
479
+ channel_credentials=None,
480
+ call_credentials=None,
481
+ insecure=False,
482
+ compression=None,
483
+ wait_for_ready=None,
484
+ timeout=None,
485
+ metadata=None):
486
+ return grpc.experimental.unary_unary(
487
+ request,
488
+ target,
489
+ '/file.FileService/BatchGetGcsUrl',
490
+ file__service__pb2.BatchGetGcsUrlRequest.SerializeToString,
491
+ file__service__pb2.BatchGetGcsUrlResponse.FromString,
492
+ options,
493
+ channel_credentials,
494
+ insecure,
495
+ call_credentials,
496
+ compression,
497
+ wait_for_ready,
498
+ timeout,
499
+ metadata,
500
+ _registered_method=True)
501
+
373
502
  @staticmethod
374
503
  def GenerateShareLink(request,
375
504
  target,
@@ -13,6 +13,9 @@ service FileService {
13
13
  rpc GenerateResumableUploadUrl (UploadUrlRequest) returns (UploadUrlResponse);
14
14
  rpc ConfirmUploadCompleted (UploadCompletedRequest) returns (Empty);
15
15
  rpc GenerateDownloadUrl (DownloadUrlRequest) returns (DownloadUrlResponse);
16
+ rpc BatchGenerateDownloadUrl (BatchDownloadUrlRequest) returns (BatchDownloadUrlResponse);
17
+ rpc GetGcsUrl (GetGcsUrlRequest) returns (GetGcsUrlResponse);
18
+ rpc BatchGetGcsUrl (BatchGetGcsUrlRequest) returns (BatchGetGcsUrlResponse);
16
19
  rpc GenerateShareLink (ShareLinkRequest) returns (ShareLinkResponse);
17
20
  rpc VisitFile (FileVisitRequest) returns (Empty);
18
21
  rpc GetFile (GetFileRequest) returns (GetFileResponse);
@@ -120,6 +123,20 @@ message ListFilesRequest {
120
123
  optional int32 page = 7;
121
124
  }
122
125
 
126
+ message BatchDownloadUrlRequest {
127
+ repeated string file_ids = 1;
128
+ optional bool is_cdn = 2;
129
+ optional int32 expire_seconds = 3;
130
+ }
131
+
132
+ message GetGcsUrlRequest {
133
+ string file_id = 1;
134
+ }
135
+
136
+ message BatchGetGcsUrlRequest {
137
+ repeated string file_ids = 1;
138
+ }
139
+
123
140
  // ========= 响应结构 =========
124
141
 
125
142
  message UploadFileResponse {
@@ -150,4 +167,30 @@ message GetFileResponse {
150
167
  optional UploadFile upload_file = 2;
151
168
  }
152
169
 
170
+ message BatchDownloadUrlResponse {
171
+ repeated DownloadUrlInfo download_urls = 1;
172
+ }
173
+
174
+ message DownloadUrlInfo {
175
+ string file_id = 1;
176
+ string url = 2;
177
+ optional string error = 3;
178
+ }
179
+
180
+ message GetGcsUrlResponse {
181
+ string gcs_url = 1;
182
+ string mime_type = 2;
183
+ }
184
+
185
+ message BatchGetGcsUrlResponse {
186
+ repeated GcsUrlInfo gcs_urls = 1;
187
+ }
188
+
189
+ message GcsUrlInfo {
190
+ string file_id = 1;
191
+ string gcs_url = 2;
192
+ string mime_type = 3;
193
+ optional string error = 4;
194
+ }
195
+
153
196
  message Empty {}
@@ -11,6 +11,11 @@ from .file import (
11
11
  FileListRequest,
12
12
  FileListResponse,
13
13
  GetFileResponse,
14
+ DownloadUrlInfo,
15
+ BatchDownloadUrlResponse,
16
+ GcsUrlInfo,
17
+ GetGcsUrlResponse,
18
+ BatchGcsUrlResponse,
14
19
  )
15
20
  from .folder import (
16
21
  FolderInfo,
@@ -63,6 +68,11 @@ __all__ = [
63
68
  "FileListRequest",
64
69
  "FileListResponse",
65
70
  "GetFileResponse",
71
+ "DownloadUrlInfo",
72
+ "BatchDownloadUrlResponse",
73
+ "GcsUrlInfo",
74
+ "GetGcsUrlResponse",
75
+ "BatchGcsUrlResponse",
66
76
 
67
77
  # 文件夹相关
68
78
  "FolderInfo",
@@ -93,3 +93,34 @@ class GetFileResponse(BaseModel):
93
93
  """获取文件响应"""
94
94
  file: File = Field(..., description="文件信息")
95
95
  upload_file: Optional[UploadFile] = Field(None, description="上传文件信息")
96
+
97
+
98
+ class DownloadUrlInfo(BaseModel):
99
+ """下载URL信息"""
100
+ file_id: str = Field(..., description="文件ID")
101
+ url: str = Field(..., description="下载URL")
102
+ error: Optional[str] = Field(None, description="错误信息")
103
+
104
+
105
+ class BatchDownloadUrlResponse(BaseModel):
106
+ """批量下载URL响应"""
107
+ download_urls: List[DownloadUrlInfo] = Field(default_factory=list, description="下载URL列表")
108
+
109
+
110
+ class GcsUrlInfo(BaseModel):
111
+ """GCS URL信息"""
112
+ file_id: str = Field(..., description="文件ID")
113
+ gcs_url: str = Field(..., description="GCS URL")
114
+ mime_type: str = Field(..., description="MIME类型")
115
+ error: Optional[str] = Field(None, description="错误信息")
116
+
117
+
118
+ class GetGcsUrlResponse(BaseModel):
119
+ """获取GCS URL响应"""
120
+ gcs_url: str = Field(..., description="GCS URL")
121
+ mime_type: str = Field(..., description="MIME类型")
122
+
123
+
124
+ class BatchGcsUrlResponse(BaseModel):
125
+ """批量GCS URL响应"""
126
+ gcs_urls: List[GcsUrlInfo] = Field(default_factory=list, description="GCS URL列表")