@@ -17,27 +17,28 @@ class DefaultNewsFeedApi(
17
17
) : NewsFeedApi {
18
18
override suspend fun getNewsFeed (): NewsFeed {
19
19
val currentDate = DateFormatter .formattedDate
20
- return httpClient.get {
21
- url{
22
- appendEncodedPathSegments(" feed" ," v1" ," wikipedia" ," en" ," featured" ,currentDate)
20
+ return httpClient.get {
21
+ url {
22
+ appendEncodedPathSegments(" feed" , " v1" , " wikipedia" , " en" , " featured" , currentDate)
23
23
protocol = URLProtocol .HTTPS
24
24
host = " api.wikimedia.org"
25
25
}
26
- header(" Authorization" ," Bearer $ACCESS_TOKEN " )
26
+ header(" Authorization" , " Bearer $ACCESS_TOKEN " )
27
27
}.body()
28
+
28
29
}
29
30
30
- override suspend fun getSearchNews (searchQuery : String ): SearchNews {
31
+ override suspend fun getSearchNews (searchQuery : String ): SearchNews {
31
32
return httpClient.get {
32
- if (searchQuery.isNotEmpty()){
33
+ if (searchQuery.isNotEmpty()) {
33
34
url {
34
- appendEncodedPathSegments(" core" ," v1" ," wikipedia" ," en" ," search" ," title" )
35
+ appendEncodedPathSegments(" core" , " v1" , " wikipedia" , " en" , " search" , " title" )
35
36
protocol = URLProtocol .HTTPS
36
37
host = " api.wikimedia.org"
37
38
}
38
- parameter(" q" ,searchQuery)
39
- parameter(" limit" ,20 ) // 20 items per pagination
40
- }
39
+ parameter(" q" , searchQuery)
40
+ parameter(" limit" , 20 ) // 20 items per pagination
41
+ }
41
42
}.body()
42
43
}
43
44
0 commit comments