@@ -18,6 +18,43 @@ Simple code and reusable data
1818https://newsapi.org/
1919
2020# Function Main From This Project
21+ // Switch For Using Chuck Interceptor
22+ fun usingChuckInterceptor(context: Context)
23+
24+ // Get Top Headline
25+ fun getTopHeadline(
26+ q: String?,
27+ sources: String?,
28+ category: String?,
29+ country: String?,
30+ pageSize: Int?,
31+ page: Int?,
32+ callback: NewsResultCallback<ArticleResponse>
33+ )
34+
35+ // Get Everythings
36+ fun getEverythings(
37+ q: String?,
38+ from: String?,
39+ to: String?,
40+ qInTitle: String?,
41+ sources: String?,
42+ domains: String?,
43+ excludeDomains: String?,
44+ language: String?,
45+ sortBy: String?,
46+ pageSize: Int?,
47+ page: Int?,
48+ callback: NewsResultCallback<ArticleResponse>
49+ )
50+
51+ // Get Sources
52+ fun getSources(
53+ language: String,
54+ country: String,
55+ category: String,
56+ callback: NewsResultCallback<SourceResponse>
57+ )
2158
2259# Android Library Version (build.gradle)
2360- ext.kotlin_version = '1.3.70'
@@ -29,14 +66,62 @@ https://newsapi.org/
2966# Version Release
3067This Is Latest Release
3168
32- $version_release = Still on development
69+ $version_release = 1.0.0
3370
3471What's New??
3572
36- * Development *
73+ * Fetching All Function on News Api *
3774
3875# How To Use This Project
39- - Release soon
76+ <h3 >Step 1. Add the JitPack repository to your build file</h3 >
77+
78+ Add it in your root build.gradle at the end of repositories:
79+
80+ allprojects {
81+ repositories {
82+ ...
83+ maven { url 'https://jitpack.io' }
84+ }
85+ }
86+
87+
88+ <h3 >Step 2. Add the dependency</h3 >
89+
90+ dependencies {
91+ // library consumable code news api
92+ implementation 'com.github.amirisback:consumable-code-news-api:$version_release'
93+ }
94+
95+ <h3 >Step 3. Declaration ConsumeNewsApi</h3 >
96+
97+ val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY) // Your API_KEY
98+ consumeNewsApi.usingChuckInterceptor(this) // Using Chuck Interceptor
99+ consumeNewsApi.getTopHeadline( // Adding Base Parameter on main function
100+ null,
101+ null,
102+ null,
103+ "id",
104+ null,
105+ null,
106+ object : NewsResultCallback<ArticleResponse> {
107+ override fun getResultData(data: ArticleResponse) {
108+ // Your Ui or data
109+ }
110+
111+ override fun failedResult(statusCode: Int, errorMessage: String?) {
112+ // Your failed to do
113+ }
114+
115+ override fun onShowProgress() {
116+ // Your Progress Show
117+ }
118+
119+ override fun onHideProgress() {
120+ // Your Progress Hide
121+ }
122+
123+ })
124+
40125
41126# Colaborator
42127Very open to anyone, I'll write your name under this, please contribute by sending an email to me
0 commit comments