output-service-rdb/src/OutputServiceRDBClient.kt

78 lines
1.8 KiB
Kotlin
Raw Normal View History

2020-04-04 18:47:24 +02:00
package com.kmalbz
import io.ktor.client.*
import io.ktor.client.request.*
2020-04-04 23:21:17 +02:00
import java.util.*
2020-04-05 11:14:02 +02:00
import com.kmalbz.database.model.ResultObject
2020-04-04 18:47:24 +02:00
/**
* Output Service - RDB Client
*
* This is the feature extraction interface of the Birbnetes system.
*/
open class OutputServiceRDBClient(val endpoint: String, val client: HttpClient = HttpClient()) {
/**
* Get all negative decision objects
*
* @return Array of decision objects
*/
suspend fun getallnegative(
2020-04-05 11:14:02 +02:00
): List<ResultObject> {
return client.get<List<ResultObject>>("$endpoint/output/filter/negative") {
2020-04-04 18:47:24 +02:00
}
}
/**
* Get positive decision objects
*
* @return Array of decision objects
*/
suspend fun getallpositive(
2020-04-05 11:14:02 +02:00
): List<ResultObject> {
return client.get<List<ResultObject>>("$endpoint/output/filter/positive") {
2020-04-04 18:47:24 +02:00
}
}
/**
* Get decision before a date
*
* @param dateAfter Date of filter
*
* @return Array of decision objects
*/
suspend fun getallafter(
dateAfter: Date // PATH
2020-04-05 11:14:02 +02:00
): List<ResultObject> {
return client.get<List<ResultObject>>("$endpoint/output/after/$dateAfter") {
2020-04-04 18:47:24 +02:00
}
}
/**
* Get decision before a date
*
* @param dateBefore Date of filter
*
* @return Array of decision objects
*/
suspend fun getallbefore(
dateBefore: Date // PATH
2020-04-05 11:14:02 +02:00
): List<ResultObject> {
return client.get<List<ResultObject>>("$endpoint/output/before/$dateBefore") {
2020-04-04 18:47:24 +02:00
}
}
/**
* Get decision by ID
*
* @param tagID ID of wave file
*
* @return Decision object
*/
suspend fun getDecision(
tagID: Int // PATH
2020-04-05 11:14:02 +02:00
): ResultObject {
return client.get<ResultObject>("$endpoint/output/$tagID") {
2020-04-04 18:47:24 +02:00
}
}
}