-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
28 changed files
with
528 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
package com.devdunnapps.amplify.data | ||
|
||
import com.devdunnapps.amplify.data.models.ResourceDTO | ||
import com.devdunnapps.amplify.data.models.SigninDTO | ||
import com.devdunnapps.amplify.data.models.SignInDTO | ||
import com.devdunnapps.amplify.data.models.SignInResponseDTO | ||
import com.devdunnapps.amplify.data.models.UserDTO | ||
import com.devdunnapps.amplify.data.networking.NetworkResponse | ||
import retrofit2.Response | ||
import retrofit2.http.* | ||
|
||
interface PlexTVAPI { | ||
|
||
@POST("api/v2/users/signin") | ||
@Headers("X-Amplify-Ignore-Auth-Errors: 1") | ||
suspend fun signInUser(@Body user: SigninDTO): Response<UserDTO> | ||
suspend fun signInUser(@Body user: SignInDTO): Response<SignInResponseDTO> | ||
|
||
@GET("api/v2/resources?includeHttps=1&includeRelay=1") | ||
suspend fun getServers(): List<ResourceDTO> | ||
|
||
@GET("api/v2/user") | ||
suspend fun getUser(): NetworkResponse<UserDTO> | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...dunnapps/amplify/data/models/SigninDTO.kt → ...dunnapps/amplify/data/models/SignInDTO.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
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/devdunnapps/amplify/data/models/SignInResponseDTO.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,12 @@ | ||
package com.devdunnapps.amplify.data.models | ||
|
||
import com.devdunnapps.amplify.domain.models.SignInModel | ||
|
||
data class SignInResponseDTO ( | ||
val authToken: String | ||
) { | ||
|
||
fun toUser() = SignInModel( | ||
authToken = authToken | ||
) | ||
} |
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
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/devdunnapps/amplify/domain/models/SignInModel.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,5 @@ | ||
package com.devdunnapps.amplify.domain.models | ||
|
||
data class SignInModel( | ||
val authToken: String | ||
) |
6 changes: 4 additions & 2 deletions
6
app/src/main/java/com/devdunnapps/amplify/domain/models/User.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,5 +1,7 @@ | ||
package com.devdunnapps.amplify.domain.models | ||
|
||
data class User ( | ||
val authToken: String | ||
data class User( | ||
val username: String, | ||
val displayName: String?, | ||
val avatar: String | ||
) |
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
6 changes: 5 additions & 1 deletion
6
app/src/main/java/com/devdunnapps/amplify/domain/repository/PlexTVRepository.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,13 +1,17 @@ | ||
package com.devdunnapps.amplify.domain.repository | ||
|
||
import com.devdunnapps.amplify.data.networking.NetworkResponse | ||
import com.devdunnapps.amplify.domain.models.Server | ||
import com.devdunnapps.amplify.domain.models.SignInModel | ||
import com.devdunnapps.amplify.domain.models.User | ||
import com.devdunnapps.amplify.utils.Resource | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface PlexTVRepository { | ||
|
||
fun signInUser(username: String, password: String, authToken: String?): Flow<Resource<User>> | ||
fun signInUser(username: String, password: String, authToken: String?): Flow<Resource<SignInModel>> | ||
|
||
fun getUserServers(): Flow<Resource<List<Server>>> | ||
|
||
suspend fun getUser(): NetworkResponse<User> | ||
} |
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.