72 lines
1.7 KiB
Kotlin
72 lines
1.7 KiB
Kotlin
|
|
package xyz.r0r5chach
|
||
|
|
|
||
|
|
import retrofit2.http.GET
|
||
|
|
import retrofit2.http.Path
|
||
|
|
import xyz.r0r5chach.RadicleApi.Companion.V1
|
||
|
|
import xyz.r0r5chach.entities.ApiIndex
|
||
|
|
import xyz.r0r5chach.entities.ApiInfo
|
||
|
|
import xyz.r0r5chach.entities.NodeByIdInfo
|
||
|
|
import xyz.r0r5chach.entities.NodeInfo
|
||
|
|
import xyz.r0r5chach.entities.Repo
|
||
|
|
import xyz.r0r5chach.entities.Root
|
||
|
|
import xyz.r0r5chach.entities.Stats
|
||
|
|
|
||
|
|
interface RadicleV1Service {
|
||
|
|
@GET("/")
|
||
|
|
suspend fun getRoot(): Root
|
||
|
|
|
||
|
|
@GET("/api")
|
||
|
|
suspend fun getApi(): ApiIndex
|
||
|
|
|
||
|
|
@GET("/raw/{rid}/head/{path}")
|
||
|
|
suspend fun getFileByCanonicalHead(
|
||
|
|
@Path("rid") rid: String,
|
||
|
|
@Path("path") path: String
|
||
|
|
) //TODO: IO Types
|
||
|
|
|
||
|
|
@GET("/raw/{rid}/blobs/{oid}")
|
||
|
|
suspend fun getFileByOID(
|
||
|
|
@Path("rid") rid: String,
|
||
|
|
@Path("oid") oid: String
|
||
|
|
) //TODO: IO Types
|
||
|
|
|
||
|
|
@GET("/{rid}/{request}")
|
||
|
|
suspend fun getGit(
|
||
|
|
@Path("rid") rid: String,
|
||
|
|
@Path("request") request: String
|
||
|
|
) //TODO: IO Types
|
||
|
|
|
||
|
|
@GET("/raw/{rid}/{sha}/{path}")
|
||
|
|
suspend fun getFileByCommit(
|
||
|
|
@Path("rid") rid: String,
|
||
|
|
@Path("sha") sha: String,
|
||
|
|
@Path("path") path: String
|
||
|
|
) //TODO: IO Types
|
||
|
|
|
||
|
|
@GET(V1)
|
||
|
|
suspend fun getInfo(): ApiInfo
|
||
|
|
|
||
|
|
@GET("$V1/repos")
|
||
|
|
suspend fun getRepos(): List<Repo>
|
||
|
|
|
||
|
|
@GET("$V1/repos/{rid}")
|
||
|
|
suspend fun getRepo(
|
||
|
|
@Path("rid") rid: String
|
||
|
|
): Repo
|
||
|
|
|
||
|
|
@GET("$V1/node")
|
||
|
|
suspend fun getNode(): NodeInfo
|
||
|
|
|
||
|
|
@GET("$V1/nodes/{nid}")
|
||
|
|
suspend fun getNodeById(
|
||
|
|
@Path("nid") nid: String
|
||
|
|
): NodeByIdInfo
|
||
|
|
|
||
|
|
@GET("$V1/delegates/{did}/repos")
|
||
|
|
suspend fun getDelegateRepos(
|
||
|
|
@Path("did") did: String
|
||
|
|
): List<Repo>
|
||
|
|
|
||
|
|
@GET("$V1/stats")
|
||
|
|
suspend fun getStats(): Stats
|
||
|
|
}
|