This repository has been archived by the owner on Jan 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new sdk version changes, api, deeplink url changes
- Loading branch information
Showing
19 changed files
with
155 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 20 additions & 33 deletions
53
app/src/main/java/com/mrwhoknows/csgeeks/repository/BlogRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,39 @@ | ||
package com.mrwhoknows.csgeeks.repository | ||
|
||
import com.mrwhoknows.csgeeks.api.RetrofitInstance | ||
import com.mrwhoknows.csgeeks.model.SendArticle | ||
import com.mrwhoknows.csgeeks.model.* | ||
import retrofit2.Response | ||
|
||
class BlogRepository { | ||
interface BlogRepository { | ||
|
||
suspend fun getAllArticles() = | ||
RetrofitInstance.api.getAllArticles() | ||
suspend fun getAllArticles(): Response<ArticleList> | ||
|
||
suspend fun getArticleById(id: String) = | ||
RetrofitInstance.api.getArticleById(id) | ||
suspend fun getArticleById(id: String): Response<Article> | ||
|
||
suspend fun searchArticles(query: String) = | ||
RetrofitInstance.api.searchArticles(query) | ||
suspend fun searchArticles(query: String): Response<ArticleList> | ||
|
||
suspend fun getArticlesByAuthor(authorName: String) = | ||
RetrofitInstance.api.getArticlesByAuthor(authorName) | ||
suspend fun getArticlesByAuthor(authorName: String): Response<ArticleList> | ||
|
||
suspend fun orderArticlesBy(orderBy: String, order: String) = | ||
RetrofitInstance.api.orderArticlesBy(orderBy, order) | ||
suspend fun orderArticlesBy(orderBy: String, order: String): Response<ArticleList> | ||
|
||
suspend fun orderArticlesBy(tag:String, orderBy: String, order: String) = | ||
RetrofitInstance.api.orderArticlesBy(tag, orderBy, order) | ||
suspend fun orderArticlesBy(tag: String, orderBy: String, order: String): Response<ArticleList> | ||
|
||
suspend fun getAuthor(authorName: String) = | ||
RetrofitInstance.api.getAuthor(authorName) | ||
suspend fun getAuthor(authorName: String): Response<Author> | ||
|
||
suspend fun createArticle(article: SendArticle, token: String) = | ||
RetrofitInstance.api.createArticle(article, token) | ||
suspend fun createArticle(article: SendArticle, token: String): Response<ResultResponse> | ||
|
||
suspend fun updateArticle(id: String, article: SendArticle, token: String) = | ||
RetrofitInstance.api.updateArticle(id, article, token) | ||
suspend fun updateArticle( | ||
id: String, article: SendArticle, token: String | ||
): Response<ResultResponse> | ||
|
||
suspend fun deleteArticle(id: String, token: String) = | ||
RetrofitInstance.api.deleteArticle(id, token) | ||
suspend fun deleteArticle(id: String, token: String): Response<ResultResponse> | ||
|
||
suspend fun getArticleTags() = | ||
RetrofitInstance.api.getTags() | ||
suspend fun getArticleTags(): Response<ArticleTags> | ||
|
||
suspend fun getArticleByTag(tag: String) = | ||
RetrofitInstance.api.getArticleByTag(tag) | ||
suspend fun getArticleByTag(tag: String): Response<ArticleList> | ||
|
||
suspend fun login(username: String, passwd: String) = | ||
RetrofitInstance.api.login(username, passwd) | ||
suspend fun login(username: String, passwd: String): Response<LoginResponse> | ||
|
||
suspend fun logoutUser(token: String) = | ||
RetrofitInstance.api.logoutUser(token) | ||
suspend fun logoutUser(token: String): Response<LoginResponse> | ||
|
||
suspend fun isLoggedIn(token: String) = | ||
RetrofitInstance.api.isLoggedIn(token) | ||
suspend fun isLoggedIn(token: String): Response<LoginResponse> | ||
} |
52 changes: 52 additions & 0 deletions
52
app/src/main/java/com/mrwhoknows/csgeeks/repository/BlogRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.mrwhoknows.csgeeks.repository | ||
|
||
import com.mrwhoknows.csgeeks.api.RetrofitInstance | ||
import com.mrwhoknows.csgeeks.model.SendArticle | ||
|
||
class BlogRepositoryImpl : BlogRepository { | ||
|
||
override suspend fun getAllArticles() = | ||
RetrofitInstance.api.getAllArticles() | ||
|
||
override suspend fun getArticleById(id: String) = | ||
RetrofitInstance.api.getArticleById(id) | ||
|
||
override suspend fun searchArticles(query: String) = | ||
RetrofitInstance.api.searchArticles(query) | ||
|
||
override suspend fun getArticlesByAuthor(authorName: String) = | ||
RetrofitInstance.api.getArticlesByAuthor(authorName) | ||
|
||
override suspend fun orderArticlesBy(orderBy: String, order: String) = | ||
RetrofitInstance.api.orderArticlesBy(orderBy, order) | ||
|
||
override suspend fun orderArticlesBy(tag:String, orderBy: String, order: String) = | ||
RetrofitInstance.api.orderArticlesBy(tag, orderBy, order) | ||
|
||
override suspend fun getAuthor(authorName: String) = | ||
RetrofitInstance.api.getAuthor(authorName) | ||
|
||
override suspend fun createArticle(article: SendArticle, token: String) = | ||
RetrofitInstance.api.createArticle(article, token) | ||
|
||
override suspend fun updateArticle(id: String, article: SendArticle, token: String) = | ||
RetrofitInstance.api.updateArticle(id, article, token) | ||
|
||
override suspend fun deleteArticle(id: String, token: String) = | ||
RetrofitInstance.api.deleteArticle(id, token) | ||
|
||
override suspend fun getArticleTags() = | ||
RetrofitInstance.api.getTags() | ||
|
||
override suspend fun getArticleByTag(tag: String) = | ||
RetrofitInstance.api.getArticleByTag(tag) | ||
|
||
override suspend fun login(username: String, passwd: String) = | ||
RetrofitInstance.api.login(username, passwd) | ||
|
||
override suspend fun logoutUser(token: String) = | ||
RetrofitInstance.api.logoutUser(token) | ||
|
||
override suspend fun isLoggedIn(token: String) = | ||
RetrofitInstance.api.isLoggedIn(token) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.