# frozen_string_literal: true

# 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.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!

require "grafeas/v1/grafeas_pb"

module Grafeas
  module V1
    module Grafeas
      module Rest
        ##
        # REST service stub for the Grafeas service.
        # Service stub contains baseline method implementations
        # including transcoding, making the REST call, and deserialing the response.
        #
        class ServiceStub
          def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
            # These require statements are intentionally placed here to initialize
            # the REST modules only when it's required.
            require "gapic/rest"

            @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
                                                         endpoint_template: endpoint_template,
                                                         universe_domain: universe_domain,
                                                         credentials: credentials,
                                                         numeric_enums: true,
                                                         raise_faraday_errors: false
          end

          ##
          # The effective universe domain
          #
          # @return [String]
          #
          def universe_domain
            @client_stub.universe_domain
          end

          ##
          # The effective endpoint
          #
          # @return [String]
          #
          def endpoint
            @client_stub.endpoint
          end

          ##
          # Baseline implementation for the get_occurrence REST call
          #
          # @param request_pb [::Grafeas::V1::GetOccurrenceRequest]
          #   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 [::Grafeas::V1::Occurrence]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Occurrence]
          #   A result object deserialized from the server's reply
          def get_occurrence request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_get_occurrence_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 = ::Grafeas::V1::Occurrence.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the list_occurrences REST call
          #
          # @param request_pb [::Grafeas::V1::ListOccurrencesRequest]
          #   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 [::Grafeas::V1::ListOccurrencesResponse]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::ListOccurrencesResponse]
          #   A result object deserialized from the server's reply
          def list_occurrences request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_list_occurrences_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 = ::Grafeas::V1::ListOccurrencesResponse.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the delete_occurrence REST call
          #
          # @param request_pb [::Grafeas::V1::DeleteOccurrenceRequest]
          #   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::Protobuf::Empty]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Google::Protobuf::Empty]
          #   A result object deserialized from the server's reply
          def delete_occurrence request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_delete_occurrence_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::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the create_occurrence REST call
          #
          # @param request_pb [::Grafeas::V1::CreateOccurrenceRequest]
          #   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 [::Grafeas::V1::Occurrence]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Occurrence]
          #   A result object deserialized from the server's reply
          def create_occurrence request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_create_occurrence_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 = ::Grafeas::V1::Occurrence.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the batch_create_occurrences REST call
          #
          # @param request_pb [::Grafeas::V1::BatchCreateOccurrencesRequest]
          #   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 [::Grafeas::V1::BatchCreateOccurrencesResponse]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::BatchCreateOccurrencesResponse]
          #   A result object deserialized from the server's reply
          def batch_create_occurrences request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_batch_create_occurrences_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 = ::Grafeas::V1::BatchCreateOccurrencesResponse.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the update_occurrence REST call
          #
          # @param request_pb [::Grafeas::V1::UpdateOccurrenceRequest]
          #   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 [::Grafeas::V1::Occurrence]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Occurrence]
          #   A result object deserialized from the server's reply
          def update_occurrence request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_update_occurrence_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 = ::Grafeas::V1::Occurrence.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the get_occurrence_note REST call
          #
          # @param request_pb [::Grafeas::V1::GetOccurrenceNoteRequest]
          #   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 [::Grafeas::V1::Note]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Note]
          #   A result object deserialized from the server's reply
          def get_occurrence_note request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_get_occurrence_note_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 = ::Grafeas::V1::Note.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the get_note REST call
          #
          # @param request_pb [::Grafeas::V1::GetNoteRequest]
          #   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 [::Grafeas::V1::Note]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Note]
          #   A result object deserialized from the server's reply
          def get_note request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_get_note_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 = ::Grafeas::V1::Note.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the list_notes REST call
          #
          # @param request_pb [::Grafeas::V1::ListNotesRequest]
          #   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 [::Grafeas::V1::ListNotesResponse]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::ListNotesResponse]
          #   A result object deserialized from the server's reply
          def list_notes request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_list_notes_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 = ::Grafeas::V1::ListNotesResponse.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the delete_note REST call
          #
          # @param request_pb [::Grafeas::V1::DeleteNoteRequest]
          #   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::Protobuf::Empty]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Google::Protobuf::Empty]
          #   A result object deserialized from the server's reply
          def delete_note request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_delete_note_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::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the create_note REST call
          #
          # @param request_pb [::Grafeas::V1::CreateNoteRequest]
          #   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 [::Grafeas::V1::Note]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Note]
          #   A result object deserialized from the server's reply
          def create_note request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_create_note_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 = ::Grafeas::V1::Note.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the batch_create_notes REST call
          #
          # @param request_pb [::Grafeas::V1::BatchCreateNotesRequest]
          #   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 [::Grafeas::V1::BatchCreateNotesResponse]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::BatchCreateNotesResponse]
          #   A result object deserialized from the server's reply
          def batch_create_notes request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_batch_create_notes_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 = ::Grafeas::V1::BatchCreateNotesResponse.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the update_note REST call
          #
          # @param request_pb [::Grafeas::V1::UpdateNoteRequest]
          #   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 [::Grafeas::V1::Note]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::Note]
          #   A result object deserialized from the server's reply
          def update_note request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_update_note_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 = ::Grafeas::V1::Note.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # Baseline implementation for the list_note_occurrences REST call
          #
          # @param request_pb [::Grafeas::V1::ListNoteOccurrencesRequest]
          #   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 [::Grafeas::V1::ListNoteOccurrencesResponse]
          # @yieldparam operation [::Gapic::Rest::TransportOperation]
          #
          # @return [::Grafeas::V1::ListNoteOccurrencesResponse]
          #   A result object deserialized from the server's reply
          def list_note_occurrences request_pb, options = nil
            raise ::ArgumentError, "request must be provided" if request_pb.nil?

            verb, uri, query_string_params, body = ServiceStub.transcode_list_note_occurrences_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 = ::Grafeas::V1::ListNoteOccurrencesResponse.decode_json response.body, ignore_unknown_fields: true

            yield result, operation if block_given?
            result
          end

          ##
          # @private
          #
          # GRPC transcoding helper method for the get_occurrence REST call
          #
          # @param request_pb [::Grafeas::V1::GetOccurrenceRequest]
          #   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_occurrence_request request_pb
            transcoder = Gapic::Rest::GrpcTranscoder.new
                                                    .with_bindings(
                                                      uri_method: :get,
                                                      uri_template: "/v1/{name}",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/occurrences/[^/]+/?$}, false]
                                                      ]
                                                    )
                                                    .with_bindings(
                                                      uri_method: :get,
                                                      uri_template: "/v1/{name}",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/locations/[^/]+/occurrences/[^/]+/?$}, false]
                                                      ]
                                                    )
            transcoder.transcode request_pb
          end

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

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

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

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

          ##
          # @private
          #
          # GRPC transcoding helper method for the update_occurrence REST call
          #
          # @param request_pb [::Grafeas::V1::UpdateOccurrenceRequest]
          #   A request object representing the call parameters. Required.
          # @return [Array(String, [String, nil], Hash{String => String})]
          #   Uri, Body, Query string parameters
          def self.transcode_update_occurrence_request request_pb
            transcoder = Gapic::Rest::GrpcTranscoder.new
                                                    .with_bindings(
                                                      uri_method: :patch,
                                                      uri_template: "/v1/{name}",
                                                      body: "occurrence",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/occurrences/[^/]+/?$}, false]
                                                      ]
                                                    )
            transcoder.transcode request_pb
          end

          ##
          # @private
          #
          # GRPC transcoding helper method for the get_occurrence_note REST call
          #
          # @param request_pb [::Grafeas::V1::GetOccurrenceNoteRequest]
          #   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_occurrence_note_request request_pb
            transcoder = Gapic::Rest::GrpcTranscoder.new
                                                    .with_bindings(
                                                      uri_method: :get,
                                                      uri_template: "/v1/{name}/notes",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/occurrences/[^/]+/?$}, false]
                                                      ]
                                                    )
                                                    .with_bindings(
                                                      uri_method: :get,
                                                      uri_template: "/v1/{name}/notes",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/locations/[^/]+/occurrences/[^/]+/?$}, false]
                                                      ]
                                                    )
            transcoder.transcode request_pb
          end

          ##
          # @private
          #
          # GRPC transcoding helper method for the get_note REST call
          #
          # @param request_pb [::Grafeas::V1::GetNoteRequest]
          #   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_note_request request_pb
            transcoder = Gapic::Rest::GrpcTranscoder.new
                                                    .with_bindings(
                                                      uri_method: :get,
                                                      uri_template: "/v1/{name}",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/notes/[^/]+/?$}, false]
                                                      ]
                                                    )
                                                    .with_bindings(
                                                      uri_method: :get,
                                                      uri_template: "/v1/{name}",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/locations/[^/]+/notes/[^/]+/?$}, false]
                                                      ]
                                                    )
            transcoder.transcode request_pb
          end

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

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

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

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

          ##
          # @private
          #
          # GRPC transcoding helper method for the update_note REST call
          #
          # @param request_pb [::Grafeas::V1::UpdateNoteRequest]
          #   A request object representing the call parameters. Required.
          # @return [Array(String, [String, nil], Hash{String => String})]
          #   Uri, Body, Query string parameters
          def self.transcode_update_note_request request_pb
            transcoder = Gapic::Rest::GrpcTranscoder.new
                                                    .with_bindings(
                                                      uri_method: :patch,
                                                      uri_template: "/v1/{name}",
                                                      body: "note",
                                                      matches: [
                                                        ["name", %r{^projects/[^/]+/notes/[^/]+/?$}, false]
                                                      ]
                                                    )
            transcoder.transcode request_pb
          end

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