google-cloud-talent-v4 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +75 -0
- data/lib/google-cloud-talent-v4.rb +21 -0
- data/lib/google/cloud/talent/v4.rb +39 -0
- data/lib/google/cloud/talent/v4/common_pb.rb +280 -0
- data/lib/google/cloud/talent/v4/company_pb.rb +42 -0
- data/lib/google/cloud/talent/v4/company_service.rb +49 -0
- data/lib/google/cloud/talent/v4/company_service/client.rb +732 -0
- data/lib/google/cloud/talent/v4/company_service/credentials.rb +52 -0
- data/lib/google/cloud/talent/v4/company_service/paths.rb +69 -0
- data/lib/google/cloud/talent/v4/company_service_pb.rb +57 -0
- data/lib/google/cloud/talent/v4/company_service_services_pb.rb +54 -0
- data/lib/google/cloud/talent/v4/completion.rb +49 -0
- data/lib/google/cloud/talent/v4/completion/client.rb +408 -0
- data/lib/google/cloud/talent/v4/completion/credentials.rb +52 -0
- data/lib/google/cloud/talent/v4/completion/paths.rb +69 -0
- data/lib/google/cloud/talent/v4/completion_service_pb.rb +57 -0
- data/lib/google/cloud/talent/v4/completion_service_services_pb.rb +46 -0
- data/lib/google/cloud/talent/v4/event_pb.rb +55 -0
- data/lib/google/cloud/talent/v4/event_service.rb +49 -0
- data/lib/google/cloud/talent/v4/event_service/client.rb +383 -0
- data/lib/google/cloud/talent/v4/event_service/credentials.rb +52 -0
- data/lib/google/cloud/talent/v4/event_service/paths.rb +50 -0
- data/lib/google/cloud/talent/v4/event_service_pb.rb +28 -0
- data/lib/google/cloud/talent/v4/event_service_services_pb.rb +51 -0
- data/lib/google/cloud/talent/v4/filters_pb.rb +87 -0
- data/lib/google/cloud/talent/v4/histogram_pb.rb +28 -0
- data/lib/google/cloud/talent/v4/job_pb.rb +72 -0
- data/lib/google/cloud/talent/v4/job_service.rb +50 -0
- data/lib/google/cloud/talent/v4/job_service/client.rb +1632 -0
- data/lib/google/cloud/talent/v4/job_service/credentials.rb +52 -0
- data/lib/google/cloud/talent/v4/job_service/operations.rb +570 -0
- data/lib/google/cloud/talent/v4/job_service/paths.rb +88 -0
- data/lib/google/cloud/talent/v4/job_service_pb.rb +173 -0
- data/lib/google/cloud/talent/v4/job_service_services_pb.rb +86 -0
- data/lib/google/cloud/talent/v4/tenant_pb.rb +26 -0
- data/lib/google/cloud/talent/v4/tenant_service.rb +49 -0
- data/lib/google/cloud/talent/v4/tenant_service/client.rb +720 -0
- data/lib/google/cloud/talent/v4/tenant_service/credentials.rb +52 -0
- data/lib/google/cloud/talent/v4/tenant_service/paths.rb +64 -0
- data/lib/google/cloud/talent/v4/tenant_service_pb.rb +56 -0
- data/lib/google/cloud/talent/v4/tenant_service_services_pb.rb +53 -0
- data/lib/google/cloud/talent/v4/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/talent/v4/common.rb +949 -0
- data/proto_docs/google/cloud/talent/v4/company.rb +117 -0
- data/proto_docs/google/cloud/talent/v4/company_service.rb +133 -0
- data/proto_docs/google/cloud/talent/v4/completion_service.rb +148 -0
- data/proto_docs/google/cloud/talent/v4/event.rb +179 -0
- data/proto_docs/google/cloud/talent/v4/event_service.rb +42 -0
- data/proto_docs/google/cloud/talent/v4/filters.rb +360 -0
- data/proto_docs/google/cloud/talent/v4/histogram.rb +72 -0
- data/proto_docs/google/cloud/talent/v4/job.rb +378 -0
- data/proto_docs/google/cloud/talent/v4/job_service.rb +737 -0
- data/proto_docs/google/cloud/talent/v4/tenant.rb +50 -0
- data/proto_docs/google/cloud/talent/v4/tenant_service.rb +121 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/latlng.rb +38 -0
- data/proto_docs/google/type/money.rb +43 -0
- data/proto_docs/google/type/postal_address.rb +135 -0
- data/proto_docs/google/type/timeofday.rb +44 -0
- metadata +258 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Talent
|
24
|
+
module V4
|
25
|
+
module CompanyService
|
26
|
+
# Credentials for the CompanyService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
30
|
+
"https://www.googleapis.com/auth/jobs"
|
31
|
+
]
|
32
|
+
self.env_vars = [
|
33
|
+
"TALENT_CREDENTIALS",
|
34
|
+
"TALENT_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE",
|
37
|
+
"GCLOUD_KEYFILE",
|
38
|
+
"TALENT_CREDENTIALS_JSON",
|
39
|
+
"TALENT_KEYFILE_JSON",
|
40
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
41
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
42
|
+
"GCLOUD_KEYFILE_JSON"
|
43
|
+
]
|
44
|
+
self.paths = [
|
45
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Talent
|
23
|
+
module V4
|
24
|
+
module CompanyService
|
25
|
+
# Path helper methods for the CompanyService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Company resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/tenants/{tenant}/companies/{company}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param tenant [String]
|
36
|
+
# @param company [String]
|
37
|
+
#
|
38
|
+
# @return [::String]
|
39
|
+
def company_path project:, tenant:, company:
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "tenant cannot contain /" if tenant.to_s.include? "/"
|
42
|
+
|
43
|
+
"projects/#{project}/tenants/#{tenant}/companies/#{company}"
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Create a fully-qualified Tenant resource string.
|
48
|
+
#
|
49
|
+
# The resource will be in the following format:
|
50
|
+
#
|
51
|
+
# `projects/{project}/tenants/{tenant}`
|
52
|
+
#
|
53
|
+
# @param project [String]
|
54
|
+
# @param tenant [String]
|
55
|
+
#
|
56
|
+
# @return [::String]
|
57
|
+
def tenant_path project:, tenant:
|
58
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
59
|
+
|
60
|
+
"projects/#{project}/tenants/#{tenant}"
|
61
|
+
end
|
62
|
+
|
63
|
+
extend self
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/talent/v4/company_service.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/cloud/talent/v4/common_pb'
|
11
|
+
require 'google/cloud/talent/v4/company_pb'
|
12
|
+
require 'google/protobuf/empty_pb'
|
13
|
+
require 'google/protobuf/field_mask_pb'
|
14
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
15
|
+
add_file("google/cloud/talent/v4/company_service.proto", :syntax => :proto3) do
|
16
|
+
add_message "google.cloud.talent.v4.CreateCompanyRequest" do
|
17
|
+
optional :parent, :string, 1
|
18
|
+
optional :company, :message, 2, "google.cloud.talent.v4.Company"
|
19
|
+
end
|
20
|
+
add_message "google.cloud.talent.v4.GetCompanyRequest" do
|
21
|
+
optional :name, :string, 1
|
22
|
+
end
|
23
|
+
add_message "google.cloud.talent.v4.UpdateCompanyRequest" do
|
24
|
+
optional :company, :message, 1, "google.cloud.talent.v4.Company"
|
25
|
+
optional :update_mask, :message, 2, "google.protobuf.FieldMask"
|
26
|
+
end
|
27
|
+
add_message "google.cloud.talent.v4.DeleteCompanyRequest" do
|
28
|
+
optional :name, :string, 1
|
29
|
+
end
|
30
|
+
add_message "google.cloud.talent.v4.ListCompaniesRequest" do
|
31
|
+
optional :parent, :string, 1
|
32
|
+
optional :page_token, :string, 2
|
33
|
+
optional :page_size, :int32, 3
|
34
|
+
optional :require_open_jobs, :bool, 4
|
35
|
+
end
|
36
|
+
add_message "google.cloud.talent.v4.ListCompaniesResponse" do
|
37
|
+
repeated :companies, :message, 1, "google.cloud.talent.v4.Company"
|
38
|
+
optional :next_page_token, :string, 2
|
39
|
+
optional :metadata, :message, 3, "google.cloud.talent.v4.ResponseMetadata"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module Google
|
45
|
+
module Cloud
|
46
|
+
module Talent
|
47
|
+
module V4
|
48
|
+
CreateCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4.CreateCompanyRequest").msgclass
|
49
|
+
GetCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4.GetCompanyRequest").msgclass
|
50
|
+
UpdateCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4.UpdateCompanyRequest").msgclass
|
51
|
+
DeleteCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4.DeleteCompanyRequest").msgclass
|
52
|
+
ListCompaniesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4.ListCompaniesRequest").msgclass
|
53
|
+
ListCompaniesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4.ListCompaniesResponse").msgclass
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/talent/v4/company_service.proto for package 'google.cloud.talent.v4'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2020 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/talent/v4/company_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Talent
|
25
|
+
module V4
|
26
|
+
module CompanyService
|
27
|
+
# A service that handles company management, including CRUD and enumeration.
|
28
|
+
class Service
|
29
|
+
|
30
|
+
include GRPC::GenericService
|
31
|
+
|
32
|
+
self.marshal_class_method = :encode
|
33
|
+
self.unmarshal_class_method = :decode
|
34
|
+
self.service_name = 'google.cloud.talent.v4.CompanyService'
|
35
|
+
|
36
|
+
# Creates a new company entity.
|
37
|
+
rpc :CreateCompany, ::Google::Cloud::Talent::V4::CreateCompanyRequest, ::Google::Cloud::Talent::V4::Company
|
38
|
+
# Retrieves specified company.
|
39
|
+
rpc :GetCompany, ::Google::Cloud::Talent::V4::GetCompanyRequest, ::Google::Cloud::Talent::V4::Company
|
40
|
+
# Updates specified company.
|
41
|
+
rpc :UpdateCompany, ::Google::Cloud::Talent::V4::UpdateCompanyRequest, ::Google::Cloud::Talent::V4::Company
|
42
|
+
# Deletes specified company.
|
43
|
+
# Prerequisite: The company has no jobs associated with it.
|
44
|
+
rpc :DeleteCompany, ::Google::Cloud::Talent::V4::DeleteCompanyRequest, ::Google::Protobuf::Empty
|
45
|
+
# Lists all companies associated with the project.
|
46
|
+
rpc :ListCompanies, ::Google::Cloud::Talent::V4::ListCompaniesRequest, ::Google::Cloud::Talent::V4::ListCompaniesResponse
|
47
|
+
end
|
48
|
+
|
49
|
+
Stub = Service.rpc_stub_class
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/talent/v4/version"
|
24
|
+
|
25
|
+
require "google/cloud/talent/v4/completion/credentials"
|
26
|
+
require "google/cloud/talent/v4/completion/paths"
|
27
|
+
require "google/cloud/talent/v4/completion/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Talent
|
32
|
+
module V4
|
33
|
+
##
|
34
|
+
# A service handles auto completion.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/talent/v4/completion"
|
39
|
+
# client = ::Google::Cloud::Talent::V4::Completion::Client.new
|
40
|
+
#
|
41
|
+
module Completion
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "completion", "helpers.rb"
|
49
|
+
require "google/cloud/talent/v4/completion/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,408 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/talent/v4/completion_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Talent
|
25
|
+
module V4
|
26
|
+
module Completion
|
27
|
+
##
|
28
|
+
# Client for the Completion service.
|
29
|
+
#
|
30
|
+
# A service handles auto completion.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :completion_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the Completion Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Talent::V4::Completion::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# ## Example
|
45
|
+
#
|
46
|
+
# To modify the configuration for all Completion clients:
|
47
|
+
#
|
48
|
+
# ::Google::Cloud::Talent::V4::Completion::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Cloud", "Talent", "V4"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config.rpcs.complete_query.timeout = 30.0
|
69
|
+
default_config.rpcs.complete_query.retry_policy = {
|
70
|
+
initial_delay: 0.1,
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: [4, 14]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config
|
77
|
+
end
|
78
|
+
yield @configure if block_given?
|
79
|
+
@configure
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Configure the Completion Client instance.
|
84
|
+
#
|
85
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
86
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
87
|
+
# should be made on {Client.configure}.
|
88
|
+
#
|
89
|
+
# See {::Google::Cloud::Talent::V4::Completion::Client::Configuration}
|
90
|
+
# for a description of the configuration fields.
|
91
|
+
#
|
92
|
+
# @yield [config] Configure the Client client.
|
93
|
+
# @yieldparam config [Client::Configuration]
|
94
|
+
#
|
95
|
+
# @return [Client::Configuration]
|
96
|
+
#
|
97
|
+
def configure
|
98
|
+
yield @config if block_given?
|
99
|
+
@config
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Create a new Completion client object.
|
104
|
+
#
|
105
|
+
# ## Examples
|
106
|
+
#
|
107
|
+
# To create a new Completion client with the default
|
108
|
+
# configuration:
|
109
|
+
#
|
110
|
+
# client = ::Google::Cloud::Talent::V4::Completion::Client.new
|
111
|
+
#
|
112
|
+
# To create a new Completion client with a custom
|
113
|
+
# configuration:
|
114
|
+
#
|
115
|
+
# client = ::Google::Cloud::Talent::V4::Completion::Client.new do |config|
|
116
|
+
# config.timeout = 10.0
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# @yield [config] Configure the Completion client.
|
120
|
+
# @yieldparam config [Client::Configuration]
|
121
|
+
#
|
122
|
+
def initialize
|
123
|
+
# These require statements are intentionally placed here to initialize
|
124
|
+
# the gRPC module only when it's required.
|
125
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
126
|
+
require "gapic/grpc"
|
127
|
+
require "google/cloud/talent/v4/completion_service_services_pb"
|
128
|
+
|
129
|
+
# Create the configuration object
|
130
|
+
@config = Configuration.new Client.configure
|
131
|
+
|
132
|
+
# Yield the configuration if needed
|
133
|
+
yield @config if block_given?
|
134
|
+
|
135
|
+
# Create credentials
|
136
|
+
credentials = @config.credentials
|
137
|
+
credentials ||= Credentials.default scope: @config.scope
|
138
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
139
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
140
|
+
end
|
141
|
+
@quota_project_id = @config.quota_project
|
142
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
143
|
+
|
144
|
+
@completion_stub = ::Gapic::ServiceStub.new(
|
145
|
+
::Google::Cloud::Talent::V4::Completion::Stub,
|
146
|
+
credentials: credentials,
|
147
|
+
endpoint: @config.endpoint,
|
148
|
+
channel_args: @config.channel_args,
|
149
|
+
interceptors: @config.interceptors
|
150
|
+
)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Service calls
|
154
|
+
|
155
|
+
##
|
156
|
+
# Completes the specified prefix with keyword suggestions.
|
157
|
+
# Intended for use by a job search auto-complete search box.
|
158
|
+
#
|
159
|
+
# @overload complete_query(request, options = nil)
|
160
|
+
# Pass arguments to `complete_query` via a request object, either of type
|
161
|
+
# {::Google::Cloud::Talent::V4::CompleteQueryRequest} or an equivalent Hash.
|
162
|
+
#
|
163
|
+
# @param request [::Google::Cloud::Talent::V4::CompleteQueryRequest, ::Hash]
|
164
|
+
# A request object representing the call parameters. Required. To specify no
|
165
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
166
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
167
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
168
|
+
#
|
169
|
+
# @overload complete_query(tenant: nil, query: nil, language_codes: nil, page_size: nil, company: nil, scope: nil, type: nil)
|
170
|
+
# Pass arguments to `complete_query` via keyword arguments. Note that at
|
171
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
172
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
173
|
+
#
|
174
|
+
# @param tenant [::String]
|
175
|
+
# Required. Resource name of tenant the completion is performed within.
|
176
|
+
#
|
177
|
+
# The format is "projects/\\{project_id}/tenants/\\{tenant_id}", for example,
|
178
|
+
# "projects/foo/tenants/bar".
|
179
|
+
# @param query [::String]
|
180
|
+
# Required. The query used to generate suggestions.
|
181
|
+
#
|
182
|
+
# The maximum number of allowed characters is 255.
|
183
|
+
# @param language_codes [::Array<::String>]
|
184
|
+
# The list of languages of the query. This is
|
185
|
+
# the BCP-47 language code, such as "en-US" or "sr-Latn".
|
186
|
+
# For more information, see
|
187
|
+
# [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
|
188
|
+
#
|
189
|
+
# The maximum number of allowed characters is 255.
|
190
|
+
# @param page_size [::Integer]
|
191
|
+
# Required. Completion result count.
|
192
|
+
#
|
193
|
+
# The maximum allowed page size is 10.
|
194
|
+
# @param company [::String]
|
195
|
+
# If provided, restricts completion to specified company.
|
196
|
+
#
|
197
|
+
# The format is
|
198
|
+
# "projects/\\{project_id}/tenants/\\{tenant_id}/companies/\\{company_id}", for
|
199
|
+
# example, "projects/foo/tenants/bar/companies/baz".
|
200
|
+
# @param scope [::Google::Cloud::Talent::V4::CompleteQueryRequest::CompletionScope]
|
201
|
+
# The scope of the completion. The defaults is
|
202
|
+
# {::Google::Cloud::Talent::V4::CompleteQueryRequest::CompletionScope::PUBLIC CompletionScope.PUBLIC}.
|
203
|
+
# @param type [::Google::Cloud::Talent::V4::CompleteQueryRequest::CompletionType]
|
204
|
+
# The completion topic. The default is
|
205
|
+
# {::Google::Cloud::Talent::V4::CompleteQueryRequest::CompletionType::COMBINED CompletionType.COMBINED}.
|
206
|
+
#
|
207
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
208
|
+
# @yieldparam response [::Google::Cloud::Talent::V4::CompleteQueryResponse]
|
209
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
210
|
+
#
|
211
|
+
# @return [::Google::Cloud::Talent::V4::CompleteQueryResponse]
|
212
|
+
#
|
213
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
214
|
+
#
|
215
|
+
def complete_query request, options = nil
|
216
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
217
|
+
|
218
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Talent::V4::CompleteQueryRequest
|
219
|
+
|
220
|
+
# Converts hash and nil to an options object
|
221
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
222
|
+
|
223
|
+
# Customize the options with defaults
|
224
|
+
metadata = @config.rpcs.complete_query.metadata.to_h
|
225
|
+
|
226
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
227
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
228
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
229
|
+
gapic_version: ::Google::Cloud::Talent::V4::VERSION
|
230
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
231
|
+
|
232
|
+
header_params = {
|
233
|
+
"tenant" => request.tenant
|
234
|
+
}
|
235
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
236
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
237
|
+
|
238
|
+
options.apply_defaults timeout: @config.rpcs.complete_query.timeout,
|
239
|
+
metadata: metadata,
|
240
|
+
retry_policy: @config.rpcs.complete_query.retry_policy
|
241
|
+
options.apply_defaults metadata: @config.metadata,
|
242
|
+
retry_policy: @config.retry_policy
|
243
|
+
|
244
|
+
@completion_stub.call_rpc :complete_query, request, options: options do |response, operation|
|
245
|
+
yield response, operation if block_given?
|
246
|
+
return response
|
247
|
+
end
|
248
|
+
rescue ::GRPC::BadStatus => e
|
249
|
+
raise ::Google::Cloud::Error.from_error(e)
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Configuration class for the Completion API.
|
254
|
+
#
|
255
|
+
# This class represents the configuration for Completion,
|
256
|
+
# providing control over timeouts, retry behavior, logging, transport
|
257
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
258
|
+
# applied individually to specific RPCs. See
|
259
|
+
# {::Google::Cloud::Talent::V4::Completion::Client::Configuration::Rpcs}
|
260
|
+
# for a list of RPCs that can be configured independently.
|
261
|
+
#
|
262
|
+
# Configuration can be applied globally to all clients, or to a single client
|
263
|
+
# on construction.
|
264
|
+
#
|
265
|
+
# # Examples
|
266
|
+
#
|
267
|
+
# To modify the global config, setting the timeout for complete_query
|
268
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
269
|
+
#
|
270
|
+
# ::Google::Cloud::Talent::V4::Completion::Client.configure do |config|
|
271
|
+
# config.timeout = 10.0
|
272
|
+
# config.rpcs.complete_query.timeout = 20.0
|
273
|
+
# end
|
274
|
+
#
|
275
|
+
# To apply the above configuration only to a new client:
|
276
|
+
#
|
277
|
+
# client = ::Google::Cloud::Talent::V4::Completion::Client.new do |config|
|
278
|
+
# config.timeout = 10.0
|
279
|
+
# config.rpcs.complete_query.timeout = 20.0
|
280
|
+
# end
|
281
|
+
#
|
282
|
+
# @!attribute [rw] endpoint
|
283
|
+
# The hostname or hostname:port of the service endpoint.
|
284
|
+
# Defaults to `"jobs.googleapis.com"`.
|
285
|
+
# @return [::String]
|
286
|
+
# @!attribute [rw] credentials
|
287
|
+
# Credentials to send with calls. You may provide any of the following types:
|
288
|
+
# * (`String`) The path to a service account key file in JSON format
|
289
|
+
# * (`Hash`) A service account key as a Hash
|
290
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
291
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
292
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
293
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
294
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
295
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
296
|
+
# * (`nil`) indicating no credentials
|
297
|
+
# @return [::Object]
|
298
|
+
# @!attribute [rw] scope
|
299
|
+
# The OAuth scopes
|
300
|
+
# @return [::Array<::String>]
|
301
|
+
# @!attribute [rw] lib_name
|
302
|
+
# The library name as recorded in instrumentation and logging
|
303
|
+
# @return [::String]
|
304
|
+
# @!attribute [rw] lib_version
|
305
|
+
# The library version as recorded in instrumentation and logging
|
306
|
+
# @return [::String]
|
307
|
+
# @!attribute [rw] channel_args
|
308
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
309
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
310
|
+
# @return [::Hash]
|
311
|
+
# @!attribute [rw] interceptors
|
312
|
+
# An array of interceptors that are run before calls are executed.
|
313
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
314
|
+
# @!attribute [rw] timeout
|
315
|
+
# The call timeout in seconds.
|
316
|
+
# @return [::Numeric]
|
317
|
+
# @!attribute [rw] metadata
|
318
|
+
# Additional gRPC headers to be sent with the call.
|
319
|
+
# @return [::Hash{::Symbol=>::String}]
|
320
|
+
# @!attribute [rw] retry_policy
|
321
|
+
# The retry policy. The value is a hash with the following keys:
|
322
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
323
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
324
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
325
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
326
|
+
# trigger a retry.
|
327
|
+
# @return [::Hash]
|
328
|
+
# @!attribute [rw] quota_project
|
329
|
+
# A separate project against which to charge quota.
|
330
|
+
# @return [::String]
|
331
|
+
#
|
332
|
+
class Configuration
|
333
|
+
extend ::Gapic::Config
|
334
|
+
|
335
|
+
config_attr :endpoint, "jobs.googleapis.com", ::String
|
336
|
+
config_attr :credentials, nil do |value|
|
337
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
338
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
339
|
+
allowed.any? { |klass| klass === value }
|
340
|
+
end
|
341
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
342
|
+
config_attr :lib_name, nil, ::String, nil
|
343
|
+
config_attr :lib_version, nil, ::String, nil
|
344
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
345
|
+
config_attr :interceptors, nil, ::Array, nil
|
346
|
+
config_attr :timeout, nil, ::Numeric, nil
|
347
|
+
config_attr :metadata, nil, ::Hash, nil
|
348
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
349
|
+
config_attr :quota_project, nil, ::String, nil
|
350
|
+
|
351
|
+
# @private
|
352
|
+
def initialize parent_config = nil
|
353
|
+
@parent_config = parent_config unless parent_config.nil?
|
354
|
+
|
355
|
+
yield self if block_given?
|
356
|
+
end
|
357
|
+
|
358
|
+
##
|
359
|
+
# Configurations for individual RPCs
|
360
|
+
# @return [Rpcs]
|
361
|
+
#
|
362
|
+
def rpcs
|
363
|
+
@rpcs ||= begin
|
364
|
+
parent_rpcs = nil
|
365
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
366
|
+
Rpcs.new parent_rpcs
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
##
|
371
|
+
# Configuration RPC class for the Completion API.
|
372
|
+
#
|
373
|
+
# Includes fields providing the configuration for each RPC in this service.
|
374
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
375
|
+
# the following configuration fields:
|
376
|
+
#
|
377
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
378
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
379
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
380
|
+
# include the following keys:
|
381
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
382
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
383
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
384
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
385
|
+
# trigger a retry.
|
386
|
+
#
|
387
|
+
class Rpcs
|
388
|
+
##
|
389
|
+
# RPC-specific configuration for `complete_query`
|
390
|
+
# @return [::Gapic::Config::Method]
|
391
|
+
#
|
392
|
+
attr_reader :complete_query
|
393
|
+
|
394
|
+
# @private
|
395
|
+
def initialize parent_rpcs = nil
|
396
|
+
complete_query_config = parent_rpcs&.complete_query if parent_rpcs&.respond_to? :complete_query
|
397
|
+
@complete_query = ::Gapic::Config::Method.new complete_query_config
|
398
|
+
|
399
|
+
yield self if block_given?
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|