initial commit
This commit is contained in:
75
src/OutputServiceRDBClient.kt
Normal file
75
src/OutputServiceRDBClient.kt
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.kmalbz
|
||||
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.request.*
|
||||
|
||||
/**
|
||||
* 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<OutputObject> {
|
||||
return client.get<List<OutputObject>>("$endpoint/output/filter/negative") {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get positive decision objects
|
||||
*
|
||||
* @return Array of decision objects
|
||||
*/
|
||||
suspend fun getallpositive(
|
||||
): List<OutputObject> {
|
||||
return client.get<List<OutputObject>>("$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<OutputObject> {
|
||||
return client.get<List<OutputObject>>("$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<OutputObject> {
|
||||
return client.get<List<OutputObject>>("$endpoint/output/before/$dateBefore") {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get decision by ID
|
||||
*
|
||||
* @param tagID ID of wave file
|
||||
*
|
||||
* @return Decision object
|
||||
*/
|
||||
suspend fun getDecision(
|
||||
tagID: Int // PATH
|
||||
): OutputObject {
|
||||
return client.get<OutputObject>("$endpoint/output/$tagID") {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user