refactor compose & announcements to coroutines (#2446)
* refactor compose & announcements to coroutines * fix code formatting * add javadoc to InstanceInfoRepository * fix comments in ImageDownsizer * remove unused Either extensions * add explicit return type for InstanceInfoRepository.getEmojis * make ComposeViewModel.pickMedia return Result * cleanup code in ImageDownsizer
This commit is contained in:
parent
d6e9fd48c0
commit
d2bfceae7b
15 changed files with 596 additions and 628 deletions
|
|
@ -77,7 +77,7 @@ interface MastodonApi {
|
|||
fun getLists(): Single<List<MastoList>>
|
||||
|
||||
@GET("/api/v1/custom_emojis")
|
||||
fun getCustomEmojis(): Single<List<Emoji>>
|
||||
suspend fun getCustomEmojis(): Result<List<Emoji>>
|
||||
|
||||
@GET("api/v1/instance")
|
||||
suspend fun getInstance(): Result<Instance>
|
||||
|
|
@ -145,17 +145,17 @@ interface MastodonApi {
|
|||
|
||||
@Multipart
|
||||
@POST("api/v2/media")
|
||||
fun uploadMedia(
|
||||
suspend fun uploadMedia(
|
||||
@Part file: MultipartBody.Part,
|
||||
@Part description: MultipartBody.Part? = null
|
||||
): Single<MediaUploadResult>
|
||||
): Result<MediaUploadResult>
|
||||
|
||||
@FormUrlEncoded
|
||||
@PUT("api/v1/media/{mediaId}")
|
||||
fun updateMedia(
|
||||
suspend fun updateMedia(
|
||||
@Path("mediaId") mediaId: String,
|
||||
@Field("description") description: String
|
||||
): Single<Attachment>
|
||||
): Result<Attachment>
|
||||
|
||||
@POST("api/v1/statuses")
|
||||
fun createStatus(
|
||||
|
|
@ -544,26 +544,26 @@ interface MastodonApi {
|
|||
): Single<Poll>
|
||||
|
||||
@GET("api/v1/announcements")
|
||||
fun listAnnouncements(
|
||||
suspend fun listAnnouncements(
|
||||
@Query("with_dismissed") withDismissed: Boolean = true
|
||||
): Single<List<Announcement>>
|
||||
): Result<List<Announcement>>
|
||||
|
||||
@POST("api/v1/announcements/{id}/dismiss")
|
||||
fun dismissAnnouncement(
|
||||
suspend fun dismissAnnouncement(
|
||||
@Path("id") announcementId: String
|
||||
): Single<ResponseBody>
|
||||
): Result<ResponseBody>
|
||||
|
||||
@PUT("api/v1/announcements/{id}/reactions/{name}")
|
||||
fun addAnnouncementReaction(
|
||||
suspend fun addAnnouncementReaction(
|
||||
@Path("id") announcementId: String,
|
||||
@Path("name") name: String
|
||||
): Single<ResponseBody>
|
||||
): Result<ResponseBody>
|
||||
|
||||
@DELETE("api/v1/announcements/{id}/reactions/{name}")
|
||||
fun removeAnnouncementReaction(
|
||||
suspend fun removeAnnouncementReaction(
|
||||
@Path("id") announcementId: String,
|
||||
@Path("name") name: String
|
||||
): Single<ResponseBody>
|
||||
): Result<ResponseBody>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("api/v1/reports")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue