Search in sources :

Example 46 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project java-talent by googleapis.

the class JobSearchListCompanies method sampleListCompanies.

/**
 * List Companies
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleListCompanies(String projectId, String tenantId) {
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        ListCompaniesRequest request = ListCompaniesRequest.newBuilder().setParent(parent.toString()).build();
        for (Company responseItem : companyServiceClient.listCompanies(request).iterateAll()) {
            System.out.printf("Company Name: %s\n", responseItem.getName());
            System.out.printf("Display Name: %s\n", responseItem.getDisplayName());
            System.out.printf("External ID: %s\n", responseItem.getExternalId());
        }
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : ListCompaniesRequest(com.google.cloud.talent.v4beta1.ListCompaniesRequest) CompanyServiceClient(com.google.cloud.talent.v4beta1.CompanyServiceClient) Company(com.google.cloud.talent.v4beta1.Company) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName)

Example 47 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project java-talent by googleapis.

the class ITSystemTest method listCompaniesTest.

@Test
public void listCompaniesTest() {
    ListCompaniesRequest request = ListCompaniesRequest.newBuilder().setParent(tenantName.toString()).build();
    for (Company actual : companyServiceClient.listCompanies(request).iterateAll()) {
        if (company.getName().equals(actual.getName())) {
            assertEquals(company.getName(), actual.getName());
            assertEquals(company.getDisplayName(), actual.getDisplayName());
            assertEquals(company.getExternalId(), actual.getExternalId());
        }
    }
}
Also used : ListCompaniesRequest(com.google.cloud.talent.v4beta1.ListCompaniesRequest) Company(com.google.cloud.talent.v4beta1.Company) Test(org.junit.Test)

Example 48 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project java-talent by googleapis.

the class ITSystemTest method getCompanyTest.

@Test
public void getCompanyTest() {
    GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(companyName.toString()).build();
    Company actual = companyServiceClient.getCompany(request);
    assertEquals(company.getName(), actual.getName());
    assertEquals(company.getDisplayName(), actual.getDisplayName());
    assertEquals(company.getExternalId(), actual.getExternalId());
}
Also used : Company(com.google.cloud.talent.v4beta1.Company) GetCompanyRequest(com.google.cloud.talent.v4beta1.GetCompanyRequest) Test(org.junit.Test)

Example 49 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project java-talent by googleapis.

the class JobSearchGetCompany method getCompany.

// Get Company.
public static void getCompany(String projectId, String tenantId, String companyId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        CompanyName name = CompanyName.of(projectId, tenantId, companyId);
        GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build();
        Company response = companyServiceClient.getCompany(request);
        System.out.format("Company name: %s%n", response.getName());
        System.out.format("Display name: %s%n", response.getDisplayName());
    }
}
Also used : CompanyName(com.google.cloud.talent.v4.CompanyName) CompanyServiceClient(com.google.cloud.talent.v4.CompanyServiceClient) Company(com.google.cloud.talent.v4.Company) GetCompanyRequest(com.google.cloud.talent.v4.GetCompanyRequest)

Aggregations

Random (java.util.Random)12 Test (org.junit.Test)11 Company (com.google.cloud.talent.v4beta1.Company)10 Company (com.google.api.ads.admanager.axis.v202205.Company)7 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202205.CompanyServiceInterface)7 Size (com.google.api.ads.admanager.axis.v202205.Size)6 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)6 AdManagerSession (com.google.api.ads.admanager.lib.client.AdManagerSession)5 MockHttpIntegrationTest (com.google.api.ads.common.lib.testing.MockHttpIntegrationTest)5 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)5 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)4 Company (com.google.api.ads.admanager.axis.v202108.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202108.CompanyServiceInterface)4 Company (com.google.api.ads.admanager.axis.v202111.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202111.CompanyServiceInterface)4 Company (com.google.api.ads.admanager.axis.v202202.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202202.CompanyServiceInterface)4 Creative (com.google.api.ads.admanager.axis.v202205.Creative)4 CreativeServiceInterface (com.google.api.ads.admanager.axis.v202205.CreativeServiceInterface)4 NetHttpTransport (com.google.api.client.http.javanet.NetHttpTransport)4