Skip to content

Instantly share code, notes, and snippets.

@andijakl
Created January 24, 2019 21:07
Show Gist options
  • Select an option

  • Save andijakl/efc94fa3bdddd458c58f3ed12f926686 to your computer and use it in GitHub Desktop.

Select an option

Save andijakl/efc94fa3bdddd458c58f3ed12f926686 to your computer and use it in GitHub Desktop.
Interface for a REST web service using Kotlin Coroutines for Retrofit
package com.andresjakl.partslist
import kotlinx.coroutines.Deferred
import retrofit2.Response
import retrofit2.http.*
interface PartsApiClient {
@GET("parts") fun getPartsAsync(): Deferred<Response<List<PartData>>>
@POST("parts") fun addPartAsync(@Body newPart : PartData): Deferred<Response<Void>>
@DELETE("parts/{id}") fun deletePartAsync(@Path("id") id: Long) : Deferred<Response<Void>>
@PUT("parts/{id}") fun updatePartAsync(@Path("id") id: Long, @Body newPart: PartData) : Deferred<Response<Void>>
}
@kchvilyov
Copy link

kchvilyov commented Nov 14, 2024

Hi, Have you implemented the interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment