Commit 5b64fc34 authored by Vladislav's avatar Vladislav

add multitour offers method

parent db683550
...@@ -40,14 +40,14 @@ class BigantoRetrofitRepository(retrofit:Retrofit) : IBigantoApi{ ...@@ -40,14 +40,14 @@ class BigantoRetrofitRepository(retrofit:Retrofit) : IBigantoApi{
override fun getTourMetaAsString(tour_id: String): Observable<String> = api override fun getTourMetaAsString(tour_id: String): Observable<String> = api
.getTourMetaAsString(ids = tour_id) .getTourMetaAsString(ids = tour_id)
.map { it.toString() } .map { it.toString() }
.doOnError { Timber.e(it) } .doOnError { e(it) }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
override fun getTourFiles(tour_id: String, resolution: String): Observable<List<TourFilesDataRaw>> = api override fun getTourFiles(tour_id: String, resolution: String): Observable<List<TourFilesDataRaw>> = api
.getTourFiles(ids = tour_id, resolution = resolution) .getTourFiles(ids = tour_id, resolution = resolution)
.compose(RetrofitResponseValidation()) .compose(RetrofitResponseValidation())
.doOnError { Timber.e(it) } .doOnError { e(it) }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -55,6 +55,15 @@ class BigantoRetrofitRepository(retrofit:Retrofit) : IBigantoApi{ ...@@ -55,6 +55,15 @@ class BigantoRetrofitRepository(retrofit:Retrofit) : IBigantoApi{
.requestFile(headers ?: HashMap<String, String>(), uri) .requestFile(headers ?: HashMap<String, String>(), uri)
.compose(FlowableRetrofitResponseValidation()) .compose(FlowableRetrofitResponseValidation())
.doOnError(::e) .doOnError(::e)
override fun getOfferTours(multiTourId:Int): Observable<List<TourPreviewRaw>> =
api
.getOfferTours(offerId = multiTourId)
.compose(RetrofitResponseValidation())
.map { it.data[multiTourId]?.toList()?: error("No tours avaliable")}
.doOnError { e(it) }
.subscribeOn(Schedulers.io())
} }
......
...@@ -23,4 +23,6 @@ interface IBigantoApi { ...@@ -23,4 +23,6 @@ interface IBigantoApi {
fun getTourFiles(tour_id: String, resolution: String): Observable<List<TourFilesDataRaw>> fun getTourFiles(tour_id: String, resolution: String): Observable<List<TourFilesDataRaw>>
fun getAppVersion(): Observable<AppVersionRaw> fun getAppVersion(): Observable<AppVersionRaw>
fun getToursPreviewById(tourIds: List<String>): Observable<List<TourPreviewRaw>> fun getToursPreviewById(tourIds: List<String>): Observable<List<TourPreviewRaw>>
fun getOfferTours(multiTourId:Int): Observable<List<TourPreviewRaw>>
} }
\ No newline at end of file
package com.biganto.visual.roompark.data.repository.api.biganto package com.biganto.visual.roompark.data.repository.api.biganto
import com.biganto.visual.roompark.data.repository.api.biganto.raw.AppVersionRaw import com.biganto.visual.roompark.data.repository.api.biganto.raw.AppVersionRaw
import com.biganto.visual.roompark.data.repository.api.biganto.raw.OfferTours
import com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFilesDataRaw import com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFilesDataRaw
import com.biganto.visual.roompark.data.repository.api.biganto.raw.TourPreviewRaw import com.biganto.visual.roompark.data.repository.api.biganto.raw.TourPreviewRaw
import com.google.gson.JsonArray import com.google.gson.JsonArray
...@@ -92,6 +93,11 @@ interface IBigantoMobileApi { ...@@ -92,6 +93,11 @@ interface IBigantoMobileApi {
const val GET_TOURS_FILES_ID="id" const val GET_TOURS_FILES_ID="id"
const val GET_TOURS_FILES_RESOLUTION="resolution" const val GET_TOURS_FILES_RESOLUTION="resolution"
//endregion //endregion
//region offers.GetTours
const val OFFER_GET_TOURS_METHOD="offers.getTours"
const val OFFER_GET_TOURS_ID="id"
//endregion
} }
@GET("$API_URL$GET_TOURS_METHOD$DELIMITER") @GET("$API_URL$GET_TOURS_METHOD$DELIMITER")
...@@ -133,6 +139,16 @@ interface IBigantoMobileApi { ...@@ -133,6 +139,16 @@ interface IBigantoMobileApi {
): Observable<Response<AppVersionRaw>> ): Observable<Response<AppVersionRaw>>
@GET("$API_URL$OFFER_GET_TOURS_METHOD$DELIMITER")
fun getOfferTours(
@Query(CLIENT_TYPE_PARAM) clientType: String = DEFAULT_CLIENT_TYPE,
@Query(CLIENT_VERSION_PARAM) clientVersion: String = DEFAULT_CLIENT_VERSION,
@Query(API_VERSION_PARAM) apiVersion: String = DEFAULT_API_VERSION,
@Query(LANG_PARAM) languageCode: String = Locale.getDefault().language,
@Query(OFFER_GET_TOURS_METHOD) offerId: Int
): Observable<Response<OfferTours>>
@Streaming @Streaming
@GET @GET
fun requestFile( fun requestFile(
......
...@@ -95,6 +95,11 @@ data class TourGetFilesRaw( ...@@ -95,6 +95,11 @@ data class TourGetFilesRaw(
val errors:List<ErrorRaw>? val errors:List<ErrorRaw>?
) )
data class OfferTours(
val data: Map<Int,List<TourPreviewRaw>>,
val errors:List<ErrorRaw>?
)
data class AppVersionRaw( data class AppVersionRaw(
val current_version : String, val current_version : String,
val download_url : String?, val download_url : String?,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment