feat: Add JitPack repository to dependency resolution management feat: Create ViewStyle enum for bookmark display styles feat: Implement EditLinkScreen with ViewModel for editing links feat: Add EditLinkViewModel to manage link editing state and logic feat: Create LinkItemViews for displaying links in various formats chore: Add build output and compile output logs
54 lines
1.7 KiB
Kotlin
54 lines
1.7 KiB
Kotlin
package com.shaarit.data.api
|
|
|
|
import com.shaarit.data.dto.CreateLinkDto
|
|
import com.shaarit.data.dto.InfoDto
|
|
import com.shaarit.data.dto.LinkDto
|
|
import com.shaarit.data.dto.TagDto
|
|
import retrofit2.Response
|
|
import retrofit2.http.Body
|
|
import retrofit2.http.DELETE
|
|
import retrofit2.http.GET
|
|
import retrofit2.http.POST
|
|
import retrofit2.http.PUT
|
|
import retrofit2.http.Path
|
|
import retrofit2.http.Query
|
|
|
|
interface ShaarliApi {
|
|
|
|
/** Get Shaarli instance info. Requires authentication - used to verify credentials. */
|
|
@GET("/api/v1/info") suspend fun getInfo(): InfoDto
|
|
|
|
@GET("/api/v1/links")
|
|
suspend fun getLinks(
|
|
@Query("offset") offset: Int,
|
|
@Query("limit") limit: Int,
|
|
@Query("searchterm") searchTerm: String? = null,
|
|
@Query("searchtags") searchTags: String? = null
|
|
): List<LinkDto>
|
|
|
|
@POST("/api/v1/links") suspend fun addLink(@Body link: CreateLinkDto): Response<LinkDto>
|
|
|
|
@PUT("/api/v1/links/{id}")
|
|
suspend fun updateLink(@Path("id") id: Int, @Body link: CreateLinkDto): Response<LinkDto>
|
|
|
|
@DELETE("/api/v1/links/{id}") suspend fun deleteLink(@Path("id") id: Int): Response<Unit>
|
|
|
|
@GET("/api/v1/links/{id}")
|
|
suspend fun getLink(@Path("id") id: Int): LinkDto
|
|
|
|
/** Get all tags with their occurrence count. */
|
|
@GET("/api/v1/tags")
|
|
suspend fun getTags(
|
|
@Query("offset") offset: Int = 0,
|
|
@Query("limit") limit: Int = 100
|
|
): List<TagDto>
|
|
|
|
/** Get links filtered by tags. */
|
|
@GET("/api/v1/links")
|
|
suspend fun getLinksByTag(
|
|
@Query("searchtags") tag: String,
|
|
@Query("offset") offset: Int = 0,
|
|
@Query("limit") limit: Int = 20
|
|
): List<LinkDto>
|
|
}
|