Skip to content

Commit 1937fc2

Browse files
committed
convenience constructors
1 parent de218a0 commit 1937fc2

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

src/jvmMain/kotlin/spp/protocol/service/LiveInstrumentService.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
*/
1818
package spp.protocol.service
1919

20+
import io.vertx.codegen.annotations.GenIgnore
2021
import io.vertx.codegen.annotations.ProxyGen
2122
import io.vertx.codegen.annotations.VertxGen
2223
import io.vertx.core.Future
24+
import io.vertx.core.Vertx
25+
import io.vertx.core.eventbus.DeliveryOptions
2326
import io.vertx.core.json.JsonObject
2427
import kotlinx.datetime.Instant
28+
import spp.protocol.SourceServices
2529
import spp.protocol.instrument.*
2630

2731
/**
@@ -33,6 +37,18 @@ import spp.protocol.instrument.*
3337
@ProxyGen
3438
@VertxGen
3539
interface LiveInstrumentService {
40+
41+
@GenIgnore
42+
companion object {
43+
@JvmStatic
44+
fun createProxy(vertx: Vertx, authToken: String? = null): LiveInstrumentService {
45+
val deliveryOptions = DeliveryOptions().apply {
46+
authToken?.let { addHeader("auth-token", it) }
47+
}
48+
return LiveInstrumentServiceVertxEBProxy(vertx, SourceServices.Utilize.LIVE_INSTRUMENT, deliveryOptions)
49+
}
50+
}
51+
3652
fun addLiveInstrument(instrument: LiveInstrument): Future<LiveInstrument>
3753

3854
@JvmSuppressWildcards

src/jvmMain/kotlin/spp/protocol/service/LiveService.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
*/
1818
package spp.protocol.service
1919

20+
import io.vertx.codegen.annotations.GenIgnore
2021
import io.vertx.codegen.annotations.ProxyGen
2122
import io.vertx.codegen.annotations.VertxGen
2223
import io.vertx.core.Future
24+
import io.vertx.core.Vertx
25+
import io.vertx.core.eventbus.DeliveryOptions
2326
import io.vertx.core.json.JsonObject
27+
import spp.protocol.SourceServices
2428
import spp.protocol.platform.developer.SelfInfo
2529
import spp.protocol.platform.general.Service
2630
import spp.protocol.platform.status.ActiveInstance
@@ -34,6 +38,17 @@ import spp.protocol.platform.status.ActiveInstance
3438
@VertxGen
3539
interface LiveService {
3640

41+
@GenIgnore
42+
companion object {
43+
@JvmStatic
44+
fun createProxy(vertx: Vertx, authToken: String? = null): LiveService {
45+
val deliveryOptions = DeliveryOptions().apply {
46+
authToken?.let { addHeader("auth-token", it) }
47+
}
48+
return LiveServiceVertxEBProxy(vertx, SourceServices.Utilize.LIVE_SERVICE, deliveryOptions)
49+
}
50+
}
51+
3752
fun getClients(): Future<JsonObject>
3853
fun getStats(): Future<JsonObject>
3954
fun getSelf(): Future<SelfInfo>

src/jvmMain/kotlin/spp/protocol/service/LiveViewService.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
*/
1818
package spp.protocol.service
1919

20+
import io.vertx.codegen.annotations.GenIgnore
2021
import io.vertx.codegen.annotations.ProxyGen
2122
import io.vertx.codegen.annotations.VertxGen
2223
import io.vertx.core.Future
24+
import io.vertx.core.Vertx
25+
import io.vertx.core.eventbus.DeliveryOptions
2326
import io.vertx.core.json.JsonObject
27+
import spp.protocol.SourceServices
2428
import spp.protocol.view.LiveViewSubscription
2529

2630
/**
@@ -32,6 +36,18 @@ import spp.protocol.view.LiveViewSubscription
3236
@ProxyGen
3337
@VertxGen
3438
interface LiveViewService {
39+
40+
@GenIgnore
41+
companion object {
42+
@JvmStatic
43+
fun createProxy(vertx: Vertx, authToken: String? = null): LiveViewService {
44+
val deliveryOptions = DeliveryOptions().apply {
45+
authToken?.let { addHeader("auth-token", it) }
46+
}
47+
return LiveViewServiceVertxEBProxy(vertx, SourceServices.Utilize.LIVE_VIEW, deliveryOptions)
48+
}
49+
}
50+
3551
fun addLiveViewSubscription(subscription: LiveViewSubscription): Future<LiveViewSubscription>
3652
fun removeLiveViewSubscription(subscriptionId: String): Future<LiveViewSubscription>
3753
fun getLiveViewSubscriptions(): Future<List<LiveViewSubscription>>

0 commit comments

Comments
 (0)