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 @POST("/api/v1/links") suspend fun addLink(@Body link: CreateLinkDto): Response @PUT("/api/v1/links/{id}") suspend fun updateLink(@Path("id") id: Int, @Body link: CreateLinkDto): Response @DELETE("/api/v1/links/{id}") suspend fun deleteLink(@Path("id") id: Int): Response @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 /** 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 }