Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Commit 9144d33

Browse files
committed
update: README.md
Release v1.0.0
1 parent c13912d commit 9144d33

File tree

2 files changed

+100
-8
lines changed

2 files changed

+100
-8
lines changed

README.md

+95-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# consumable-code-covid-19-api By AmirIsBack
22
- v1.0.0 - Development
3-
- Release soon
3+
- Stable Version
44

55
# About This Project
66
Eliminates the method of retrieving json data using retrofit repeatedly. so this project has a set of functions to retrieve data without the need for fetching data using the retrofit of the API
@@ -19,6 +19,57 @@ https://covid19api.com/
1919

2020
# Function Main From This Project
2121

22+
// Switch For Using Chuck Interceptor
23+
fun usingChuckInterceptor(context: Context)
24+
25+
// Get Summary Data
26+
// Return new cases and total cases per country.
27+
fun getSummaryData(callback: Covid19ResultCallback<ReponseSummary>)
28+
29+
// Get All Data
30+
// This call returns ~8MB of data and currently takes around 5 seconds.
31+
fun getAllData(callback: Covid19ResultCallback<List<Status>>)
32+
33+
// Get All Countries
34+
// List all countries and their provinces.
35+
fun getAllCountries(callback: Covid19ResultCallback<List<Country>>)
36+
37+
// Get Status By Country
38+
// {country} must be the country_slug the API call above
39+
// {status} must be one of: confirmed, deaths, recovered
40+
fun getStatusByCountry(
41+
country: String,
42+
status: String,
43+
callback: Covid19ResultCallback<List<Status>>
44+
)
45+
46+
// Get Status By Country And Province
47+
// {country} must be the country_slug the API call above
48+
// {status} must be one of: confirmed, deaths, recovered
49+
fun getStatusByCountryProvince(
50+
country: String,
51+
status: String,
52+
callback: Covid19ResultCallback<List<Status>>
53+
)
54+
55+
// Get Status By Country From First Recorded Case
56+
// {country} must be the country_slug the API call above
57+
// {status} must be one of: confirmed, deaths, recovered
58+
fun getFirstRecordedByCountry(
59+
country: String,
60+
status: String,
61+
callback: Covid19ResultCallback<List<Status>>
62+
)
63+
64+
// Get Status By Country And Province From First Recorded Case
65+
// {country} must be the country_slug the API call above
66+
// {status} must be one of: confirmed, deaths, recovered
67+
fun getFirstRecordedByCountryProvince(
68+
country: String,
69+
status: String,
70+
callback: Covid19ResultCallback<List<Status>>
71+
)
72+
2273
# Android Library Version (build.gradle)
2374
- ext.kotlin_version = '1.3.70'
2475
- classpath 'com.android.tools.build:gradle:3.6.1'
@@ -29,13 +80,54 @@ https://covid19api.com/
2980
# Version Release
3081
This Is Latest Release
3182

32-
$version_release = Release Soon
83+
$version_release = 1.0.0
3384

3485
What's New??
3586

36-
* Development Mode *
87+
* Consumable Code Covid 19 API*
3788

3889
# How To Use This Project
90+
<h3>Step 1. Add the JitPack repository to your build file</h3>
91+
92+
Add it in your root build.gradle at the end of repositories:
93+
94+
allprojects {
95+
repositories {
96+
...
97+
maven { url 'https://jitpack.io' }
98+
}
99+
}
100+
101+
102+
<h3>Step 2. Add the dependency</h3>
103+
104+
dependencies {
105+
// library consumable code covid 19 api
106+
implementation 'com.github.amirisback:consumable-code-covid-19-api:$version_release'
107+
}
108+
109+
<h3>Step 3. Declaration ConsumeTheSportDbApi</h3>
110+
111+
val consumeCovid19Api = ConsumeCovid19Api()
112+
consumeCovid19Api.usingChuckInterceptor(this) // This is Code Chuck Interceptor
113+
consumeCovid19Api.getSummaryData(object : Covid19ResultCallback<ReponseSummary> {
114+
override fun getResultData(data: ReponseSummary) {
115+
// * PLACE YOUR CODE HERE FOR UI / ARRAYLIST *
116+
}
117+
118+
override fun failedResult(statusCode: Int, errorMessage: String?) {
119+
// failed result
120+
}
121+
122+
override fun onShowProgress() {
123+
// showing your progress view
124+
}
125+
126+
override fun onHideProgress() {
127+
// hiding your progress view
128+
}
129+
})
130+
39131

40132

41133
# Colaborator

app/src/main/java/com/frogobox/covid19api/MainActivity.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ class MainActivity : AppCompatActivity() {
1313
setContentView(R.layout.activity_main)
1414

1515
val consumeCovid19Api = ConsumeCovid19Api()
16-
consumeCovid19Api.usingChuckInterceptor(this)
16+
consumeCovid19Api.usingChuckInterceptor(this) // This is Code Chuck Interceptor
1717
consumeCovid19Api.getSummaryData(object : Covid19ResultCallback<ReponseSummary> {
1818
override fun getResultData(data: ReponseSummary) {
19-
println(data.countries?.get(0)?.country)
19+
// * PLACE YOUR CODE HERE FOR UI / ARRAYLIST *
2020
}
2121

2222
override fun failedResult(statusCode: Int, errorMessage: String?) {
23-
23+
// failed result
2424
}
2525

2626
override fun onShowProgress() {
27-
27+
// showing your progress view
2828
}
2929

3030
override fun onHideProgress() {
31-
31+
// hiding your progress view
3232
}
3333
})
3434

0 commit comments

Comments
 (0)