Utiliser la saisie semi-automatique (v3)

Cloud Talent Solution fournit des suggestions de saisie semi-automatique pour les intitulés de postes et les noms de sociétés. Les résultats de suggestion ne prennent en compte que les offres d'emploi actives et les entreprises avec au moins un poste à pourvoir. Après l'ajout d'une nouvelle offre d'emploi ou d'une nouvelle entreprise, l'intégration des informations à l'ensemble des résultats de la saisie semi-automatique peut prendre jusqu'à 48 heures.

Pour utiliser la saisie semi-automatique, appelez la méthode complete lorsque la barre de recherche est mise à jour.

Java

Pour en savoir plus sur l'installation et la création d'un client Cloud Talent Solution, consultez la page Bibliothèques clientes Cloud Talent Solution.


  /**
   * Auto completes job titles within given companyName.
   */
  public static void jobTitleAutoComplete(String companyName, String query)
      throws IOException {

    Complete complete =
        talentSolutionClient
            .projects()
            .complete(DEFAULT_PROJECT_ID)
            .setQuery(query)
            .setLanguageCode("en-US")
            .setType("JOB_TITLE")
            .setPageSize(10);
    if (companyName != null) {
      complete.setCompanyName(companyName);
    }

    CompleteQueryResponse results = complete.execute();

    System.out.println(results);
  }

  /**
   * Auto completes job titles within given companyName.
   */
  public static void defaultAutoComplete(String companyName, String query)
      throws IOException {
    Complete complete =
        talentSolutionClient
            .projects()
            .complete(DEFAULT_PROJECT_ID)
            .setQuery(query)
            .setLanguageCode("en-US")
            .setPageSize(10);
    if (companyName != null) {
      complete.setCompanyName(companyName);
    }

    CompleteQueryResponse results = complete.execute();

    System.out.println(results);
  }

  public static void main(String... args) throws Exception {
    Company companyToBeCreated = BasicCompanySample.generateCompany().setDisplayName("Google");
    String companyName = BasicCompanySample.createCompany(companyToBeCreated).getName();

    Job jobToBeCreated = BasicJobSample.generateJobWithRequiredFields(companyName)
        .setTitle("Software engineer");
    final String jobName = BasicJobSample.createJob(jobToBeCreated).getName();

    // Wait several seconds for post processing
    Thread.sleep(10000);
    defaultAutoComplete(companyName, "goo");
    defaultAutoComplete(companyName, "sof");
    jobTitleAutoComplete(companyName, "sof");

    BasicJobSample.deleteJob(jobName);
    BasicCompanySample.deleteCompany(companyName);
  }
}

Python

Pour en savoir plus sur l'installation et la création d'un client Cloud Talent Solution, consultez la page Bibliothèques clientes Cloud Talent Solution.

def job_title_auto_complete(client_service, query, company_name):
    complete = client_service.projects().complete(
        name=name, query=query,
        languageCode='en-US', type='JOB_TITLE', pageSize=10)
    if company_name is not None:
        complete.companyName = company_name

    results = complete.execute()
    print(results)

C#

Pour en savoir plus sur l'installation et la création d'un client Cloud Talent Solution, consultez la page Bibliothèques clientes Cloud Talent Solution.


public static void JobTitleAutoComplete(String companyName, String query)
{
    CompleteRequest completeRequest = new CompleteRequest(jobServiceClient, parent)
    {
        Query = query,
        LanguageCode = "en-US",
        Type = CompleteRequest.TypeEnum.JOBTITLE,
        PageSize = 10
    };

    if (companyName != null)
    {
        completeRequest.CompanyName = companyName;
    }

    CompleteQueryResponse results = completeRequest.Execute();
    Console.WriteLine("Completion results: " + ToJsonString(results));
}

Go

Pour en savoir plus sur l'installation et la création d'un client Cloud Talent Solution, consultez la page Bibliothèques clientes Cloud Talent Solution.


// jobTitleAutoComplete suggests the job titles of the given companyName based
// on query.
func jobTitleAutoComplete(w io.Writer, projectID, companyName, query string) (*talent.CompleteQueryResponse, error) {
	ctx := context.Background()

	client, err := google.DefaultClient(ctx, talent.CloudPlatformScope)
	if err != nil {
		return nil, fmt.Errorf("google.DefaultClient: %v", err)
	}
	// Create the jobs service client.
	service, err := talent.New(client)
	if err != nil {
		return nil, fmt.Errorf("talent.New: %v", err)
	}

	parent := "projects/" + projectID
	complete := service.Projects.Complete(parent).Query(query).LanguageCode("en-US").Type("JOB_TITLE").PageSize(10)
	if companyName != "" {
		complete.CompanyName(companyName)
	}
	resp, err := complete.Do()
	if err != nil {
		return nil, fmt.Errorf("failed to auto complete with query %s in company %s: %v", query, companyName, err)
	}

	fmt.Fprintf(w, "Auto complete results:")
	for _, c := range resp.CompletionResults {
		fmt.Fprintf(w, "\t%v", c.Suggestion)
	}

	return resp, nil
}

Node.js

Pour en savoir plus sur l'installation et la création d'un client Cloud Talent Solution, consultez la page Bibliothèques clientes Cloud Talent Solution.


/**
 * Auto completes job titles within given companyName.
 */
const jobTitleAutoComplete = async (jobServiceClient, query, companyName) => {
  try {
    const request = {
      name: `projects/${PROJECT_ID}`,
      query: query,
      languageCode: 'en-US',
      type: 'JOB_TITLE',
      pageSize: 10,
    };

    if (companyName) {
      request.companyName = companyName;
    }

    const complete = await jobServiceClient.projects.complete(request);

    console.log(JSON.stringify(complete.data));
  } catch (e) {
    console.error(e);
    throw e;
  }
};

Ruby

Pour en savoir plus sur l'installation et la création d'un client Cloud Talent Solution, consultez la page Bibliothèques clientes Cloud Talent Solution.

# project_id     = "Project id required"
# company_name   = "The resource name of the company listing the job. The format is "projects/{project_id}/companies/{company_id}""
# query          = "Job title 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
type = "JOB_TITLE"
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, type: type
) do |result, err|
  if err.nil?
    puts "Job title auto complete result: #{result.to_json}"
  else
    puts "Error when auto completing job title. Error message: #{err.to_json}"
  end
end
result