-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from BIDMCDigitalPsychiatry/streak_widget_api_…
…changes Streak widget api changes
- Loading branch information
Showing
2 changed files
with
190 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
/** | ||
* LAMP Platform | ||
* The LAMP Platform API. | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
* LAMP Platform | ||
* The LAMP Platform API. | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
package digital.lamp.lamp_kotlin.lamp_core.apis | ||
|
||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.* | ||
import digital.lamp.lamp_kotlin.lamp_core.models.ActivityEvent | ||
import android.util.Log | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.ApiClient | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.ClientError | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.ClientException | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.MultiValueMap | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.RequestConfig | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.RequestMethod | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.ResponseType | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.ServerError | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.ServerException | ||
import digital.lamp.lamp_kotlin.lamp_core.infrastructure.Success | ||
import digital.lamp.lamp_kotlin.lamp_core.models.ActivityEvent | ||
|
||
|
||
class ActivityEventAPI(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { | ||
|
@@ -25,77 +34,98 @@ class ActivityEventAPI(basePath: kotlin.String = defaultBasePath) : ApiClient(ba | |
} | ||
|
||
/** | ||
* Get all activity events for a participant. | ||
* Get the set of all activity events produced by a given participant, by identifier. | ||
* @param participantId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.Array<kotlin.Any> | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
* Get all activity events for a participant. | ||
* Get the set of all activity events produced by a given participant, by identifier. | ||
* @param participantId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.Array<kotlin.Any> | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
@Suppress("UNCHECKED_CAST") | ||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) | ||
fun activityEventAllByParticipant(participantId: kotlin.String, origin: kotlin.String?, from: java.sql.Timestamp?, to: java.sql.Timestamp?, transform: kotlin.String?) : kotlin.Array<kotlin.Any> { | ||
val localVariableBody: kotlin.Any? = null | ||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>() | ||
.apply { | ||
if (origin != null) { | ||
put("origin", listOf(origin.toString())) | ||
} | ||
if (from != null) { | ||
put("from", listOf(from.toString())) | ||
} | ||
if (to != null) { | ||
put("to", listOf(to.toString())) | ||
} | ||
if (transform != null) { | ||
put("transform", listOf(transform.toString())) | ||
} | ||
fun activityEventAllByParticipant(participantId: kotlin.String, origin: kotlin.String?, from: Long?, to: Long?, transform: kotlin.String?,basic: String) :Any { | ||
try { | ||
val localVariableBody: kotlin.Any? = null | ||
val localVariableQuery: MultiValueMap = | ||
mutableMapOf<kotlin.String, List<kotlin.String>>() | ||
.apply { | ||
if (origin != null) { | ||
put("origin", listOf(origin.toString())) | ||
} | ||
if (from != null) { | ||
put("from", listOf(from.toString())) | ||
} | ||
if (to != null) { | ||
put("to", listOf(to.toString())) | ||
} | ||
if (transform != null) { | ||
put("transform", listOf(transform.toString())) | ||
} | ||
} | ||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf() | ||
localVariableHeaders.apply { | ||
put("Authorization", basic) | ||
} | ||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf() | ||
val localVariableConfig = RequestConfig( | ||
RequestMethod.GET, | ||
"/participant/{participant_id}/activity_event".replace("{"+"participant_id"+"}", "$participantId"), | ||
query = localVariableQuery, | ||
headers = localVariableHeaders | ||
) | ||
val localVarResponse = request<kotlin.Array<kotlin.Any>>( | ||
localVariableConfig, | ||
localVariableBody | ||
) | ||
val localVariableConfig = RequestConfig( | ||
RequestMethod.GET, | ||
"/participant/{participant_id}/activity_event".replace( | ||
"{" + "participant_id" + "}", | ||
"$participantId" | ||
), | ||
query = localVariableQuery, | ||
headers = localVariableHeaders | ||
) | ||
val localVarResponse = request<kotlin.Array<kotlin.Any>>( | ||
localVariableConfig, | ||
localVariableBody | ||
) | ||
|
||
return when (localVarResponse.responseType) { | ||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Array<kotlin.Any> | ||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") | ||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") | ||
ResponseType.ClientError -> { | ||
val localVarError = localVarResponse as ClientError<*> | ||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) | ||
} | ||
ResponseType.ServerError -> { | ||
val localVarError = localVarResponse as ServerError<*> | ||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) | ||
return when (localVarResponse.responseType) { | ||
ResponseType.Success -> (localVarResponse as Success<*>).data as Any | ||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") | ||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") | ||
ResponseType.ClientError -> { | ||
val localVarError = localVarResponse as ClientError<*> | ||
throw ClientException( | ||
"Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", | ||
localVarError.statusCode, | ||
localVarResponse | ||
) | ||
} | ||
|
||
ResponseType.ServerError -> { | ||
val localVarError = localVarResponse as ServerError<*> | ||
throw ServerException( | ||
"Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", | ||
localVarError.statusCode, | ||
localVarResponse | ||
) | ||
} | ||
} | ||
}catch (e:Exception){ | ||
Log.e("activity api event","${e.message}") | ||
return e | ||
} | ||
} | ||
|
||
/** | ||
* Get all activity events for a researcher by participant. | ||
* Get the set of all activity events produced by participants of any study conducted by a researcher, by researcher identifier. | ||
* @param researcherId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.Array<kotlin.Any> | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
* Get all activity events for a researcher by participant. | ||
* Get the set of all activity events produced by participants of any study conducted by a researcher, by researcher identifier. | ||
* @param researcherId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.Array<kotlin.Any> | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
@Suppress("UNCHECKED_CAST") | ||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) | ||
fun activityEventAllByResearcher(researcherId: kotlin.String, origin: kotlin.String?, from: java.sql.Timestamp?, to: java.sql.Timestamp?, transform: kotlin.String?) : kotlin.Array<kotlin.Any> { | ||
|
@@ -143,18 +173,18 @@ class ActivityEventAPI(basePath: kotlin.String = defaultBasePath) : ApiClient(ba | |
} | ||
|
||
/** | ||
* Get all activity events for a study by participant. | ||
* Get the set of all activity events produced by participants of a single study, by study identifier. | ||
* @param studyId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.Array<kotlin.Any> | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
* Get all activity events for a study by participant. | ||
* Get the set of all activity events produced by participants of a single study, by study identifier. | ||
* @param studyId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.Array<kotlin.Any> | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
@Suppress("UNCHECKED_CAST") | ||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) | ||
fun activityEventAllByStudy(studyId: kotlin.String, origin: kotlin.String?, from: java.sql.Timestamp?, to: java.sql.Timestamp?, transform: kotlin.String?) : kotlin.Array<kotlin.Any> { | ||
|
@@ -202,15 +232,15 @@ class ActivityEventAPI(basePath: kotlin.String = defaultBasePath) : ApiClient(ba | |
} | ||
|
||
/** | ||
* Create a new ActivityEvent for the given Participant. | ||
* Create a new ActivityEvent for the given Participant. | ||
* @param participantId | ||
* @param activityEvent | ||
* @return kotlin.String | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
* Create a new ActivityEvent for the given Participant. | ||
* Create a new ActivityEvent for the given Participant. | ||
* @param participantId | ||
* @param activityEvent | ||
* @return kotlin.String | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
@Suppress("UNCHECKED_CAST") | ||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) | ||
fun activityEventCreate(participantId: kotlin.String, activityEvent: ActivityEvent) : kotlin.String { | ||
|
@@ -244,18 +274,18 @@ class ActivityEventAPI(basePath: kotlin.String = defaultBasePath) : ApiClient(ba | |
} | ||
|
||
/** | ||
* Delete a ActivityEvent. | ||
* Delete a ActivityEvent. | ||
* @param participantId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.String | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
* Delete a ActivityEvent. | ||
* Delete a ActivityEvent. | ||
* @param participantId | ||
* @param origin (optional) | ||
* @param from (optional) | ||
* @param to (optional) | ||
* @param transform (optional) | ||
* @return kotlin.String | ||
* @throws UnsupportedOperationException If the API returns an informational or redirection response | ||
* @throws ClientException If the API returns a client error response | ||
* @throws ServerException If the API returns a server error response | ||
*/ | ||
@Suppress("UNCHECKED_CAST") | ||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) | ||
fun activityEventDelete(participantId: kotlin.String, origin: kotlin.String?, from: java.sql.Timestamp?, to: java.sql.Timestamp?, transform: kotlin.String?) : kotlin.String { | ||
|
Oops, something went wrong.