78 lines
1.8 KiB
Kotlin
78 lines
1.8 KiB
Kotlin
package com.kmalbz
|
|
|
|
import io.ktor.client.*
|
|
import io.ktor.client.request.*
|
|
import java.util.*
|
|
import com.kmalbz.database.model.ResultObject
|
|
|
|
/**
|
|
* 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(
|
|
): List<ResultObject> {
|
|
return client.get<List<ResultObject>>("$endpoint/output/filter/negative") {
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get positive decision objects
|
|
*
|
|
* @return Array of decision objects
|
|
*/
|
|
suspend fun getallpositive(
|
|
): List<ResultObject> {
|
|
return client.get<List<ResultObject>>("$endpoint/output/filter/positive") {
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get decision before a date
|
|
*
|
|
* @param dateAfter Date of filter
|
|
*
|
|
* @return Array of decision objects
|
|
*/
|
|
suspend fun getallafter(
|
|
dateAfter: Date // PATH
|
|
): List<ResultObject> {
|
|
return client.get<List<ResultObject>>("$endpoint/output/after/$dateAfter") {
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get decision before a date
|
|
*
|
|
* @param dateBefore Date of filter
|
|
*
|
|
* @return Array of decision objects
|
|
*/
|
|
suspend fun getallbefore(
|
|
dateBefore: Date // PATH
|
|
): List<ResultObject> {
|
|
return client.get<List<ResultObject>>("$endpoint/output/before/$dateBefore") {
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get decision by ID
|
|
*
|
|
* @param tagID ID of wave file
|
|
*
|
|
* @return Decision object
|
|
*/
|
|
suspend fun getDecision(
|
|
tagID: Int // PATH
|
|
): ResultObject {
|
|
return client.get<ResultObject>("$endpoint/output/$tagID") {
|
|
}
|
|
}
|
|
}
|