-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8a8e4d
commit e2ea6da
Showing
18 changed files
with
165 additions
and
69 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
core/network/src/main/kotlin/org/michaelbel/movies/network/AccountNetworkService.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,21 @@ | ||
package org.michaelbel.movies.network | ||
|
||
import org.michaelbel.movies.network.ktor.KtorAccountService | ||
import org.michaelbel.movies.network.model.Account | ||
import org.michaelbel.movies.network.retrofit.RetrofitAccountService | ||
import javax.inject.Inject | ||
|
||
/** | ||
* You can replace [ktorAccountService] with [retrofitAccountService] to use it. | ||
*/ | ||
class AccountNetworkService @Inject internal constructor( | ||
private val retrofitAccountService: RetrofitAccountService, | ||
private val ktorAccountService: KtorAccountService | ||
) { | ||
|
||
suspend fun accountDetails( | ||
sessionId: String | ||
): Account { | ||
return ktorAccountService.accountDetails(sessionId) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
core/network/src/main/kotlin/org/michaelbel/movies/network/AuthenticationNetworkService.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,42 @@ | ||
package org.michaelbel.movies.network | ||
|
||
import org.michaelbel.movies.network.ktor.KtorAuthenticationService | ||
import org.michaelbel.movies.network.model.DeletedSession | ||
import org.michaelbel.movies.network.model.RequestToken | ||
import org.michaelbel.movies.network.model.Session | ||
import org.michaelbel.movies.network.model.SessionRequest | ||
import org.michaelbel.movies.network.model.Token | ||
import org.michaelbel.movies.network.model.Username | ||
import org.michaelbel.movies.network.retrofit.RetrofitAuthenticationService | ||
import javax.inject.Inject | ||
|
||
/** | ||
* You can replace [ktorAuthenticationService] with [retrofitAuthenticationService] to use it. | ||
*/ | ||
class AuthenticationNetworkService @Inject internal constructor( | ||
private val retrofitAuthenticationService: RetrofitAuthenticationService, | ||
private val ktorAuthenticationService: KtorAuthenticationService | ||
) { | ||
|
||
suspend fun createRequestToken(): Token { | ||
return ktorAuthenticationService.createRequestToken() | ||
} | ||
|
||
suspend fun createSessionWithLogin( | ||
username: Username | ||
): Token { | ||
return ktorAuthenticationService.createSessionWithLogin(username) | ||
} | ||
|
||
suspend fun createSession( | ||
authToken: RequestToken | ||
): Session { | ||
return ktorAuthenticationService.createSession(authToken) | ||
} | ||
|
||
suspend fun deleteSession( | ||
sessionRequest: SessionRequest | ||
): DeletedSession { | ||
return ktorAuthenticationService.deleteSession(sessionRequest) | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
core/network/src/main/kotlin/org/michaelbel/movies/network/MovieNetworkService.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,39 @@ | ||
package org.michaelbel.movies.network | ||
|
||
import org.michaelbel.movies.network.ktor.KtorMovieService | ||
import org.michaelbel.movies.network.model.ImagesResponse | ||
import org.michaelbel.movies.network.model.Movie | ||
import org.michaelbel.movies.network.model.MovieResponse | ||
import org.michaelbel.movies.network.model.Result | ||
import org.michaelbel.movies.network.retrofit.RetrofitMovieService | ||
import javax.inject.Inject | ||
|
||
/** | ||
* You can replace [ktorMovieService] with [retrofitMovieService] to use it. | ||
*/ | ||
class MovieNetworkService @Inject internal constructor( | ||
private val retrofitMovieService: RetrofitMovieService, | ||
private val ktorMovieService: KtorMovieService | ||
) { | ||
|
||
suspend fun movies( | ||
list: String, | ||
language: String, | ||
page: Int | ||
): Result<MovieResponse> { | ||
return ktorMovieService.movies(list, language, page) | ||
} | ||
|
||
suspend fun movie( | ||
movieId: Int, | ||
language: String | ||
): Movie { | ||
return ktorMovieService.movie(movieId, language) | ||
} | ||
|
||
suspend fun images( | ||
movieId: Int | ||
): ImagesResponse { | ||
return ktorMovieService.images(movieId) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
core/network/src/main/kotlin/org/michaelbel/movies/network/SearchNetworkService.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,24 @@ | ||
package org.michaelbel.movies.network | ||
|
||
import org.michaelbel.movies.network.ktor.KtorSearchService | ||
import org.michaelbel.movies.network.model.MovieResponse | ||
import org.michaelbel.movies.network.model.Result | ||
import org.michaelbel.movies.network.retrofit.RetrofitSearchService | ||
import javax.inject.Inject | ||
|
||
/** | ||
* You can replace [ktorSearchService] with [retrofitSearchService] to use it. | ||
*/ | ||
class SearchNetworkService @Inject internal constructor( | ||
private val retrofitSearchService: RetrofitSearchService, | ||
private val ktorSearchService: KtorSearchService | ||
) { | ||
|
||
suspend fun searchMovies( | ||
query: String, | ||
language: String, | ||
page: Int | ||
): Result<MovieResponse> { | ||
return ktorSearchService.searchMovies(query, language, page) | ||
} | ||
} |
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
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
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.