| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845 |
- //
- // DO NOT EDIT.
- // swift-format-ignore-file
- //
- // Generated by the protocol buffer compiler.
- // Source: google/cloud/language/v1/language_service.proto
- //
- import GRPC
- import NIO
- import NIOConcurrencyHelpers
- import SwiftProtobuf
- /// Provides text analysis operations such as sentiment analysis and entity
- /// recognition.
- ///
- /// Usage: instantiate `Google_Cloud_Language_V1_LanguageServiceClient`, then call methods of this protocol to make API calls.
- internal protocol Google_Cloud_Language_V1_LanguageServiceClientProtocol: GRPCClient {
- var serviceName: String { get }
- var interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? { get }
- 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>
- }
- extension Google_Cloud_Language_V1_LanguageServiceClientProtocol {
- internal var serviceName: String {
- return "google.cloud.language.v1.LanguageService"
- }
- /// Analyzes the sentiment of the provided text.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeSentiment.
- /// - callOptions: Call options.
- /// - 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_LanguageServiceClientMetadata.Methods.analyzeSentiment.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeSentimentInterceptors() ?? []
- )
- }
- /// Finds named entities (currently proper names and common nouns) in the text
- /// along with entity types, salience, mentions for each entity, and
- /// other properties.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeEntities.
- /// - callOptions: Call options.
- /// - 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_LanguageServiceClientMetadata.Methods.analyzeEntities.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeEntitiesInterceptors() ?? []
- )
- }
- /// Finds entities, similar to
- /// [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
- /// in the text and analyzes sentiment associated with each entity and its
- /// mentions.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeEntitySentiment.
- /// - callOptions: Call options.
- /// - 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_LanguageServiceClientMetadata.Methods.analyzeEntitySentiment.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeEntitySentimentInterceptors() ?? []
- )
- }
- /// Analyzes the syntax of the text and provides sentence boundaries and
- /// tokenization along with part of speech tags, dependency trees, and other
- /// properties.
- ///
- /// - Parameters:
- /// - request: Request to send to AnalyzeSyntax.
- /// - callOptions: Call options.
- /// - 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_LanguageServiceClientMetadata.Methods.analyzeSyntax.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeSyntaxInterceptors() ?? []
- )
- }
- /// Classifies a document into categories.
- ///
- /// - Parameters:
- /// - request: Request to send to ClassifyText.
- /// - callOptions: Call options.
- /// - 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_LanguageServiceClientMetadata.Methods.classifyText.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeClassifyTextInterceptors() ?? []
- )
- }
- /// A convenience method that provides all the features that analyzeSentiment,
- /// analyzeEntities, and analyzeSyntax provide in one call.
- ///
- /// - Parameters:
- /// - request: Request to send to AnnotateText.
- /// - callOptions: Call options.
- /// - 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_LanguageServiceClientMetadata.Methods.annotateText.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnnotateTextInterceptors() ?? []
- )
- }
- }
- #if compiler(>=5.6)
- @available(*, deprecated)
- extension Google_Cloud_Language_V1_LanguageServiceClient: @unchecked Sendable {}
- #endif // compiler(>=5.6)
- @available(*, deprecated, renamed: "Google_Cloud_Language_V1_LanguageServiceNIOClient")
- internal final class Google_Cloud_Language_V1_LanguageServiceClient: Google_Cloud_Language_V1_LanguageServiceClientProtocol {
- private let lock = Lock()
- private var _defaultCallOptions: CallOptions
- private var _interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol?
- internal let channel: GRPCChannel
- internal var defaultCallOptions: CallOptions {
- get { self.lock.withLock { return self._defaultCallOptions } }
- set { self.lock.withLockVoid { self._defaultCallOptions = newValue } }
- }
- internal var interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? {
- get { self.lock.withLock { return self._interceptors } }
- set { self.lock.withLockVoid { self._interceptors = newValue } }
- }
- /// Creates a client for the google.cloud.language.v1.LanguageService service.
- ///
- /// - Parameters:
- /// - channel: `GRPCChannel` to the service host.
- /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
- /// - interceptors: A factory providing interceptors for each RPC.
- internal init(
- channel: GRPCChannel,
- defaultCallOptions: CallOptions = CallOptions(),
- interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? = nil
- ) {
- self.channel = channel
- self._defaultCallOptions = defaultCallOptions
- self._interceptors = interceptors
- }
- }
- internal struct Google_Cloud_Language_V1_LanguageServiceNIOClient: Google_Cloud_Language_V1_LanguageServiceClientProtocol {
- internal var channel: GRPCChannel
- internal var defaultCallOptions: CallOptions
- internal var interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol?
- /// Creates a client for the google.cloud.language.v1.LanguageService service.
- ///
- /// - Parameters:
- /// - channel: `GRPCChannel` to the service host.
- /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
- /// - interceptors: A factory providing interceptors for each RPC.
- internal init(
- channel: GRPCChannel,
- defaultCallOptions: CallOptions = CallOptions(),
- interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? = nil
- ) {
- self.channel = channel
- self.defaultCallOptions = defaultCallOptions
- self.interceptors = interceptors
- }
- }
- #if compiler(>=5.6)
- /// Provides text analysis operations such as sentiment analysis and entity
- /// recognition.
- @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
- internal protocol Google_Cloud_Language_V1_LanguageServiceAsyncClientProtocol: GRPCClient {
- static var serviceDescriptor: GRPCServiceDescriptor { get }
- var interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? { get }
- func makeAnalyzeSentimentCall(
- _ request: Google_Cloud_Language_V1_AnalyzeSentimentRequest,
- callOptions: CallOptions?
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeSentimentRequest, Google_Cloud_Language_V1_AnalyzeSentimentResponse>
- func makeAnalyzeEntitiesCall(
- _ request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest,
- callOptions: CallOptions?
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeEntitiesRequest, Google_Cloud_Language_V1_AnalyzeEntitiesResponse>
- func makeAnalyzeEntitySentimentCall(
- _ request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest,
- callOptions: CallOptions?
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>
- func makeAnalyzeSyntaxCall(
- _ request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest,
- callOptions: CallOptions?
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeSyntaxRequest, Google_Cloud_Language_V1_AnalyzeSyntaxResponse>
- func makeClassifyTextCall(
- _ request: Google_Cloud_Language_V1_ClassifyTextRequest,
- callOptions: CallOptions?
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_ClassifyTextRequest, Google_Cloud_Language_V1_ClassifyTextResponse>
- func makeAnnotateTextCall(
- _ request: Google_Cloud_Language_V1_AnnotateTextRequest,
- callOptions: CallOptions?
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnnotateTextRequest, Google_Cloud_Language_V1_AnnotateTextResponse>
- }
- @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
- extension Google_Cloud_Language_V1_LanguageServiceAsyncClientProtocol {
- internal static var serviceDescriptor: GRPCServiceDescriptor {
- return Google_Cloud_Language_V1_LanguageServiceClientMetadata.serviceDescriptor
- }
- internal var interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? {
- return nil
- }
- internal func makeAnalyzeSentimentCall(
- _ request: Google_Cloud_Language_V1_AnalyzeSentimentRequest,
- callOptions: CallOptions? = nil
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeSentimentRequest, Google_Cloud_Language_V1_AnalyzeSentimentResponse> {
- return self.makeAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeSentiment.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeSentimentInterceptors() ?? []
- )
- }
- internal func makeAnalyzeEntitiesCall(
- _ request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest,
- callOptions: CallOptions? = nil
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeEntitiesRequest, Google_Cloud_Language_V1_AnalyzeEntitiesResponse> {
- return self.makeAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeEntities.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeEntitiesInterceptors() ?? []
- )
- }
- internal func makeAnalyzeEntitySentimentCall(
- _ request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest,
- callOptions: CallOptions? = nil
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse> {
- return self.makeAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeEntitySentiment.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeEntitySentimentInterceptors() ?? []
- )
- }
- internal func makeAnalyzeSyntaxCall(
- _ request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest,
- callOptions: CallOptions? = nil
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnalyzeSyntaxRequest, Google_Cloud_Language_V1_AnalyzeSyntaxResponse> {
- return self.makeAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeSyntax.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeSyntaxInterceptors() ?? []
- )
- }
- internal func makeClassifyTextCall(
- _ request: Google_Cloud_Language_V1_ClassifyTextRequest,
- callOptions: CallOptions? = nil
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_ClassifyTextRequest, Google_Cloud_Language_V1_ClassifyTextResponse> {
- return self.makeAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.classifyText.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeClassifyTextInterceptors() ?? []
- )
- }
- internal func makeAnnotateTextCall(
- _ request: Google_Cloud_Language_V1_AnnotateTextRequest,
- callOptions: CallOptions? = nil
- ) -> GRPCAsyncUnaryCall<Google_Cloud_Language_V1_AnnotateTextRequest, Google_Cloud_Language_V1_AnnotateTextResponse> {
- return self.makeAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.annotateText.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnnotateTextInterceptors() ?? []
- )
- }
- }
- @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
- extension Google_Cloud_Language_V1_LanguageServiceAsyncClientProtocol {
- internal func analyzeSentiment(
- _ request: Google_Cloud_Language_V1_AnalyzeSentimentRequest,
- callOptions: CallOptions? = nil
- ) async throws -> Google_Cloud_Language_V1_AnalyzeSentimentResponse {
- return try await self.performAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeSentiment.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeSentimentInterceptors() ?? []
- )
- }
- internal func analyzeEntities(
- _ request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest,
- callOptions: CallOptions? = nil
- ) async throws -> Google_Cloud_Language_V1_AnalyzeEntitiesResponse {
- return try await self.performAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeEntities.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeEntitiesInterceptors() ?? []
- )
- }
- internal func analyzeEntitySentiment(
- _ request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest,
- callOptions: CallOptions? = nil
- ) async throws -> Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse {
- return try await self.performAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeEntitySentiment.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeEntitySentimentInterceptors() ?? []
- )
- }
- internal func analyzeSyntax(
- _ request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest,
- callOptions: CallOptions? = nil
- ) async throws -> Google_Cloud_Language_V1_AnalyzeSyntaxResponse {
- return try await self.performAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeSyntax.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnalyzeSyntaxInterceptors() ?? []
- )
- }
- internal func classifyText(
- _ request: Google_Cloud_Language_V1_ClassifyTextRequest,
- callOptions: CallOptions? = nil
- ) async throws -> Google_Cloud_Language_V1_ClassifyTextResponse {
- return try await self.performAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.classifyText.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeClassifyTextInterceptors() ?? []
- )
- }
- internal func annotateText(
- _ request: Google_Cloud_Language_V1_AnnotateTextRequest,
- callOptions: CallOptions? = nil
- ) async throws -> Google_Cloud_Language_V1_AnnotateTextResponse {
- return try await self.performAsyncUnaryCall(
- path: Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.annotateText.path,
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeAnnotateTextInterceptors() ?? []
- )
- }
- }
- @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
- internal struct Google_Cloud_Language_V1_LanguageServiceAsyncClient: Google_Cloud_Language_V1_LanguageServiceAsyncClientProtocol {
- internal var channel: GRPCChannel
- internal var defaultCallOptions: CallOptions
- internal var interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol?
- internal init(
- channel: GRPCChannel,
- defaultCallOptions: CallOptions = CallOptions(),
- interceptors: Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol? = nil
- ) {
- self.channel = channel
- self.defaultCallOptions = defaultCallOptions
- self.interceptors = interceptors
- }
- }
- #endif // compiler(>=5.6)
- internal protocol Google_Cloud_Language_V1_LanguageServiceClientInterceptorFactoryProtocol: GRPCSendable {
- /// - Returns: Interceptors to use when invoking 'analyzeSentiment'.
- func makeAnalyzeSentimentInterceptors() -> [ClientInterceptor<Google_Cloud_Language_V1_AnalyzeSentimentRequest, Google_Cloud_Language_V1_AnalyzeSentimentResponse>]
- /// - Returns: Interceptors to use when invoking 'analyzeEntities'.
- func makeAnalyzeEntitiesInterceptors() -> [ClientInterceptor<Google_Cloud_Language_V1_AnalyzeEntitiesRequest, Google_Cloud_Language_V1_AnalyzeEntitiesResponse>]
- /// - Returns: Interceptors to use when invoking 'analyzeEntitySentiment'.
- func makeAnalyzeEntitySentimentInterceptors() -> [ClientInterceptor<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>]
- /// - Returns: Interceptors to use when invoking 'analyzeSyntax'.
- func makeAnalyzeSyntaxInterceptors() -> [ClientInterceptor<Google_Cloud_Language_V1_AnalyzeSyntaxRequest, Google_Cloud_Language_V1_AnalyzeSyntaxResponse>]
- /// - Returns: Interceptors to use when invoking 'classifyText'.
- func makeClassifyTextInterceptors() -> [ClientInterceptor<Google_Cloud_Language_V1_ClassifyTextRequest, Google_Cloud_Language_V1_ClassifyTextResponse>]
- /// - Returns: Interceptors to use when invoking 'annotateText'.
- func makeAnnotateTextInterceptors() -> [ClientInterceptor<Google_Cloud_Language_V1_AnnotateTextRequest, Google_Cloud_Language_V1_AnnotateTextResponse>]
- }
- internal enum Google_Cloud_Language_V1_LanguageServiceClientMetadata {
- internal static let serviceDescriptor = GRPCServiceDescriptor(
- name: "LanguageService",
- fullName: "google.cloud.language.v1.LanguageService",
- methods: [
- Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeSentiment,
- Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeEntities,
- Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeEntitySentiment,
- Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.analyzeSyntax,
- Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.classifyText,
- Google_Cloud_Language_V1_LanguageServiceClientMetadata.Methods.annotateText,
- ]
- )
- internal enum Methods {
- internal static let analyzeSentiment = GRPCMethodDescriptor(
- name: "AnalyzeSentiment",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeSentiment",
- type: GRPCCallType.unary
- )
- internal static let analyzeEntities = GRPCMethodDescriptor(
- name: "AnalyzeEntities",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeEntities",
- type: GRPCCallType.unary
- )
- internal static let analyzeEntitySentiment = GRPCMethodDescriptor(
- name: "AnalyzeEntitySentiment",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment",
- type: GRPCCallType.unary
- )
- internal static let analyzeSyntax = GRPCMethodDescriptor(
- name: "AnalyzeSyntax",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeSyntax",
- type: GRPCCallType.unary
- )
- internal static let classifyText = GRPCMethodDescriptor(
- name: "ClassifyText",
- path: "/google.cloud.language.v1.LanguageService/ClassifyText",
- type: GRPCCallType.unary
- )
- internal static let annotateText = GRPCMethodDescriptor(
- name: "AnnotateText",
- path: "/google.cloud.language.v1.LanguageService/AnnotateText",
- type: GRPCCallType.unary
- )
- }
- }
- /// Provides text analysis operations such as sentiment analysis and entity
- /// recognition.
- ///
- /// To build a server, implement a class that conforms to this protocol.
- internal protocol Google_Cloud_Language_V1_LanguageServiceProvider: CallHandlerProvider {
- var interceptors: Google_Cloud_Language_V1_LanguageServiceServerInterceptorFactoryProtocol? { get }
- /// Analyzes the sentiment of the provided text.
- func analyzeSentiment(request: Google_Cloud_Language_V1_AnalyzeSentimentRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeSentimentResponse>
- /// Finds named entities (currently proper names and common nouns) in the text
- /// along with entity types, salience, mentions for each entity, and
- /// other properties.
- func analyzeEntities(request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeEntitiesResponse>
- /// Finds entities, similar to
- /// [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
- /// in the text and analyzes sentiment associated with each entity and its
- /// mentions.
- func analyzeEntitySentiment(request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>
- /// Analyzes the syntax of the text and provides sentence boundaries and
- /// tokenization along with part of speech tags, dependency trees, and other
- /// properties.
- func analyzeSyntax(request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_AnalyzeSyntaxResponse>
- /// Classifies a document into categories.
- func classifyText(request: Google_Cloud_Language_V1_ClassifyTextRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Google_Cloud_Language_V1_ClassifyTextResponse>
- /// A convenience method that provides all the features that analyzeSentiment,
- /// analyzeEntities, and analyzeSyntax provide in one call.
- 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: Substring {
- return Google_Cloud_Language_V1_LanguageServiceServerMetadata.serviceDescriptor.fullName[...]
- }
- /// 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 handle(
- method name: Substring,
- context: CallHandlerContext
- ) -> GRPCServerHandlerProtocol? {
- switch name {
- case "AnalyzeSentiment":
- return UnaryServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeSentimentRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeSentimentResponse>(),
- interceptors: self.interceptors?.makeAnalyzeSentimentInterceptors() ?? [],
- userFunction: self.analyzeSentiment(request:context:)
- )
- case "AnalyzeEntities":
- return UnaryServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeEntitiesRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeEntitiesResponse>(),
- interceptors: self.interceptors?.makeAnalyzeEntitiesInterceptors() ?? [],
- userFunction: self.analyzeEntities(request:context:)
- )
- case "AnalyzeEntitySentiment":
- return UnaryServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>(),
- interceptors: self.interceptors?.makeAnalyzeEntitySentimentInterceptors() ?? [],
- userFunction: self.analyzeEntitySentiment(request:context:)
- )
- case "AnalyzeSyntax":
- return UnaryServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeSyntaxRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeSyntaxResponse>(),
- interceptors: self.interceptors?.makeAnalyzeSyntaxInterceptors() ?? [],
- userFunction: self.analyzeSyntax(request:context:)
- )
- case "ClassifyText":
- return UnaryServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_ClassifyTextRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_ClassifyTextResponse>(),
- interceptors: self.interceptors?.makeClassifyTextInterceptors() ?? [],
- userFunction: self.classifyText(request:context:)
- )
- case "AnnotateText":
- return UnaryServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnnotateTextRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnnotateTextResponse>(),
- interceptors: self.interceptors?.makeAnnotateTextInterceptors() ?? [],
- userFunction: self.annotateText(request:context:)
- )
- default:
- return nil
- }
- }
- }
- #if compiler(>=5.6)
- /// Provides text analysis operations such as sentiment analysis and entity
- /// recognition.
- ///
- /// To implement a server, implement an object which conforms to this protocol.
- @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
- internal protocol Google_Cloud_Language_V1_LanguageServiceAsyncProvider: CallHandlerProvider {
- static var serviceDescriptor: GRPCServiceDescriptor { get }
- var interceptors: Google_Cloud_Language_V1_LanguageServiceServerInterceptorFactoryProtocol? { get }
- /// Analyzes the sentiment of the provided text.
- @Sendable func analyzeSentiment(
- request: Google_Cloud_Language_V1_AnalyzeSentimentRequest,
- context: GRPCAsyncServerCallContext
- ) async throws -> Google_Cloud_Language_V1_AnalyzeSentimentResponse
- /// Finds named entities (currently proper names and common nouns) in the text
- /// along with entity types, salience, mentions for each entity, and
- /// other properties.
- @Sendable func analyzeEntities(
- request: Google_Cloud_Language_V1_AnalyzeEntitiesRequest,
- context: GRPCAsyncServerCallContext
- ) async throws -> Google_Cloud_Language_V1_AnalyzeEntitiesResponse
- /// Finds entities, similar to
- /// [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
- /// in the text and analyzes sentiment associated with each entity and its
- /// mentions.
- @Sendable func analyzeEntitySentiment(
- request: Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest,
- context: GRPCAsyncServerCallContext
- ) async throws -> Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse
- /// Analyzes the syntax of the text and provides sentence boundaries and
- /// tokenization along with part of speech tags, dependency trees, and other
- /// properties.
- @Sendable func analyzeSyntax(
- request: Google_Cloud_Language_V1_AnalyzeSyntaxRequest,
- context: GRPCAsyncServerCallContext
- ) async throws -> Google_Cloud_Language_V1_AnalyzeSyntaxResponse
- /// Classifies a document into categories.
- @Sendable func classifyText(
- request: Google_Cloud_Language_V1_ClassifyTextRequest,
- context: GRPCAsyncServerCallContext
- ) async throws -> Google_Cloud_Language_V1_ClassifyTextResponse
- /// A convenience method that provides all the features that analyzeSentiment,
- /// analyzeEntities, and analyzeSyntax provide in one call.
- @Sendable func annotateText(
- request: Google_Cloud_Language_V1_AnnotateTextRequest,
- context: GRPCAsyncServerCallContext
- ) async throws -> Google_Cloud_Language_V1_AnnotateTextResponse
- }
- @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
- extension Google_Cloud_Language_V1_LanguageServiceAsyncProvider {
- internal static var serviceDescriptor: GRPCServiceDescriptor {
- return Google_Cloud_Language_V1_LanguageServiceServerMetadata.serviceDescriptor
- }
- internal var serviceName: Substring {
- return Google_Cloud_Language_V1_LanguageServiceServerMetadata.serviceDescriptor.fullName[...]
- }
- internal var interceptors: Google_Cloud_Language_V1_LanguageServiceServerInterceptorFactoryProtocol? {
- return nil
- }
- internal func handle(
- method name: Substring,
- context: CallHandlerContext
- ) -> GRPCServerHandlerProtocol? {
- switch name {
- case "AnalyzeSentiment":
- return GRPCAsyncServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeSentimentRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeSentimentResponse>(),
- interceptors: self.interceptors?.makeAnalyzeSentimentInterceptors() ?? [],
- wrapping: self.analyzeSentiment(request:context:)
- )
- case "AnalyzeEntities":
- return GRPCAsyncServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeEntitiesRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeEntitiesResponse>(),
- interceptors: self.interceptors?.makeAnalyzeEntitiesInterceptors() ?? [],
- wrapping: self.analyzeEntities(request:context:)
- )
- case "AnalyzeEntitySentiment":
- return GRPCAsyncServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>(),
- interceptors: self.interceptors?.makeAnalyzeEntitySentimentInterceptors() ?? [],
- wrapping: self.analyzeEntitySentiment(request:context:)
- )
- case "AnalyzeSyntax":
- return GRPCAsyncServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnalyzeSyntaxRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnalyzeSyntaxResponse>(),
- interceptors: self.interceptors?.makeAnalyzeSyntaxInterceptors() ?? [],
- wrapping: self.analyzeSyntax(request:context:)
- )
- case "ClassifyText":
- return GRPCAsyncServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_ClassifyTextRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_ClassifyTextResponse>(),
- interceptors: self.interceptors?.makeClassifyTextInterceptors() ?? [],
- wrapping: self.classifyText(request:context:)
- )
- case "AnnotateText":
- return GRPCAsyncServerHandler(
- context: context,
- requestDeserializer: ProtobufDeserializer<Google_Cloud_Language_V1_AnnotateTextRequest>(),
- responseSerializer: ProtobufSerializer<Google_Cloud_Language_V1_AnnotateTextResponse>(),
- interceptors: self.interceptors?.makeAnnotateTextInterceptors() ?? [],
- wrapping: self.annotateText(request:context:)
- )
- default:
- return nil
- }
- }
- }
- #endif // compiler(>=5.6)
- internal protocol Google_Cloud_Language_V1_LanguageServiceServerInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when handling 'analyzeSentiment'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeAnalyzeSentimentInterceptors() -> [ServerInterceptor<Google_Cloud_Language_V1_AnalyzeSentimentRequest, Google_Cloud_Language_V1_AnalyzeSentimentResponse>]
- /// - Returns: Interceptors to use when handling 'analyzeEntities'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeAnalyzeEntitiesInterceptors() -> [ServerInterceptor<Google_Cloud_Language_V1_AnalyzeEntitiesRequest, Google_Cloud_Language_V1_AnalyzeEntitiesResponse>]
- /// - Returns: Interceptors to use when handling 'analyzeEntitySentiment'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeAnalyzeEntitySentimentInterceptors() -> [ServerInterceptor<Google_Cloud_Language_V1_AnalyzeEntitySentimentRequest, Google_Cloud_Language_V1_AnalyzeEntitySentimentResponse>]
- /// - Returns: Interceptors to use when handling 'analyzeSyntax'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeAnalyzeSyntaxInterceptors() -> [ServerInterceptor<Google_Cloud_Language_V1_AnalyzeSyntaxRequest, Google_Cloud_Language_V1_AnalyzeSyntaxResponse>]
- /// - Returns: Interceptors to use when handling 'classifyText'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeClassifyTextInterceptors() -> [ServerInterceptor<Google_Cloud_Language_V1_ClassifyTextRequest, Google_Cloud_Language_V1_ClassifyTextResponse>]
- /// - Returns: Interceptors to use when handling 'annotateText'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeAnnotateTextInterceptors() -> [ServerInterceptor<Google_Cloud_Language_V1_AnnotateTextRequest, Google_Cloud_Language_V1_AnnotateTextResponse>]
- }
- internal enum Google_Cloud_Language_V1_LanguageServiceServerMetadata {
- internal static let serviceDescriptor = GRPCServiceDescriptor(
- name: "LanguageService",
- fullName: "google.cloud.language.v1.LanguageService",
- methods: [
- Google_Cloud_Language_V1_LanguageServiceServerMetadata.Methods.analyzeSentiment,
- Google_Cloud_Language_V1_LanguageServiceServerMetadata.Methods.analyzeEntities,
- Google_Cloud_Language_V1_LanguageServiceServerMetadata.Methods.analyzeEntitySentiment,
- Google_Cloud_Language_V1_LanguageServiceServerMetadata.Methods.analyzeSyntax,
- Google_Cloud_Language_V1_LanguageServiceServerMetadata.Methods.classifyText,
- Google_Cloud_Language_V1_LanguageServiceServerMetadata.Methods.annotateText,
- ]
- )
- internal enum Methods {
- internal static let analyzeSentiment = GRPCMethodDescriptor(
- name: "AnalyzeSentiment",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeSentiment",
- type: GRPCCallType.unary
- )
- internal static let analyzeEntities = GRPCMethodDescriptor(
- name: "AnalyzeEntities",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeEntities",
- type: GRPCCallType.unary
- )
- internal static let analyzeEntitySentiment = GRPCMethodDescriptor(
- name: "AnalyzeEntitySentiment",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment",
- type: GRPCCallType.unary
- )
- internal static let analyzeSyntax = GRPCMethodDescriptor(
- name: "AnalyzeSyntax",
- path: "/google.cloud.language.v1.LanguageService/AnalyzeSyntax",
- type: GRPCCallType.unary
- )
- internal static let classifyText = GRPCMethodDescriptor(
- name: "ClassifyText",
- path: "/google.cloud.language.v1.LanguageService/ClassifyText",
- type: GRPCCallType.unary
- )
- internal static let annotateText = GRPCMethodDescriptor(
- name: "AnnotateText",
- path: "/google.cloud.language.v1.LanguageService/AnnotateText",
- type: GRPCCallType.unary
- )
- }
- }
|