Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add import / export IssueModel #27411

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions google-cloud-contact_center_insights-v1/.owlbot-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@
"snippets/contact_center_insights/delete_view.rb",
"snippets/contact_center_insights/deploy_issue_model.rb",
"snippets/contact_center_insights/export_insights_data.rb",
"snippets/contact_center_insights/export_issue_model.rb",
"snippets/contact_center_insights/get_analysis.rb",
"snippets/contact_center_insights/get_conversation.rb",
"snippets/contact_center_insights/get_encryption_spec.rb",
"snippets/contact_center_insights/get_issue.rb",
"snippets/contact_center_insights/get_issue_model.rb",
"snippets/contact_center_insights/get_phrase_matcher.rb",
"snippets/contact_center_insights/get_settings.rb",
"snippets/contact_center_insights/get_view.rb",
"snippets/contact_center_insights/import_issue_model.rb",
"snippets/contact_center_insights/ingest_conversations.rb",
"snippets/contact_center_insights/initialize_encryption_spec.rb",
"snippets/contact_center_insights/list_analyses.rb",
"snippets/contact_center_insights/list_conversations.rb",
"snippets/contact_center_insights/list_issue_models.rb",
Expand Down
20 changes: 20 additions & 0 deletions google-cloud-contact_center_insights-v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@
"undeploy_issue_model"
]
},
"ExportIssueModel": {
"methods": [
"export_issue_model"
]
},
"ImportIssueModel": {
"methods": [
"import_issue_model"
]
},
"GetIssue": {
"methods": [
"get_issue"
Expand Down Expand Up @@ -180,6 +190,16 @@
"update_settings"
]
},
"GetEncryptionSpec": {
"methods": [
"get_encryption_spec"
]
},
"InitializeEncryptionSpec": {
"methods": [
"initialize_encryption_spec"
]
},
"CreateView": {
"methods": [
"create_view"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ def conversation_profile_path project:, location:, conversation_profile:
"projects/#{project}/locations/#{location}/conversationProfiles/#{conversation_profile}"
end

##
# Create a fully-qualified EncryptionSpec resource string.
#
# The resource will be in the following format:
#
# `projects/{project}/locations/{location}/encryptionSpec`
#
# @param project [String]
# @param location [String]
#
# @return [::String]
def encryption_spec_path project:, location:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

"projects/#{project}/locations/#{location}/encryptionSpec"
end

##
# Create a fully-qualified Issue resource string.
#
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,82 @@ def undeploy_issue_model request_pb, options = nil
result
end

##
# Baseline implementation for the export_issue_model REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::ExportIssueModelRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Google::Longrunning::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Google::Longrunning::Operation]
# A result object deserialized from the server's reply
def export_issue_model request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?

verb, uri, query_string_params, body = ServiceStub.transcode_export_issue_model_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,
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true

yield result, operation if block_given?
result
end

##
# Baseline implementation for the import_issue_model REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::ImportIssueModelRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Google::Longrunning::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Google::Longrunning::Operation]
# A result object deserialized from the server's reply
def import_issue_model request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?

verb, uri, query_string_params, body = ServiceStub.transcode_import_issue_model_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,
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true

yield result, operation if block_given?
result
end

##
# Baseline implementation for the get_issue REST call
#
Expand Down Expand Up @@ -1353,6 +1429,82 @@ def update_settings request_pb, options = nil
result
end

##
# Baseline implementation for the get_encryption_spec REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::GetEncryptionSpecRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Google::Cloud::ContactCenterInsights::V1::EncryptionSpec]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Google::Cloud::ContactCenterInsights::V1::EncryptionSpec]
# A result object deserialized from the server's reply
def get_encryption_spec request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?

verb, uri, query_string_params, body = ServiceStub.transcode_get_encryption_spec_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,
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Cloud::ContactCenterInsights::V1::EncryptionSpec.decode_json response.body, ignore_unknown_fields: true

yield result, operation if block_given?
result
end

##
# Baseline implementation for the initialize_encryption_spec REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::InitializeEncryptionSpecRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Google::Longrunning::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Google::Longrunning::Operation]
# A result object deserialized from the server's reply
def initialize_encryption_spec request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?

verb, uri, query_string_params, body = ServiceStub.transcode_initialize_encryption_spec_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,
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true

yield result, operation if block_given?
result
end

##
# Baseline implementation for the create_view REST call
#
Expand Down Expand Up @@ -1996,6 +2148,50 @@ def self.transcode_undeploy_issue_model_request request_pb
transcoder.transcode request_pb
end

##
# @private
#
# GRPC transcoding helper method for the export_issue_model REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::ExportIssueModelRequest]
# A request object representing the call parameters. Required.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
def self.transcode_export_issue_model_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{name}:export",
body: "*",
matches: [
["name", %r{^projects/[^/]+/locations/[^/]+/issueModels/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

##
# @private
#
# GRPC transcoding helper method for the import_issue_model REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::ImportIssueModelRequest]
# A request object representing the call parameters. Required.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
def self.transcode_import_issue_model_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}/issueModels:import",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

##
# @private
#
Expand Down Expand Up @@ -2273,6 +2469,49 @@ def self.transcode_update_settings_request request_pb
transcoder.transcode request_pb
end

##
# @private
#
# GRPC transcoding helper method for the get_encryption_spec REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::GetEncryptionSpecRequest]
# A request object representing the call parameters. Required.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
def self.transcode_get_encryption_spec_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :get,
uri_template: "/v1/{name}",
matches: [
["name", %r{^projects/[^/]+/locations/[^/]+/encryptionSpec/?$}, false]
]
)
transcoder.transcode request_pb
end

##
# @private
#
# GRPC transcoding helper method for the initialize_encryption_spec REST call
#
# @param request_pb [::Google::Cloud::ContactCenterInsights::V1::InitializeEncryptionSpecRequest]
# A request object representing the call parameters. Required.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
def self.transcode_initialize_encryption_spec_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{encryption_spec.name}:initialize",
body: "*",
matches: [
["encryption_spec.name", %r{^projects/[^/]+/locations/[^/]+/encryptionSpec/?$}, false]
]
)
transcoder.transcode request_pb
end

##
# @private
#
Expand Down

Large diffs are not rendered by default.

Loading