/// <summary>Snippet for CompleteQuery</summary>
 public void CompleteQuery_RequestObject()
 {
     // Snippet: CompleteQuery(CompleteQueryRequest,CallSettings)
     // Create client
     CompletionClient completionClient = CompletionClient.Create();
     // Initialize request argument(s)
     CompleteQueryRequest request = new CompleteQueryRequest
     {
         ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
         Query    = "",
         PageSize = 0,
     };
     // Make the request
     CompleteQueryResponse response = completionClient.CompleteQuery(request);
     // End snippet
 }
 /// <summary>Snippet for CompleteQuery</summary>
 public void CompleteQuery_RequestObject()
 {
     // Snippet: CompleteQuery(CompleteQueryRequest,CallSettings)
     // Create client
     CompletionClient completionClient = CompletionClient.Create();
     // Initialize request argument(s)
     CompleteQueryRequest request = new CompleteQueryRequest
     {
         ProjectName = new ProjectName("[PROJECT]"),
         Query       = "",
         PageSize    = 0,
     };
     // Make the request
     CompleteQueryResponse response = completionClient.CompleteQuery(request);
     // End snippet
 }
 /// <summary>Snippet for CompleteQuery</summary>
 public void CompleteQueryRequestObject()
 {
     // Snippet: CompleteQuery(CompleteQueryRequest, CallSettings)
     // Create client
     CompletionClient completionClient = CompletionClient.Create();
     // Initialize request argument(s)
     CompleteQueryRequest request = new CompleteQueryRequest
     {
         ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
         Query                = "",
         LanguageCodes        = { "", },
         PageSize             = 0,
         CompanyAsCompanyName = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"),
         Scope                = CompleteQueryRequest.Types.CompletionScope.Unspecified,
         Type = CompleteQueryRequest.Types.CompletionType.Unspecified,
     };
     // Make the request
     CompleteQueryResponse response = completionClient.CompleteQuery(request);
     // End snippet
 }
Exemple #4
0
        // [START job_search_autocomplete_job_title]
        public static object CompleteQuery(string projectId, string tenantId, string query)
        {
            CompletionClient     completionClient = CompletionClient.Create();
            TenantName           tenant           = TenantName.FromProjectTenant(projectId, tenantId);
            CompleteQueryRequest request          = new CompleteQueryRequest
            {
                ParentAsTenantName = tenant,
                Query         = query, // partial text for job title
                PageSize      = 5,     // limit for number of results
                LanguageCodes = { "en-US" } // language code
            };
            var response = completionClient.CompleteQuery(request);

            foreach (var result in response.CompletionResults)
            {
                Console.WriteLine($"Suggested title: {result.Suggestion}");
                // Suggestion type is JOB_TITLE or COMPANY_TITLE
                Console.WriteLine($"Suggestion type: {result.Type}");
            }

            return(0);
        }