org.xmtp.proto.mls.api.v1.MlsGrpcKt.kt Maven / Gradle / Ivy
The newest version!
package org.xmtp.proto.mls.api.v1
import com.google.protobuf.Empty
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
import org.xmtp.proto.mls.api.v1.MlsApiGrpc.getServiceDescriptor
/**
* Holder for Kotlin coroutine-based client and server APIs for xmtp.mls.api.v1.MlsApi.
*/
public object MlsApiGrpcKt {
public const val SERVICE_NAME: String = MlsApiGrpc.SERVICE_NAME
@JvmStatic
public val serviceDescriptor: ServiceDescriptor
get() = MlsApiGrpc.getServiceDescriptor()
public val sendGroupMessagesMethod: MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getSendGroupMessagesMethod()
public val sendWelcomeMessagesMethod: MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getSendWelcomeMessagesMethod()
public val uploadKeyPackageMethod: MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getUploadKeyPackageMethod()
public val fetchKeyPackagesMethod:
MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getFetchKeyPackagesMethod()
public val queryGroupMessagesMethod:
MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getQueryGroupMessagesMethod()
public val queryWelcomeMessagesMethod:
MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getQueryWelcomeMessagesMethod()
public val subscribeGroupMessagesMethod:
MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getSubscribeGroupMessagesMethod()
public val subscribeWelcomeMessagesMethod:
MethodDescriptor
@JvmStatic
get() = MlsApiGrpc.getSubscribeWelcomeMessagesMethod()
/**
* A stub for issuing RPCs to a(n) xmtp.mls.api.v1.MlsApi service as suspending coroutines.
*/
@StubFor(MlsApiGrpc::class)
public class MlsApiCoroutineStub @JvmOverloads constructor(
channel: Channel,
callOptions: CallOptions = DEFAULT,
) : AbstractCoroutineStub(channel, callOptions) {
public override fun build(channel: Channel, callOptions: CallOptions): MlsApiCoroutineStub =
MlsApiCoroutineStub(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 sendGroupMessages(request: Mls.SendGroupMessagesRequest, headers: Metadata =
Metadata()): Empty = unaryRpc(
channel,
MlsApiGrpc.getSendGroupMessagesMethod(),
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 sendWelcomeMessages(request: Mls.SendWelcomeMessagesRequest,
headers: Metadata = Metadata()): Empty = unaryRpc(
channel,
MlsApiGrpc.getSendWelcomeMessagesMethod(),
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 uploadKeyPackage(request: Mls.UploadKeyPackageRequest, headers: Metadata =
Metadata()): Empty = unaryRpc(
channel,
MlsApiGrpc.getUploadKeyPackageMethod(),
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 fetchKeyPackages(request: Mls.FetchKeyPackagesRequest, headers: Metadata =
Metadata()): Mls.FetchKeyPackagesResponse = unaryRpc(
channel,
MlsApiGrpc.getFetchKeyPackagesMethod(),
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 queryGroupMessages(request: Mls.QueryGroupMessagesRequest, headers: Metadata
= Metadata()): Mls.QueryGroupMessagesResponse = unaryRpc(
channel,
MlsApiGrpc.getQueryGroupMessagesMethod(),
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 queryWelcomeMessages(request: Mls.QueryWelcomeMessagesRequest,
headers: Metadata = Metadata()): Mls.QueryWelcomeMessagesResponse = unaryRpc(
channel,
MlsApiGrpc.getQueryWelcomeMessagesMethod(),
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 subscribeGroupMessages(request: Mls.SubscribeGroupMessagesRequest, headers: Metadata
= Metadata()): Flow = serverStreamingRpc(
channel,
MlsApiGrpc.getSubscribeGroupMessagesMethod(),
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 subscribeWelcomeMessages(request: Mls.SubscribeWelcomeMessagesRequest,
headers: Metadata = Metadata()): Flow = serverStreamingRpc(
channel,
MlsApiGrpc.getSubscribeWelcomeMessagesMethod(),
request,
callOptions,
headers
)
}
/**
* Skeletal implementation of the xmtp.mls.api.v1.MlsApi service based on Kotlin coroutines.
*/
public abstract class MlsApiCoroutineImplBase(
coroutineContext: CoroutineContext = EmptyCoroutineContext,
) : AbstractCoroutineServerImpl(coroutineContext) {
/**
* Returns the response to an RPC for xmtp.mls.api.v1.MlsApi.SendGroupMessages.
*
* 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 sendGroupMessages(request: Mls.SendGroupMessagesRequest): Empty = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.SendGroupMessages is unimplemented"))
/**
* Returns the response to an RPC for xmtp.mls.api.v1.MlsApi.SendWelcomeMessages.
*
* 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 sendWelcomeMessages(request: Mls.SendWelcomeMessagesRequest): Empty =
throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.SendWelcomeMessages is unimplemented"))
/**
* Returns the response to an RPC for xmtp.mls.api.v1.MlsApi.UploadKeyPackage.
*
* 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 uploadKeyPackage(request: Mls.UploadKeyPackageRequest): Empty = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.UploadKeyPackage is unimplemented"))
/**
* Returns the response to an RPC for xmtp.mls.api.v1.MlsApi.FetchKeyPackages.
*
* 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 fetchKeyPackages(request: Mls.FetchKeyPackagesRequest):
Mls.FetchKeyPackagesResponse = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.FetchKeyPackages is unimplemented"))
/**
* Returns the response to an RPC for xmtp.mls.api.v1.MlsApi.QueryGroupMessages.
*
* 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 queryGroupMessages(request: Mls.QueryGroupMessagesRequest):
Mls.QueryGroupMessagesResponse = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.QueryGroupMessages is unimplemented"))
/**
* Returns the response to an RPC for xmtp.mls.api.v1.MlsApi.QueryWelcomeMessages.
*
* 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 queryWelcomeMessages(request: Mls.QueryWelcomeMessagesRequest):
Mls.QueryWelcomeMessagesResponse = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.QueryWelcomeMessages is unimplemented"))
/**
* Returns a [Flow] of responses to an RPC for xmtp.mls.api.v1.MlsApi.SubscribeGroupMessages.
*
* 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 subscribeGroupMessages(request: Mls.SubscribeGroupMessagesRequest):
Flow = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.SubscribeGroupMessages is unimplemented"))
/**
* Returns a [Flow] of responses to an RPC for xmtp.mls.api.v1.MlsApi.SubscribeWelcomeMessages.
*
* 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 subscribeWelcomeMessages(request: Mls.SubscribeWelcomeMessagesRequest):
Flow = throw
StatusException(UNIMPLEMENTED.withDescription("Method xmtp.mls.api.v1.MlsApi.SubscribeWelcomeMessages is unimplemented"))
public final override fun bindService(): ServerServiceDefinition =
builder(getServiceDescriptor())
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getSendGroupMessagesMethod(),
implementation = ::sendGroupMessages
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getSendWelcomeMessagesMethod(),
implementation = ::sendWelcomeMessages
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getUploadKeyPackageMethod(),
implementation = ::uploadKeyPackage
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getFetchKeyPackagesMethod(),
implementation = ::fetchKeyPackages
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getQueryGroupMessagesMethod(),
implementation = ::queryGroupMessages
))
.addMethod(unaryServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getQueryWelcomeMessagesMethod(),
implementation = ::queryWelcomeMessages
))
.addMethod(serverStreamingServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getSubscribeGroupMessagesMethod(),
implementation = ::subscribeGroupMessages
))
.addMethod(serverStreamingServerMethodDefinition(
context = this.context,
descriptor = MlsApiGrpc.getSubscribeWelcomeMessagesMethod(),
implementation = ::subscribeWelcomeMessages
)).build()
}
}