/** 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`); }
/** * 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); }); }
const client = new talent.CompanyServiceClient();
/** 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); }); }