|
@@ -0,0 +1,168 @@
|
|
|
|
+package com.example.kdan_data_center.datacenter.file
|
|
|
|
+
|
|
|
|
+import com.example.kdan_data_center.datacenter.file.body.SyncBody
|
|
|
|
+import com.example.kdan_data_center.datacenter.file.data.*
|
|
|
|
+import io.reactivex.Observable
|
|
|
|
+import retrofit2.http.*
|
|
|
|
+
|
|
|
|
+interface FileService {
|
|
|
|
+ companion object {
|
|
|
|
+ const val BASE_URL = "api/v3/file_objects/"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @POST("upload_mission")
|
|
|
|
+ fun uploadFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Header("Content-Type") contentType: String
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @GET("list")
|
|
|
|
+ fun getFileInfo(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Query("object_type") objectType: String?,
|
|
|
|
+ @Query("object_state") objectState: String?,
|
|
|
|
+ @Query("object_id_list[]") objectIdList: Array<Int>?,
|
|
|
|
+ @Query("category") category: String?,
|
|
|
|
+ @Query("app_series") appSeries: String?
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @GET(".")
|
|
|
|
+ fun getFileInfo(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Query("object_type") objectType: String?,
|
|
|
|
+ @Query("object_id") objectId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @PUT(".")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun updateFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_id") objectId: Int,
|
|
|
|
+ @Field("project_name") projectName: String?,
|
|
|
|
+ @Field("parent_id") parentId: Int?
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @HTTP(method = "DELETE", path = ".", hasBody = true)
|
|
|
|
+ fun deleteFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_id") objectId: Int,
|
|
|
|
+ @Field("object_type") objectType: String?
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @HTTP(method = "DELETE", path = ".", hasBody = true)
|
|
|
|
+ fun deleteFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_id_list") objectIdList: Array<Int>,
|
|
|
|
+ @Field("object_type") objectType: String?
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @HTTP(method = "DELETE", path = "hard_destroy", hasBody = true)
|
|
|
|
+ fun hardDeleteFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id") objectId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @HTTP(method = "DELETE", path = "hard_destroy", hasBody = true)
|
|
|
|
+ fun hardDeleteFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id_list") objectIdList: Array<Int>
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @HTTP(method = "DELETE", path = "clean", hasBody = true)
|
|
|
|
+ fun cleanDeleteFile(
|
|
|
|
+ @Header("Authorization") accessToken: String
|
|
|
|
+ ): Observable<CleanDeleteFileData>
|
|
|
|
+
|
|
|
|
+ @PUT("restore")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun restoreFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id") objectId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @PUT("restore")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun restoreFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id_list") objectIdList: Array<Int>
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @POST("copy")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun copyFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id") objectId: Int,
|
|
|
|
+ @Field("parent_id") parentId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @POST("copy")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun copyFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id_list") objectIdList: Array<Int>,
|
|
|
|
+ @Field("parent_id") parentId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @PUT("move")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun moveFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id") objectId: Int,
|
|
|
|
+ @Field("parent_id") parentId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @PUT("move")
|
|
|
|
+ @FormUrlEncoded
|
|
|
|
+ fun moveFile(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Field("object_type") objectType: String?,
|
|
|
|
+ @Field("object_id_list") objectIdList: Array<Int>,
|
|
|
|
+ @Field("parent_id") parentId: Int
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @GET("download_url")
|
|
|
|
+ fun getDownloadUrl(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Query("object_id") objectId: Int,
|
|
|
|
+ @Query("object_type") objectType: String?
|
|
|
|
+ ): Observable<DownloadUrlData>
|
|
|
|
+
|
|
|
|
+ @GET("data_source_url")
|
|
|
|
+ fun getDataSourceUrl(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Query("object_id") objectId: Int
|
|
|
|
+ ): Observable<DataSourceUrlData>
|
|
|
|
+
|
|
|
|
+ @GET("file_credential")
|
|
|
|
+ fun getFileCredential(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Query("object_id") objectId: Int,
|
|
|
|
+ @Query("object_type") objectType: String?
|
|
|
|
+ ): Observable<FileCredentialData>
|
|
|
|
+
|
|
|
|
+ @GET("preview_token")
|
|
|
|
+ fun getFilePreviewToken(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Query("object_id") objectId: Int,
|
|
|
|
+ @Query("object_type") objectType: String?
|
|
|
|
+ ): Observable<FilePreviewTokenData>
|
|
|
|
+
|
|
|
|
+ @GET("preview_info")
|
|
|
|
+ fun getFilePreviewInfo(
|
|
|
|
+ @Query("token") previewToken: String
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ @PUT("sync_architecture")
|
|
|
|
+ fun sync(
|
|
|
|
+ @Header("Authorization") accessToken: String,
|
|
|
|
+ @Header("Content-Type") contentType: String,
|
|
|
|
+ @Body syncBody: SyncBody
|
|
|
|
+ ): Observable<SyncData>
|
|
|
|
+}
|