Skip to content

Commit

Permalink
Fix spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
alexymumo committed Mar 29, 2024
1 parent d1ca10c commit 536d0ec
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@ import com.alexmumo.common.Constants.NEWS_API_KEY
import com.alexmumo.common.Constants.PAGE
import com.alexmumo.common.Constants.PAGE_SIZE
import com.alexmumo.network.response.NewsResponse
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query

interface NewsApi {
interface NewsService {
@GET("everything")
suspend fun searchNews(
@Query("q") q: String,
@Query("pageSize") pageSize: Int = PAGE_SIZE,
@Query("page") page: Int = PAGE,
@Query("apiKey") apiKey: String = NEWS_API_KEY
): Response<NewsResponse>
): NewsResponse

@GET("top-headlines")
suspend fun getTopHeadLines(
Expand All @@ -39,5 +38,5 @@ interface NewsApi {
@Query("pageSize") pageSize: Int = PAGE_SIZE,
@Query("page") page: Int = PAGE,
@Query("apiKey") apiKey: String = NEWS_API_KEY
): Response<NewsResponse>
): NewsResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2024 News-App
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alexmumo.network.api

import com.alexmumo.network.response.NewsResponse
import io.ktor.client.HttpClient
import io.ktor.client.request.get

class NewsApiImpl(private val httpClient: HttpClient) : NewsService {
override suspend fun searchNews(
q: String,
pageSize: Int,
page: Int,
apiKey: String
): NewsResponse {
TODO()
}

override suspend fun getTopHeadLines(
country: String,
category: String,
pageSize: Int,
page: Int,
apiKey: String
): NewsResponse {
TODO("Not yet implemented")
}
}

This file was deleted.

42 changes: 42 additions & 0 deletions core/network/src/main/java/com/alexmumo/network/api/NewsService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2023 News-App
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alexmumo.network.api

import com.alexmumo.common.Constants.NEWS_API_KEY
import com.alexmumo.common.Constants.PAGE
import com.alexmumo.common.Constants.PAGE_SIZE
import com.alexmumo.network.response.NewsResponse
import retrofit2.http.GET
import retrofit2.http.Query

interface NewsService {
@GET("everything")
suspend fun searchNews(
@Query("q") q: String,
@Query("pageSize") pageSize: Int = PAGE_SIZE,
@Query("page") page: Int = PAGE,
@Query("apiKey") apiKey: String = NEWS_API_KEY
): NewsResponse

@GET("top-headlines")
suspend fun getTopHeadLines(
@Query("country") country: String,
@Query("category") category: String,
@Query("pageSize") pageSize: Int = PAGE_SIZE,
@Query("page") page: Int = PAGE,
@Query("apiKey") apiKey: String = NEWS_API_KEY
): NewsResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2024 News-App
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alexmumo.network.api

import com.alexmumo.network.response.NewsResponse
import io.ktor.client.HttpClient
import io.ktor.client.request.get

class NewsApiImpl(private val httpClient: HttpClient) : NewsService {
override suspend fun searchNews(
q: String,
pageSize: Int,
page: Int,
apiKey: String
): NewsResponse {
TODO()
}

override suspend fun getTopHeadLines(
country: String,
category: String,
pageSize: Int,
page: Int,
apiKey: String
): NewsResponse {
TODO("Not yet implemented")
}
}

0 comments on commit 536d0ec

Please sign in to comment.