Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing to disease.sh api #86

Open
wants to merge 5 commits into
base: release/4.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object RetrofitInstance {

fun createInstance(): Retrofit {
return Retrofit.Builder()
.baseUrl("https://api.covid19api.com")
.baseUrl("https://disease.sh/v3/covid-19/")
.addConverterFactory(GsonConverterFactory.create())
.build()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.gocoronago.homepage.models


import com.google.gson.annotations.SerializedName
import androidx.annotation.Keep

@Keep
data class WorldwideData(
@SerializedName("active")
var active: Double?, // 0
@SerializedName("activePerOneMillion")
var activePerOneMillion: Double?, // 0
@SerializedName("affectedCountries")
var affectedCountries: Double?, // 0
@SerializedName("cases")
var cases: Double?, // 0
@SerializedName("casesPerOneMillion")
var casesPerOneMillion: Double?, // 0
@SerializedName("critical")
var critical: Double?, // 0
@SerializedName("criticalPerOneMillion")
var criticalPerOneMillion: Double?, // 0
@SerializedName("deaths")
var deaths: Double?, // 0
@SerializedName("deathsPerOneMillion")
var deathsPerOneMillion: Double?, // 0
@SerializedName("oneCasePerPeople")
var oneCasePerPeople: Double?, // 0
@SerializedName("oneDeathPerPeople")
var oneDeathPerPeople: Double?, // 0
@SerializedName("oneTestPerPeople")
var oneTestPerPeople: Double?, // 0
@SerializedName("population")
var population: Double?, // 0
@SerializedName("recovered")
var recovered: Double?, // 0
@SerializedName("recoveredPerOneMillion")
var recoveredPerOneMillion: Double?, // 0
@SerializedName("tests")
var tests: Double?, // 0
@SerializedName("testsPerOneMillion")
var testsPerOneMillion: Double?, // 0
@SerializedName("todayCases")
var todayCases: Double?, // 0
@SerializedName("todayRecovered")
var todayRecovered: Double?, // 0
@SerializedName("updated")
var updated: Double? // 0
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.example.gocoronago.ui.main

import com.example.gocoronago.homepage.Summary
import com.example.gocoronago.homepage.models.WorldwideData
import retrofit2.http.GET

interface MainInterface {
@GET("summary")
suspend fun getSummary(): Summary
@GET("all")
suspend fun getSummary(): WorldwideData
}
4 changes: 2 additions & 2 deletions app/src/main/java/com/example/gocoronago/ui/main/MainRepo.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.example.gocoronago.ui.main

import com.example.gocoronago.homepage.Summary
import com.example.gocoronago.base.BaseRepo
import com.example.gocoronago.homepage.models.WorldwideData

class MainRepo : BaseRepo() {

private val service = retrofit.create(MainInterface::class.java)
suspend fun getCovidSummary(): Summary {
suspend fun getCovidSummary(): WorldwideData {
return service.getSummary()
}
}