# frozen_string_literal: true # Copyright 2020 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 "google/cloud/errors" require "google/cloud/talent/v4beta1/profile_service_pb" module Google module Cloud module Talent module V4beta1 module ProfileService ## # Client for the ProfileService service. # # A service that handles profile management, including profile CRUD, # enumeration and search. # class Client include Paths # @private attr_reader :profile_service_stub ## # Configure the ProfileService Client class. # # See {::Google::Cloud::Talent::V4beta1::ProfileService::Client::Configuration} # for a description of the configuration fields. # # @example # # # Modify the configuration for all ProfileService clients # ::Google::Cloud::Talent::V4beta1::ProfileService::Client.configure do |config| # config.timeout = 10.0 # end # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Talent", "V4beta1"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.list_profiles.timeout = 30.0 default_config.rpcs.list_profiles.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.create_profile.timeout = 30.0 default_config.rpcs.get_profile.timeout = 30.0 default_config.rpcs.get_profile.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.update_profile.timeout = 30.0 default_config.rpcs.delete_profile.timeout = 30.0 default_config.rpcs.delete_profile.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.search_profiles.timeout = 30.0 default_config end yield @configure if block_given? @configure end ## # Configure the ProfileService Client instance. # # The configuration is set to the derived mode, meaning that values can be changed, # but structural changes (adding new fields, etc.) are not allowed. Structural changes # should be made on {Client.configure}. # # See {::Google::Cloud::Talent::V4beta1::ProfileService::Client::Configuration} # for a description of the configuration fields. # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # def configure yield @config if block_given? @config end ## # Create a new ProfileService client object. # # @example # # # Create a client using the default configuration # client = ::Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a client using a custom configuration # client = ::Google::Cloud::Talent::V4beta1::ProfileService::Client.new do |config| # config.timeout = 10.0 # end # # @yield [config] Configure the ProfileService client. # @yieldparam config [Client::Configuration] # def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/cloud/talent/v4beta1/profile_service_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @profile_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Talent::V4beta1::ProfileService::Stub, credentials: credentials, endpoint: @config.endpoint, channel_args: @config.channel_args, interceptors: @config.interceptors ) end # Service calls ## # Lists profiles by filter. The order is unspecified. # # @overload list_profiles(request, options = nil) # Pass arguments to `list_profiles` via a request object, either of type # {::Google::Cloud::Talent::V4beta1::ListProfilesRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Talent::V4beta1::ListProfilesRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload list_profiles(parent: nil, filter: nil, page_token: nil, page_size: nil, read_mask: nil) # Pass arguments to `list_profiles` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The resource name of the tenant under which the profile is created. # # The format is "projects/\\{project_id}/tenants/\\{tenant_id}". For example, # "projects/foo/tenants/bar". # @param filter [::String] # The filter string specifies the profiles to be enumerated. # # Supported operator: =, AND # # The field(s) eligible for filtering are: # # * `externalId` # * `groupId` # # externalId and groupId cannot be specified at the same time. If both # externalId and groupId are provided, the API will return a bad request # error. # # Sample Query: # # * externalId = "externalId-1" # * groupId = "groupId-1" # @param page_token [::String] # The token that specifies the current offset (that is, starting result). # # Please set the value to {::Google::Cloud::Talent::V4beta1::ListProfilesResponse#next_page_token ListProfilesResponse.next_page_token} to # continue the list. # @param page_size [::Integer] # The maximum number of profiles to be returned, at most 100. # # Default is 100 unless a positive number smaller than 100 is specified. # @param read_mask [::Google::Protobuf::FieldMask, ::Hash] # A field mask to specify the profile fields to be listed in response. # All fields are listed if it is unset. # # Valid values are: # # * name # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Talent::V4beta1::Profile>] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Gapic::PagedEnumerable<::Google::Cloud::Talent::V4beta1::Profile>] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # # @example Basic example # require "google/cloud/talent/v4beta1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::Talent::V4beta1::ListProfilesRequest.new # # # Call the list_profiles method. # result = client.list_profiles request # # # The returned object is of type Gapic::PagedEnumerable. You can # # iterate over all elements by calling #each, and the enumerable # # will lazily make API calls to fetch subsequent pages. Other # # methods are also available for managing paging directly. # result.each do |response| # # Each element is of type ::Google::Cloud::Talent::V4beta1::Profile. # p response # end # def list_profiles request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4beta1::ListProfilesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_profiles.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_profiles.timeout, metadata: metadata, retry_policy: @config.rpcs.list_profiles.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @profile_service_stub.call_rpc :list_profiles, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @profile_service_stub, :list_profiles, request, response, operation, options yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end ## # Creates and returns a new profile. # # @overload create_profile(request, options = nil) # Pass arguments to `create_profile` via a request object, either of type # {::Google::Cloud::Talent::V4beta1::CreateProfileRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Talent::V4beta1::CreateProfileRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload create_profile(parent: nil, profile: nil) # Pass arguments to `create_profile` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The name of the tenant this profile belongs to. # # The format is "projects/\\{project_id}/tenants/\\{tenant_id}". For example, # "projects/foo/tenants/bar". # @param profile [::Google::Cloud::Talent::V4beta1::Profile, ::Hash] # Required. The profile to be created. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Talent::V4beta1::Profile] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Talent::V4beta1::Profile] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # # @example Basic example # require "google/cloud/talent/v4beta1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::Talent::V4beta1::CreateProfileRequest.new # # # Call the create_profile method. # result = client.create_profile request # # # The returned object is of type Google::Cloud::Talent::V4beta1::Profile. # p result # def create_profile request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4beta1::CreateProfileRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_profile.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_profile.timeout, metadata: metadata, retry_policy: @config.rpcs.create_profile.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @profile_service_stub.call_rpc :create_profile, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end ## # Gets the specified profile. # # @overload get_profile(request, options = nil) # Pass arguments to `get_profile` via a request object, either of type # {::Google::Cloud::Talent::V4beta1::GetProfileRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Talent::V4beta1::GetProfileRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload get_profile(name: nil) # Pass arguments to `get_profile` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. Resource name of the profile to get. # # The format is # "projects/\\{project_id}/tenants/\\{tenant_id}/profiles/\\{profile_id}". For # example, "projects/foo/tenants/bar/profiles/baz". # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Talent::V4beta1::Profile] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Talent::V4beta1::Profile] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # # @example Basic example # require "google/cloud/talent/v4beta1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::Talent::V4beta1::GetProfileRequest.new # # # Call the get_profile method. # result = client.get_profile request # # # The returned object is of type Google::Cloud::Talent::V4beta1::Profile. # p result # def get_profile request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4beta1::GetProfileRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_profile.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_profile.timeout, metadata: metadata, retry_policy: @config.rpcs.get_profile.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @profile_service_stub.call_rpc :get_profile, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end ## # Updates the specified profile and returns the updated result. # # @overload update_profile(request, options = nil) # Pass arguments to `update_profile` via a request object, either of type # {::Google::Cloud::Talent::V4beta1::UpdateProfileRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Talent::V4beta1::UpdateProfileRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload update_profile(profile: nil, update_mask: nil) # Pass arguments to `update_profile` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param profile [::Google::Cloud::Talent::V4beta1::Profile, ::Hash] # Required. Profile to be updated. # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] # A field mask to specify the profile fields to update. # # A full update is performed if it is unset. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Talent::V4beta1::Profile] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Talent::V4beta1::Profile] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # # @example Basic example # require "google/cloud/talent/v4beta1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::Talent::V4beta1::UpdateProfileRequest.new # # # Call the update_profile method. # result = client.update_profile request # # # The returned object is of type Google::Cloud::Talent::V4beta1::Profile. # p result # def update_profile request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4beta1::UpdateProfileRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.update_profile.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.profile&.name header_params["profile.name"] = request.profile.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_profile.timeout, metadata: metadata, retry_policy: @config.rpcs.update_profile.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @profile_service_stub.call_rpc :update_profile, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end ## # Deletes the specified profile. # Prerequisite: The profile has no associated applications or assignments # associated. # # @overload delete_profile(request, options = nil) # Pass arguments to `delete_profile` via a request object, either of type # {::Google::Cloud::Talent::V4beta1::DeleteProfileRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Talent::V4beta1::DeleteProfileRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload delete_profile(name: nil) # Pass arguments to `delete_profile` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param name [::String] # Required. Resource name of the profile to be deleted. # # The format is # "projects/\\{project_id}/tenants/\\{tenant_id}/profiles/\\{profile_id}". For # example, "projects/foo/tenants/bar/profiles/baz". # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Protobuf::Empty] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Protobuf::Empty] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # # @example Basic example # require "google/cloud/talent/v4beta1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::Talent::V4beta1::DeleteProfileRequest.new # # # Call the delete_profile method. # result = client.delete_profile request # # # The returned object is of type Google::Protobuf::Empty. # p result # def delete_profile request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4beta1::DeleteProfileRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_profile.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_profile.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_profile.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @profile_service_stub.call_rpc :delete_profile, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end ## # Searches for profiles within a tenant. # # For example, search by raw queries "software engineer in Mountain View" or # search by structured filters (location filter, education filter, etc.). # # See {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest SearchProfilesRequest} for more information. # # @overload search_profiles(request, options = nil) # Pass arguments to `search_profiles` via a request object, either of type # {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest} or an equivalent Hash. # # @param request [::Google::Cloud::Talent::V4beta1::SearchProfilesRequest, ::Hash] # A request object representing the call parameters. Required. To specify no # parameters, or to keep all the default parameter values, pass an empty Hash. # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # # @overload search_profiles(parent: nil, request_metadata: nil, profile_query: nil, page_size: nil, page_token: nil, offset: nil, disable_spell_check: nil, order_by: nil, case_sensitive_sort: nil, histogram_queries: nil, result_set_id: nil, strict_keywords_search: nil) # Pass arguments to `search_profiles` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param parent [::String] # Required. The resource name of the tenant to search within. # # The format is "projects/\\{project_id}/tenants/\\{tenant_id}". For example, # "projects/foo/tenants/bar". # @param request_metadata [::Google::Cloud::Talent::V4beta1::RequestMetadata, ::Hash] # Required. The meta information collected about the profile search user. This is used # to improve the search quality of the service. These values are provided by # users, and must be precise and consistent. # @param profile_query [::Google::Cloud::Talent::V4beta1::ProfileQuery, ::Hash] # Search query to execute. See {::Google::Cloud::Talent::V4beta1::ProfileQuery ProfileQuery} for more details. # @param page_size [::Integer] # A limit on the number of profiles returned in the search results. # A value above the default value 10 can increase search response time. # # The maximum value allowed is 100. Otherwise an error is thrown. # @param page_token [::String] # The pageToken, similar to offset enables users of the API to paginate # through the search results. To retrieve the first page of results, set the # pageToken to empty. The search response includes a # {::Google::Cloud::Talent::V4beta1::SearchProfilesResponse#next_page_token nextPageToken} field that can be # used to populate the pageToken field for the next page of results. Using # pageToken instead of offset increases the performance of the API, # especially compared to larger offset values. # @param offset [::Integer] # An integer that specifies the current offset (that is, starting result) in # search results. This field is only considered if {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#page_token page_token} is unset. # # The maximum allowed value is 5000. Otherwise an error is thrown. # # For example, 0 means to search from the first profile, and 10 means to # search from the 11th profile. This can be used for pagination, for example # pageSize = 10 and offset = 10 means to search from the second page. # @param disable_spell_check [::Boolean] # This flag controls the spell-check feature. If `false`, the # service attempts to correct a misspelled query. # # For example, "enginee" is corrected to "engineer". # @param order_by [::String] # The criteria that determines how search results are sorted. # Defaults is "relevance desc" if no value is specified. # # Supported options are: # # * "relevance desc": By descending relevance, as determined by the API # algorithms. # * "update_date desc": Sort by {::Google::Cloud::Talent::V4beta1::Profile#update_time Profile.update_time} in descending order # (recently updated profiles first). # * "create_date desc": Sort by {::Google::Cloud::Talent::V4beta1::Profile#create_time Profile.create_time} in descending order # (recently created profiles first). # * "first_name": Sort by {::Google::Cloud::Talent::V4beta1::PersonName::PersonStructuredName#given_name PersonName.PersonStructuredName.given_name} in # ascending order. # * "first_name desc": Sort by {::Google::Cloud::Talent::V4beta1::PersonName::PersonStructuredName#given_name PersonName.PersonStructuredName.given_name} # in descending order. # * "last_name": Sort by {::Google::Cloud::Talent::V4beta1::PersonName::PersonStructuredName#family_name PersonName.PersonStructuredName.family_name} in # ascending order. # * "last_name desc": Sort by {::Google::Cloud::Talent::V4beta1::PersonName::PersonStructuredName#family_name PersonName.PersonStructuredName.family_name} # in ascending order. # @param case_sensitive_sort [::Boolean] # When sort by field is based on alphabetical order, sort values case # sensitively (based on ASCII) when the value is set to true. Default value # is case in-sensitive sort (false). # @param histogram_queries [::Array<::Google::Cloud::Talent::V4beta1::HistogramQuery, ::Hash>] # A list of expressions specifies histogram requests against matching # profiles for {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest SearchProfilesRequest}. # # The expression syntax looks like a function definition with parameters. # # Function syntax: function_name(histogram_facet[, list of buckets]) # # Data types: # # * Histogram facet: facet names with format `[a-zA-Z][a-zA-Z0-9_]+`. # * String: string like "any string with backslash escape for quote(\")." # * Number: whole number and floating point number like 10, -1 and -0.01. # * List: list of elements with comma(,) separator surrounded by square # brackets. For example, [1, 2, 3] and ["one", "two", "three"]. # # Built-in constants: # # * MIN (minimum number similar to java Double.MIN_VALUE) # * MAX (maximum number similar to java Double.MAX_VALUE) # # Built-in functions: # # * bucket(start, end[, label]) # Bucket build-in function creates a bucket with range of [start, end). Note # that the end is exclusive. # For example, bucket(1, MAX, "positive number") or bucket(1, 10). # # Histogram Facets: # # * admin1: Admin1 is a global placeholder for referring to state, province, # or the particular term a country uses to define the geographic structure # below the country level. Examples include states codes such as "CA", "IL", # "NY", and provinces, such as "BC". # * locality: Locality is a global placeholder for referring to city, town, # or the particular term a country uses to define the geographic structure # below the admin1 level. Examples include city names such as # "Mountain View" and "New York". # * extended_locality: Extended locality is concatenated version of admin1 # and locality with comma separator. For example, "Mountain View, CA" and # "New York, NY". # * postal_code: Postal code of profile which follows locale code. # * country: Country code (ISO-3166-1 alpha-2 code) of profile, such as US, # JP, GB. # * job_title: Normalized job titles specified in EmploymentHistory. # * company_name: Normalized company name of profiles to match on. # * institution: The school name. For example, "MIT", # "University of California, Berkeley" # * degree: Highest education degree in ISCED code. Each value in degree # covers a specific level of education, without any expansion to upper nor # lower levels of education degree. # * experience_in_months: experience in months. 0 means 0 month to 1 month # (exclusive). # * application_date: The application date specifies application start dates. # See {::Google::Cloud::Talent::V4beta1::ApplicationDateFilter ApplicationDateFilter} for more details. # * application_outcome_notes: The application outcome reason specifies the # reasons behind the outcome of the job application. # See {::Google::Cloud::Talent::V4beta1::ApplicationOutcomeNotesFilter ApplicationOutcomeNotesFilter} for more details. # * application_job_title: The application job title specifies the job # applied for in the application. # See {::Google::Cloud::Talent::V4beta1::ApplicationJobFilter ApplicationJobFilter} for more details. # * hirable_status: Hirable status specifies the profile's hirable status. # * string_custom_attribute: String custom attributes. Values can be accessed # via square bracket notation like string_custom_attribute["key1"]. # * numeric_custom_attribute: Numeric custom attributes. Values can be # accessed via square bracket notation like numeric_custom_attribute["key1"]. # # Example expressions: # # * count(admin1) # * count(experience_in_months, [bucket(0, 12, "1 year"), # bucket(12, 36, "1-3 years"), bucket(36, MAX, "3+ years")]) # * count(string_custom_attribute["assigned_recruiter"]) # * count(numeric_custom_attribute["favorite_number"], # [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")]) # @param result_set_id [::String] # An id that uniquely identifies the result set of a # {::Google::Cloud::Talent::V4beta1::ProfileService::Client#search_profiles SearchProfiles} call. The id should be # retrieved from the # {::Google::Cloud::Talent::V4beta1::SearchProfilesResponse SearchProfilesResponse} message returned from a previous # invocation of {::Google::Cloud::Talent::V4beta1::ProfileService::Client#search_profiles SearchProfiles}. # # A result set is an ordered list of search results. # # If this field is not set, a new result set is computed based on the # {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#profile_query profile_query}. A new {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#result_set_id result_set_id} is returned as a handle to # access this result set. # # If this field is set, the service will ignore the resource and # {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#profile_query profile_query} values, and simply retrieve a page of results from the # corresponding result set. In this case, one and only one of {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#page_token page_token} # or {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#offset offset} must be set. # # A typical use case is to invoke {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest SearchProfilesRequest} without this # field, then use the resulting {::Google::Cloud::Talent::V4beta1::SearchProfilesRequest#result_set_id result_set_id} in # {::Google::Cloud::Talent::V4beta1::SearchProfilesResponse SearchProfilesResponse} to page through the results. # @param strict_keywords_search [::Boolean] # This flag is used to indicate whether the service will attempt to # understand synonyms and terms related to the search query or treat the # query "as is" when it generates a set of results. By default this flag is # set to false, thus allowing expanded results to also be returned. For # example a search for "software engineer" might also return candidates who # have experience in jobs similar to software engineer positions. By setting # this flag to true, the service will only attempt to deliver candidates has # software engineer in his/her global fields by treating "software engineer" # as a keyword. # # It is recommended to provide a feature in the UI (such as a checkbox) to # allow recruiters to set this flag to true if they intend to search for # longer boolean strings. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Talent::V4beta1::SearchProfilesResponse] # @yieldparam operation [::GRPC::ActiveCall::Operation] # # @return [::Google::Cloud::Talent::V4beta1::SearchProfilesResponse] # # @raise [::Google::Cloud::Error] if the RPC is aborted. # # @example Basic example # require "google/cloud/talent/v4beta1" # # # Create a client object. The client can be reused for multiple calls. # client = Google::Cloud::Talent::V4beta1::ProfileService::Client.new # # # Create a request. To set request fields, pass in keyword arguments. # request = Google::Cloud::Talent::V4beta1::SearchProfilesRequest.new # # # Call the search_profiles method. # result = client.search_profiles request # # # The returned object is of type Google::Cloud::Talent::V4beta1::SearchProfilesResponse. # p result # def search_profiles request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4beta1::SearchProfilesRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.search_profiles.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.search_profiles.timeout, metadata: metadata, retry_policy: @config.rpcs.search_profiles.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @profile_service_stub.call_rpc :search_profiles, request, options: options do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end ## # Configuration class for the ProfileService API. # # This class represents the configuration for ProfileService, # providing control over timeouts, retry behavior, logging, transport # parameters, and other low-level controls. Certain parameters can also be # applied individually to specific RPCs. See # {::Google::Cloud::Talent::V4beta1::ProfileService::Client::Configuration::Rpcs} # for a list of RPCs that can be configured independently. # # Configuration can be applied globally to all clients, or to a single client # on construction. # # @example # # # Modify the global config, setting the timeout for # # list_profiles to 20 seconds, # # and all remaining timeouts to 10 seconds. # ::Google::Cloud::Talent::V4beta1::ProfileService::Client.configure do |config| # config.timeout = 10.0 # config.rpcs.list_profiles.timeout = 20.0 # end # # # Apply the above configuration only to a new client. # client = ::Google::Cloud::Talent::V4beta1::ProfileService::Client.new do |config| # config.timeout = 10.0 # config.rpcs.list_profiles.timeout = 20.0 # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"jobs.googleapis.com"`. # @return [::String] # @!attribute [rw] credentials # Credentials to send with calls. You may provide any of the following types: # * (`String`) The path to a service account key file in JSON format # * (`Hash`) A service account key as a Hash # * (`Google::Auth::Credentials`) A googleauth credentials object # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html)) # * (`Signet::OAuth2::Client`) A signet oauth2 client object # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html)) # * (`GRPC::Core::Channel`) a gRPC channel with included credentials # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object # * (`nil`) indicating no credentials # @return [::Object] # @!attribute [rw] scope # The OAuth scopes # @return [::Array<::String>] # @!attribute [rw] lib_name # The library name as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] lib_version # The library version as recorded in instrumentation and logging # @return [::String] # @!attribute [rw] channel_args # Extra parameters passed to the gRPC channel. Note: this is ignored if a # `GRPC::Core::Channel` object is provided as the credential. # @return [::Hash] # @!attribute [rw] interceptors # An array of interceptors that are run before calls are executed. # @return [::Array<::GRPC::ClientInterceptor>] # @!attribute [rw] timeout # The call timeout in seconds. # @return [::Numeric] # @!attribute [rw] metadata # Additional gRPC headers to be sent with the call. # @return [::Hash{::Symbol=>::String}] # @!attribute [rw] retry_policy # The retry policy. The value is a hash with the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. # * `:retry_codes` (*type:* `Array`) - The error codes that should # trigger a retry. # @return [::Hash] # @!attribute [rw] quota_project # A separate project against which to charge quota. # @return [::String] # class Configuration extend ::Gapic::Config config_attr :endpoint, "jobs.googleapis.com", ::String config_attr :credentials, nil do |value| allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC allowed.any? { |klass| klass === value } end config_attr :scope, nil, ::String, ::Array, nil config_attr :lib_name, nil, ::String, nil config_attr :lib_version, nil, ::String, nil config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) config_attr :interceptors, nil, ::Array, nil config_attr :timeout, nil, ::Numeric, nil config_attr :metadata, nil, ::Hash, nil config_attr :retry_policy, nil, ::Hash, ::Proc, nil config_attr :quota_project, nil, ::String, nil # @private def initialize parent_config = nil @parent_config = parent_config unless parent_config.nil? yield self if block_given? end ## # Configurations for individual RPCs # @return [Rpcs] # def rpcs @rpcs ||= begin parent_rpcs = nil parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) Rpcs.new parent_rpcs end end ## # Configuration RPC class for the ProfileService API. # # Includes fields providing the configuration for each RPC in this service. # Each configuration object is of type `Gapic::Config::Method` and includes # the following configuration fields: # # * `timeout` (*type:* `Numeric`) - The call timeout in seconds # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields # include the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. # * `:retry_codes` (*type:* `Array`) - The error codes that should # trigger a retry. # class Rpcs ## # RPC-specific configuration for `list_profiles` # @return [::Gapic::Config::Method] # attr_reader :list_profiles ## # RPC-specific configuration for `create_profile` # @return [::Gapic::Config::Method] # attr_reader :create_profile ## # RPC-specific configuration for `get_profile` # @return [::Gapic::Config::Method] # attr_reader :get_profile ## # RPC-specific configuration for `update_profile` # @return [::Gapic::Config::Method] # attr_reader :update_profile ## # RPC-specific configuration for `delete_profile` # @return [::Gapic::Config::Method] # attr_reader :delete_profile ## # RPC-specific configuration for `search_profiles` # @return [::Gapic::Config::Method] # attr_reader :search_profiles # @private def initialize parent_rpcs = nil list_profiles_config = parent_rpcs.list_profiles if parent_rpcs.respond_to? :list_profiles @list_profiles = ::Gapic::Config::Method.new list_profiles_config create_profile_config = parent_rpcs.create_profile if parent_rpcs.respond_to? :create_profile @create_profile = ::Gapic::Config::Method.new create_profile_config get_profile_config = parent_rpcs.get_profile if parent_rpcs.respond_to? :get_profile @get_profile = ::Gapic::Config::Method.new get_profile_config update_profile_config = parent_rpcs.update_profile if parent_rpcs.respond_to? :update_profile @update_profile = ::Gapic::Config::Method.new update_profile_config delete_profile_config = parent_rpcs.delete_profile if parent_rpcs.respond_to? :delete_profile @delete_profile = ::Gapic::Config::Method.new delete_profile_config search_profiles_config = parent_rpcs.search_profiles if parent_rpcs.respond_to? :search_profiles @search_profiles = ::Gapic::Config::Method.new search_profiles_config yield self if block_given? end end end end end end end end end