| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- //
- // DO NOT EDIT.
- //
- // Generated by the protocol buffer compiler.
- // Source: google/cloud/language/v1/language_service.proto
- //
- //
- // Copyright 2018, gRPC Authors All rights reserved.
- //
- // 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
- //
- // http://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.
- //
- import Foundation
- import GRPC
- import NIO
- import NIOHTTP1
- import SwiftProtobuf
- /// Usage: instantiate Google_Cloud_Language_V1_LanguageServiceServiceClient, then call methods of this protocol to make API calls.
- internal protocol Google_Cloud_Language_V1_LanguageServiceService {
- func analyzeSentiment(_ request: Google_Cloud_Language_V1_AnalyzeSentimentRequest, callOptions: CallOptions?) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeSentimentRequest, Google_Cloud_Language_V1_AnalyzeSentimentResponse>
- func analyzeEntities(_ request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest, callOptions: CallOptions?) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeEntitiesRequest, Google_Cloud_Language_V1_AnalyzeEntitiesResponse>
- func analyzeEntitySentiment(_ request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, callOptions: CallOptions?) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>
- func analyzeSyntax(_ request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest, callOptions: CallOptions?) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeSyntaxRequest, Google_Cloud_Language_V1_AnalyzeSyntaxResponse>
- func classifyText(_ request: Google_Cloud_Language_V1_ClassifyTextRequest, callOptions: CallOptions?) -> UnaryCall<Google_Cloud_Language_V1_ClassifyTextRequest, Google_Cloud_Language_V1_ClassifyTextResponse>
- func annotateText(_ request: Google_Cloud_Language_V1_AnnotateTextRequest, callOptions: CallOptions?) -> UnaryCall<Google_Cloud_Language_V1_AnnotateTextRequest, Google_Cloud_Language_V1_AnnotateTextResponse>
- }
- internal final class Google_Cloud_Language_V1_LanguageServiceServiceClient: GRPCClient, Google_Cloud_Language_V1_LanguageServiceService {
- internal let connection: ClientConnection
- internal var defaultCallOptions: CallOptions
- /// Creates a client for the google.cloud.language.v1.LanguageService service.
- ///
- /// - Parameters:
- /// - connection: `ClientConnection` to the service host.
- /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
- internal init(connection: ClientConnection, defaultCallOptions: CallOptions = CallOptions()) {
- self.connection = connection
- self.defaultCallOptions = defaultCallOptions
- }
- /// Asynchronous unary call to AnalyzeSentiment.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeSentiment.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
- internal func analyzeSentiment(_ request: Google_Cloud_Language_V1_AnalyzeSentimentRequest, callOptions: CallOptions? = nil) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeSentimentRequest, Google_Cloud_Language_V1_AnalyzeSentimentResponse> {
- return self.makeUnaryCall(path: "/google.cloud.language.v1.LanguageService/AnalyzeSentiment",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to AnalyzeEntities.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeEntities.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
- internal func analyzeEntities(_ request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest, callOptions: CallOptions? = nil) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeEntitiesRequest, Google_Cloud_Language_V1_AnalyzeEntitiesResponse> {
- return self.makeUnaryCall(path: "/google.cloud.language.v1.LanguageService/AnalyzeEntities",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to AnalyzeEntitySentiment.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeEntitySentiment.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
- internal func analyzeEntitySentiment(_ request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, callOptions: CallOptions? = nil) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse> {
- return self.makeUnaryCall(path: "/google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to AnalyzeSyntax.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeSyntax.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
- internal func analyzeSyntax(_ request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest, callOptions: CallOptions? = nil) -> UnaryCall<Google_Cloud_Language_V1_AnalyzeSyntaxRequest, Google_Cloud_Language_V1_AnalyzeSyntaxResponse> {
- return self.makeUnaryCall(path: "/google.cloud.language.v1.LanguageService/AnalyzeSyntax",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to ClassifyText.
- ///
- /// - Parameters:
- /// - request: Request to send to ClassifyText.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
- internal func classifyText(_ request: Google_Cloud_Language_V1_ClassifyTextRequest, callOptions: CallOptions? = nil) -> UnaryCall<Google_Cloud_Language_V1_ClassifyTextRequest, Google_Cloud_Language_V1_ClassifyTextResponse> {
- return self.makeUnaryCall(path: "/google.cloud.language.v1.LanguageService/ClassifyText",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to AnnotateText.
- ///
- /// - Parameters:
- /// - request: Request to send to AnnotateText.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
- internal func annotateText(_ request: Google_Cloud_Language_V1_AnnotateTextRequest, callOptions: CallOptions? = nil) -> UnaryCall<Google_Cloud_Language_V1_AnnotateTextRequest, Google_Cloud_Language_V1_AnnotateTextResponse> {
- return self.makeUnaryCall(path: "/google.cloud.language.v1.LanguageService/AnnotateText",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- }
- /// To build a server, implement a class that conforms to this protocol.
- internal protocol Google_Cloud_Language_V1_LanguageServiceProvider: CallHandlerProvider {
- func analyzeSentiment(request: Google_Cloud_Language_V1_AnalyzeSentimentRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeSentimentResponse>
- func analyzeEntities(request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeEntitiesResponse>
- func analyzeEntitySentiment(request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>
- func analyzeSyntax(request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeSyntaxResponse>
- func classifyText(request: Google_Cloud_Language_V1_ClassifyTextRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_ClassifyTextResponse>
- func annotateText(request: Google_Cloud_Language_V1_AnnotateTextRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnnotateTextResponse>
- }
- extension Google_Cloud_Language_V1_LanguageServiceProvider {
- internal var serviceName: String { return "google.cloud.language.v1.LanguageService" }
- /// Determines, calls and returns the appropriate request handler, depending on the request's method.
- /// Returns nil for methods not handled by this service.
- internal func handleMethod(_ methodName: String, callHandlerContext: CallHandlerContext) -> GRPCCallHandler? {
- switch methodName {
- case "AnalyzeSentiment":
- return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
- return { request in
- self.analyzeSentiment(request: request, context: context)
- }
- }
- case "AnalyzeEntities":
- return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
- return { request in
- self.analyzeEntities(request: request, context: context)
- }
- }
- case "AnalyzeEntitySentiment":
- return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
- return { request in
- self.analyzeEntitySentiment(request: request, context: context)
- }
- }
- case "AnalyzeSyntax":
- return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
- return { request in
- self.analyzeSyntax(request: request, context: context)
- }
- }
- case "ClassifyText":
- return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
- return { request in
- self.classifyText(request: request, context: context)
- }
- }
- case "AnnotateText":
- return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
- return { request in
- self.annotateText(request: request, context: context)
- }
- }
- default: return nil
- }
- }
- }
|