games.mythical.saga.sdk.proto.api.currency.RpcGrpcKt.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of saga-sdk-proto Show documentation
Show all versions of saga-sdk-proto Show documentation
Saga SDK for Java game servers
package games.mythical.saga.sdk.proto.api.currency
import games.mythical.saga.sdk.proto.api.currency.CurrencyServiceGrpc.getServiceDescriptor
import games.mythical.saga.sdk.proto.common.ReceivedResponse
import io.grpc.CallOptions
import io.grpc.CallOptions.DEFAULT
import io.grpc.Channel
import io.grpc.Metadata
import io.grpc.MethodDescriptor
import io.grpc.ServerServiceDefinition
import io.grpc.ServerServiceDefinition.builder
import io.grpc.ServiceDescriptor
import io.grpc.Status
import io.grpc.Status.UNIMPLEMENTED
import io.grpc.StatusException
import io.grpc.kotlin.AbstractCoroutineServerImpl
import io.grpc.kotlin.AbstractCoroutineStub
import io.grpc.kotlin.ClientCalls
import io.grpc.kotlin.ClientCalls.unaryRpc
import io.grpc.kotlin.ServerCalls
import io.grpc.kotlin.ServerCalls.unaryServerMethodDefinition
import io.grpc.kotlin.StubFor
import kotlin.String
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.jvm.JvmOverloads
import kotlin.jvm.JvmStatic
/**
* Holder for Kotlin coroutine-based client and server APIs for saga.api.currency.CurrencyService.
*/
object CurrencyServiceGrpcKt {
const val SERVICE_NAME: String = CurrencyServiceGrpc.SERVICE_NAME
@JvmStatic
val serviceDescriptor: ServiceDescriptor
get() = CurrencyServiceGrpc.getServiceDescriptor()
val issueCurrencyMethod: MethodDescriptor
@JvmStatic
get() = CurrencyServiceGrpc.getIssueCurrencyMethod()
val transferCurrencyMethod: MethodDescriptor
@JvmStatic
get() = CurrencyServiceGrpc.getTransferCurrencyMethod()
val burnCurrencyMethod: MethodDescriptor
@JvmStatic
get() = CurrencyServiceGrpc.getBurnCurrencyMethod()
val getBalanceOfPlayerMethod: MethodDescriptor
@JvmStatic
get() = CurrencyServiceGrpc.getGetBalanceOfPlayerMethod()
val getBalancesOfPlayerMethod: MethodDescriptor
@JvmStatic
get() = CurrencyServiceGrpc.getGetBalancesOfPlayerMethod()
/**
* A stub for issuing RPCs to a(n) saga.api.currency.CurrencyService service as suspending
* coroutines.
*/
@StubFor(CurrencyServiceGrpc::class)
class CurrencyServiceCoroutineStub @JvmOverloads constructor(
channel: Channel,
callOptions: CallOptions = DEFAULT
) : AbstractCoroutineStub(channel, callOptions) {
override fun build(channel: Channel, callOptions: CallOptions): CurrencyServiceCoroutineStub =
CurrencyServiceCoroutineStub(channel, callOptions)
/**
* Executes this RPC and returns the response message, suspending until the RPC completes
* with [`Status.OK`][Status]. If the RPC completes with another status, a corresponding
* [StatusException] is thrown. If this coroutine is cancelled, the RPC is also cancelled
* with the corresponding exception as a cause.
*
* @param request The request message to send to the server.
*
* @param headers Metadata to attach to the request. Most users will not need this.
*
* @return The single response from the server.
*/
suspend fun issueCurrency(request: IssueCurrencyRequest, headers: Metadata = Metadata()):
ReceivedResponse = unaryRpc(
channel,
CurrencyServiceGrpc.getIssueCurrencyMethod(),
request,
callOptions,
headers
)
/**
* Executes this RPC and returns the response message, suspending until the RPC completes
* with [`Status.OK`][Status]. If the RPC completes with another status, a corresponding
* [StatusException] is thrown. If this coroutine is cancelled, the RPC is also cancelled
* with the corresponding exception as a cause.
*
* @param request The request message to send to the server.
*
* @param headers Metadata to attach to the request. Most users will not need this.
*
* @return The single response from the server.
*/
suspend fun transferCurrency(request: TransferCurrencyRequest, headers: Metadata = Metadata()):
ReceivedResponse = unaryRpc(
channel,
CurrencyServiceGrpc.getTransferCurrencyMethod(),
request,
callOptions,
headers
)
/**
* Executes this RPC and returns the response message, suspending until the RPC completes
* with [`Status.OK`][Status]. If the RPC completes with another status, a corresponding
* [StatusException] is thrown. If this coroutine is cancelled, the RPC is also cancelled
* with the corresponding exception as a cause.
*
* @param request The request message to send to the server.
*
* @param headers Metadata to attach to the request. Most users will not need this.
*
* @return The single response from the server.
*/
suspend fun burnCurrency(request: BurnCurrencyRequest, headers: Metadata = Metadata()):
ReceivedResponse = unaryRpc(
channel,
CurrencyServiceGrpc.getBurnCurrencyMethod(),
request,
callOptions,
headers
)
/**
* Executes this RPC and returns the response message, suspending until the RPC completes
* with [`Status.OK`][Status]. If the RPC completes with another status, a corresponding
* [StatusException] is thrown. If this coroutine is cancelled, the RPC is also cancelled
* with the corresponding exception as a cause.
*
* @param request The request message to send to the server.
*
* @param headers Metadata to attach to the request. Most users will not need this.
*
* @return The single response from the server.
*/
suspend fun getBalanceOfPlayer(request: GetBalanceOfPlayerRequest, headers: Metadata =
Metadata()): BalanceOfPlayerProto = unaryRpc(
channel,
CurrencyServiceGrpc.getGetBalanceOfPlayerMethod(),
request,
callOptions,
headers
)
/**
* Executes this RPC and returns the response message, suspending until the RPC completes
* with [`Status.OK`][Status]. If the RPC completes with another status, a corresponding
* [StatusException] is thrown. If this coroutine is cancelled, the RPC is also cancelled
* with the corresponding exception as a cause.
*
* @param request The request message to send to the server.
*
* @param headers Metadata to attach to the request. Most users will not need this.
*
* @return The single response from the server.
*/
suspend fun getBalancesOfPlayer(request: GetBalancesOfPlayerRequest, headers: Metadata =
Metadata()): BalancesOfPlayerProto = unaryRpc(
channel,
CurrencyServiceGrpc.getGetBalancesOfPlayerMethod(),
request,
callOptions,
headers
)}
/**
* Skeletal implementation of the saga.api.currency.CurrencyService service based on Kotlin
* coroutines.
*/
abstract class CurrencyServiceCoroutineImplBase(
coroutineContext: CoroutineContext = EmptyCoroutineContext
) : AbstractCoroutineServerImpl(coroutineContext) {
/**
* Returns the response to an RPC for saga.api.currency.CurrencyService.IssueCurrency.
*
* If this method fails with a [StatusException], the RPC will fail with the corresponding
* [Status]. If this method fails with a [java.util.concurrent.CancellationException], the RPC
* will fail
* with status `Status.CANCELLED`. If this method fails for any other reason, the RPC will
* fail with `Status.UNKNOWN` with the exception as a cause.
*
* @param request The request from the client.
*/
open suspend fun issueCurrency(request: IssueCurrencyRequest): ReceivedResponse = throw
StatusException(UNIMPLEMENTED.withDescription("Method saga.api.currency.CurrencyService.IssueCurrency is unimplemented"))
/**
* Returns the response to an RPC for saga.api.currency.CurrencyService.TransferCurrency.
*
* If this method fails with a [StatusException], the RPC will fail with the corresponding
* [Status]. If this method fails with a [java.util.concurrent.CancellationException], the RPC
* will fail
* with status `Status.CANCELLED`. If this method fails for any other reason, the RPC will
* fail with `Status.UNKNOWN` with the exception as a cause.
*
* @param request The request from the client.
*/
open suspend fun transferCurrency(request: TransferCurrencyRequest): ReceivedResponse = throw
StatusException(UNIMPLEMENTED.withDescription("Method saga.api.currency.CurrencyService.TransferCurrency is unimplemented"))
/**
* Returns the response to an RPC for saga.api.currency.CurrencyService.BurnCurrency.
*
* If this method fails with a [StatusException], the RPC will fail with the corresponding
* [Status]. If this method fails with a [java.util.concurrent.CancellationException], the RPC
* will fail
* with status `Status.CANCELLED`. If this method fails for any other reason, the RPC will
* fail with `Status.UNKNOWN` with the exception as a cause.
*
* @param request The request from the client.
*/
open suspend fun burnCurrency(request: BurnCurrencyRequest): ReceivedResponse = throw
StatusException(UNIMPLEMENTED.withDescription("Method saga.api.currency.CurrencyService.BurnCurrency is unimplemented"))
/**
* Returns the response to an RPC for saga.api.currency.CurrencyService.GetBalanceOfPlayer.
*
* If this method fails with a [StatusException], the RPC will fail with the corresponding
* [Status]. If this method fails with a [java.util.concurrent.CancellationException], the RPC
* will fail
* with status `Status.CANCELLED`. If this method fails for any other reason, the RPC will
* fail with `Status.UNKNOWN` with the exception as a cause.
*
* @param request The request from the client.
*/
open suspend fun getBalanceOfPlayer(request: GetBalanceOfPlayerRequest): BalanceOfPlayerProto =
throw
StatusException(UNIMPLEMENTED.withDescription("Method saga.api.currency.CurrencyService.GetBalanceOfPlayer is unimplemented"))
/**
* Returns the response to an RPC for saga.api.currency.CurrencyService.GetBalancesOfPlayer.
*
* If this method fails with a [StatusException], the RPC will fail with the corresponding
* [Status]. If this method fails with a [java.util.concurrent.CancellationException], the RPC
* will fail
* with status `Status.CANCELLED`. If this method fails for any other reason, the RPC will
* fail with `Status.UNKNOWN` with the exception as a cause.
*
* @param request The request from the client.
*/
open suspend fun getBalancesOfPlayer(request: GetBalancesOfPlayerRequest): BalancesOfPlayerProto
= throw
StatusException(UNIMPLEMENTED.withDescription("Method saga.api.currency.CurrencyService.GetBalancesOfPlayer is unimplemented"))
final override fun bindService(): ServerServiceDefinition = builder(getServiceDescriptor())
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = CurrencyServiceGrpc.getIssueCurrencyMethod(),
implementation = ::issueCurrency
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = CurrencyServiceGrpc.getTransferCurrencyMethod(),
implementation = ::transferCurrency
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = CurrencyServiceGrpc.getBurnCurrencyMethod(),
implementation = ::burnCurrency
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = CurrencyServiceGrpc.getGetBalanceOfPlayerMethod(),
implementation = ::getBalanceOfPlayer
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = CurrencyServiceGrpc.getGetBalancesOfPlayerMethod(),
implementation = ::getBalancesOfPlayer
)).build()
}
}