Create and update companies

A Company resource in Cloud Talent Solution represents a single company. Any job belonging to that company refers to a job posting that is created for an open position in that company. It contains information such as the company name and address, as well as internal fields that tie the resource in the Cloud Talent Solution service back to your internal databases.

Create a company

To create a company, send a POST request to the companies endpoint, specifying at least the two required fields. Refer to the Quickstart: Create companies and jobs page for details on how to create a company.

Go

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// createCompany creates a company as given.
func createCompany(w io.Writer, projectID, externalID, displayName string) (*talentpb.Company, error) {
	ctx := context.Background()

	// Initializes a companyService client.
	c, err := talent.NewCompanyClient(ctx)
	if err != nil {
		return nil, fmt.Errorf("talent.NewCompanyClient: %v", err)
	}

	// Construct a createCompany request.
	req := &talentpb.CreateCompanyRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		Company: &talentpb.Company{
			ExternalId:  externalID,
			DisplayName: displayName,
		},
	}

	resp, err := c.CreateCompany(ctx, req)
	if err != nil {
		return nil, fmt.Errorf("CreateCompany: %v", err)
	}

	fmt.Fprintf(w, "Created company: %q\n", resp.GetName())

	return resp, nil
}

Java

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

/*
 * Please include the following imports to run this sample.
 *
 * import com.google.cloud.talent.v4beta1.Company;
 * import com.google.cloud.talent.v4beta1.CompanyServiceClient;
 * import com.google.cloud.talent.v4beta1.CreateCompanyRequest;
 * import com.google.cloud.talent.v4beta1.TenantName;
 * import com.google.cloud.talent.v4beta1.TenantOrProjectName;
 */

/**
 * Create Company
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleCreateCompany(
    String projectId, String tenantId, String displayName, String externalId) {
  try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
    // projectId = "Your Google Cloud Project ID";
    // tenantId = "Your Tenant ID (using tenancy is optional)";
    // displayName = "My Company Name";
    // externalId = "Identifier of this company in my system";
    TenantOrProjectName parent = TenantName.of(projectId, tenantId);
    Company company =
        Company.newBuilder().setDisplayName(displayName).setExternalId(externalId).build();
    CreateCompanyRequest request =
        CreateCompanyRequest.newBuilder()
            .setParent(parent.toString())
            .setCompany(company)
            .build();
    Company response = companyServiceClient.createCompany(request);
    System.out.println("Created Company");
    System.out.printf("Name: %s\n", response.getName());
    System.out.printf("Display Name: %s\n", response.getDisplayName());
    System.out.printf("External ID: %s\n", response.getExternalId());
  } catch (Exception exception) {
    System.err.println("Failed to create the client due to: " + exception);
  }
}

Node.js

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


const talent = require('@google-cloud/talent').v4beta1;

/**
 * Create Company
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenant
 */
function sampleCreateCompany(projectId, tenantId, displayName, externalId) {
  const client = new talent.CompanyServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const displayName = 'My Company Name';
  // const externalId = 'Identifier of this company in my system';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const company = {
    displayName: displayName,
    externalId: externalId,
  };
  const request = {
    parent: formattedParent,
    company: company,
  };
  client.createCompany(request)
    .then(responses => {
      const response = responses[0];
      console.log(`Created Company`);
      console.log(`Name: ${response.name}`);
      console.log(`Display Name: ${response.displayName}`);
      console.log(`External ID: ${response.externalId}`);
    })
    .catch(err => {
      console.error(err);
    });
}

PHP

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Talent\V4beta1\CompanyServiceClient;
use Google\Cloud\Talent\V4beta1\Company;

/**
 * Create Company.
 *
 * @param string $projectId Your Google Cloud Project ID
 * @param string $tenantId  Identifier of the Tenant
 */
function sampleCreateCompany($projectId, $tenantId, $displayName, $externalId)
{

    $companyServiceClient = new CompanyServiceClient();

    // $projectId = 'Your Google Cloud Project ID';
    // $tenantId = 'Your Tenant ID (using tenancy is optional)';
    // $displayName = 'My Company Name';
    // $externalId = 'Identifier of this company in my system';
    $formattedParent = $companyServiceClient->tenantName($projectId, $tenantId);
    $company = new Company();
    $company->setDisplayName($displayName);
    $company->setExternalId($externalId);

    try {
        $response = $companyServiceClient->createCompany($formattedParent, $company);
        printf('Created Company'.PHP_EOL);
        printf('Name: %s'.PHP_EOL, $response->getName());
        printf('Display Name: %s'.PHP_EOL, $response->getDisplayName());
        printf('External ID: %s'.PHP_EOL, $response->getExternalId());
    } finally {
        $companyServiceClient->close();
    }

}

Python

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


from google.cloud import talent_v4beta1
import six


def sample_create_company(project_id, tenant_id, display_name, external_id):
    """Create Company"""

    client = talent_v4beta1.CompanyServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # display_name = 'My Company Name'
    # external_id = 'Identifier of this company in my system'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode('utf-8')
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode('utf-8')
    if isinstance(display_name, six.binary_type):
        display_name = display_name.decode('utf-8')
    if isinstance(external_id, six.binary_type):
        external_id = external_id.decode('utf-8')
    parent = client.tenant_path(project_id, tenant_id)
    company = {'display_name': display_name, 'external_id': external_id}

    response = client.create_company(parent, company)
    print('Created Company')
    print('Name: {}'.format(response.name))
    print('Display Name: {}'.format(response.display_name))
    print('External ID: {}'.format(response.external_id))


Ruby

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


 # Create Company
 #
 # @param project_id {String} Your Google Cloud Project ID
 # @param tenant_id {String} Identifier of the Tenant
def sample_create_company(project_id, tenant_id, display_name, external_id)
  # Instantiate a client
  company_client = Google::Cloud::Talent::CompanyService.new version: :v4beta1

  # project_id = "Your Google Cloud Project ID"
  # tenant_id = "Your Tenant ID (using tenancy is optional)"
  # display_name = "My Company Name"
  # external_id = "Identifier of this company in my system"
  formatted_parent = company_client.class.tenant_path(project_id, tenant_id)
  company = { display_name: display_name, external_id: external_id }

  response = company_client.create_company(formatted_parent, company)
  puts "Created Company"
  puts "Name: #{response.name}"
  puts "Display Name: #{response.display_name}"
  puts "External ID: #{response.external_id}"

end

Required fields

The following fields are required in create/update requests:

  • displayName: The name of the employer displayed with the job, for example, "Google LLC".

  • externalId: Your internal ID for this company. This field allows you to map your internal identifiers to the company in Google's system. If the company doesn't have a separate internal identifier, set this field to the same value as displayName.

Commonly used fields

  • headquartersAddress: The street address of the company's main headquarters, which may be different from the job location. Cloud Talent Solution only accepts a single HQ location per company. The service attempts to geolocate the address, and populates a more specific location when possible in derivedInfo.headquartersLocation (which is output only).

  • size: A bucket value representing the size of the company in terms of number of employees, from MINI to GIANT. See the size reference for enums and their definitions.

  • eeoText: A string containing the Equal Employment Opportunity legal disclaimer text to be associated with all jobs for this company.

  • keywordSearchableJobCustomAttributes: Specifies which customAttributes on this company's jobs should be indexed and searchable by general keyword search.

Confidential companies

In cases where you want to post a confidential job, we recommend creating a separate company that mimics the company's fields, but obfuscates the displayName, externalId, and any other identifying fields.

In cases where the end employer should be anonymous (for example, the Staffing Agency use case), we recommend setting the externalId and displayName to random but unique values.

Retrieve a company

Go

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// getCompany gets an existing company by its resource name.
func getCompany(w io.Writer, projectID, companyID string) (*talentpb.Company, error) {
	ctx := context.Background()

	// Initialize a companyService client.
	c, err := talent.NewCompanyClient(ctx)
	if err != nil {
		return nil, fmt.Errorf("talent.NewCompanyClient: %v", err)
	}

	// Construct a getCompany request.
	companyName := fmt.Sprintf("projects/%s/companies/%s", projectID, companyID)
	req := &talentpb.GetCompanyRequest{
		// The resource name of the company to be retrieved.
		// The format is "projects/{project_id}/companies/{company_id}".
		Name: companyName,
	}

	resp, err := c.GetCompany(ctx, req)
	if err != nil {
		return nil, fmt.Errorf("GetCompany: %v", err)
	}

	fmt.Fprintf(w, "Company: %q\n", resp.GetName())
	fmt.Fprintf(w, "Company display name: %q\n", resp.GetDisplayName())

	return resp, nil
}

Java

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

/*
 * Please include the following imports to run this sample.
 *
 * import com.google.cloud.talent.v4beta1.Company;
 * import com.google.cloud.talent.v4beta1.CompanyName;
 * import com.google.cloud.talent.v4beta1.CompanyServiceClient;
 * import com.google.cloud.talent.v4beta1.CompanyWithTenantName;
 * import com.google.cloud.talent.v4beta1.GetCompanyRequest;
 */

/** Get Company */
public static void sampleGetCompany(String projectId, String tenantId, String companyId) {
  try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
    // projectId = "Your Google Cloud Project ID";
    // tenantId = "Your Tenant ID (using tenancy is optional)";
    // companyId = "Company ID";
    CompanyName name = CompanyWithTenantName.of(projectId, tenantId, companyId);
    GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build();
    Company response = companyServiceClient.getCompany(request);
    System.out.printf("Company name: %s\n", response.getName());
    System.out.printf("Display name: %s\n", response.getDisplayName());
  } catch (Exception exception) {
    System.err.println("Failed to create the client due to: " + exception);
  }
}

Node.js

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


const talent = require('@google-cloud/talent').v4beta1;

/** Get Company */
function sampleGetCompany(projectId, tenantId, companyId) {
  const client = new talent.CompanyServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const companyId = 'Company ID';
  const formattedName = client.companyPath(projectId, tenantId, companyId);
  client.getCompany({name: formattedName})
    .then(responses => {
      const response = responses[0];
      console.log(`Company name: ${response.name}`);
      console.log(`Display name: ${response.displayName}`);
    })
    .catch(err => {
      console.error(err);
    });
}

PHP

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Talent\V4beta1\CompanyServiceClient;

/** Get Company */
function sampleGetCompany($projectId, $tenantId, $companyId)
{

    $companyServiceClient = new CompanyServiceClient();

    // $projectId = 'Your Google Cloud Project ID';
    // $tenantId = 'Your Tenant ID (using tenancy is optional)';
    // $companyId = 'Company ID';
    $formattedName = $companyServiceClient->companyName($projectId, $tenantId, $companyId);

    try {
        $response = $companyServiceClient->getCompany($formattedName);
        printf('Company name: %s'.PHP_EOL, $response->getName());
        printf('Display name: %s'.PHP_EOL, $response->getDisplayName());
    } finally {
        $companyServiceClient->close();
    }

}

Python

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


from google.cloud import talent_v4beta1
import six


def sample_get_company(project_id, tenant_id, company_id):
    """Get Company"""

    client = talent_v4beta1.CompanyServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_id = 'Company ID'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode('utf-8')
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode('utf-8')
    if isinstance(company_id, six.binary_type):
        company_id = company_id.decode('utf-8')
    name = client.company_path(project_id, tenant_id, company_id)

    response = client.get_company(name)
    print('Company name: {}'.format(response.name))
    print('Display name: {}'.format(response.display_name))


Ruby

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


# Get Company
def sample_get_company(project_id, tenant_id, company_id)
  # Instantiate a client
  company_client = Google::Cloud::Talent::CompanyService.new version: :v4beta1

  # project_id = "Your Google Cloud Project ID"
  # tenant_id = "Your Tenant ID (using tenancy is optional)"
  # company_id = "Company ID"
  formatted_name = company_client.class.company_path(project_id, tenant_id, company_id)

  response = company_client.get_company(formatted_name)
  puts "Company name: #{response.name}"
  puts "Display name: #{response.display_name}"

end

List companies

Go

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	"google.golang.org/api/iterator"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// listCompanies lists all companies in the project.
func listCompanies(w io.Writer, projectID string) error {
	ctx := context.Background()

	// Initialize a compnayService client.
	c, err := talent.NewCompanyClient(ctx)
	if err != nil {
		return fmt.Errorf("talent.NewCompanyClient: %v", err)
	}

	// Construct a listCompanies request.
	req := &talentpb.ListCompaniesRequest{
		Parent: "projects/" + projectID,
	}

	it := c.ListCompanies(ctx, req)

	for {
		resp, err := it.Next()
		if err == iterator.Done {
			return nil
		}
		if err != nil {
			return fmt.Errorf("it.Next: %v", err)
		}
		fmt.Fprintf(w, "Listing company: %q\n", resp.GetName())
		fmt.Fprintf(w, "Display name: %v\n", resp.GetDisplayName())
		fmt.Fprintf(w, "External ID: %v\n", resp.GetExternalId())
	}
}

Java

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

/*
 * Please include the following imports to run this sample.
 *
 * import com.google.cloud.talent.v4beta1.Company;
 * import com.google.cloud.talent.v4beta1.CompanyServiceClient;
 * import com.google.cloud.talent.v4beta1.ListCompaniesRequest;
 * import com.google.cloud.talent.v4beta1.TenantName;
 * import com.google.cloud.talent.v4beta1.TenantOrProjectName;
 */

/**
 * 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()) {
    // projectId = "Your Google Cloud Project ID";
    // tenantId = "Your Tenant ID (using tenancy is optional)";
    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);
  }
}

Node.js

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


const talent = require('@google-cloud/talent').v4beta1;

/**
 * List Companies
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenant
 */
function sampleListCompanies(projectId, tenantId) {
  const client = new talent.CompanyServiceClient();
  // Iterate over all elements.
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  const formattedParent = client.tenantPath(projectId, tenantId);

  client.listCompanies({parent: formattedParent})
    .then(responses => {
      const resources = responses[0];
      for (const resource of resources) {
        console.log(`Company Name: ${resource.name}`);
        console.log(`Display Name: ${resource.displayName}`);
        console.log(`External ID: ${resource.externalId}`);
      }
    })
    .catch(err => {
      console.error(err);
    });
}

PHP

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Talent\V4beta1\CompanyServiceClient;

/**
 * List Companies.
 *
 * @param string $projectId Your Google Cloud Project ID
 * @param string $tenantId  Identifier of the Tenant
 */
function sampleListCompanies($projectId, $tenantId)
{

    $companyServiceClient = new CompanyServiceClient();

    // $projectId = 'Your Google Cloud Project ID';
    // $tenantId = 'Your Tenant ID (using tenancy is optional)';
    $formattedParent = $companyServiceClient->tenantName($projectId, $tenantId);

    try {
        // Iterate through all elements
        $pagedResponse = $companyServiceClient->listCompanies($formattedParent);
        foreach ($pagedResponse->iterateAllElements() as $responseItem) {
            printf('Company Name: %s'.PHP_EOL, $responseItem->getName());
            printf('Display Name: %s'.PHP_EOL, $responseItem->getDisplayName());
            printf('External ID: %s'.PHP_EOL, $responseItem->getExternalId());
        }
    } finally {
        $companyServiceClient->close();
    }

}

Python

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


from google.cloud import talent_v4beta1
import six


def sample_list_companies(project_id, tenant_id):
    """List Companies"""

    client = talent_v4beta1.CompanyServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode('utf-8')
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode('utf-8')
    parent = client.tenant_path(project_id, tenant_id)

    # Iterate over all results
    for response_item in client.list_companies(parent):
        print('Company Name: {}'.format(response_item.name))
        print('Display Name: {}'.format(response_item.display_name))
        print('External ID: {}'.format(response_item.external_id))


Ruby

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


 # List Companies
 #
 # @param project_id {String} Your Google Cloud Project ID
 # @param tenant_id {String} Identifier of the Tenant
def sample_list_companies(project_id, tenant_id)
  # Instantiate a client
  company_client = Google::Cloud::Talent::CompanyService.new version: :v4beta1

  # project_id = "Your Google Cloud Project ID"
  # tenant_id = "Your Tenant ID (using tenancy is optional)"
  formatted_parent = company_client.class.tenant_path(project_id, tenant_id)

  # Iterate over all results.
  company_client.list_companies(formatted_parent).each do |element|
    puts "Company Name: #{element.name}"
    puts "Display Name: #{element.display_name}"
    puts "External ID: #{element.external_id}"
  end

end

Delete a company

Go

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// deleteCompany deletes an existing company. Companies with
// existing jobs cannot be deleted until those jobs have been deleted.
func deleteCompany(w io.Writer, projectID, companyID string) error {
	ctx := context.Background()

	// Initialize a companyService client.
	c, err := talent.NewCompanyClient(ctx)
	if err != nil {
		return fmt.Errorf("talent.NewCompanyClient: %v", err)
	}

	// Construct a deleteCompany request.
	companyName := fmt.Sprintf("projects/%s/companies/%s", projectID, companyID)
	req := &talentpb.DeleteCompanyRequest{
		// The resource name of the company to be deleted.
		// The format is "projects/{project_id}/companies/{company_id}".
		Name: companyName,
	}

	if err := c.DeleteCompany(ctx, req); err != nil {
		return fmt.Errorf("DeleteCompany(%s): %v", companyName, err)
	}

	fmt.Fprintf(w, "Deleted company: %q\n", companyName)

	return nil
}

// [END job_search_delete_company

Java

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

/*
 * Please include the following imports to run this sample.
 *
 * import com.google.cloud.talent.v4beta1.CompanyName;
 * import com.google.cloud.talent.v4beta1.CompanyServiceClient;
 * import com.google.cloud.talent.v4beta1.CompanyWithTenantName;
 * import com.google.cloud.talent.v4beta1.DeleteCompanyRequest;
 */

/** Delete Company */
public static void sampleDeleteCompany(String projectId, String tenantId, String companyId) {
  try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
    // projectId = "Your Google Cloud Project ID";
    // tenantId = "Your Tenant ID (using tenancy is optional)";
    // companyId = "ID of the company to delete";
    CompanyName name = CompanyWithTenantName.of(projectId, tenantId, companyId);
    DeleteCompanyRequest request =
        DeleteCompanyRequest.newBuilder().setName(name.toString()).build();
    companyServiceClient.deleteCompany(request);
    System.out.println("Deleted company");
  } catch (Exception exception) {
    System.err.println("Failed to create the client due to: " + exception);
  }
}

Node.js

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


const talent = require('@google-cloud/talent').v4beta1;

/** Delete Company */
function sampleDeleteCompany(projectId, tenantId, companyId) {
  const client = new talent.CompanyServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const companyId = 'ID of the company to delete';
  const formattedName = client.companyPath(projectId, tenantId, companyId);
  client.deleteCompany({name: formattedName}).catch(err => {
    console.error(err);
  });
  console.log(`Deleted company`);
}

PHP

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Talent\V4beta1\CompanyServiceClient;

/** Delete Company */
function sampleDeleteCompany($projectId, $tenantId, $companyId)
{

    $companyServiceClient = new CompanyServiceClient();

    // $projectId = 'Your Google Cloud Project ID';
    // $tenantId = 'Your Tenant ID (using tenancy is optional)';
    // $companyId = 'ID of the company to delete';
    $formattedName = $companyServiceClient->companyName($projectId, $tenantId, $companyId);

    try {
        $companyServiceClient->deleteCompany($formattedName);
        printf('Deleted company'.PHP_EOL);
    } finally {
        $companyServiceClient->close();
    }

}

Python

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


from google.cloud import talent_v4beta1
import six


def sample_delete_company(project_id, tenant_id, company_id):
    """Delete Company"""

    client = talent_v4beta1.CompanyServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_id = 'ID of the company to delete'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode('utf-8')
    if isinstance(tenant_id, six.binary_type):
        tenant_id = tenant_id.decode('utf-8')
    if isinstance(company_id, six.binary_type):
        company_id = company_id.decode('utf-8')
    name = client.company_path(project_id, tenant_id, company_id)

    client.delete_company(name)
    print('Deleted company')


Ruby

For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


# Delete Company
def sample_delete_company(project_id, tenant_id, company_id)
  # Instantiate a client
  company_client = Google::Cloud::Talent::CompanyService.new version: :v4beta1

  # project_id = "Your Google Cloud Project ID"
  # tenant_id = "Your Tenant ID (using tenancy is optional)"
  # company_id = "ID of the company to delete"
  formatted_name = company_client.class.company_path(project_id, tenant_id, company_id)

  company_client.delete_company(formatted_name)

  puts "Deleted company"

end

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...

Job Search documentation