Skip to content

Commit d395f06

Browse files
committed
fix: add comments to form router. Update README to reflect pagination response
1 parent 19bc1ab commit d395f06

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ runBlocking {
9494

9595
api.applySessionToken(response.sessionToken)
9696
val vehicles = api.vehicles.all("org-123")
97-
println(vehicles.size)
97+
println(vehicles.data.size)
9898
}
9999
```

src/main/kotlin/com/ctrlhub/core/datacapture/FormsRouter.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ import com.ctrlhub.core.router.Router
77
import com.ctrlhub.core.router.request.RequestParameters
88
import io.ktor.client.HttpClient
99

10+
/**
11+
* A router that interacts with the forms realm of the Ctrl Hub API
12+
*/
1013
class FormsRouter(httpClient: HttpClient) : Router(httpClient) {
14+
15+
/**
16+
* Retrieve a list of all forms
17+
*
18+
* @param organisationId String The organisation ID to retrieve all forms for
19+
*
20+
* @return A list of all forms
21+
*/
1122
suspend fun all(
1223
organisationId: String,
1324
requestParameters: RequestParameters = RequestParameters()
@@ -19,6 +30,13 @@ class FormsRouter(httpClient: HttpClient) : Router(httpClient) {
1930
)
2031
}
2132

33+
/**
34+
* Fetch a single form by ID
35+
*
36+
* @param organisationId String The organisation ID to retrieve a single form for
37+
*
38+
* @return FOrm
39+
*/
2240
suspend fun one(organisationId: String, formId: String): Form {
2341
return fetchJsonApiResource("/v3/orgs/${organisationId}/data-capture-forms/${formId}")
2442
}

0 commit comments

Comments
 (0)