Class: Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::ServiceStub

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb

Overview

REST service stub for the Sessions service. Service stub contains baseline method implementations including transcoding, making the REST call, and deserialing the response.

Instance Method Summary collapse

Instance Method Details

#detect_intent(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse

Baseline implementation for the detect_intent REST call

Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 91

def detect_intent request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  verb, uri, query_string_params, body = ServiceStub.transcode_detect_intent_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "detect_intent",
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse.decode_json response.body, ignore_unknown_fields: true
  catch :response do
    yield result, operation if block_given?
    result
  end
end

#endpointString

The effective endpoint

Returns:

  • (String)


64
65
66
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 64

def endpoint
  @client_stub.endpoint
end

#fulfill_intent(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse

Baseline implementation for the fulfill_intent REST call

Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 205

def fulfill_intent request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  verb, uri, query_string_params, body = ServiceStub.transcode_fulfill_intent_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "fulfill_intent",
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse.decode_json response.body, ignore_unknown_fields: true
  catch :response do
    yield result, operation if block_given?
    result
  end
end

#logger(stub: false) ⇒ Logger

The logger used for request/response debug logging.

Returns:

  • (Logger)


73
74
75
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 73

def logger stub: false
  stub ? @client_stub.stub_logger : @client_stub.logger
end

#match_intent(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse

Baseline implementation for the match_intent REST call

Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 165

def match_intent request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  verb, uri, query_string_params, body = ServiceStub.transcode_match_intent_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "match_intent",
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse.decode_json response.body, ignore_unknown_fields: true
  catch :response do
    yield result, operation if block_given?
    result
  end
end

#server_streaming_detect_intent(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation

Baseline implementation for the server_streaming_detect_intent REST call

Parameters:

Yield Parameters:

  • chunk (::String)

    The chunk of data received during server streaming.

Returns:

  • (::Gapic::Rest::TransportOperation)

Raises:

  • (::ArgumentError)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 128

def server_streaming_detect_intent request_pb, options = nil, &block
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  verb, uri, query_string_params, body = ServiceStub.transcode_server_streaming_detect_intent_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "server_streaming_detect_intent",
    options: options,
    is_server_streaming: true,
    &block
  )
  ::Gapic::Rest::TransportOperation.new response
end

#submit_answer_feedback(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::CX::V3::AnswerFeedback

Baseline implementation for the submit_answer_feedback REST call

Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 245

def submit_answer_feedback request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  verb, uri, query_string_params, body = ServiceStub.transcode_submit_answer_feedback_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "submit_answer_feedback",
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::Dialogflow::CX::V3::AnswerFeedback.decode_json response.body, ignore_unknown_fields: true
  catch :response do
    yield result, operation if block_given?
    result
  end
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


55
56
57
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb', line 55

def universe_domain
  @client_stub.universe_domain
end