-
Notifications
You must be signed in to change notification settings - Fork 0
Connect GitHub Rock to its Ktor backend #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
bb866b6
Add configurable backend endpoint
SayanthRock dc3593e
Add backend API contract
SayanthRock 1306346
Add runtime backend gateway
SayanthRock 4948f5f
Connect Device Flow to backend with fallback
SayanthRock 8dd6a24
Add native backend connection centre
SayanthRock 30a0bec
Expose backend connection in app information
SayanthRock fadafce
Expose backend connection snapshot to UI
SayanthRock d746868
Test backend connection entry point
SayanthRock b7ec77d
Test Android backend contract
SayanthRock 90f6220
Inject backend URL into Android CI
SayanthRock e6a5f1d
Document Android backend URL
SayanthRock d67a867
Document Android backend integration
SayanthRock 76976a0
Verify Android backend HTTP paths
SayanthRock e3236a4
Inject backend URL into release APKs
SayanthRock 34bdc7a
Enforce backend compatibility and feature flags
SayanthRock c576cfd
Test backend compatibility policy
SayanthRock 8caa7b9
Complete backend version compatibility tests
SayanthRock bf3a592
Document backend production readiness checks
SayanthRock 1bec999
Bootstrap Android CI for backend integration branch
SayanthRock 73eab1a
Restore Android CI to main and pull requests
SayanthRock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
71 changes: 71 additions & 0 deletions
71
app/src/main/java/com/sayanthrock/githubrock/core/network/GitHubRockBackendApi.kt
This file contains hidden or 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,71 @@ | ||
| package com.sayanthrock.githubrock.core.network | ||
|
|
||
| import com.sayanthrock.githubrock.core.model.DeviceCodeResponse | ||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.GET | ||
| import retrofit2.http.POST | ||
|
|
||
| @Serializable | ||
| data class BackendHealthResponse( | ||
| val status: String, | ||
| val version: String, | ||
| val postgres: String, | ||
| val redis: String, | ||
| val meilisearch: String, | ||
| val timestamp: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class BackendPublicConfigResponse( | ||
| val apiVersion: String = "v1", | ||
| val minSupportedAppVersion: String, | ||
| val latestAppVersion: String, | ||
| val maintenanceMode: Boolean, | ||
| val features: Map<String, Boolean> = emptyMap(), | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class BackendDevicePollRequest( | ||
| @SerialName("device_code") val deviceCode: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class BackendTokenRefreshRequest( | ||
| @SerialName("refresh_token") val refreshToken: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class BackendDeviceTokenResponse( | ||
| val state: String, | ||
| @SerialName("access_token") val accessToken: String? = null, | ||
| @SerialName("token_type") val tokenType: String? = null, | ||
| val scope: String? = null, | ||
| @SerialName("expires_in") val expiresIn: Long? = null, | ||
| @SerialName("refresh_token") val refreshToken: String? = null, | ||
| @SerialName("refresh_token_expires_in") val refreshTokenExpiresIn: Long? = null, | ||
| val message: String? = null, | ||
| val interval: Int? = null, | ||
| ) | ||
|
|
||
| interface GitHubRockBackendApi { | ||
| @GET("v1/health") | ||
| suspend fun health(): BackendHealthResponse | ||
|
|
||
| @GET("v1/config") | ||
| suspend fun config(): BackendPublicConfigResponse | ||
|
|
||
| @POST("v1/auth/device/start") | ||
| suspend fun startDeviceFlow(): DeviceCodeResponse | ||
|
|
||
| @POST("v1/auth/device/poll") | ||
| suspend fun pollDeviceFlow( | ||
| @Body request: BackendDevicePollRequest, | ||
| ): BackendDeviceTokenResponse | ||
|
|
||
| @POST("v1/auth/device/refresh") | ||
| suspend fun refreshToken( | ||
| @Body request: BackendTokenRefreshRequest, | ||
| ): BackendDeviceTokenResponse | ||
| } |
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.