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

com.google.chat.v1.stub.HttpJsonChatServiceStub 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.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.httpjson.ApiMethodDescriptor;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
import com.google.api.gax.httpjson.ProtoMessageResponseParser;
import com.google.api.gax.httpjson.ProtoRestSerializer;
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.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * REST 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 HttpJsonChatServiceStub extends ChatServiceStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); private static final ApiMethodDescriptor createMessageMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/CreateMessage") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*}/messages", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "messageId", request.getMessageId()); serializer.putQueryParam( fields, "messageReplyOption", request.getMessageReplyOptionValue()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "threadKey", request.getThreadKey()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("message", request.getMessage(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Message.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listMessagesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/ListMessages") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*}/messages", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam( fields, "showDeleted", request.getShowDeleted()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListMessagesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listMembershipsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/ListMemberships") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*}/members", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "showGroups", request.getShowGroups()); serializer.putQueryParam( fields, "showInvited", request.getShowInvited()); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListMembershipsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getMembershipMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetMembership") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/members/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Membership.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getMessageMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetMessage") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/messages/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Message.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateMessageMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/UpdateMessage") .setHttpMethod("PUT") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{message.name=spaces/*/messages/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "message.name", request.getMessage().getName()); return fields; }) .setAdditionalPaths("/v1/{message.name=spaces/*/messages/*}") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "allowMissing", request.getAllowMissing()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("message", request.getMessage(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Message.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteMessageMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/DeleteMessage") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/messages/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "force", request.getForce()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Empty.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getAttachmentMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetAttachment") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/messages/*/attachments/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Attachment.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor uploadAttachmentMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/UploadAttachment") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*}/attachments:upload", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearParent().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(UploadAttachmentResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listSpacesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/ListSpaces") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/spaces", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListSpacesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor searchSpacesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/SearchSpaces") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/spaces:search", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "query", request.getQuery()); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(SearchSpacesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getSpaceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetSpace") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Space.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createSpaceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/CreateSpace") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/spaces", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create().toBody("space", request.getSpace(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Space.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor setUpSpaceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/SetUpSpace") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/spaces:setup", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Space.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateSpaceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/UpdateSpace") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{space.name=spaces/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "space.name", request.getSpace().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create().toBody("space", request.getSpace(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Space.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteSpaceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/DeleteSpace") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Empty.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor completeImportSpaceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/CompleteImportSpace") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*}:completeImport", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(CompleteImportSpaceResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor findDirectMessageMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/FindDirectMessage") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/spaces:findDirectMessage", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "name", request.getName()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Space.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createMembershipMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/CreateMembership") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*}/members", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("membership", request.getMembership(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Membership.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateMembershipMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/UpdateMembership") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{membership.name=spaces/*/members/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "membership.name", request.getMembership().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("membership", request.getMembership(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Membership.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteMembershipMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/DeleteMembership") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/members/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "useAdminAccess", request.getUseAdminAccess()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Membership.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createReactionMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/CreateReaction") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*/messages/*}/reactions", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("reaction", request.getReaction(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Reaction.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listReactionsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/ListReactions") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*/messages/*}/reactions", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListReactionsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteReactionMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/DeleteReaction") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/messages/*/reactions/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Empty.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getSpaceReadStateMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetSpaceReadState") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=users/*/spaces/*/spaceReadState}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(SpaceReadState.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateSpaceReadStateMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/UpdateSpaceReadState") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{spaceReadState.name=users/*/spaces/*/spaceReadState}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "spaceReadState.name", request.getSpaceReadState().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("spaceReadState", request.getSpaceReadState(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(SpaceReadState.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getThreadReadStateMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetThreadReadState") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=users/*/spaces/*/threads/*/threadReadState}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ThreadReadState.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getSpaceEventMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/GetSpaceEvent") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=spaces/*/spaceEvents/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(SpaceEvent.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listSpaceEventsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.chat.v1.ChatService/ListSpaceEvents") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=spaces/*}/spaceEvents", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListSpaceEventsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .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 HttpJsonStubCallableFactory callableFactory; public static final HttpJsonChatServiceStub create(ChatServiceStubSettings settings) throws IOException { return new HttpJsonChatServiceStub(settings, ClientContext.create(settings)); } public static final HttpJsonChatServiceStub create(ClientContext clientContext) throws IOException { return new HttpJsonChatServiceStub( ChatServiceStubSettings.newHttpJsonBuilder().build(), clientContext); } public static final HttpJsonChatServiceStub create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { return new HttpJsonChatServiceStub( ChatServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of HttpJsonChatServiceStub, 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 HttpJsonChatServiceStub(ChatServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new HttpJsonChatServiceCallableFactory()); } /** * Constructs an instance of HttpJsonChatServiceStub, 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 HttpJsonChatServiceStub( ChatServiceStubSettings settings, ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; HttpJsonCallSettings createMessageTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createMessageMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listMessagesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listMessagesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listMembershipsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listMembershipsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getMembershipTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getMembershipMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getMessageTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getMessageMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings updateMessageTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateMessageMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("message.name", String.valueOf(request.getMessage().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteMessageTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteMessageMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getAttachmentTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getAttachmentMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings uploadAttachmentTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(uploadAttachmentMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listSpacesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listSpacesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); HttpJsonCallSettings searchSpacesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(searchSpacesMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); HttpJsonCallSettings getSpaceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getSpaceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createSpaceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createSpaceMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); HttpJsonCallSettings setUpSpaceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(setUpSpaceMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); HttpJsonCallSettings updateSpaceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateSpaceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("space.name", String.valueOf(request.getSpace().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteSpaceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteSpaceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings completeImportSpaceTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(completeImportSpaceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings findDirectMessageTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(findDirectMessageMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); HttpJsonCallSettings createMembershipTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createMembershipMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateMembershipTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateMembershipMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("membership.name", String.valueOf(request.getMembership().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteMembershipTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteMembershipMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createReactionTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createReactionMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listReactionsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listReactionsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings deleteReactionTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteReactionMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getSpaceReadStateTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getSpaceReadStateMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings updateSpaceReadStateTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateSpaceReadStateMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "space_read_state.name", String.valueOf(request.getSpaceReadState().getName())); return builder.build(); }) .build(); HttpJsonCallSettings getThreadReadStateTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getThreadReadStateMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getSpaceEventTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getSpaceEventMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listSpaceEventsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listSpaceEventsMethodDescriptor) .setTypeRegistry(typeRegistry) .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()); } @InternalApi public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(createMessageMethodDescriptor); methodDescriptors.add(listMessagesMethodDescriptor); methodDescriptors.add(listMembershipsMethodDescriptor); methodDescriptors.add(getMembershipMethodDescriptor); methodDescriptors.add(getMessageMethodDescriptor); methodDescriptors.add(updateMessageMethodDescriptor); methodDescriptors.add(deleteMessageMethodDescriptor); methodDescriptors.add(getAttachmentMethodDescriptor); methodDescriptors.add(uploadAttachmentMethodDescriptor); methodDescriptors.add(listSpacesMethodDescriptor); methodDescriptors.add(searchSpacesMethodDescriptor); methodDescriptors.add(getSpaceMethodDescriptor); methodDescriptors.add(createSpaceMethodDescriptor); methodDescriptors.add(setUpSpaceMethodDescriptor); methodDescriptors.add(updateSpaceMethodDescriptor); methodDescriptors.add(deleteSpaceMethodDescriptor); methodDescriptors.add(completeImportSpaceMethodDescriptor); methodDescriptors.add(findDirectMessageMethodDescriptor); methodDescriptors.add(createMembershipMethodDescriptor); methodDescriptors.add(updateMembershipMethodDescriptor); methodDescriptors.add(deleteMembershipMethodDescriptor); methodDescriptors.add(createReactionMethodDescriptor); methodDescriptors.add(listReactionsMethodDescriptor); methodDescriptors.add(deleteReactionMethodDescriptor); methodDescriptors.add(getSpaceReadStateMethodDescriptor); methodDescriptors.add(updateSpaceReadStateMethodDescriptor); methodDescriptors.add(getThreadReadStateMethodDescriptor); methodDescriptors.add(getSpaceEventMethodDescriptor); methodDescriptors.add(listSpaceEventsMethodDescriptor); return methodDescriptors; } @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); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy