自動填入關鍵字 (v3)

自動完成搜尋關鍵字前置字串。

程式碼範例

Ruby

如要瞭解如何安裝及使用 CTS 的用戶端程式庫,請參閱 CTS 用戶端程式庫

如要向 CTS 進行驗證,請設定應用程式預設憑證。 詳情請參閱「為本機開發環境設定驗證」。

# project_id     = "Project id required"
# company_name   = "The company's name which the job belongs to. The format is "projects/{project_id}/companies/{company_id}""
# query          = "Keyword prefix as auto complete query"

require "google/apis/jobs_v3"

jobs = Google::Apis::JobsV3
talent_solution_client = jobs::CloudTalentSolutionService.new
talent_solution_client.authorization = Google::Auth.get_application_default(
  "https://www.googleapis.com/auth/jobs"
)

page_size = 10
language_code = "en-US"
result = talent_solution_client.complete_project(
  project_id, company_name: company_name, page_size: page_size, query: query,
  language_code: language_code
) do |result, err|
  if err.nil?
    puts "Default auto complete result: #{result.to_json}"
  else
    puts "Error when auto completing. Error message: #{err.to_json}"
  end
end

後續步驟

如要搜尋及篩選其他 Google Cloud 產品的程式碼範例,請參閱Google Cloud 範例瀏覽器