All Downloads are FREE. Search and download functionalities are using the official Maven repository.

games.mythical.saga.sdk.proto.api.item.RpcGrpcKt.kt Maven / Gradle / Ivy

There is a newer version: 1.1.30
Show newest version
package games.mythical.saga.sdk.proto.api.item

import games.mythical.saga.sdk.proto.api.item.ItemServiceGrpc.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.item.ItemService.
 */
object ItemServiceGrpcKt {
  const val SERVICE_NAME: String = ItemServiceGrpc.SERVICE_NAME

  @JvmStatic
  val serviceDescriptor: ServiceDescriptor
    get() = ItemServiceGrpc.getServiceDescriptor()

  val getItemMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getGetItemMethod()

  val getItemsMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getGetItemsMethod()

  val getItemsForPlayerMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getGetItemsForPlayerMethod()

  val issueItemMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getIssueItemMethod()

  val transferItemMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getTransferItemMethod()

  val transferItemBulkMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getTransferItemBulkMethod()

  val burnItemMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getBurnItemMethod()

  val depositItemMethod: MethodDescriptor
    @JvmStatic
    get() = ItemServiceGrpc.getDepositItemMethod()

  /**
   * A stub for issuing RPCs to a(n) saga.api.item.ItemService service as suspending coroutines.
   */
  @StubFor(ItemServiceGrpc::class)
  class ItemServiceCoroutineStub @JvmOverloads constructor(
    channel: Channel,
    callOptions: CallOptions = DEFAULT
  ) : AbstractCoroutineStub(channel, callOptions) {
    override fun build(channel: Channel, callOptions: CallOptions): ItemServiceCoroutineStub =
        ItemServiceCoroutineStub(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 getItem(request: GetItemRequest, headers: Metadata = Metadata()): ItemProto =
        unaryRpc(
      channel,
      ItemServiceGrpc.getGetItemMethod(),
      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 getItems(request: GetItemsRequest, headers: Metadata = Metadata()): ItemsProto =
        unaryRpc(
      channel,
      ItemServiceGrpc.getGetItemsMethod(),
      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 getItemsForPlayer(request: GetItemsForPlayerRequest, headers: Metadata =
        Metadata()): ItemsProto = unaryRpc(
      channel,
      ItemServiceGrpc.getGetItemsForPlayerMethod(),
      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 issueItem(request: IssueItemRequest, headers: Metadata = Metadata()):
        ReceivedResponse = unaryRpc(
      channel,
      ItemServiceGrpc.getIssueItemMethod(),
      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 transferItem(request: TransferItemRequest, headers: Metadata = Metadata()):
        ReceivedResponse = unaryRpc(
      channel,
      ItemServiceGrpc.getTransferItemMethod(),
      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 transferItemBulk(request: TransferItemBulkRequest, headers: Metadata = Metadata()):
        ReceivedResponse = unaryRpc(
      channel,
      ItemServiceGrpc.getTransferItemBulkMethod(),
      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 burnItem(request: BurnItemRequest, headers: Metadata = Metadata()): ReceivedResponse
        = unaryRpc(
      channel,
      ItemServiceGrpc.getBurnItemMethod(),
      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 depositItem(request: DepositItemRequest, headers: Metadata = Metadata()):
        ReceivedResponse = unaryRpc(
      channel,
      ItemServiceGrpc.getDepositItemMethod(),
      request,
      callOptions,
      headers
    )}

  /**
   * Skeletal implementation of the saga.api.item.ItemService service based on Kotlin coroutines.
   */
  abstract class ItemServiceCoroutineImplBase(
    coroutineContext: CoroutineContext = EmptyCoroutineContext
  ) : AbstractCoroutineServerImpl(coroutineContext) {
    /**
     * Returns the response to an RPC for saga.api.item.ItemService.GetItem.
     *
     * 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 getItem(request: GetItemRequest): ItemProto = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.GetItem is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.GetItems.
     *
     * 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 getItems(request: GetItemsRequest): ItemsProto = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.GetItems is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.GetItemsForPlayer.
     *
     * 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 getItemsForPlayer(request: GetItemsForPlayerRequest): ItemsProto = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.GetItemsForPlayer is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.IssueItem.
     *
     * 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 issueItem(request: IssueItemRequest): ReceivedResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.IssueItem is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.TransferItem.
     *
     * 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 transferItem(request: TransferItemRequest): ReceivedResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.TransferItem is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.TransferItemBulk.
     *
     * 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 transferItemBulk(request: TransferItemBulkRequest): ReceivedResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.TransferItemBulk is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.BurnItem.
     *
     * 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 burnItem(request: BurnItemRequest): ReceivedResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.BurnItem is unimplemented"))

    /**
     * Returns the response to an RPC for saga.api.item.ItemService.DepositItem.
     *
     * 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 depositItem(request: DepositItemRequest): ReceivedResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method saga.api.item.ItemService.DepositItem is unimplemented"))

    final override fun bindService(): ServerServiceDefinition = builder(getServiceDescriptor())
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getGetItemMethod(),
      implementation = ::getItem
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getGetItemsMethod(),
      implementation = ::getItems
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getGetItemsForPlayerMethod(),
      implementation = ::getItemsForPlayer
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getIssueItemMethod(),
      implementation = ::issueItem
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getTransferItemMethod(),
      implementation = ::transferItem
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getTransferItemBulkMethod(),
      implementation = ::transferItemBulk
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getBurnItemMethod(),
      implementation = ::burnItem
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ItemServiceGrpc.getDepositItemMethod(),
      implementation = ::depositItem
    )).build()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy