DownloadApiService

다운로드 관련 API를 정의한 Interface

getDownloadImg

  • URL링크에서 이미지를 다운로드한다.

@Streaming
@GET
fun getDownloadImg(@Url fileUrl:String): Observable<Response<ResponseBody>>

create

  • Service 객체를 생성하여 반환한다.

companion object {
    fun create(): DownloadApiService {

        val retrofit = Retrofit.Builder()
            .addCallAdapterFactory(
                RxJava2CallAdapterFactory.create()) //retrofit 과 rx의 조합
            .baseUrl("http://www.thecamp.or.kr/")
            .build()

        return retrofit.create(DownloadApiService::class.java)
    }
}

Last updated

Was this helpful?