1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.talent.v4beta1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/talent/v4beta1/common.proto"; 24 25option go_package = "cloud.google.com/go/talent/apiv4beta1/talentpb;talentpb"; 26option java_multiple_files = true; 27option java_outer_classname = "CompletionServiceProto"; 28option java_package = "com.google.cloud.talent.v4beta1"; 29option objc_class_prefix = "CTS"; 30 31// A service handles auto completion. 32service Completion { 33 option (google.api.default_host) = "jobs.googleapis.com"; 34 option (google.api.oauth_scopes) = 35 "https://www.googleapis.com/auth/cloud-platform," 36 "https://www.googleapis.com/auth/jobs"; 37 38 // Completes the specified prefix with keyword suggestions. 39 // Intended for use by a job search auto-complete search box. 40 rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { 41 option (google.api.http) = { 42 get: "/v4beta1/{parent=projects/*/tenants/*}:complete" 43 additional_bindings { get: "/v4beta1/{parent=projects/*}:complete" } 44 }; 45 } 46} 47 48// Auto-complete parameters. 49message CompleteQueryRequest { 50 // Enum to specify the scope of completion. 51 enum CompletionScope { 52 // Default value. 53 COMPLETION_SCOPE_UNSPECIFIED = 0; 54 55 // Suggestions are based only on the data provided by the client. 56 TENANT = 1; 57 58 // Suggestions are based on all jobs data in the system that's visible to 59 // the client 60 PUBLIC = 2; 61 } 62 63 // Enum to specify auto-completion topics. 64 enum CompletionType { 65 // Default value. 66 COMPLETION_TYPE_UNSPECIFIED = 0; 67 68 // Suggest job titles for jobs autocomplete. 69 // 70 // For 71 // [CompletionType.JOB_TITLE][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.JOB_TITLE] 72 // type, only open jobs with the same 73 // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] 74 // are returned. 75 JOB_TITLE = 1; 76 77 // Suggest company names for jobs autocomplete. 78 // 79 // For 80 // [CompletionType.COMPANY_NAME][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMPANY_NAME] 81 // type, only companies having open jobs with the same 82 // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] 83 // are returned. 84 COMPANY_NAME = 2; 85 86 // Suggest both job titles and company names for jobs autocomplete. 87 // 88 // For 89 // [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED] 90 // type, only open jobs with the same 91 // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] 92 // or companies having open jobs with the same 93 // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] 94 // are returned. 95 COMBINED = 3; 96 } 97 98 // Required. Resource name of tenant the completion is performed within. 99 // 100 // The format is "projects/{project_id}/tenants/{tenant_id}", for example, 101 // "projects/foo/tenant/bar". 102 // 103 // If tenant id is unspecified, the default tenant is used, for 104 // example, "projects/foo". 105 string parent = 1 [ 106 (google.api.field_behavior) = REQUIRED, 107 (google.api.resource_reference) = { 108 child_type: "jobs.googleapis.com/Company" 109 } 110 ]; 111 112 // Required. The query used to generate suggestions. 113 // 114 // The maximum number of allowed characters is 255. 115 string query = 2 [(google.api.field_behavior) = REQUIRED]; 116 117 // The list of languages of the query. This is 118 // the BCP-47 language code, such as "en-US" or "sr-Latn". 119 // For more information, see 120 // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). 121 // 122 // The maximum number of allowed characters is 255. 123 repeated string language_codes = 3; 124 125 // Required. Completion result count. 126 // 127 // The maximum allowed page size is 10. 128 int32 page_size = 4 [(google.api.field_behavior) = REQUIRED]; 129 130 // If provided, restricts completion to specified company. 131 // 132 // The format is 133 // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for 134 // example, "projects/foo/tenants/bar/companies/baz". 135 // 136 // If tenant id is unspecified, the default tenant is used, for 137 // example, "projects/foo". 138 string company = 5 [ 139 (google.api.resource_reference) = { type: "jobs.googleapis.com/Company" } 140 ]; 141 142 // The scope of the completion. The defaults is 143 // [CompletionScope.PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC]. 144 CompletionScope scope = 6; 145 146 // The completion topic. The default is 147 // [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED]. 148 CompletionType type = 7; 149} 150 151// Response of auto-complete query. 152message CompleteQueryResponse { 153 // Resource that represents completion results. 154 message CompletionResult { 155 // The suggestion for the query. 156 string suggestion = 1; 157 158 // The completion topic. 159 CompleteQueryRequest.CompletionType type = 2; 160 161 // The URI of the company image for 162 // [COMPANY_NAME][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMPANY_NAME]. 163 string image_uri = 3; 164 } 165 166 // Results of the matching job/company candidates. 167 repeated CompletionResult completion_results = 1; 168 169 // Additional information for the API invocation, such as the request 170 // tracking id. 171 ResponseMetadata metadata = 2; 172} 173