Amaliy ish №3,4 Topshirdi: Ustaboyev Abbosbek Qabul qildi: Jabborova N. Toshkent 022 Mavzu: Dasturiy mahsulotning backend qismi. Dastur kodi va screenshot: Bu ilova mvvm arhitekturasida qili Shopping Repository



Download 453,35 Kb.
bet2/11
Sana20.07.2022
Hajmi453,35 Kb.
#829770
1   2   3   4   5   6   7   8   9   10   11
Bog'liq
UnitTest Dik 3-4

Api uchun kerakli kodlar :

package mobiler.abbosbek.onlineshopping.api

import io.reactivex.Observable
import mobiler.abbosbek.onlineshopping.model.BaseResponse
import mobiler.abbosbek.onlineshopping.model.CategoryModel
import mobiler.abbosbek.onlineshopping.model.OfferModel
import mobiler.abbosbek.onlineshopping.model.ProductModel
import mobiler.abbosbek.onlineshopping.model.request.GetProductsByIdRequest
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path

interface Api {


@GET("get_offers")
fun getOffers() : Observable>>

@GET("get_categories")


fun getCategories() : Observable>>

@GET("get_top_products")


fun getTopProducts() : Observable>>

@GET("get_products/{category_id}")


fun getCategoryProducts(@Path("category_id" ) categoryId : Int) : Observable>>

@POST("get_products_by_ids")


fun getTopProductsByIds(@Body request: GetProductsByIdRequest) : Observable>>
}
Apidan ma’lumotni olish uchun

package mobiler.abbosbek.onlineshopping.api

import mobiler.abbosbek.onlineshopping.utils.Constants
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory

object NetworkManager {


var retrofit : Retrofit ?= null
var api : Api ?= null

fun getApiService() : Api{


if (api == null){
retrofit = Retrofit
.Builder()
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.baseUrl(Constants.BASE_URL)
.build()
api = retrofit!!.create(Api::class.java)
}
return api!!
}
}



Download 453,35 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10   11




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish