com.google.chat.v1.stub.GrpcChatServiceStub Maven / Gradle / Ivy
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.chat.v1.stub;
import static com.google.chat.v1.ChatServiceClient.ListMembershipsPagedResponse;
import static com.google.chat.v1.ChatServiceClient.ListMessagesPagedResponse;
import static com.google.chat.v1.ChatServiceClient.ListReactionsPagedResponse;
import static com.google.chat.v1.ChatServiceClient.ListSpaceEventsPagedResponse;
import static com.google.chat.v1.ChatServiceClient.ListSpacesPagedResponse;
import static com.google.chat.v1.ChatServiceClient.SearchSpacesPagedResponse;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.chat.v1.Attachment;
import com.google.chat.v1.CompleteImportSpaceRequest;
import com.google.chat.v1.CompleteImportSpaceResponse;
import com.google.chat.v1.CreateMembershipRequest;
import com.google.chat.v1.CreateMessageRequest;
import com.google.chat.v1.CreateReactionRequest;
import com.google.chat.v1.CreateSpaceRequest;
import com.google.chat.v1.DeleteMembershipRequest;
import com.google.chat.v1.DeleteMessageRequest;
import com.google.chat.v1.DeleteReactionRequest;
import com.google.chat.v1.DeleteSpaceRequest;
import com.google.chat.v1.FindDirectMessageRequest;
import com.google.chat.v1.GetAttachmentRequest;
import com.google.chat.v1.GetMembershipRequest;
import com.google.chat.v1.GetMessageRequest;
import com.google.chat.v1.GetSpaceEventRequest;
import com.google.chat.v1.GetSpaceReadStateRequest;
import com.google.chat.v1.GetSpaceRequest;
import com.google.chat.v1.GetThreadReadStateRequest;
import com.google.chat.v1.ListMembershipsRequest;
import com.google.chat.v1.ListMembershipsResponse;
import com.google.chat.v1.ListMessagesRequest;
import com.google.chat.v1.ListMessagesResponse;
import com.google.chat.v1.ListReactionsRequest;
import com.google.chat.v1.ListReactionsResponse;
import com.google.chat.v1.ListSpaceEventsRequest;
import com.google.chat.v1.ListSpaceEventsResponse;
import com.google.chat.v1.ListSpacesRequest;
import com.google.chat.v1.ListSpacesResponse;
import com.google.chat.v1.Membership;
import com.google.chat.v1.Message;
import com.google.chat.v1.Reaction;
import com.google.chat.v1.SearchSpacesRequest;
import com.google.chat.v1.SearchSpacesResponse;
import com.google.chat.v1.SetUpSpaceRequest;
import com.google.chat.v1.Space;
import com.google.chat.v1.SpaceEvent;
import com.google.chat.v1.SpaceReadState;
import com.google.chat.v1.ThreadReadState;
import com.google.chat.v1.UpdateMembershipRequest;
import com.google.chat.v1.UpdateMessageRequest;
import com.google.chat.v1.UpdateSpaceReadStateRequest;
import com.google.chat.v1.UpdateSpaceRequest;
import com.google.chat.v1.UploadAttachmentRequest;
import com.google.chat.v1.UploadAttachmentResponse;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* gRPC stub implementation for the ChatService service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcChatServiceStub extends ChatServiceStub {
private static final MethodDescriptor
createMessageMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/CreateMessage")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateMessageRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Message.getDefaultInstance()))
.build();
private static final MethodDescriptor
listMessagesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/ListMessages")
.setRequestMarshaller(ProtoUtils.marshaller(ListMessagesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListMessagesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
listMembershipsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/ListMemberships")
.setRequestMarshaller(
ProtoUtils.marshaller(ListMembershipsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListMembershipsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getMembershipMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetMembership")
.setRequestMarshaller(
ProtoUtils.marshaller(GetMembershipRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Membership.getDefaultInstance()))
.build();
private static final MethodDescriptor getMessageMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetMessage")
.setRequestMarshaller(ProtoUtils.marshaller(GetMessageRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Message.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateMessageMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/UpdateMessage")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateMessageRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Message.getDefaultInstance()))
.build();
private static final MethodDescriptor deleteMessageMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/DeleteMessage")
.setRequestMarshaller(ProtoUtils.marshaller(DeleteMessageRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor
getAttachmentMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetAttachment")
.setRequestMarshaller(
ProtoUtils.marshaller(GetAttachmentRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Attachment.getDefaultInstance()))
.build();
private static final MethodDescriptor
uploadAttachmentMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/UploadAttachment")
.setRequestMarshaller(
ProtoUtils.marshaller(UploadAttachmentRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(UploadAttachmentResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
listSpacesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/ListSpaces")
.setRequestMarshaller(ProtoUtils.marshaller(ListSpacesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListSpacesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
searchSpacesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/SearchSpaces")
.setRequestMarshaller(ProtoUtils.marshaller(SearchSpacesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(SearchSpacesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getSpaceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetSpace")
.setRequestMarshaller(ProtoUtils.marshaller(GetSpaceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Space.getDefaultInstance()))
.build();
private static final MethodDescriptor createSpaceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/CreateSpace")
.setRequestMarshaller(ProtoUtils.marshaller(CreateSpaceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Space.getDefaultInstance()))
.build();
private static final MethodDescriptor setUpSpaceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/SetUpSpace")
.setRequestMarshaller(ProtoUtils.marshaller(SetUpSpaceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Space.getDefaultInstance()))
.build();
private static final MethodDescriptor updateSpaceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/UpdateSpace")
.setRequestMarshaller(ProtoUtils.marshaller(UpdateSpaceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Space.getDefaultInstance()))
.build();
private static final MethodDescriptor deleteSpaceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/DeleteSpace")
.setRequestMarshaller(ProtoUtils.marshaller(DeleteSpaceRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor
completeImportSpaceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/CompleteImportSpace")
.setRequestMarshaller(
ProtoUtils.marshaller(CompleteImportSpaceRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(CompleteImportSpaceResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
findDirectMessageMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/FindDirectMessage")
.setRequestMarshaller(
ProtoUtils.marshaller(FindDirectMessageRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Space.getDefaultInstance()))
.build();
private static final MethodDescriptor
createMembershipMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/CreateMembership")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateMembershipRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Membership.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateMembershipMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/UpdateMembership")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateMembershipRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Membership.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteMembershipMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/DeleteMembership")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteMembershipRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Membership.getDefaultInstance()))
.build();
private static final MethodDescriptor
createReactionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/CreateReaction")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateReactionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Reaction.getDefaultInstance()))
.build();
private static final MethodDescriptor
listReactionsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/ListReactions")
.setRequestMarshaller(
ProtoUtils.marshaller(ListReactionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListReactionsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteReactionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/DeleteReaction")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteReactionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
private static final MethodDescriptor
getSpaceReadStateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetSpaceReadState")
.setRequestMarshaller(
ProtoUtils.marshaller(GetSpaceReadStateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(SpaceReadState.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateSpaceReadStateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/UpdateSpaceReadState")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateSpaceReadStateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(SpaceReadState.getDefaultInstance()))
.build();
private static final MethodDescriptor
getThreadReadStateMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetThreadReadState")
.setRequestMarshaller(
ProtoUtils.marshaller(GetThreadReadStateRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ThreadReadState.getDefaultInstance()))
.build();
private static final MethodDescriptor
getSpaceEventMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/GetSpaceEvent")
.setRequestMarshaller(
ProtoUtils.marshaller(GetSpaceEventRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(SpaceEvent.getDefaultInstance()))
.build();
private static final MethodDescriptor
listSpaceEventsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.chat.v1.ChatService/ListSpaceEvents")
.setRequestMarshaller(
ProtoUtils.marshaller(ListSpaceEventsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListSpaceEventsResponse.getDefaultInstance()))
.build();
private final UnaryCallable createMessageCallable;
private final UnaryCallable listMessagesCallable;
private final UnaryCallable
listMessagesPagedCallable;
private final UnaryCallable
listMembershipsCallable;
private final UnaryCallable
listMembershipsPagedCallable;
private final UnaryCallable getMembershipCallable;
private final UnaryCallable getMessageCallable;
private final UnaryCallable updateMessageCallable;
private final UnaryCallable deleteMessageCallable;
private final UnaryCallable getAttachmentCallable;
private final UnaryCallable
uploadAttachmentCallable;
private final UnaryCallable listSpacesCallable;
private final UnaryCallable listSpacesPagedCallable;
private final UnaryCallable searchSpacesCallable;
private final UnaryCallable
searchSpacesPagedCallable;
private final UnaryCallable getSpaceCallable;
private final UnaryCallable createSpaceCallable;
private final UnaryCallable setUpSpaceCallable;
private final UnaryCallable updateSpaceCallable;
private final UnaryCallable deleteSpaceCallable;
private final UnaryCallable
completeImportSpaceCallable;
private final UnaryCallable findDirectMessageCallable;
private final UnaryCallable createMembershipCallable;
private final UnaryCallable updateMembershipCallable;
private final UnaryCallable deleteMembershipCallable;
private final UnaryCallable createReactionCallable;
private final UnaryCallable listReactionsCallable;
private final UnaryCallable
listReactionsPagedCallable;
private final UnaryCallable deleteReactionCallable;
private final UnaryCallable getSpaceReadStateCallable;
private final UnaryCallable
updateSpaceReadStateCallable;
private final UnaryCallable
getThreadReadStateCallable;
private final UnaryCallable getSpaceEventCallable;
private final UnaryCallable
listSpaceEventsCallable;
private final UnaryCallable
listSpaceEventsPagedCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcChatServiceStub create(ChatServiceStubSettings settings)
throws IOException {
return new GrpcChatServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcChatServiceStub create(ClientContext clientContext) throws IOException {
return new GrpcChatServiceStub(ChatServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcChatServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcChatServiceStub(
ChatServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcChatServiceStub, using the given settings. This is protected so
* that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected GrpcChatServiceStub(ChatServiceStubSettings settings, ClientContext clientContext)
throws IOException {
this(settings, clientContext, new GrpcChatServiceCallableFactory());
}
/**
* Constructs an instance of GrpcChatServiceStub, using the given settings. This is protected so
* that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected GrpcChatServiceStub(
ChatServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings createMessageTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createMessageMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings listMessagesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listMessagesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
listMembershipsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listMembershipsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getMembershipTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getMembershipMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getMessageTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getMessageMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings updateMessageTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateMessageMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("message.name", String.valueOf(request.getMessage().getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteMessageTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteMessageMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getAttachmentTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getAttachmentMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
uploadAttachmentTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(uploadAttachmentMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings listSpacesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listSpacesMethodDescriptor)
.build();
GrpcCallSettings searchSpacesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(searchSpacesMethodDescriptor)
.build();
GrpcCallSettings getSpaceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getSpaceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createSpaceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createSpaceMethodDescriptor)
.build();
GrpcCallSettings setUpSpaceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setUpSpaceMethodDescriptor)
.build();
GrpcCallSettings updateSpaceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateSpaceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("space.name", String.valueOf(request.getSpace().getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteSpaceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteSpaceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
completeImportSpaceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(completeImportSpaceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings findDirectMessageTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(findDirectMessageMethodDescriptor)
.build();
GrpcCallSettings createMembershipTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createMembershipMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings updateMembershipTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateMembershipMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("membership.name", String.valueOf(request.getMembership().getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteMembershipTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteMembershipMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createReactionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createReactionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings listReactionsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listReactionsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings deleteReactionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteReactionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getSpaceReadStateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getSpaceReadStateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
updateSpaceReadStateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateSpaceReadStateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add(
"space_read_state.name",
String.valueOf(request.getSpaceReadState().getName()));
return builder.build();
})
.build();
GrpcCallSettings
getThreadReadStateTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getThreadReadStateMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getSpaceEventTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getSpaceEventMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
listSpaceEventsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listSpaceEventsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
this.createMessageCallable =
callableFactory.createUnaryCallable(
createMessageTransportSettings, settings.createMessageSettings(), clientContext);
this.listMessagesCallable =
callableFactory.createUnaryCallable(
listMessagesTransportSettings, settings.listMessagesSettings(), clientContext);
this.listMessagesPagedCallable =
callableFactory.createPagedCallable(
listMessagesTransportSettings, settings.listMessagesSettings(), clientContext);
this.listMembershipsCallable =
callableFactory.createUnaryCallable(
listMembershipsTransportSettings, settings.listMembershipsSettings(), clientContext);
this.listMembershipsPagedCallable =
callableFactory.createPagedCallable(
listMembershipsTransportSettings, settings.listMembershipsSettings(), clientContext);
this.getMembershipCallable =
callableFactory.createUnaryCallable(
getMembershipTransportSettings, settings.getMembershipSettings(), clientContext);
this.getMessageCallable =
callableFactory.createUnaryCallable(
getMessageTransportSettings, settings.getMessageSettings(), clientContext);
this.updateMessageCallable =
callableFactory.createUnaryCallable(
updateMessageTransportSettings, settings.updateMessageSettings(), clientContext);
this.deleteMessageCallable =
callableFactory.createUnaryCallable(
deleteMessageTransportSettings, settings.deleteMessageSettings(), clientContext);
this.getAttachmentCallable =
callableFactory.createUnaryCallable(
getAttachmentTransportSettings, settings.getAttachmentSettings(), clientContext);
this.uploadAttachmentCallable =
callableFactory.createUnaryCallable(
uploadAttachmentTransportSettings, settings.uploadAttachmentSettings(), clientContext);
this.listSpacesCallable =
callableFactory.createUnaryCallable(
listSpacesTransportSettings, settings.listSpacesSettings(), clientContext);
this.listSpacesPagedCallable =
callableFactory.createPagedCallable(
listSpacesTransportSettings, settings.listSpacesSettings(), clientContext);
this.searchSpacesCallable =
callableFactory.createUnaryCallable(
searchSpacesTransportSettings, settings.searchSpacesSettings(), clientContext);
this.searchSpacesPagedCallable =
callableFactory.createPagedCallable(
searchSpacesTransportSettings, settings.searchSpacesSettings(), clientContext);
this.getSpaceCallable =
callableFactory.createUnaryCallable(
getSpaceTransportSettings, settings.getSpaceSettings(), clientContext);
this.createSpaceCallable =
callableFactory.createUnaryCallable(
createSpaceTransportSettings, settings.createSpaceSettings(), clientContext);
this.setUpSpaceCallable =
callableFactory.createUnaryCallable(
setUpSpaceTransportSettings, settings.setUpSpaceSettings(), clientContext);
this.updateSpaceCallable =
callableFactory.createUnaryCallable(
updateSpaceTransportSettings, settings.updateSpaceSettings(), clientContext);
this.deleteSpaceCallable =
callableFactory.createUnaryCallable(
deleteSpaceTransportSettings, settings.deleteSpaceSettings(), clientContext);
this.completeImportSpaceCallable =
callableFactory.createUnaryCallable(
completeImportSpaceTransportSettings,
settings.completeImportSpaceSettings(),
clientContext);
this.findDirectMessageCallable =
callableFactory.createUnaryCallable(
findDirectMessageTransportSettings,
settings.findDirectMessageSettings(),
clientContext);
this.createMembershipCallable =
callableFactory.createUnaryCallable(
createMembershipTransportSettings, settings.createMembershipSettings(), clientContext);
this.updateMembershipCallable =
callableFactory.createUnaryCallable(
updateMembershipTransportSettings, settings.updateMembershipSettings(), clientContext);
this.deleteMembershipCallable =
callableFactory.createUnaryCallable(
deleteMembershipTransportSettings, settings.deleteMembershipSettings(), clientContext);
this.createReactionCallable =
callableFactory.createUnaryCallable(
createReactionTransportSettings, settings.createReactionSettings(), clientContext);
this.listReactionsCallable =
callableFactory.createUnaryCallable(
listReactionsTransportSettings, settings.listReactionsSettings(), clientContext);
this.listReactionsPagedCallable =
callableFactory.createPagedCallable(
listReactionsTransportSettings, settings.listReactionsSettings(), clientContext);
this.deleteReactionCallable =
callableFactory.createUnaryCallable(
deleteReactionTransportSettings, settings.deleteReactionSettings(), clientContext);
this.getSpaceReadStateCallable =
callableFactory.createUnaryCallable(
getSpaceReadStateTransportSettings,
settings.getSpaceReadStateSettings(),
clientContext);
this.updateSpaceReadStateCallable =
callableFactory.createUnaryCallable(
updateSpaceReadStateTransportSettings,
settings.updateSpaceReadStateSettings(),
clientContext);
this.getThreadReadStateCallable =
callableFactory.createUnaryCallable(
getThreadReadStateTransportSettings,
settings.getThreadReadStateSettings(),
clientContext);
this.getSpaceEventCallable =
callableFactory.createUnaryCallable(
getSpaceEventTransportSettings, settings.getSpaceEventSettings(), clientContext);
this.listSpaceEventsCallable =
callableFactory.createUnaryCallable(
listSpaceEventsTransportSettings, settings.listSpaceEventsSettings(), clientContext);
this.listSpaceEventsPagedCallable =
callableFactory.createPagedCallable(
listSpaceEventsTransportSettings, settings.listSpaceEventsSettings(), clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable createMessageCallable() {
return createMessageCallable;
}
@Override
public UnaryCallable listMessagesCallable() {
return listMessagesCallable;
}
@Override
public UnaryCallable listMessagesPagedCallable() {
return listMessagesPagedCallable;
}
@Override
public UnaryCallable listMembershipsCallable() {
return listMembershipsCallable;
}
@Override
public UnaryCallable
listMembershipsPagedCallable() {
return listMembershipsPagedCallable;
}
@Override
public UnaryCallable getMembershipCallable() {
return getMembershipCallable;
}
@Override
public UnaryCallable getMessageCallable() {
return getMessageCallable;
}
@Override
public UnaryCallable updateMessageCallable() {
return updateMessageCallable;
}
@Override
public UnaryCallable deleteMessageCallable() {
return deleteMessageCallable;
}
@Override
public UnaryCallable getAttachmentCallable() {
return getAttachmentCallable;
}
@Override
public UnaryCallable
uploadAttachmentCallable() {
return uploadAttachmentCallable;
}
@Override
public UnaryCallable listSpacesCallable() {
return listSpacesCallable;
}
@Override
public UnaryCallable listSpacesPagedCallable() {
return listSpacesPagedCallable;
}
@Override
public UnaryCallable searchSpacesCallable() {
return searchSpacesCallable;
}
@Override
public UnaryCallable searchSpacesPagedCallable() {
return searchSpacesPagedCallable;
}
@Override
public UnaryCallable getSpaceCallable() {
return getSpaceCallable;
}
@Override
public UnaryCallable createSpaceCallable() {
return createSpaceCallable;
}
@Override
public UnaryCallable setUpSpaceCallable() {
return setUpSpaceCallable;
}
@Override
public UnaryCallable updateSpaceCallable() {
return updateSpaceCallable;
}
@Override
public UnaryCallable deleteSpaceCallable() {
return deleteSpaceCallable;
}
@Override
public UnaryCallable
completeImportSpaceCallable() {
return completeImportSpaceCallable;
}
@Override
public UnaryCallable findDirectMessageCallable() {
return findDirectMessageCallable;
}
@Override
public UnaryCallable createMembershipCallable() {
return createMembershipCallable;
}
@Override
public UnaryCallable updateMembershipCallable() {
return updateMembershipCallable;
}
@Override
public UnaryCallable deleteMembershipCallable() {
return deleteMembershipCallable;
}
@Override
public UnaryCallable createReactionCallable() {
return createReactionCallable;
}
@Override
public UnaryCallable listReactionsCallable() {
return listReactionsCallable;
}
@Override
public UnaryCallable
listReactionsPagedCallable() {
return listReactionsPagedCallable;
}
@Override
public UnaryCallable deleteReactionCallable() {
return deleteReactionCallable;
}
@Override
public UnaryCallable getSpaceReadStateCallable() {
return getSpaceReadStateCallable;
}
@Override
public UnaryCallable updateSpaceReadStateCallable() {
return updateSpaceReadStateCallable;
}
@Override
public UnaryCallable getThreadReadStateCallable() {
return getThreadReadStateCallable;
}
@Override
public UnaryCallable getSpaceEventCallable() {
return getSpaceEventCallable;
}
@Override
public UnaryCallable listSpaceEventsCallable() {
return listSpaceEventsCallable;
}
@Override
public UnaryCallable
listSpaceEventsPagedCallable() {
return listSpaceEventsPagedCallable;
}
@Override
public final void close() {
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}
@Override
public void shutdown() {
backgroundResources.shutdown();
}
@Override
public boolean isShutdown() {
return backgroundResources.isShutdown();
}
@Override
public boolean isTerminated() {
return backgroundResources.isTerminated();
}
@Override
public void shutdownNow() {
backgroundResources.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return backgroundResources.awaitTermination(duration, unit);
}
}