All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pubnub.api.services.FilesService.kt Maven / Gradle / Ivy

Go to download

PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!

There is a newer version: 10.2.0
Show newest version
package com.pubnub.api.services

import com.pubnub.api.models.server.files.GenerateUploadUrlPayload
import com.pubnub.api.models.server.files.GeneratedUploadUrlResponse
import com.pubnub.api.models.server.files.ListFilesResult
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.QueryMap

interface FilesService {
    @POST("/v1/files/{subKey}/channels/{channel}/generate-upload-url")
    fun generateUploadUrl(
        @Path("subKey") subKey: String,
        @Path("channel") channel: String,
        @Body body: GenerateUploadUrlPayload,
        @QueryMap options: Map
    ): Call

    @GET("/v1/files/publish-file/{pubKey}/{subKey}/0/{channel}/0/{message}")
    fun notifyAboutFileUpload(
        @Path("pubKey") pubKey: String,
        @Path("subKey") subKey: String,
        @Path("channel") channel: String,
        @Path(value = "message") message: String,
        @QueryMap options: Map
    ): Call>

    @GET("/v1/files/{subKey}/channels/{channel}/files")
    fun listFiles(
        @Path("subKey") subKey: String,
        @Path("channel") channel: String,
        @QueryMap options: Map
    ): Call

    @GET(GET_FILE_URL)
    fun downloadFile(
        @Path("subKey") subKey: String,
        @Path("channel") channel: String,
        @Path("fileId") fileId: String,
        @Path("fileName") fileName: String,
        @QueryMap options: Map
    ): Call

    @DELETE("/v1/files/{subKey}/channels/{channel}/files/{fileId}/{fileName}")
    fun deleteFile(
        @Path("subKey") subKey: String,
        @Path("channel") channel: String,
        @Path("fileId") fileId: String,
        @Path("fileName") fileName: String,
        @QueryMap options: Map
    ): Call

    companion object {
        const val GET_FILE_URL = "/v1/files/{subKey}/channels/{channel}/files/{fileId}/{fileName}"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy