google-cloud-talent-v4beta1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +71 -0
  6. data/lib/google-cloud-talent-v4beta1.rb +21 -0
  7. data/lib/google/cloud/common_resources_pb.rb +15 -0
  8. data/lib/google/cloud/talent/v4beta1.rb +41 -0
  9. data/lib/google/cloud/talent/v4beta1/application_pb.rb +64 -0
  10. data/lib/google/cloud/talent/v4beta1/application_service.rb +50 -0
  11. data/lib/google/cloud/talent/v4beta1/application_service/client.rb +717 -0
  12. data/lib/google/cloud/talent/v4beta1/application_service/credentials.rb +52 -0
  13. data/lib/google/cloud/talent/v4beta1/application_service/paths.rb +155 -0
  14. data/lib/google/cloud/talent/v4beta1/application_service_pb.rb +56 -0
  15. data/lib/google/cloud/talent/v4beta1/application_service_services_pb.rb +54 -0
  16. data/lib/google/cloud/talent/v4beta1/batch_pb.rb +19 -0
  17. data/lib/google/cloud/talent/v4beta1/common_pb.rb +342 -0
  18. data/lib/google/cloud/talent/v4beta1/company_pb.rb +42 -0
  19. data/lib/google/cloud/talent/v4beta1/company_service.rb +49 -0
  20. data/lib/google/cloud/talent/v4beta1/company_service/client.rb +732 -0
  21. data/lib/google/cloud/talent/v4beta1/company_service/credentials.rb +52 -0
  22. data/lib/google/cloud/talent/v4beta1/company_service/paths.rb +105 -0
  23. data/lib/google/cloud/talent/v4beta1/company_service_pb.rb +57 -0
  24. data/lib/google/cloud/talent/v4beta1/company_service_services_pb.rb +54 -0
  25. data/lib/google/cloud/talent/v4beta1/completion.rb +49 -0
  26. data/lib/google/cloud/talent/v4beta1/completion/client.rb +407 -0
  27. data/lib/google/cloud/talent/v4beta1/completion/credentials.rb +52 -0
  28. data/lib/google/cloud/talent/v4beta1/completion/paths.rb +105 -0
  29. data/lib/google/cloud/talent/v4beta1/completion_service_pb.rb +57 -0
  30. data/lib/google/cloud/talent/v4beta1/completion_service_services_pb.rb +46 -0
  31. data/lib/google/cloud/talent/v4beta1/event_pb.rb +70 -0
  32. data/lib/google/cloud/talent/v4beta1/event_service.rb +49 -0
  33. data/lib/google/cloud/talent/v4beta1/event_service/client.rb +379 -0
  34. data/lib/google/cloud/talent/v4beta1/event_service/credentials.rb +52 -0
  35. data/lib/google/cloud/talent/v4beta1/event_service/paths.rb +64 -0
  36. data/lib/google/cloud/talent/v4beta1/event_service_pb.rb +28 -0
  37. data/lib/google/cloud/talent/v4beta1/event_service_services_pb.rb +51 -0
  38. data/lib/google/cloud/talent/v4beta1/filters_pb.rb +188 -0
  39. data/lib/google/cloud/talent/v4beta1/histogram_pb.rb +28 -0
  40. data/lib/google/cloud/talent/v4beta1/job_pb.rb +73 -0
  41. data/lib/google/cloud/talent/v4beta1/job_service.rb +50 -0
  42. data/lib/google/cloud/talent/v4beta1/job_service/client.rb +1660 -0
  43. data/lib/google/cloud/talent/v4beta1/job_service/credentials.rb +52 -0
  44. data/lib/google/cloud/talent/v4beta1/job_service/operations.rb +564 -0
  45. data/lib/google/cloud/talent/v4beta1/job_service/paths.rb +146 -0
  46. data/lib/google/cloud/talent/v4beta1/job_service_pb.rb +167 -0
  47. data/lib/google/cloud/talent/v4beta1/job_service_services_pb.rb +86 -0
  48. data/lib/google/cloud/talent/v4beta1/profile_pb.rb +214 -0
  49. data/lib/google/cloud/talent/v4beta1/profile_service.rb +50 -0
  50. data/lib/google/cloud/talent/v4beta1/profile_service/client.rb +992 -0
  51. data/lib/google/cloud/talent/v4beta1/profile_service/credentials.rb +52 -0
  52. data/lib/google/cloud/talent/v4beta1/profile_service/paths.rb +69 -0
  53. data/lib/google/cloud/talent/v4beta1/profile_service_pb.rb +92 -0
  54. data/lib/google/cloud/talent/v4beta1/profile_service_services_pb.rb +63 -0
  55. data/lib/google/cloud/talent/v4beta1/tenant_pb.rb +35 -0
  56. data/lib/google/cloud/talent/v4beta1/tenant_service.rb +49 -0
  57. data/lib/google/cloud/talent/v4beta1/tenant_service/client.rb +712 -0
  58. data/lib/google/cloud/talent/v4beta1/tenant_service/credentials.rb +52 -0
  59. data/lib/google/cloud/talent/v4beta1/tenant_service/paths.rb +64 -0
  60. data/lib/google/cloud/talent/v4beta1/tenant_service_pb.rb +56 -0
  61. data/lib/google/cloud/talent/v4beta1/tenant_service_services_pb.rb +53 -0
  62. data/lib/google/cloud/talent/v4beta1/version.rb +28 -0
  63. data/proto_docs/README.md +4 -0
  64. data/proto_docs/google/api/field_behavior.rb +59 -0
  65. data/proto_docs/google/api/resource.rb +247 -0
  66. data/proto_docs/google/cloud/talent/v4beta1/application.rb +169 -0
  67. data/proto_docs/google/cloud/talent/v4beta1/application_service.rb +122 -0
  68. data/proto_docs/google/cloud/talent/v4beta1/common.rb +1106 -0
  69. data/proto_docs/google/cloud/talent/v4beta1/company.rb +117 -0
  70. data/proto_docs/google/cloud/talent/v4beta1/company_service.rb +138 -0
  71. data/proto_docs/google/cloud/talent/v4beta1/completion_service.rb +143 -0
  72. data/proto_docs/google/cloud/talent/v4beta1/event.rb +237 -0
  73. data/proto_docs/google/cloud/talent/v4beta1/event_service.rb +43 -0
  74. data/proto_docs/google/cloud/talent/v4beta1/filters.rb +818 -0
  75. data/proto_docs/google/cloud/talent/v4beta1/histogram.rb +69 -0
  76. data/proto_docs/google/cloud/talent/v4beta1/job.rb +356 -0
  77. data/proto_docs/google/cloud/talent/v4beta1/job_service.rb +746 -0
  78. data/proto_docs/google/cloud/talent/v4beta1/profile.rb +811 -0
  79. data/proto_docs/google/cloud/talent/v4beta1/profile_service.rb +392 -0
  80. data/proto_docs/google/cloud/talent/v4beta1/tenant.rb +77 -0
  81. data/proto_docs/google/cloud/talent/v4beta1/tenant_service.rb +118 -0
  82. data/proto_docs/google/longrunning/operations.rb +150 -0
  83. data/proto_docs/google/protobuf/any.rb +138 -0
  84. data/proto_docs/google/protobuf/duration.rb +98 -0
  85. data/proto_docs/google/protobuf/empty.rb +36 -0
  86. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  87. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  88. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  89. data/proto_docs/google/rpc/status.rb +46 -0
  90. data/proto_docs/google/type/date.rb +50 -0
  91. data/proto_docs/google/type/latlng.rb +38 -0
  92. data/proto_docs/google/type/money.rb +43 -0
  93. data/proto_docs/google/type/postal_address.rb +135 -0
  94. data/proto_docs/google/type/timeofday.rb +44 -0
  95. metadata +251 -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 V4beta1
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,105 @@
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 V4beta1
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
+ # @overload company_path(project:, tenant:, company:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/tenants/{tenant}/companies/{company}`
34
+ #
35
+ # @param project [String]
36
+ # @param tenant [String]
37
+ # @param company [String]
38
+ #
39
+ # @overload company_path(project:, company:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `projects/{project}/companies/{company}`
43
+ #
44
+ # @param project [String]
45
+ # @param company [String]
46
+ #
47
+ # @return [String]
48
+ def company_path **args
49
+ resources = {
50
+ "company:project:tenant" => (proc do |project:, tenant:, company:|
51
+ raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
52
+ raise ArgumentError, "tenant cannot contain /" if tenant.to_s.include? "/"
53
+
54
+ "projects/#{project}/tenants/#{tenant}/companies/#{company}"
55
+ end),
56
+ "company:project" => (proc do |project:, company:|
57
+ raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
58
+
59
+ "projects/#{project}/companies/#{company}"
60
+ end)
61
+ }
62
+
63
+ resource = resources[args.keys.sort.join(":")]
64
+ raise ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
65
+ resource.call(**args)
66
+ end
67
+
68
+ ##
69
+ # Create a fully-qualified Project resource string.
70
+ #
71
+ # The resource will be in the following format:
72
+ #
73
+ # `projects/{project}`
74
+ #
75
+ # @param project [String]
76
+ #
77
+ # @return [String]
78
+ def project_path project:
79
+ "projects/#{project}"
80
+ end
81
+
82
+ ##
83
+ # Create a fully-qualified Tenant resource string.
84
+ #
85
+ # The resource will be in the following format:
86
+ #
87
+ # `projects/{project}/tenants/{tenant}`
88
+ #
89
+ # @param project [String]
90
+ # @param tenant [String]
91
+ #
92
+ # @return [String]
93
+ def tenant_path project:, tenant:
94
+ raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
95
+
96
+ "projects/#{project}/tenants/#{tenant}"
97
+ end
98
+
99
+ extend self
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,57 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/talent/v4beta1/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/v4beta1/common_pb'
11
+ require 'google/cloud/talent/v4beta1/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/v4beta1/company_service.proto", :syntax => :proto3) do
16
+ add_message "google.cloud.talent.v4beta1.CreateCompanyRequest" do
17
+ optional :parent, :string, 1
18
+ optional :company, :message, 2, "google.cloud.talent.v4beta1.Company"
19
+ end
20
+ add_message "google.cloud.talent.v4beta1.GetCompanyRequest" do
21
+ optional :name, :string, 1
22
+ end
23
+ add_message "google.cloud.talent.v4beta1.UpdateCompanyRequest" do
24
+ optional :company, :message, 1, "google.cloud.talent.v4beta1.Company"
25
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
26
+ end
27
+ add_message "google.cloud.talent.v4beta1.DeleteCompanyRequest" do
28
+ optional :name, :string, 1
29
+ end
30
+ add_message "google.cloud.talent.v4beta1.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.v4beta1.ListCompaniesResponse" do
37
+ repeated :companies, :message, 1, "google.cloud.talent.v4beta1.Company"
38
+ optional :next_page_token, :string, 2
39
+ optional :metadata, :message, 3, "google.cloud.talent.v4beta1.ResponseMetadata"
40
+ end
41
+ end
42
+ end
43
+
44
+ module Google
45
+ module Cloud
46
+ module Talent
47
+ module V4beta1
48
+ CreateCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.CreateCompanyRequest").msgclass
49
+ GetCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.GetCompanyRequest").msgclass
50
+ UpdateCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.UpdateCompanyRequest").msgclass
51
+ DeleteCompanyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.DeleteCompanyRequest").msgclass
52
+ ListCompaniesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.ListCompaniesRequest").msgclass
53
+ ListCompaniesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.talent.v4beta1.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/v4beta1/company_service.proto for package 'google.cloud.talent.v4beta1'
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/v4beta1/company_service_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Talent
25
+ module V4beta1
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.v4beta1.CompanyService'
35
+
36
+ # Creates a new company entity.
37
+ rpc :CreateCompany, CreateCompanyRequest, Company
38
+ # Retrieves specified company.
39
+ rpc :GetCompany, GetCompanyRequest, Company
40
+ # Updates specified company.
41
+ rpc :UpdateCompany, UpdateCompanyRequest, Company
42
+ # Deletes specified company.
43
+ # Prerequisite: The company has no jobs associated with it.
44
+ rpc :DeleteCompany, DeleteCompanyRequest, Google::Protobuf::Empty
45
+ # Lists all companies associated with the project.
46
+ rpc :ListCompanies, ListCompaniesRequest, 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/v4beta1/version"
24
+
25
+ require "google/cloud/talent/v4beta1/completion/credentials"
26
+ require "google/cloud/talent/v4beta1/completion/paths"
27
+ require "google/cloud/talent/v4beta1/completion/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Talent
32
+ module V4beta1
33
+ ##
34
+ # A service handles auto completion.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/talent/v4beta1/completion"
39
+ # client = Google::Cloud::Talent::V4beta1::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/v4beta1/completion/helpers" if ::File.file? helper_path
@@ -0,0 +1,407 @@
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/v4beta1/completion_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Talent
25
+ module V4beta1
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::V4beta1::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::V4beta1::Completion::Client.configure do |config|
49
+ # config.timeout = 10_000
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", "V4beta1"]
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: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
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::V4beta1::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::V4beta1::Completion::Client.new
111
+ #
112
+ # To create a new Completion client with a custom
113
+ # configuration:
114
+ #
115
+ # client = Google::Cloud::Talent::V4beta1::Completion::Client.new do |config|
116
+ # config.timeout = 10_000
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/v4beta1/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 = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
142
+
143
+ @completion_stub = Gapic::ServiceStub.new(
144
+ Google::Cloud::Talent::V4beta1::Completion::Stub,
145
+ credentials: credentials,
146
+ endpoint: @config.endpoint,
147
+ channel_args: @config.channel_args,
148
+ interceptors: @config.interceptors
149
+ )
150
+ end
151
+
152
+ # Service calls
153
+
154
+ ##
155
+ # Completes the specified prefix with keyword suggestions.
156
+ # Intended for use by a job search auto-complete search box.
157
+ #
158
+ # @overload complete_query(request, options = nil)
159
+ # Pass arguments to `complete_query` via a request object, either of type
160
+ # {Google::Cloud::Talent::V4beta1::CompleteQueryRequest} or an equivalent Hash.
161
+ #
162
+ # @param request [Google::Cloud::Talent::V4beta1::CompleteQueryRequest, Hash]
163
+ # A request object representing the call parameters. Required. To specify no
164
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
165
+ # @param options [Gapic::CallOptions, Hash]
166
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
167
+ #
168
+ # @overload complete_query(parent: nil, query: nil, language_codes: nil, page_size: nil, company: nil, scope: nil, type: nil)
169
+ # Pass arguments to `complete_query` via keyword arguments. Note that at
170
+ # least one keyword argument is required. To specify no parameters, or to keep all
171
+ # the default parameter values, pass an empty Hash as a request object (see above).
172
+ #
173
+ # @param parent [String]
174
+ # Required. Resource name of tenant the completion is performed within.
175
+ #
176
+ # The format is "projects/\\{project_id}/tenants/\\{tenant_id}", for example,
177
+ # "projects/foo/tenant/bar".
178
+ #
179
+ # If tenant id is unspecified, the default tenant is used, for
180
+ # example, "projects/foo".
181
+ # @param query [String]
182
+ # Required. The query used to generate suggestions.
183
+ #
184
+ # The maximum number of allowed characters is 255.
185
+ # @param language_codes [Array<String>]
186
+ # The list of languages of the query. This is
187
+ # the BCP-47 language code, such as "en-US" or "sr-Latn".
188
+ # For more information, see
189
+ # [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
190
+ #
191
+ # The maximum number of allowed characters is 255.
192
+ # @param page_size [Integer]
193
+ # Required. Completion result count.
194
+ #
195
+ # The maximum allowed page size is 10.
196
+ # @param company [String]
197
+ # If provided, restricts completion to specified company.
198
+ #
199
+ # The format is
200
+ # "projects/\\{project_id}/tenants/\\{tenant_id}/companies/\\{company_id}", for
201
+ # example, "projects/foo/tenants/bar/companies/baz".
202
+ #
203
+ # If tenant id is unspecified, the default tenant is used, for
204
+ # example, "projects/foo".
205
+ # @param scope [Google::Cloud::Talent::V4beta1::CompleteQueryRequest::CompletionScope]
206
+ # The scope of the completion. The defaults is {Google::Cloud::Talent::V4beta1::CompleteQueryRequest::CompletionScope::PUBLIC CompletionScope.PUBLIC}.
207
+ # @param type [Google::Cloud::Talent::V4beta1::CompleteQueryRequest::CompletionType]
208
+ # The completion topic. The default is {Google::Cloud::Talent::V4beta1::CompleteQueryRequest::CompletionType::COMBINED CompletionType.COMBINED}.
209
+ #
210
+ # @yield [response, operation] Access the result along with the RPC operation
211
+ # @yieldparam response [Google::Cloud::Talent::V4beta1::CompleteQueryResponse]
212
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
213
+ #
214
+ # @return [Google::Cloud::Talent::V4beta1::CompleteQueryResponse]
215
+ #
216
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
217
+ #
218
+ def complete_query request, options = nil
219
+ raise ArgumentError, "request must be provided" if request.nil?
220
+
221
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::Talent::V4beta1::CompleteQueryRequest
222
+
223
+ # Converts hash and nil to an options object
224
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
225
+
226
+ # Customize the options with defaults
227
+ metadata = @config.rpcs.complete_query.metadata.to_h
228
+
229
+ # Set x-goog-api-client and x-goog-user-project headers
230
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
231
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
232
+ gapic_version: ::Google::Cloud::Talent::V4beta1::VERSION
233
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
+
235
+ header_params = {
236
+ "parent" => request.parent
237
+ }
238
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
+ metadata[:"x-goog-request-params"] ||= request_params_header
240
+
241
+ options.apply_defaults timeout: @config.rpcs.complete_query.timeout,
242
+ metadata: metadata,
243
+ retry_policy: @config.rpcs.complete_query.retry_policy
244
+ options.apply_defaults metadata: @config.metadata,
245
+ retry_policy: @config.retry_policy
246
+
247
+ @completion_stub.call_rpc :complete_query, request, options: options do |response, operation|
248
+ yield response, operation if block_given?
249
+ return response
250
+ end
251
+ rescue GRPC::BadStatus => e
252
+ raise Google::Cloud::Error.from_error(e)
253
+ end
254
+
255
+ ##
256
+ # Configuration class for the Completion API.
257
+ #
258
+ # This class represents the configuration for Completion,
259
+ # providing control over timeouts, retry behavior, logging, transport
260
+ # parameters, and other low-level controls. Certain parameters can also be
261
+ # applied individually to specific RPCs. See
262
+ # {Google::Cloud::Talent::V4beta1::Completion::Client::Configuration::Rpcs}
263
+ # for a list of RPCs that can be configured independently.
264
+ #
265
+ # Configuration can be applied globally to all clients, or to a single client
266
+ # on construction.
267
+ #
268
+ # # Examples
269
+ #
270
+ # To modify the global config, setting the timeout for complete_query
271
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
272
+ #
273
+ # Google::Cloud::Talent::V4beta1::Completion::Client.configure do |config|
274
+ # config.timeout = 10_000
275
+ # config.rpcs.complete_query.timeout = 20_000
276
+ # end
277
+ #
278
+ # To apply the above configuration only to a new client:
279
+ #
280
+ # client = Google::Cloud::Talent::V4beta1::Completion::Client.new do |config|
281
+ # config.timeout = 10_000
282
+ # config.rpcs.complete_query.timeout = 20_000
283
+ # end
284
+ #
285
+ # @!attribute [rw] endpoint
286
+ # The hostname or hostname:port of the service endpoint.
287
+ # Defaults to `"jobs.googleapis.com"`.
288
+ # @return [String]
289
+ # @!attribute [rw] credentials
290
+ # Credentials to send with calls. You may provide any of the following types:
291
+ # * (`String`) The path to a service account key file in JSON format
292
+ # * (`Hash`) A service account key as a Hash
293
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
294
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
295
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
296
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
297
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
298
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
299
+ # * (`nil`) indicating no credentials
300
+ # @return [Object]
301
+ # @!attribute [rw] scope
302
+ # The OAuth scopes
303
+ # @return [Array<String>]
304
+ # @!attribute [rw] lib_name
305
+ # The library name as recorded in instrumentation and logging
306
+ # @return [String]
307
+ # @!attribute [rw] lib_version
308
+ # The library version as recorded in instrumentation and logging
309
+ # @return [String]
310
+ # @!attribute [rw] channel_args
311
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
312
+ # `GRPC::Core::Channel` object is provided as the credential.
313
+ # @return [Hash]
314
+ # @!attribute [rw] interceptors
315
+ # An array of interceptors that are run before calls are executed.
316
+ # @return [Array<GRPC::ClientInterceptor>]
317
+ # @!attribute [rw] timeout
318
+ # The call timeout in milliseconds.
319
+ # @return [Numeric]
320
+ # @!attribute [rw] metadata
321
+ # Additional gRPC headers to be sent with the call.
322
+ # @return [Hash{Symbol=>String}]
323
+ # @!attribute [rw] retry_policy
324
+ # The retry policy. The value is a hash with the following keys:
325
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
326
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
327
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
328
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
329
+ # trigger a retry.
330
+ # @return [Hash]
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, ::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
+
350
+ # @private
351
+ def initialize parent_config = nil
352
+ @parent_config = parent_config unless parent_config.nil?
353
+
354
+ yield self if block_given?
355
+ end
356
+
357
+ ##
358
+ # Configurations for individual RPCs
359
+ # @return [Rpcs]
360
+ #
361
+ def rpcs
362
+ @rpcs ||= begin
363
+ parent_rpcs = nil
364
+ parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
365
+ Rpcs.new parent_rpcs
366
+ end
367
+ end
368
+
369
+ ##
370
+ # Configuration RPC class for the Completion API.
371
+ #
372
+ # Includes fields providing the configuration for each RPC in this service.
373
+ # Each configuration object is of type `Gapic::Config::Method` and includes
374
+ # the following configuration fields:
375
+ #
376
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
377
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
378
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
379
+ # include the following keys:
380
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
381
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
382
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
383
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
384
+ # trigger a retry.
385
+ #
386
+ class Rpcs
387
+ ##
388
+ # RPC-specific configuration for `complete_query`
389
+ # @return [Gapic::Config::Method]
390
+ #
391
+ attr_reader :complete_query
392
+
393
+ # @private
394
+ def initialize parent_rpcs = nil
395
+ complete_query_config = parent_rpcs&.complete_query if parent_rpcs&.respond_to? :complete_query
396
+ @complete_query = Gapic::Config::Method.new complete_query_config
397
+
398
+ yield self if block_given?
399
+ end
400
+ end
401
+ end
402
+ end
403
+ end
404
+ end
405
+ end
406
+ end
407
+ end