public async Task CreateClientEventAsync() { Mock <EventService.EventServiceClient> mockGrpcClient = new Mock <EventService.EventServiceClient>(MockBehavior.Strict); CreateClientEventRequest expectedRequest = new CreateClientEventRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), ClientEvent = new ClientEvent(), }; ClientEvent expectedResponse = new ClientEvent { RequestId = "requestId37109963", EventId = "eventId278118624", EventNotes = "eventNotes445073628", }; mockGrpcClient.Setup(x => x.CreateClientEventAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ClientEvent>(Task.FromResult(expectedResponse), null, null, null, null)); EventServiceClient client = new EventServiceClientImpl(mockGrpcClient.Object, null); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); ClientEvent clientEvent = new ClientEvent(); ClientEvent response = await client.CreateClientEventAsync(parent, clientEvent); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public static int Main(string[] args) { // Read projectId from args if (args.Length != 1) { Console.WriteLine("Usage: Project ID must be passed as first argument."); Console.WriteLine(); return(1); } string projectId = args[0]; // Create client CompanyServiceClient client = CompanyServiceClient.Create(); // Initialize request argument(s) ProjectName projectName = new ProjectName(projectId); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(projectName); // Call API method PagedEnumerable <ListCompaniesResponse, Company> pagedResponse = client.ListCompanies(parent); // Show the result foreach (var item in pagedResponse) { Console.WriteLine(item); } // Success Console.WriteLine("Smoke test passed OK"); return(0); }
// [START job_search_create_job_beta] public static object CreateJob(string projectId, string tenantId, string companyId, string requisitionId, string jobApplicationUrl) { JobServiceClient jobServiceClient = JobServiceClient.Create(); TenantName tenantName = new TenantName(projectId, tenantId); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(tenantName); ApplicationInfo applicationInfo = new ApplicationInfo(); applicationInfo.Uris.Add(jobApplicationUrl); Job job = new Job { Company = companyId, RequisitionId = requisitionId, Title = "Software Developer", Description = "Develop, maintain the software solutions.", ApplicationInfo = applicationInfo, LanguageCode = "en-US" }; string[] addresses = { "1600 Amphitheatre Parkway, Mountain View, CA 94043", "111 8th Avenue, New York, NY 10011" }; job.Addresses.Add(addresses); CreateJobRequest request = new CreateJobRequest { ParentAsTenantOrProjectNameOneof = parent, Job = job }; Job response = jobServiceClient.CreateJob(request); Console.WriteLine($"Created Job: {response.Name}"); return(0); }
// [START job_search_create_company_beta] public static object CreateCompany(string projectId, string tenantId, string displayName, string externalId) { CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); TenantName tenantName = new TenantName(projectId, tenantId); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(tenantName); Company company = new Company { DisplayName = displayName, ExternalId = externalId }; CreateCompanyRequest request = new CreateCompanyRequest { ParentAsTenantOrProjectNameOneof = parent, Company = company }; Company response = companyServiceClient.CreateCompany(request); Console.WriteLine("Created Company"); Console.WriteLine($"Name: {response.Name}"); Console.WriteLine($"Display Name: {response.DisplayName}"); Console.WriteLine($"External ID: {response.ExternalId}"); return(0); }
public async Task CreateCompanyAsync() { Mock <CompanyService.CompanyServiceClient> mockGrpcClient = new Mock <CompanyService.CompanyServiceClient>(MockBehavior.Strict); CreateCompanyRequest expectedRequest = new CreateCompanyRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Company = new Company(), }; Company expectedResponse = new Company { CompanyNameOneof = CompanyNameOneof.From(new CompanyOldName("[PROJECT]", "[COMPANY]")), DisplayName = "displayName1615086568", ExternalId = "externalId-1153075697", HeadquartersAddress = "headquartersAddress-1879520036", HiringAgency = false, EeoText = "eeoText-1652097123", WebsiteUri = "websiteUri-2118185016", CareerSiteUri = "careerSiteUri1223331861", ImageUri = "imageUri-877823864", Suspended = false, }; mockGrpcClient.Setup(x => x.CreateCompanyAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Company>(Task.FromResult(expectedResponse), null, null, null, null)); CompanyServiceClient client = new CompanyServiceClientImpl(mockGrpcClient.Object, null); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Company company = new Company(); Company response = await client.CreateCompanyAsync(parent, company); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateJob2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); CreateJobRequest request = new CreateJobRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Job = new Job(), }; Job expectedResponse = new Job { JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")), CompanyAsCompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")), RequisitionId = "requisitionId980224926", Title = "title110371416", Description = "description-1724546052", Department = "department848184146", Incentives = "incentives-1262874520", LanguageCode = "languageCode-412800396", PromotionValue = 353413845, Qualifications = "qualifications1903501412", Responsibilities = "responsibilities-926952660", CompanyDisplayName = "companyDisplayName1982424170", }; mockGrpcClient.Setup(x => x.CreateJob(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); Job response = client.CreateJob(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task CreateJobAsync() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); CreateJobRequest expectedRequest = new CreateJobRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Job = new Job(), }; Job expectedResponse = new Job { JobNameOneof = JobNameOneof.From(new JobOldName("[PROJECT]", "[JOBS]")), Company = "company950484093", RequisitionId = "requisitionId980224926", Title = "title110371416", Description = "description-1724546052", Department = "department848184146", Incentives = "incentives-1262874520", LanguageCode = "languageCode-412800396", PromotionValue = 353413845, Qualifications = "qualifications1903501412", Responsibilities = "responsibilities-926952660", CompanyDisplayName = "companyDisplayName1982424170", }; mockGrpcClient.Setup(x => x.CreateJobAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Job>(Task.FromResult(expectedResponse), null, null, null, null)); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Job job = new Job(); Job response = await client.CreateJobAsync(parent, job); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for CreateClientEvent</summary> public void CreateClientEvent() { // Snippet: CreateClientEvent(TenantOrProjectNameOneof,ClientEvent,CallSettings) // Create client EventServiceClient eventServiceClient = EventServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); ClientEvent clientEvent = new ClientEvent(); // Make the request ClientEvent response = eventServiceClient.CreateClientEvent(parent, clientEvent); // End snippet }
/// <summary>Snippet for CreateJob</summary> public void CreateJob() { // Snippet: CreateJob(TenantOrProjectNameOneof,Job,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Job job = new Job(); // Make the request Job response = jobServiceClient.CreateJob(parent, job); // End snippet }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompany() { // Snippet: CreateCompany(TenantOrProjectNameOneof,Company,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Company company = new Company(); // Make the request Company response = companyServiceClient.CreateCompany(parent, company); // End snippet }
// [START job_search_create_client_event] public static object CreateClientEvent(string projectId, string tenantId, string requestId, string eventId, IEnumerable <string> jobIds) { EventServiceClient eventServiceClient = EventServiceClient.Create(); TenantName parent = new TenantName(projectId, tenantId); long seconds = 1L; Timestamp createTime = new Timestamp { Seconds = seconds }; // The type of event attributed to the behavior of the end user. JobEventType type = JobEventType.View; // List of job names associated with this event. List <string> jobs = new List <string>(); foreach (var jobId in jobIds) { //build full path of job IDs JobName name = new JobName(projectId, tenantId, jobId); jobs.Add(name.ToString()); } JobEvent jobEvent = new JobEvent { Type = type }; jobEvent.Jobs.Add(jobs); ClientEvent clientEvent = new ClientEvent { RequestId = requestId, EventId = eventId, CreateTime = createTime, JobEvent = jobEvent }; CreateClientEventRequest request = new CreateClientEventRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(parent), ClientEvent = clientEvent }; ClientEvent response = eventServiceClient.CreateClientEvent(request); Console.WriteLine($"Created client event."); Console.WriteLine(response); return(0); }
/// <summary>Snippet for BatchDeleteJobs</summary> public void BatchDeleteJobs() { // Snippet: BatchDeleteJobs(TenantOrProjectNameOneof,string,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); string filter = ""; // Make the request jobServiceClient.BatchDeleteJobs(parent, filter); // End snippet }
private CompanyNameOneof CreateSampleCompany() { CompanyServiceClient client = CompanyServiceClient.Create(); Company company = new Company { DisplayName = "Sample company created by fixture", ExternalId = GenerateCompanyExternalId(), Size = CompanySize.Giant }; Company created = client.CreateCompany(TenantOrProjectNameOneof.From(ProjectName), company); return(created.CompanyNameOneof); }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompany_RequestObject() { // Snippet: CreateCompany(CreateCompanyRequest,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) CreateCompanyRequest request = new CreateCompanyRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Company = new Company(), }; // Make the request Company response = companyServiceClient.CreateCompany(request); // End snippet }
/// <summary>Snippet for BatchDeleteJobsAsync</summary> public async Task BatchDeleteJobsAsync() { // Snippet: BatchDeleteJobsAsync(TenantOrProjectNameOneof,string,CallSettings) // Additional: BatchDeleteJobsAsync(TenantOrProjectNameOneof,string,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); string filter = ""; // Make the request await jobServiceClient.BatchDeleteJobsAsync(parent, filter); // End snippet }
/// <summary>Snippet for CreateCompanyAsync</summary> public async Task CreateCompanyAsync() { // Snippet: CreateCompanyAsync(TenantOrProjectNameOneof,Company,CallSettings) // Additional: CreateCompanyAsync(TenantOrProjectNameOneof,Company,CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Company company = new Company(); // Make the request Company response = await companyServiceClient.CreateCompanyAsync(parent, company); // End snippet }
/// <summary>Snippet for CreateJob</summary> public void CreateJob_RequestObject() { // Snippet: CreateJob(CreateJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) CreateJobRequest request = new CreateJobRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Job = new Job(), }; // Make the request Job response = jobServiceClient.CreateJob(request); // End snippet }
/// <summary>Snippet for CreateJobAsync</summary> public async Task CreateJobAsync() { // Snippet: CreateJobAsync(TenantOrProjectNameOneof,Job,CallSettings) // Additional: CreateJobAsync(TenantOrProjectNameOneof,Job,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Job job = new Job(); // Make the request Job response = await jobServiceClient.CreateJobAsync(parent, job); // End snippet }
/// <summary>Snippet for SearchJobsForAlertAsync</summary> public async Task SearchJobsForAlertAsync_RequestObject() { // Snippet: SearchJobsForAlertAsync(SearchJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) SearchJobsRequest request = new SearchJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), RequestMetadata = new RequestMetadata(), }; // Make the request PagedAsyncEnumerable <SearchJobsResponse, MatchingJob> response = jobServiceClient.SearchJobsForAlertAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((SearchJobsResponse.Types.MatchingJob item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((SearchJobsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (SearchJobsResponse.Types.MatchingJob item in page) { Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <SearchJobsResponse.Types.MatchingJob> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (SearchJobsResponse.Types.MatchingJob item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for BatchDeleteJobs</summary> public void BatchDeleteJobs_RequestObject() { // Snippet: BatchDeleteJobs(BatchDeleteJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "", }; // Make the request jobServiceClient.BatchDeleteJobs(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 { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Query = "", PageSize = 0, }; // Make the request CompleteQueryResponse response = completionClient.CompleteQuery(request); // End snippet }
/// <summary>Snippet for ListJobs</summary> public void ListJobs_RequestObject() { // Snippet: ListJobs(ListJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) ListJobsRequest request = new ListJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "", }; // Make the request PagedEnumerable <ListJobsResponse, Job> response = jobServiceClient.ListJobs(request); // Iterate over all response items, lazily performing RPCs as required foreach (Job item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListJobsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Job item in page) { Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Job> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Job item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
private static int Main(string[] args) { if (args.Length != 1) { Console.Error.WriteLine("Specify the project ID as the only command line argument"); return(1); } ProjectName projectName = new ProjectName(args[0]); var companyClient = CompanyServiceClient.Create(); var jobClient = JobServiceClient.Create(); var parentName = TenantOrProjectNameOneof.From(projectName); var testCompanies = companyClient.ListCompanies(parentName) .Where(cn => cn.ExternalId.StartsWith("test-")) .Select(c => c.CompanyNameOneof) .ToList(); Console.WriteLine($"Companies to delete: {testCompanies.Count}"); foreach (var companyName in testCompanies) { var jobs = jobClient.ListJobs(parentName, $"companyName=\"{companyName}\"").ToList(); Console.WriteLine($"Jobs for company {companyName}: {jobs.Count}"); foreach (var job in jobs) { try { jobClient.DeleteJob(job.JobNameOneof); } catch (RpcException e) { Console.WriteLine($"Failed to delete job {job.Name}: {e.Message}"); } } try { companyClient.DeleteCompany(companyName); } catch (RpcException e) { Console.WriteLine($"Failed to delete company {companyName}: {e.Message}"); } } return(0); }
public void BatchDeleteJobs2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "filter-1274492040", }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.BatchDeleteJobs(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); client.BatchDeleteJobs(request); mockGrpcClient.VerifyAll(); }
public async Task BatchDeleteJobsAsync2() { Mock <JobService.JobServiceClient> mockGrpcClient = new Mock <JobService.JobServiceClient>(MockBehavior.Strict); BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "filter-1274492040", }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.BatchDeleteJobsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); JobServiceClient client = new JobServiceClientImpl(mockGrpcClient.Object, null); await client.BatchDeleteJobsAsync(request); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for ListJobsAsync</summary> public async Task ListJobsAsync() { // Snippet: ListJobsAsync(TenantOrProjectNameOneof,string,string,int?,CallSettings) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); string filter = ""; // Make the request PagedAsyncEnumerable <ListJobsResponse, Job> response = jobServiceClient.ListJobsAsync(parent, filter); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Job item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListJobsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Job item in page) { Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Job> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Job item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
// [START job_search_custom_ranking_search] public static object CustomRankingSearch(string projectId, string tenantId) { JobServiceClient jobServiceClient = JobServiceClient.Create(); TenantName name = new TenantName(projectId, tenantId); string domain = "www.example.com"; string sessionId = "Hashed session identifier"; string userId = "Hashed user identifier"; RequestMetadata requestMetadata = new RequestMetadata { Domain = domain, SessionId = sessionId, UserId = userId }; CustomRankingInfo customRankingInfo = new CustomRankingInfo { ImportanceLevel = ImportanceLevel.Extreme, // Custom ranking supports math operators, and Field name can be CPC or Freshness // https://cloud.google.com/talent-solution/job-search/docs/custom-ranking#how_to_use RankingExpression = "(someFieldLong + 25) * 0.25" }; string orderBy = "custom_ranking desc"; SearchJobsRequest request = new SearchJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(name), CustomRankingInfo = customRankingInfo, RequestMetadata = requestMetadata, OrderBy = orderBy }; var response = jobServiceClient.SearchJobs(request); foreach (var result in response) { Console.WriteLine($"Job summary: {result.JobSummary}"); Console.WriteLine($"Job title snippet: {result.JobTitleSnippet}"); Job job = result.Job; Console.WriteLine($"Job name: {job.Name}"); Console.WriteLine($"Job title: {job.Title}"); } return(0); }
/// <summary>Snippet for CreateCompanyAsync</summary> public async Task CreateCompanyAsync_RequestObject() { // Snippet: CreateCompanyAsync(CreateCompanyRequest,CallSettings) // Additional: CreateCompanyAsync(CreateCompanyRequest,CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) CreateCompanyRequest request = new CreateCompanyRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Company = new Company(), }; // Make the request Company response = await companyServiceClient.CreateCompanyAsync(request); // End snippet }
// [START job_search_create_company_core] /// <summary> /// Create Company /// </summary> /// <param name="projectId">Your Google Cloud Project ID</param> public static void SampleCreateCompany(string projectId, string displayName, string externalId) { CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // string projectId = "Your Google Cloud Project ID" // string displayName = "My Company Name" // string externalId = "Identifier of this company in my system" CreateCompanyRequest request = new CreateCompanyRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new ProjectName(projectId)), Company = new Company { DisplayName = "My Company Name", ExternalId = "Identifier of this company in my system", }, }; Company response = companyServiceClient.CreateCompany(request); // FIXME: inspect the results }
/// <summary>Snippet for BatchDeleteJobsAsync</summary> public async Task BatchDeleteJobsAsync_RequestObject() { // Snippet: BatchDeleteJobsAsync(BatchDeleteJobsRequest,CallSettings) // Additional: BatchDeleteJobsAsync(BatchDeleteJobsRequest,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "", }; // Make the request await jobServiceClient.BatchDeleteJobsAsync(request); // End snippet }