-
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.
Fix generation of wrapper to recognize pagingsource as an async retur…
…n type. Add DoorJsonRequest and DoorJsonResponse.
- Loading branch information
1 parent
42ff6ac
commit 2228e35
Showing
6 changed files
with
68 additions
and
11 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
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
36 changes: 36 additions & 0 deletions
36
door-runtime/src/commonMain/kotlin/com/ustadmobile/door/requests/DoorJsonRequest.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,36 @@ | ||
package com.ustadmobile.door.requests | ||
|
||
/** | ||
* Simple data class that is used as a common representation of a json http request. This can then be sent using KTOR | ||
* over HTTP, Android Interprocess (IPC) Messenger Service, or Bluetooth. | ||
* | ||
* An extension function will be generated for each database function that will create a request object roughly as follows: | ||
* | ||
* fun DaoClass.functionName_JsonRequest(repoConfig, param1: String, param2) { | ||
* return DoorJsonRequest( | ||
* method = "GET", | ||
* protocol = "http", | ||
* path = "repoConfig.path/DaoName/functionName", | ||
* queryParams = mapOf("param1" to param1, | ||
* "param2" to param2), | ||
* ) | ||
* } | ||
* | ||
* @param queryParams map of query parameters to send. Simplified by design not to allow duplicate keys | ||
* @param headers map of headers to send. Simplified by design not to allow duplicate keys | ||
*/ | ||
data class DoorJsonRequest( | ||
val method: Method, | ||
val protocol: String, | ||
val host: String, | ||
val path: String, | ||
val queryParams: Map<String, String>, | ||
val headers: Map<String, String>, | ||
val requestBody: String? = null, | ||
){ | ||
|
||
enum class Method { | ||
GET, POST, PUT | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
door-runtime/src/commonMain/kotlin/com/ustadmobile/door/requests/DoorJsonResponse.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.ustadmobile.door.requests | ||
|
||
/** | ||
* Simple data class that is used as a common representation of a json http response. This can then be sent using KTOR | ||
* over HTTP, Android Interprocess (IPC) Messenger Service, or Bluetooth. | ||
*/ | ||
data class DoorJsonResponse( | ||
val statusCode: Int, | ||
val headers: Map<String, String>, | ||
val responseBody: String? | ||
) { | ||
} |