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

com.figure.block.api.proto.groups.ProposalServerGrpcKt.kt Maven / Gradle / Ivy

The newest version!
package com.figure.block.api.proto.groups

import com.figure.block.api.proto.groups.ProposalServiceGrpc.getServiceDescriptor
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.serverStreamingRpc
import io.grpc.kotlin.ClientCalls.unaryRpc
import io.grpc.kotlin.ServerCalls
import io.grpc.kotlin.ServerCalls.serverStreamingServerMethodDefinition
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
import kotlinx.coroutines.flow.Flow

/**
 * Holder for Kotlin coroutine-based client and server APIs for api.groups.ProposalService.
 */
public object ProposalServiceGrpcKt {
  public const val SERVICE_NAME: String = ProposalServiceGrpc.SERVICE_NAME

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

  public val latestProposalStateMethod:
      MethodDescriptor
    @JvmStatic
    get() = ProposalServiceGrpc.getLatestProposalStateMethod()

  public val allProposalStatesMethod:
      MethodDescriptor
    @JvmStatic
    get() = ProposalServiceGrpc.getAllProposalStatesMethod()

  public val latestProposalStatesByGroupIdMethod:
      MethodDescriptor
    @JvmStatic
    get() = ProposalServiceGrpc.getLatestProposalStatesByGroupIdMethod()

  public val streamLatestProposalStatesMethod:
      MethodDescriptor
    @JvmStatic
    get() = ProposalServiceGrpc.getStreamLatestProposalStatesMethod()

  /**
   * A stub for issuing RPCs to a(n) api.groups.ProposalService service as suspending coroutines.
   */
  @StubFor(ProposalServiceGrpc::class)
  public class ProposalServiceCoroutineStub @JvmOverloads constructor(
    channel: Channel,
    callOptions: CallOptions = DEFAULT,
  ) : AbstractCoroutineStub(channel, callOptions) {
    public override fun build(channel: Channel, callOptions: CallOptions):
        ProposalServiceCoroutineStub = ProposalServiceCoroutineStub(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.
     */
    public suspend fun latestProposalState(request: ProposalServer.LatestProposalStateRequest,
        headers: Metadata = Metadata()): ProposalServer.LatestProposalStateResponse = unaryRpc(
      channel,
      ProposalServiceGrpc.getLatestProposalStateMethod(),
      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.
     */
    public suspend fun allProposalStates(request: ProposalServer.AllProposalStatesRequest,
        headers: Metadata = Metadata()): ProposalServer.AllProposalStatesResponse = unaryRpc(
      channel,
      ProposalServiceGrpc.getAllProposalStatesMethod(),
      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.
     */
    public suspend
        fun latestProposalStatesByGroupId(request: ProposalServer.LatestProposalStatesByGroupIdRequest,
        headers: Metadata = Metadata()): ProposalServer.LatestProposalStatesByGroupIdResponse =
        unaryRpc(
      channel,
      ProposalServiceGrpc.getLatestProposalStatesByGroupIdMethod(),
      request,
      callOptions,
      headers
    )

    /**
     * Returns a [Flow] that, when collected, executes this RPC and emits responses from the
     * server as they arrive.  That flow finishes normally if the server closes its response with
     * [`Status.OK`][Status], and fails by throwing a [StatusException] otherwise.  If
     * collecting the flow downstream fails exceptionally (including via cancellation), the RPC
     * is cancelled with that 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 A flow that, when collected, emits the responses from the server.
     */
    public fun streamLatestProposalStates(request: ProposalServer.StreamLatestProposalStatesRequest,
        headers: Metadata = Metadata()): Flow =
        serverStreamingRpc(
      channel,
      ProposalServiceGrpc.getStreamLatestProposalStatesMethod(),
      request,
      callOptions,
      headers
    )
  }

  /**
   * Skeletal implementation of the api.groups.ProposalService service based on Kotlin coroutines.
   */
  public abstract class ProposalServiceCoroutineImplBase(
    coroutineContext: CoroutineContext = EmptyCoroutineContext,
  ) : AbstractCoroutineServerImpl(coroutineContext) {
    /**
     * Returns the response to an RPC for api.groups.ProposalService.LatestProposalState.
     *
     * 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.
     */
    public open suspend fun latestProposalState(request: ProposalServer.LatestProposalStateRequest):
        ProposalServer.LatestProposalStateResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method api.groups.ProposalService.LatestProposalState is unimplemented"))

    /**
     * Returns the response to an RPC for api.groups.ProposalService.AllProposalStates.
     *
     * 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.
     */
    public open suspend fun allProposalStates(request: ProposalServer.AllProposalStatesRequest):
        ProposalServer.AllProposalStatesResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method api.groups.ProposalService.AllProposalStates is unimplemented"))

    /**
     * Returns the response to an RPC for api.groups.ProposalService.LatestProposalStatesByGroupId.
     *
     * 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.
     */
    public open suspend
        fun latestProposalStatesByGroupId(request: ProposalServer.LatestProposalStatesByGroupIdRequest):
        ProposalServer.LatestProposalStatesByGroupIdResponse = throw
        StatusException(UNIMPLEMENTED.withDescription("Method api.groups.ProposalService.LatestProposalStatesByGroupId is unimplemented"))

    /**
     * Returns a [Flow] of responses to an RPC for
     * api.groups.ProposalService.StreamLatestProposalStates.
     *
     * If creating or collecting the returned flow fails with a [StatusException], the RPC
     * will fail with the corresponding [Status].  If it fails with a
     * [java.util.concurrent.CancellationException], the RPC will fail with status
     * `Status.CANCELLED`.  If creating
     * or collecting the returned flow 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.
     */
    public open
        fun streamLatestProposalStates(request: ProposalServer.StreamLatestProposalStatesRequest):
        Flow = throw
        StatusException(UNIMPLEMENTED.withDescription("Method api.groups.ProposalService.StreamLatestProposalStates is unimplemented"))

    public final override fun bindService(): ServerServiceDefinition =
        builder(getServiceDescriptor())
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ProposalServiceGrpc.getLatestProposalStateMethod(),
      implementation = ::latestProposalState
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ProposalServiceGrpc.getAllProposalStatesMethod(),
      implementation = ::allProposalStates
    ))
      .addMethod(unaryServerMethodDefinition(
      context = this.context,
      descriptor = ProposalServiceGrpc.getLatestProposalStatesByGroupIdMethod(),
      implementation = ::latestProposalStatesByGroupId
    ))
      .addMethod(serverStreamingServerMethodDefinition(
      context = this.context,
      descriptor = ProposalServiceGrpc.getStreamLatestProposalStatesMethod(),
      implementation = ::streamLatestProposalStates
    )).build()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy