diff --git a/owl-bot-staging/v4/README.md b/owl-bot-staging/v4/README.md new file mode 100644 index 0000000..29e9e27 --- /dev/null +++ b/owl-bot-staging/v4/README.md @@ -0,0 +1 @@ +Talent: Nodejs Client diff --git a/owl-bot-staging/v4/linkinator.config.json b/owl-bot-staging/v4/linkinator.config.json new file mode 100644 index 0000000..29a223b --- /dev/null +++ b/owl-bot-staging/v4/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v4/package.json b/owl-bot-staging/v4/package.json new file mode 100644 index 0000000..368dac9 --- /dev/null +++ b/owl-bot-staging/v4/package.json @@ -0,0 +1,68 @@ +{ + "name": "@google-cloud/talent", + "version": "0.1.0", + "description": "Talent client for Node.js", + "repository": "googleapis/nodejs-talent", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google talent", + "talent", + "company service", + "completion", + "event service", + "job service", + "tenant service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.14.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.17.1", + "@types/sinon": "^10.0.0", + "c8": "^7.7.2", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.6", + "linkinator": "^2.13.6", + "mocha": "^8.4.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^10.0.0", + "ts-loader": "^9.2.2", + "typescript": "^4.2.4", + "webpack": "^5.37.1", + "webpack-cli": "^4.7.0" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/common.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/common.proto new file mode 100644 index 0000000..d187a17 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/common.proto @@ -0,0 +1,860 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/latlng.proto"; +import "google/type/money.proto"; +import "google/type/postal_address.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// Message representing a period of time between two timestamps. +message TimestampRange { + // Begin of the period (inclusive). + google.protobuf.Timestamp start_time = 1; + + // End of the period (exclusive). + google.protobuf.Timestamp end_time = 2; +} + +// An enum that represents the size of the company. +enum CompanySize { + // Default value if the size isn't specified. + COMPANY_SIZE_UNSPECIFIED = 0; + + // The company has less than 50 employees. + MINI = 1; + + // The company has between 50 and 99 employees. + SMALL = 2; + + // The company has between 100 and 499 employees. + SMEDIUM = 3; + + // The company has between 500 and 999 employees. + MEDIUM = 4; + + // The company has between 1,000 and 4,999 employees. + BIG = 5; + + // The company has between 5,000 and 9,999 employees. + BIGGER = 6; + + // The company has 10,000 or more employees. + GIANT = 7; +} + +// An enum that represents employee benefits included with the job. +enum JobBenefit { + // Default value if the type isn't specified. + JOB_BENEFIT_UNSPECIFIED = 0; + + // The job includes access to programs that support child care, such + // as daycare. + CHILD_CARE = 1; + + // The job includes dental services covered by a dental + // insurance plan. + DENTAL = 2; + + // The job offers specific benefits to domestic partners. + DOMESTIC_PARTNER = 3; + + // The job allows for a flexible work schedule. + FLEXIBLE_HOURS = 4; + + // The job includes health services covered by a medical insurance plan. + MEDICAL = 5; + + // The job includes a life insurance plan provided by the employer or + // available for purchase by the employee. + LIFE_INSURANCE = 6; + + // The job allows for a leave of absence to a parent to care for a newborn + // child. + PARENTAL_LEAVE = 7; + + // The job includes a workplace retirement plan provided by the + // employer or available for purchase by the employee. + RETIREMENT_PLAN = 8; + + // The job allows for paid time off due to illness. + SICK_DAYS = 9; + + // The job includes paid time off for vacation. + VACATION = 10; + + // The job includes vision services covered by a vision + // insurance plan. + VISION = 11; +} + +// Educational degree level defined in International Standard Classification +// of Education (ISCED). +enum DegreeType { + // Default value. Represents no degree, or early childhood education. + // Maps to ISCED code 0. + // Ex) Kindergarten + DEGREE_TYPE_UNSPECIFIED = 0; + + // Primary education which is typically the first stage of compulsory + // education. ISCED code 1. + // Ex) Elementary school + PRIMARY_EDUCATION = 1; + + // Lower secondary education; First stage of secondary education building on + // primary education, typically with a more subject-oriented curriculum. + // ISCED code 2. + // Ex) Middle school + LOWER_SECONDARY_EDUCATION = 2; + + // Middle education; Second/final stage of secondary education preparing for + // tertiary education and/or providing skills relevant to employment. + // Usually with an increased range of subject options and streams. ISCED + // code 3. + // Ex) High school + UPPER_SECONDARY_EDUCATION = 3; + + // Adult Remedial Education; Programmes providing learning experiences that + // build on secondary education and prepare for labour market entry and/or + // tertiary education. The content is broader than secondary but not as + // complex as tertiary education. ISCED code 4. + ADULT_REMEDIAL_EDUCATION = 4; + + // Associate's or equivalent; Short first tertiary programmes that are + // typically practically-based, occupationally-specific and prepare for + // labour market entry. These programmes may also provide a pathway to other + // tertiary programmes. ISCED code 5. + ASSOCIATES_OR_EQUIVALENT = 5; + + // Bachelor's or equivalent; Programmes designed to provide intermediate + // academic and/or professional knowledge, skills and competencies leading + // to a first tertiary degree or equivalent qualification. ISCED code 6. + BACHELORS_OR_EQUIVALENT = 6; + + // Master's or equivalent; Programmes designed to provide advanced academic + // and/or professional knowledge, skills and competencies leading to a + // second tertiary degree or equivalent qualification. ISCED code 7. + MASTERS_OR_EQUIVALENT = 7; + + // Doctoral or equivalent; Programmes designed primarily to lead to an + // advanced research qualification, usually concluding with the submission + // and defense of a substantive dissertation of publishable quality based on + // original research. ISCED code 8. + DOCTORAL_OR_EQUIVALENT = 8; +} + +// An enum that represents the employment type of a job. +enum EmploymentType { + // The default value if the employment type isn't specified. + EMPLOYMENT_TYPE_UNSPECIFIED = 0; + + // The job requires working a number of hours that constitute full + // time employment, typically 40 or more hours per week. + FULL_TIME = 1; + + // The job entails working fewer hours than a full time job, + // typically less than 40 hours a week. + PART_TIME = 2; + + // The job is offered as a contracted, as opposed to a salaried employee, + // position. + CONTRACTOR = 3; + + // The job is offered as a contracted position with the understanding + // that it's converted into a full-time position at the end of the + // contract. Jobs of this type are also returned by a search for + // [EmploymentType.CONTRACTOR][google.cloud.talent.v4.EmploymentType.CONTRACTOR] jobs. + CONTRACT_TO_HIRE = 4; + + // The job is offered as a temporary employment opportunity, usually + // a short-term engagement. + TEMPORARY = 5; + + // The job is a fixed-term opportunity for students or entry-level job + // seekers to obtain on-the-job training, typically offered as a summer + // position. + INTERN = 6; + + // The is an opportunity for an individual to volunteer, where there's no + // expectation of compensation for the provided services. + VOLUNTEER = 7; + + // The job requires an employee to work on an as-needed basis with a + // flexible schedule. + PER_DIEM = 8; + + // The job involves employing people in remote areas and flying them + // temporarily to the work site instead of relocating employees and their + // families permanently. + FLY_IN_FLY_OUT = 9; + + // The job does not fit any of the other listed types. + OTHER_EMPLOYMENT_TYPE = 10; +} + +// An enum that represents the required experience level required for the job. +enum JobLevel { + // The default value if the level isn't specified. + JOB_LEVEL_UNSPECIFIED = 0; + + // Entry-level individual contributors, typically with less than 2 years of + // experience in a similar role. Includes interns. + ENTRY_LEVEL = 1; + + // Experienced individual contributors, typically with 2+ years of + // experience in a similar role. + EXPERIENCED = 2; + + // Entry- to mid-level managers responsible for managing a team of people. + MANAGER = 3; + + // Senior-level managers responsible for managing teams of managers. + DIRECTOR = 4; + + // Executive-level managers and above, including C-level positions. + EXECUTIVE = 5; +} + +// An enum that represents the categorization or primary focus of specific +// role. This value is different than the "industry" associated with a role, +// which is related to the categorization of the company listing the job. +enum JobCategory { + // The default value if the category isn't specified. + JOB_CATEGORY_UNSPECIFIED = 0; + + // An accounting and finance job, such as an Accountant. + ACCOUNTING_AND_FINANCE = 1; + + // An administrative and office job, such as an Administrative Assistant. + ADMINISTRATIVE_AND_OFFICE = 2; + + // An advertising and marketing job, such as Marketing Manager. + ADVERTISING_AND_MARKETING = 3; + + // An animal care job, such as Veterinarian. + ANIMAL_CARE = 4; + + // An art, fashion, or design job, such as Designer. + ART_FASHION_AND_DESIGN = 5; + + // A business operations job, such as Business Operations Manager. + BUSINESS_OPERATIONS = 6; + + // A cleaning and facilities job, such as Custodial Staff. + CLEANING_AND_FACILITIES = 7; + + // A computer and IT job, such as Systems Administrator. + COMPUTER_AND_IT = 8; + + // A construction job, such as General Laborer. + CONSTRUCTION = 9; + + // A customer service job, such s Cashier. + CUSTOMER_SERVICE = 10; + + // An education job, such as School Teacher. + EDUCATION = 11; + + // An entertainment and travel job, such as Flight Attendant. + ENTERTAINMENT_AND_TRAVEL = 12; + + // A farming or outdoor job, such as Park Ranger. + FARMING_AND_OUTDOORS = 13; + + // A healthcare job, such as Registered Nurse. + HEALTHCARE = 14; + + // A human resources job, such as Human Resources Director. + HUMAN_RESOURCES = 15; + + // An installation, maintenance, or repair job, such as Electrician. + INSTALLATION_MAINTENANCE_AND_REPAIR = 16; + + // A legal job, such as Law Clerk. + LEGAL = 17; + + // A management job, often used in conjunction with another category, + // such as Store Manager. + MANAGEMENT = 18; + + // A manufacturing or warehouse job, such as Assembly Technician. + MANUFACTURING_AND_WAREHOUSE = 19; + + // A media, communications, or writing job, such as Media Relations. + MEDIA_COMMUNICATIONS_AND_WRITING = 20; + + // An oil, gas or mining job, such as Offshore Driller. + OIL_GAS_AND_MINING = 21; + + // A personal care and services job, such as Hair Stylist. + PERSONAL_CARE_AND_SERVICES = 22; + + // A protective services job, such as Security Guard. + PROTECTIVE_SERVICES = 23; + + // A real estate job, such as Buyer's Agent. + REAL_ESTATE = 24; + + // A restaurant and hospitality job, such as Restaurant Server. + RESTAURANT_AND_HOSPITALITY = 25; + + // A sales and/or retail job, such Sales Associate. + SALES_AND_RETAIL = 26; + + // A science and engineering job, such as Lab Technician. + SCIENCE_AND_ENGINEERING = 27; + + // A social services or non-profit job, such as Case Worker. + SOCIAL_SERVICES_AND_NON_PROFIT = 28; + + // A sports, fitness, or recreation job, such as Personal Trainer. + SPORTS_FITNESS_AND_RECREATION = 29; + + // A transportation or logistics job, such as Truck Driver. + TRANSPORTATION_AND_LOGISTICS = 30; +} + +// An enum that represents the job posting region. In most cases, job postings +// don't need to specify a region. If a region is given, jobs are +// eligible for searches in the specified region. +enum PostingRegion { + // If the region is unspecified, the job is only returned if it + // matches the [LocationFilter][google.cloud.talent.v4.LocationFilter]. + POSTING_REGION_UNSPECIFIED = 0; + + // In addition to exact location matching, job posting is returned when the + // [LocationFilter][google.cloud.talent.v4.LocationFilter] in the search query is in the same administrative area + // as the returned job posting. For example, if a `ADMINISTRATIVE_AREA` job + // is posted in "CA, USA", it's returned if [LocationFilter][google.cloud.talent.v4.LocationFilter] has + // "Mountain View". + // + // Administrative area refers to top-level administrative subdivision of this + // country. For example, US state, IT region, UK constituent nation and + // JP prefecture. + ADMINISTRATIVE_AREA = 1; + + // In addition to exact location matching, job is returned when + // [LocationFilter][google.cloud.talent.v4.LocationFilter] in search query is in the same country as this job. + // For example, if a `NATION_WIDE` job is posted in "USA", it's + // returned if [LocationFilter][google.cloud.talent.v4.LocationFilter] has 'Mountain View'. + NATION = 2; + + // Job allows employees to work remotely (telecommute). + // If locations are provided with this value, the job is + // considered as having a location, but telecommuting is allowed. + TELECOMMUTE = 3; +} + +// Deprecated. All resources are only visible to the owner. +// +// An enum that represents who has view access to the resource. +enum Visibility { + option deprecated = true; + + // Default value. + VISIBILITY_UNSPECIFIED = 0; + + // The resource is only visible to the GCP account who owns it. + ACCOUNT_ONLY = 1; + + // The resource is visible to the owner and may be visible to other + // applications and processes at Google. + SHARED_WITH_GOOGLE = 2; + + // The resource is visible to the owner and may be visible to all other API + // clients. + SHARED_WITH_PUBLIC = 3; +} + +// Option for HTML content sanitization on user input fields, for example, job +// description. By setting this option, user can determine whether and how +// sanitization is performed on these fields. +enum HtmlSanitization { + // Default value. + HTML_SANITIZATION_UNSPECIFIED = 0; + + // Disables sanitization on HTML input. + HTML_SANITIZATION_DISABLED = 1; + + // Sanitizes HTML input, only accepts bold, italic, ordered list, and + // unordered list markup tags. + SIMPLE_FORMATTING_ONLY = 2; +} + +// Method for commute. +enum CommuteMethod { + // Commute method isn't specified. + COMMUTE_METHOD_UNSPECIFIED = 0; + + // Commute time is calculated based on driving time. + DRIVING = 1; + + // Commute time is calculated based on public transit including bus, metro, + // subway, and so on. + TRANSIT = 2; +} + +// A resource that represents a location with full geographic information. +message Location { + // An enum which represents the type of a location. + enum LocationType { + // Default value if the type isn't specified. + LOCATION_TYPE_UNSPECIFIED = 0; + + // A country level location. + COUNTRY = 1; + + // A state or equivalent level location. + ADMINISTRATIVE_AREA = 2; + + // A county or equivalent level location. + SUB_ADMINISTRATIVE_AREA = 3; + + // A city or equivalent level location. + LOCALITY = 4; + + // A postal code level location. + POSTAL_CODE = 5; + + // A sublocality is a subdivision of a locality, for example a city borough, + // ward, or arrondissement. Sublocalities are usually recognized by a local + // political authority. For example, Manhattan and Brooklyn are recognized + // as boroughs by the City of New York, and are therefore modeled as + // sublocalities. + SUB_LOCALITY = 6; + + // A district or equivalent level location. + SUB_LOCALITY_1 = 7; + + // A smaller district or equivalent level display. + SUB_LOCALITY_2 = 8; + + // A neighborhood level location. + NEIGHBORHOOD = 9; + + // A street address level location. + STREET_ADDRESS = 10; + } + + // The type of a location, which corresponds to the address lines field of + // [google.type.PostalAddress][google.type.PostalAddress]. For example, "Downtown, Atlanta, GA, USA" + // has a type of [LocationType.NEIGHBORHOOD][google.cloud.talent.v4.Location.LocationType.NEIGHBORHOOD], and "Kansas City, KS, USA" + // has a type of [LocationType.LOCALITY][google.cloud.talent.v4.Location.LocationType.LOCALITY]. + LocationType location_type = 1; + + // Postal address of the location that includes human readable information, + // such as postal delivery and payments addresses. Given a postal address, + // a postal service can deliver items to a premises, P.O. Box, or other + // delivery location. + google.type.PostalAddress postal_address = 2; + + // An object representing a latitude/longitude pair. + google.type.LatLng lat_lng = 3; + + // Radius in miles of the job location. This value is derived from the + // location bounding box in which a circle with the specified radius + // centered from [google.type.LatLng][google.type.LatLng] covers the area associated with the + // job location. + // For example, currently, "Mountain View, CA, USA" has a radius of + // 6.17 miles. + double radius_miles = 4; +} + +// Meta information related to the job searcher or entity +// conducting the job search. This information is used to improve the +// performance of the service. +message RequestMetadata { + // Required if [allow_missing_ids][google.cloud.talent.v4.RequestMetadata.allow_missing_ids] is unset or `false`. + // + // The client-defined scope or source of the service call, which typically + // is the domain on + // which the service has been implemented and is currently being run. + // + // For example, if the service is being run by client Foo, Inc., on + // job board www.foo.com and career site www.bar.com, then this field is + // set to "foo.com" for use on the job board, and "bar.com" for use on the + // career site. + // + // Note that any improvements to the model for a particular tenant site rely + // on this field being set correctly to a unique domain. + // + // The maximum number of allowed characters is 255. + string domain = 1; + + // Required if [allow_missing_ids][google.cloud.talent.v4.RequestMetadata.allow_missing_ids] is unset or `false`. + // + // A unique session identification string. A session is defined as the + // duration of an end user's interaction with the service over a certain + // period. + // Obfuscate this field for privacy concerns before + // providing it to the service. + // + // Note that any improvements to the model for a particular tenant site rely + // on this field being set correctly to a unique session ID. + // + // The maximum number of allowed characters is 255. + string session_id = 2; + + // Required if [allow_missing_ids][google.cloud.talent.v4.RequestMetadata.allow_missing_ids] is unset or `false`. + // + // A unique user identification string, as determined by the client. + // To have the strongest positive impact on search quality + // make sure the client-level is unique. + // Obfuscate this field for privacy concerns before + // providing it to the service. + // + // Note that any improvements to the model for a particular tenant site rely + // on this field being set correctly to a unique user ID. + // + // The maximum number of allowed characters is 255. + string user_id = 3; + + // Only set when any of [domain][google.cloud.talent.v4.RequestMetadata.domain], [session_id][google.cloud.talent.v4.RequestMetadata.session_id] and [user_id][google.cloud.talent.v4.RequestMetadata.user_id] isn't + // available for some reason. It is highly recommended not to set this field + // and provide accurate [domain][google.cloud.talent.v4.RequestMetadata.domain], [session_id][google.cloud.talent.v4.RequestMetadata.session_id] and [user_id][google.cloud.talent.v4.RequestMetadata.user_id] for the + // best service experience. + bool allow_missing_ids = 4; + + // The type of device used by the job seeker at the time of the call to the + // service. + DeviceInfo device_info = 5; +} + +// Additional information returned to client, such as debugging information. +message ResponseMetadata { + // A unique id associated with this call. + // This id is logged for tracking purposes. + string request_id = 1; +} + +// Device information collected from the job seeker, candidate, or +// other entity conducting the job search. Providing this information improves +// the quality of the search results across devices. +message DeviceInfo { + // An enumeration describing an API access portal and exposure mechanism. + enum DeviceType { + // The device type isn't specified. + DEVICE_TYPE_UNSPECIFIED = 0; + + // A desktop web browser, such as, Chrome, Firefox, Safari, or Internet + // Explorer) + WEB = 1; + + // A mobile device web browser, such as a phone or tablet with a Chrome + // browser. + MOBILE_WEB = 2; + + // An Android device native application. + ANDROID = 3; + + // An iOS device native application. + IOS = 4; + + // A bot, as opposed to a device operated by human beings, such as a web + // crawler. + BOT = 5; + + // Other devices types. + OTHER = 6; + } + + // Type of the device. + DeviceType device_type = 1; + + // A device-specific ID. The ID must be a unique identifier that + // distinguishes the device from other devices. + string id = 2; +} + +// Custom attribute values that are either filterable or non-filterable. +message CustomAttribute { + // Exactly one of [string_values][google.cloud.talent.v4.CustomAttribute.string_values] or [long_values][google.cloud.talent.v4.CustomAttribute.long_values] must be specified. + // + // This field is used to perform a string match (`CASE_SENSITIVE_MATCH` or + // `CASE_INSENSITIVE_MATCH`) search. + // For filterable `string_value`s, a maximum total number of 200 values + // is allowed, with each `string_value` has a byte size of no more than + // 500B. For unfilterable `string_values`, the maximum total byte size of + // unfilterable `string_values` is 50KB. + // + // Empty string isn't allowed. + repeated string string_values = 1; + + // Exactly one of [string_values][google.cloud.talent.v4.CustomAttribute.string_values] or [long_values][google.cloud.talent.v4.CustomAttribute.long_values] must be specified. + // + // This field is used to perform number range search. + // (`EQ`, `GT`, `GE`, `LE`, `LT`) over filterable `long_value`. + // + // Currently at most 1 [long_values][google.cloud.talent.v4.CustomAttribute.long_values] is supported. + repeated int64 long_values = 2; + + // If the `filterable` flag is true, the custom field values may be used for + // custom attribute filters [JobQuery.custom_attribute_filter][google.cloud.talent.v4.JobQuery.custom_attribute_filter]. + // If false, these values may not be used for custom attribute filters. + // + // Default is false. + bool filterable = 3; + + // If the `keyword_searchable` flag is true, the keywords in custom fields are + // searchable by keyword match. + // If false, the values are not searchable by keyword match. + // + // Default is false. + bool keyword_searchable = 4; +} + +// Spell check result. +message SpellingCorrection { + // Indicates if the query was corrected by the spell checker. + bool corrected = 1; + + // Correction output consisting of the corrected keyword string. + string corrected_text = 2; + + // Corrected output with html tags to highlight the corrected words. + // Corrected words are called out with the "..." html tags. + // + // For example, the user input query is "software enginear", where the second + // word, "enginear," is incorrect. It should be "engineer". When spelling + // correction is enabled, this value is + // "software engineer". + string corrected_html = 3; +} + +// Job compensation details. +message CompensationInfo { + // A compensation entry that represents one component of compensation, such + // as base pay, bonus, or other compensation type. + // + // Annualization: One compensation entry can be annualized if + // - it contains valid [amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] or [range][google.cloud.talent.v4.CompensationInfo.CompensationEntry.range]. + // - and its [expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year] is set or can be derived. + // Its annualized range is determined as ([amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] or [range][google.cloud.talent.v4.CompensationInfo.CompensationEntry.range]) times + // [expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year]. + message CompensationEntry { + // Compensation type. + // + // Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. + CompensationType type = 1; + + // Frequency of the specified amount. + // + // Default is [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED]. + CompensationUnit unit = 2; + + // Compensation amount. It could be a fixed amount or a floating range. + oneof compensation_amount { + // Compensation amount. + google.type.Money amount = 3; + + // Compensation range. + CompensationRange range = 4; + } + + // Compensation description. For example, could + // indicate equity terms or provide additional context to an estimated + // bonus. + string description = 5; + + // Expected number of units paid each year. If not specified, when + // [Job.employment_types][google.cloud.talent.v4.Job.employment_types] is FULLTIME, a default value is inferred + // based on [unit][google.cloud.talent.v4.CompensationInfo.CompensationEntry.unit]. Default values: + // - HOURLY: 2080 + // - DAILY: 260 + // - WEEKLY: 52 + // - MONTHLY: 12 + // - ANNUAL: 1 + google.protobuf.DoubleValue expected_units_per_year = 6; + } + + // Compensation range. + message CompensationRange { + // The maximum amount of compensation. If left empty, the value is set + // to a maximal compensation value and the currency code is set to + // match the [currency code][google.type.Money.currency_code] of + // min_compensation. + google.type.Money max_compensation = 2; + + // The minimum amount of compensation. If left empty, the value is set + // to zero and the currency code is set to match the + // [currency code][google.type.Money.currency_code] of max_compensation. + google.type.Money min_compensation = 1; + } + + // The type of compensation. + // + // For compensation amounts specified in non-monetary amounts, + // describe the compensation scheme in the [CompensationEntry.description][google.cloud.talent.v4.CompensationInfo.CompensationEntry.description]. + // + // For example, tipping format is described in + // [CompensationEntry.description][google.cloud.talent.v4.CompensationInfo.CompensationEntry.description] (for example, "expect 15-20% tips based + // on customer bill.") and an estimate of the tips provided in + // [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] or [CompensationEntry.range][google.cloud.talent.v4.CompensationInfo.CompensationEntry.range] ($10 per hour). + // + // For example, equity is described in [CompensationEntry.description][google.cloud.talent.v4.CompensationInfo.CompensationEntry.description] + // (for example, "1% - 2% equity vesting over 4 years, 1 year cliff") and + // value estimated in [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] or + // [CompensationEntry.range][google.cloud.talent.v4.CompensationInfo.CompensationEntry.range]. If no value estimate is possible, units are + // [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED] and then further + // clarified in [CompensationEntry.description][google.cloud.talent.v4.CompensationInfo.CompensationEntry.description] field. + enum CompensationType { + // Default value. + COMPENSATION_TYPE_UNSPECIFIED = 0; + + // Base compensation: Refers to the fixed amount of money paid to an + // employee by an employer in return for work performed. Base compensation + // does not include benefits, bonuses or any other potential compensation + // from an employer. + BASE = 1; + + // Bonus. + BONUS = 2; + + // Signing bonus. + SIGNING_BONUS = 3; + + // Equity. + EQUITY = 4; + + // Profit sharing. + PROFIT_SHARING = 5; + + // Commission. + COMMISSIONS = 6; + + // Tips. + TIPS = 7; + + // Other compensation type. + OTHER_COMPENSATION_TYPE = 8; + } + + // Pay frequency. + enum CompensationUnit { + // Default value. + COMPENSATION_UNIT_UNSPECIFIED = 0; + + // Hourly. + HOURLY = 1; + + // Daily. + DAILY = 2; + + // Weekly + WEEKLY = 3; + + // Monthly. + MONTHLY = 4; + + // Yearly. + YEARLY = 5; + + // One time. + ONE_TIME = 6; + + // Other compensation units. + OTHER_COMPENSATION_UNIT = 7; + } + + // Job compensation information. + // + // At most one entry can be of type + // [CompensationInfo.CompensationType.BASE][google.cloud.talent.v4.CompensationInfo.CompensationType.BASE], which is + // referred as **base compensation entry** for the job. + repeated CompensationEntry entries = 1; + + // Output only. Annualized base compensation range. Computed as base compensation entry's + // [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] times + // [CompensationEntry.expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year]. + // + // See [CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for explanation on compensation annualization. + CompensationRange annualized_base_compensation_range = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Annualized total compensation range. Computed as all compensation entries' + // [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] times + // [CompensationEntry.expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year]. + // + // See [CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for explanation on compensation annualization. + CompensationRange annualized_total_compensation_range = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata used for long running operations returned by CTS batch APIs. +// It's used to replace [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. +message BatchOperationMetadata { + enum State { + // Default value. + STATE_UNSPECIFIED = 0; + + // The batch operation is being prepared for processing. + INITIALIZING = 1; + + // The batch operation is actively being processed. + PROCESSING = 2; + + // The batch operation is processed, and at least one item has been + // successfully processed. + SUCCEEDED = 3; + + // The batch operation is done and no item has been successfully processed. + FAILED = 4; + + // The batch operation is in the process of cancelling after + // [google.longrunning.Operations.CancelOperation][google.longrunning.Operations.CancelOperation] is called. + CANCELLING = 5; + + // The batch operation is done after + // [google.longrunning.Operations.CancelOperation][google.longrunning.Operations.CancelOperation] is called. Any items + // processed before cancelling are returned in the response. + CANCELLED = 6; + } + + // The state of a long running operation. + State state = 1; + + // More detailed information about operation state. + string state_description = 2; + + // Count of successful item(s) inside an operation. + int32 success_count = 3; + + // Count of failed item(s) inside an operation. + int32 failure_count = 4; + + // Count of total item(s) inside an operation. + int32 total_count = 5; + + // The time when the batch operation is created. + google.protobuf.Timestamp create_time = 6; + + // The time when the batch operation status is updated. The metadata and the + // [update_time][google.cloud.talent.v4.BatchOperationMetadata.update_time] is refreshed every minute otherwise cached data is + // returned. + google.protobuf.Timestamp update_time = 7; + + // The time when the batch operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to `true`. + google.protobuf.Timestamp end_time = 8; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/company.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/company.proto new file mode 100644 index 0000000..c6b61a2 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/company.proto @@ -0,0 +1,115 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "CompanyProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A Company resource represents a company in the service. A company is the +// entity that owns job postings, that is, the hiring entity responsible for +// employing applicants for the job position. +message Company { + option (google.api.resource) = { + type: "jobs.googleapis.com/Company" + pattern: "projects/{project}/tenants/{tenant}/companies/{company}" + }; + + // Derived details about the company. + message DerivedInfo { + // A structured headquarters location of the company, resolved from + // [Company.headquarters_address][google.cloud.talent.v4.Company.headquarters_address] if provided. + Location headquarters_location = 1; + } + + // Required during company update. + // + // The resource name for a company. This is generated by the service when a + // company is created. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/foo/tenants/bar/companies/baz". + string name = 1; + + // Required. The display name of the company, for example, "Google LLC". + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Client side company identifier, used to uniquely identify the + // company. + // + // The maximum number of allowed characters is 255. + string external_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // The employer's company size. + CompanySize size = 4; + + // The street address of the company's main headquarters, which may be + // different from the job location. The service attempts + // to geolocate the provided address, and populates a more specific + // location wherever possible in [DerivedInfo.headquarters_location][google.cloud.talent.v4.Company.DerivedInfo.headquarters_location]. + string headquarters_address = 5; + + // Set to true if it is the hiring agency that post jobs for other + // employers. + // + // Defaults to false if not provided. + bool hiring_agency = 6; + + // Equal Employment Opportunity legal disclaimer text to be + // associated with all jobs, and typically to be displayed in all + // roles. + // + // The maximum number of allowed characters is 500. + string eeo_text = 7; + + // The URI representing the company's primary web site or home page, + // for example, "https://www.google.com". + // + // The maximum number of allowed characters is 255. + string website_uri = 8; + + // The URI to employer's career site or careers page on the employer's web + // site, for example, "https://careers.google.com". + string career_site_uri = 9; + + // A URI that hosts the employer's company logo. + string image_uri = 10; + + // A list of keys of filterable [Job.custom_attributes][google.cloud.talent.v4.Job.custom_attributes], whose + // corresponding `string_values` are used in keyword searches. Jobs with + // `string_values` under these specified field keys are returned if any + // of the values match the search keyword. Custom field values with + // parenthesis, brackets and special symbols are not searchable as-is, + // and those keyword queries must be surrounded by quotes. + repeated string keyword_searchable_job_custom_attributes = 11; + + // Output only. Derived details about the company. + DerivedInfo derived_info = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether a company is flagged to be suspended from + // public availability by the service when job content appears suspicious, + // abusive, or spammy. + bool suspended = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/company_service.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/company_service.proto new file mode 100644 index 0000000..54ee480 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/company_service.proto @@ -0,0 +1,187 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/cloud/talent/v4/company.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "CompanyServiceProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A service that handles company management, including CRUD and enumeration. +service CompanyService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new company entity. + rpc CreateCompany(CreateCompanyRequest) returns (Company) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/companies" + body: "company" + }; + option (google.api.method_signature) = "parent,company"; + } + + // Retrieves specified company. + rpc GetCompany(GetCompanyRequest) returns (Company) { + option (google.api.http) = { + get: "/v4/{name=projects/*/tenants/*/companies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified company. + rpc UpdateCompany(UpdateCompanyRequest) returns (Company) { + option (google.api.http) = { + patch: "/v4/{company.name=projects/*/tenants/*/companies/*}" + body: "company" + }; + option (google.api.method_signature) = "company,update_mask"; + } + + // Deletes specified company. + // Prerequisite: The company has no jobs associated with it. + rpc DeleteCompany(DeleteCompanyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4/{name=projects/*/tenants/*/companies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all companies associated with the project. + rpc ListCompanies(ListCompaniesRequest) returns (ListCompaniesResponse) { + option (google.api.http) = { + get: "/v4/{parent=projects/*/tenants/*}/companies" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The Request of the CreateCompany method. +message CreateCompanyRequest { + // Required. Resource name of the tenant under which the company is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // Required. The company to be created. + Company company = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for getting a company by name. +message GetCompanyRequest { + // Required. The resource name of the company to be retrieved. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/api-test-project/tenants/foo/companies/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + } + ]; +} + +// Request for updating a specified company. +message UpdateCompanyRequest { + // Required. The company resource to replace the current resource in the system. + Company company = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4.UpdateCompanyRequest.update_mask] is provided, only the specified fields in + // [company][google.cloud.talent.v4.UpdateCompanyRequest.company] are updated. Otherwise all the fields are updated. + // + // A field mask to specify the company fields to be updated. Only + // top level fields of [Company][google.cloud.talent.v4.Company] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to delete a company. +message DeleteCompanyRequest { + // Required. The resource name of the company to be deleted. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/foo/tenants/bar/companies/baz". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + } + ]; +} + +// List companies for which the client has ACL visibility. +message ListCompaniesRequest { + // Required. Resource name of the tenant under which the company is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // The starting indicator from which to return results. + string page_token = 2; + + // The maximum number of companies to be returned, at most 100. + // Default is 100 if a non-positive number is provided. + int32 page_size = 3; + + // Set to true if the companies requested must have open jobs. + // + // Defaults to false. + // + // If true, at most [page_size][google.cloud.talent.v4.ListCompaniesRequest.page_size] of companies are fetched, among which + // only those with open jobs are returned. + bool require_open_jobs = 4; +} + +// The List companies response object. +message ListCompaniesResponse { + // Companies for the current client. + repeated Company companies = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/completion_service.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/completion_service.proto new file mode 100644 index 0000000..73af1e8 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/completion_service.proto @@ -0,0 +1,154 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/api/client.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "CompletionServiceProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A service handles auto completion. +service Completion { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Completes the specified prefix with keyword suggestions. + // Intended for use by a job search auto-complete search box. + rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { + option (google.api.http) = { + get: "/v4/{tenant=projects/*/tenants/*}:completeQuery" + }; + } +} + +// Auto-complete parameters. +message CompleteQueryRequest { + // Enum to specify the scope of completion. + enum CompletionScope { + // Default value. + COMPLETION_SCOPE_UNSPECIFIED = 0; + + // Suggestions are based only on the data provided by the client. + TENANT = 1; + + // Suggestions are based on all jobs data in the system that's visible to + // the client + PUBLIC = 2; + } + + // Enum to specify auto-completion topics. + enum CompletionType { + // Default value. + COMPLETION_TYPE_UNSPECIFIED = 0; + + // Suggest job titles for jobs autocomplete. + // + // For [CompletionType.JOB_TITLE][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.JOB_TITLE] type, only open jobs with the same + // [language_codes][google.cloud.talent.v4.CompleteQueryRequest.language_codes] are returned. + JOB_TITLE = 1; + + // Suggest company names for jobs autocomplete. + // + // For [CompletionType.COMPANY_NAME][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMPANY_NAME] type, + // only companies having open jobs with the same [language_codes][google.cloud.talent.v4.CompleteQueryRequest.language_codes] are + // returned. + COMPANY_NAME = 2; + + // Suggest both job titles and company names for jobs autocomplete. + // + // For [CompletionType.COMBINED][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED] type, only open jobs with the same + // [language_codes][google.cloud.talent.v4.CompleteQueryRequest.language_codes] or companies having open jobs with the same + // [language_codes][google.cloud.talent.v4.CompleteQueryRequest.language_codes] are returned. + COMBINED = 3; + } + + // Required. Resource name of tenant the completion is performed within. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string tenant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // Required. The query used to generate suggestions. + // + // The maximum number of allowed characters is 255. + string query = 2 [(google.api.field_behavior) = REQUIRED]; + + // The list of languages of the query. This is + // the BCP-47 language code, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // The maximum number of allowed characters is 255. + repeated string language_codes = 3; + + // Required. Completion result count. + // + // The maximum allowed page size is 10. + int32 page_size = 4 [(google.api.field_behavior) = REQUIRED]; + + // If provided, restricts completion to specified company. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/foo/tenants/bar/companies/baz". + string company = 5 [(google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + }]; + + // The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4.CompleteQueryRequest.CompletionScope.PUBLIC]. + CompletionScope scope = 6; + + // The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED]. + CompletionType type = 7; +} + +// Response of auto-complete query. +message CompleteQueryResponse { + // Resource that represents completion results. + message CompletionResult { + // The suggestion for the query. + string suggestion = 1; + + // The completion topic. + CompleteQueryRequest.CompletionType type = 2; + + // The URI of the company image for + // [COMPANY_NAME][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMPANY_NAME]. + string image_uri = 3; + } + + // Results of the matching job/company candidates. + repeated CompletionResult completion_results = 1; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 2; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/event.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/event.proto new file mode 100644 index 0000000..874228e --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/event.proto @@ -0,0 +1,171 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "EventProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// An event issued when an end user interacts with the application that +// implements Cloud Talent Solution. Providing this information improves the +// quality of results for the API clients, enabling the +// service to perform optimally. The number of events sent must be consistent +// with other calls, such as job searches, issued to the service by the client. +message ClientEvent { + // Strongly recommended for the best service experience. + // + // A unique ID generated in the API responses. It can be found in + // [ResponseMetadata.request_id][google.cloud.talent.v4.ResponseMetadata.request_id]. + string request_id = 1; + + // Required. A unique identifier, generated by the client application. + string event_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The timestamp of the event. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. + // + // The detail information of a specific event type. + oneof event { + // An event issued when a job seeker interacts with the application that + // implements Cloud Talent Solution. + JobEvent job_event = 5; + } + + // Notes about the event provided by recruiters or other users, for example, + // feedback on why a job was bookmarked. + string event_notes = 9; +} + +// An event issued when a job seeker interacts with the application that +// implements Cloud Talent Solution. +message JobEvent { + // An enumeration of an event attributed to the behavior of the end user, + // such as a job seeker. + enum JobEventType { + // The event is unspecified by other provided values. + JOB_EVENT_TYPE_UNSPECIFIED = 0; + + // The job seeker or other entity interacting with the service has + // had a job rendered in their view, such as in a list of search results in + // a compressed or clipped format. This event is typically associated with + // the viewing of a jobs list on a single page by a job seeker. + IMPRESSION = 1; + + // The job seeker, or other entity interacting with the service, has + // viewed the details of a job, including the full description. This + // event doesn't apply to the viewing a snippet of a job appearing as a + // part of the job search results. Viewing a snippet is associated with an + // [impression][google.cloud.talent.v4.JobEvent.JobEventType.IMPRESSION]). + VIEW = 2; + + // The job seeker or other entity interacting with the service + // performed an action to view a job and was redirected to a different + // website for job. + VIEW_REDIRECT = 3; + + // The job seeker or other entity interacting with the service + // began the process or demonstrated the intention of applying for a job. + APPLICATION_START = 4; + + // The job seeker or other entity interacting with the service + // submitted an application for a job. + APPLICATION_FINISH = 5; + + // The job seeker or other entity interacting with the service + // submitted an application for a job with a single click without + // entering information. If a job seeker performs this action, send only + // this event to the service. Do not also send + // [JobEventType.APPLICATION_START][google.cloud.talent.v4.JobEvent.JobEventType.APPLICATION_START] or [JobEventType.APPLICATION_FINISH][google.cloud.talent.v4.JobEvent.JobEventType.APPLICATION_FINISH] + // events. + APPLICATION_QUICK_SUBMISSION = 6; + + // The job seeker or other entity interacting with the service + // performed an action to apply to a job and was redirected to a different + // website to complete the application. + APPLICATION_REDIRECT = 7; + + // The job seeker or other entity interacting with the service began the + // process or demonstrated the intention of applying for a job from the + // search results page without viewing the details of the job posting. + // If sending this event, JobEventType.VIEW event shouldn't be sent. + APPLICATION_START_FROM_SEARCH = 8; + + // The job seeker, or other entity interacting with the service, performs an + // action with a single click from the search results page to apply to a job + // (without viewing the details of the job posting), and is redirected + // to a different website to complete the application. If a candidate + // performs this action, send only this event to the service. Do not also + // send [JobEventType.APPLICATION_START][google.cloud.talent.v4.JobEvent.JobEventType.APPLICATION_START], + // [JobEventType.APPLICATION_FINISH][google.cloud.talent.v4.JobEvent.JobEventType.APPLICATION_FINISH] or [JobEventType.VIEW][google.cloud.talent.v4.JobEvent.JobEventType.VIEW] events. + APPLICATION_REDIRECT_FROM_SEARCH = 9; + + // This event should be used when a company submits an application + // on behalf of a job seeker. This event is intended for use by staffing + // agencies attempting to place candidates. + APPLICATION_COMPANY_SUBMIT = 10; + + // The job seeker or other entity interacting with the service demonstrated + // an interest in a job by bookmarking or saving it. + BOOKMARK = 11; + + // The job seeker or other entity interacting with the service was + // sent a notification, such as an email alert or device notification, + // containing one or more jobs listings generated by the service. + NOTIFICATION = 12; + + // The job seeker or other entity interacting with the service was + // employed by the hiring entity (employer). Send this event + // only if the job seeker was hired through an application that was + // initiated by a search conducted through the Cloud Talent Solution + // service. + HIRED = 13; + + // A recruiter or staffing agency submitted an application on behalf of the + // candidate after interacting with the service to identify a suitable job + // posting. + SENT_CV = 14; + + // The entity interacting with the service (for example, the job seeker), + // was granted an initial interview by the hiring entity (employer). This + // event should only be sent if the job seeker was granted an interview as + // part of an application that was initiated by a search conducted through / + // recommendation provided by the Cloud Talent Solution service. + INTERVIEW_GRANTED = 15; + } + + // Required. The type of the event (see [JobEventType][google.cloud.talent.v4.JobEvent.JobEventType]). + JobEventType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The [job name(s)][google.cloud.talent.v4.Job.name] associated with this event. + // For example, if this is an [impression][google.cloud.talent.v4.JobEvent.JobEventType.IMPRESSION] event, + // this field contains the identifiers of all jobs shown to the job seeker. + // If this was a [view][google.cloud.talent.v4.JobEvent.JobEventType.VIEW] event, this field contains the + // identifier of the viewed job. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for + // example, "projects/foo/tenants/bar/jobs/baz". + repeated string jobs = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/event_service.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/event_service.proto new file mode 100644 index 0000000..0f18136 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/event_service.proto @@ -0,0 +1,70 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/event.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "EventServiceProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A service handles client event report. +service EventService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Report events issued when end user interacts with customer's application + // that uses Cloud Talent Solution. You may inspect the created events in + // [self service + // tools](https://console.cloud.google.com/talent-solution/overview). + // [Learn + // more](https://cloud.google.com/talent-solution/docs/management-tools) + // about self service tools. + rpc CreateClientEvent(CreateClientEventRequest) returns (ClientEvent) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/clientEvents" + body: "client_event" + }; + option (google.api.method_signature) = "parent,client_event"; + } +} + +// The report event request. +message CreateClientEventRequest { + // Required. Resource name of the tenant under which the event is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // Required. Events issued when end user interacts with customer's application that + // uses Cloud Talent Solution. + ClientEvent client_event = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/filters.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/filters.proto new file mode 100644 index 0000000..a0063ca --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/filters.proto @@ -0,0 +1,338 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/field_behavior.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/protobuf/duration.proto"; +import "google/type/latlng.proto"; +import "google/type/timeofday.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "FiltersProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// The query required to perform a search query. +message JobQuery { + // The query string that matches against the job title, description, and + // location fields. + // + // The maximum number of allowed characters is 255. + string query = 1; + + // The language code of [query][google.cloud.talent.v4.JobQuery.query]. For example, "en-US". This field helps to + // better interpret the query. + // + // If a value isn't specified, the query language code is automatically + // detected, which may not be accurate. + // + // Language code should be in BCP-47 format, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + string query_language_code = 14; + + // This filter specifies the company entities to search against. + // + // If a value isn't specified, jobs are searched for against all + // companies. + // + // If multiple values are specified, jobs are searched against the + // companies specified. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For + // example, "projects/foo/tenants/bar/companies/baz". + // + // At most 20 company filters are allowed. + repeated string companies = 2; + + // The location filter specifies geo-regions containing the jobs to + // search against. See [LocationFilter][google.cloud.talent.v4.LocationFilter] for more information. + // + // If a location value isn't specified, jobs fitting the other search + // criteria are retrieved regardless of where they're located. + // + // If multiple values are specified, jobs are retrieved from any of the + // specified locations. If different values are specified for the + // [LocationFilter.distance_in_miles][google.cloud.talent.v4.LocationFilter.distance_in_miles] parameter, the maximum provided + // distance is used for all locations. + // + // At most 5 location filters are allowed. + repeated LocationFilter location_filters = 3; + + // The category filter specifies the categories of jobs to search against. + // See [JobCategory][google.cloud.talent.v4.JobCategory] for more information. + // + // If a value isn't specified, jobs from any category are searched against. + // + // If multiple values are specified, jobs from any of the specified + // categories are searched against. + repeated JobCategory job_categories = 4; + + // Allows filtering jobs by commute time with different travel methods (for + // example, driving or public transit). + // + // Note: This only works when you specify a [CommuteMethod][google.cloud.talent.v4.CommuteMethod]. In this case, + // [location_filters][google.cloud.talent.v4.JobQuery.location_filters] is ignored. + // + // Currently we don't support sorting by commute time. + CommuteFilter commute_filter = 5; + + // This filter specifies the exact company [Company.display_name][google.cloud.talent.v4.Company.display_name] + // of the jobs to search against. + // + // If a value isn't specified, jobs within the search results are + // associated with any company. + // + // If multiple values are specified, jobs within the search results may be + // associated with any of the specified companies. + // + // At most 20 company display name filters are allowed. + repeated string company_display_names = 6; + + // This search filter is applied only to + // [Job.compensation_info][google.cloud.talent.v4.Job.compensation_info]. For example, if the filter is specified + // as "Hourly job with per-hour compensation > $15", only jobs meeting + // these criteria are searched. If a filter isn't defined, all open jobs + // are searched. + CompensationFilter compensation_filter = 7; + + // This filter specifies a structured syntax to match against the + // [Job.custom_attributes][google.cloud.talent.v4.Job.custom_attributes] marked as `filterable`. + // + // The syntax for this expression is a subset of SQL syntax. + // + // Supported operators are: `=`, `!=`, `<`, `<=`, `>`, and `>=` where the + // left of the operator is a custom field key and the right of the operator + // is a number or a quoted string. You must escape backslash (\\) and + // quote (\") characters. + // + // Supported functions are `LOWER([field_name])` to + // perform a case insensitive match and `EMPTY([field_name])` to filter on the + // existence of a key. + // + // Boolean expressions (AND/OR/NOT) are supported up to 3 levels of + // nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 100 + // comparisons or functions are allowed in the expression. The expression + // must be < 6000 bytes in length. + // + // Sample Query: + // `(LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND + // driving_years > 10` + string custom_attribute_filter = 8; + + // This flag controls the spell-check feature. If false, the + // service attempts to correct a misspelled query, + // for example, "enginee" is corrected to "engineer". + // + // Defaults to false: a spell check is performed. + bool disable_spell_check = 9; + + // The employment type filter specifies the employment type of jobs to + // search against, such as [EmploymentType.FULL_TIME][google.cloud.talent.v4.EmploymentType.FULL_TIME]. + // + // If a value isn't specified, jobs in the search results includes any + // employment type. + // + // If multiple values are specified, jobs in the search results include + // any of the specified employment types. + repeated EmploymentType employment_types = 10; + + // This filter specifies the locale of jobs to search against, + // for example, "en-US". + // + // If a value isn't specified, the search results can contain jobs in any + // locale. + // + // + // Language codes should be in BCP-47 format, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // At most 10 language code filters are allowed. + repeated string language_codes = 11; + + // Jobs published within a range specified by this filter are searched + // against. + TimestampRange publish_time_range = 12; + + // This filter specifies a list of job names to be excluded during search. + // + // At most 400 excluded job names are allowed. + repeated string excluded_jobs = 13; +} + +// Geographic region of the search. +message LocationFilter { + // Specify whether to include telecommute jobs. + enum TelecommutePreference { + // Default value if the telecommute preference isn't specified. + TELECOMMUTE_PREFERENCE_UNSPECIFIED = 0; + + // Exclude telecommute jobs. + TELECOMMUTE_EXCLUDED = 1; + + // Allow telecommute jobs. + TELECOMMUTE_ALLOWED = 2; + } + + // The address name, such as "Mountain View" or "Bay Area". + string address = 1; + + // CLDR region code of the country/region of the address. This is used + // to address ambiguity of the user-input location, for example, "Liverpool" + // against "Liverpool, NY, US" or "Liverpool, UK". + // + // Set this field to bias location resolution toward a specific country + // or territory. If this field is not set, application behavior is biased + // toward the United States by default. + // + // See + // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + // for details. Example: "CH" for Switzerland. + string region_code = 2; + + // The latitude and longitude of the geographic center to search from. This + // field is ignored if `address` is provided. + google.type.LatLng lat_lng = 3; + + // The distance_in_miles is applied when the location being searched for is + // identified as a city or smaller. This field is ignored if the location + // being searched for is a state or larger. + double distance_in_miles = 4; + + // Allows the client to return jobs without a + // set location, specifically, telecommuting jobs (telecommuting is considered + // by the service as a special location. + // [Job.posting_region][google.cloud.talent.v4.Job.posting_region] indicates if a job permits telecommuting. + // If this field is set to [TelecommutePreference.TELECOMMUTE_ALLOWED][google.cloud.talent.v4.LocationFilter.TelecommutePreference.TELECOMMUTE_ALLOWED], + // telecommuting jobs are searched, and [address][google.cloud.talent.v4.LocationFilter.address] and [lat_lng][google.cloud.talent.v4.LocationFilter.lat_lng] are + // ignored. If not set or set to + // [TelecommutePreference.TELECOMMUTE_EXCLUDED][google.cloud.talent.v4.LocationFilter.TelecommutePreference.TELECOMMUTE_EXCLUDED], telecommute job are not + // searched. + // + // This filter can be used by itself to search exclusively for telecommuting + // jobs, or it can be combined with another location + // filter to search for a combination of job locations, + // such as "Mountain View" or "telecommuting" jobs. However, when used in + // combination with other location filters, telecommuting jobs can be + // treated as less relevant than other jobs in the search response. + // + // This field is only used for job search requests. + TelecommutePreference telecommute_preference = 5; +} + +// Filter on job compensation type and amount. +message CompensationFilter { + // Specify the type of filtering. + enum FilterType { + // Filter type unspecified. Position holder, INVALID, should never be used. + FILTER_TYPE_UNSPECIFIED = 0; + + // Filter by `base compensation entry's` unit. A job is a match if and + // only if the job contains a base CompensationEntry and the base + // CompensationEntry's unit matches provided [units][google.cloud.talent.v4.CompensationFilter.units]. + // Populate one or more [units][google.cloud.talent.v4.CompensationFilter.units]. + // + // See [CompensationInfo.CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for definition of + // base compensation entry. + UNIT_ONLY = 1; + + // Filter by `base compensation entry's` unit and amount / range. A job + // is a match if and only if the job contains a base CompensationEntry, and + // the base entry's unit matches provided + // [CompensationUnit][google.cloud.talent.v4.CompensationInfo.CompensationUnit] and + // amount or range overlaps with provided + // [CompensationRange][google.cloud.talent.v4.CompensationInfo.CompensationRange]. + // + // See [CompensationInfo.CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for definition of + // base compensation entry. + // + // Set exactly one [units][google.cloud.talent.v4.CompensationFilter.units] and populate [range][google.cloud.talent.v4.CompensationFilter.range]. + UNIT_AND_AMOUNT = 2; + + // Filter by annualized base compensation amount and `base compensation + // entry's` unit. Populate [range][google.cloud.talent.v4.CompensationFilter.range] and zero or more [units][google.cloud.talent.v4.CompensationFilter.units]. + ANNUALIZED_BASE_AMOUNT = 3; + + // Filter by annualized total compensation amount and `base compensation + // entry's` unit . Populate [range][google.cloud.talent.v4.CompensationFilter.range] and zero or more [units][google.cloud.talent.v4.CompensationFilter.units]. + ANNUALIZED_TOTAL_AMOUNT = 4; + } + + // Required. Type of filter. + FilterType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specify desired `base compensation entry's` + // [CompensationInfo.CompensationUnit][google.cloud.talent.v4.CompensationInfo.CompensationUnit]. + repeated CompensationInfo.CompensationUnit units = 2 [(google.api.field_behavior) = REQUIRED]; + + // Compensation range. + CompensationInfo.CompensationRange range = 3; + + // If set to true, jobs with unspecified compensation range fields are + // included. + bool include_jobs_with_unspecified_compensation_range = 4; +} + +// Parameters needed for commute search. +message CommuteFilter { + // The traffic density to use when calculating commute time. + enum RoadTraffic { + // Road traffic situation isn't specified. + ROAD_TRAFFIC_UNSPECIFIED = 0; + + // Optimal commute time without considering any traffic impact. + TRAFFIC_FREE = 1; + + // Commute time calculation takes in account the peak traffic impact. + BUSY_HOUR = 2; + } + + // Required. The method of transportation to calculate the commute time for. + CommuteMethod commute_method = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The latitude and longitude of the location to calculate the + // commute time from. + google.type.LatLng start_coordinates = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The maximum travel time in seconds. The maximum allowed value is `3600s` + // (one hour). Format is `123s`. + google.protobuf.Duration travel_duration = 3 [(google.api.field_behavior) = REQUIRED]; + + // If `true`, jobs without street level addresses may also be returned. + // For city level addresses, the city center is used. For state and coarser + // level addresses, text matching is used. + // If this field is set to `false` or isn't specified, only jobs that include + // street level addresses will be returned by commute search. + bool allow_imprecise_addresses = 4; + + // Traffic factor to take into account while searching by commute. + oneof traffic_option { + // Specifies the traffic density to use when calculating commute time. + RoadTraffic road_traffic = 5; + + // The departure time used to calculate traffic impact, represented as + // [google.type.TimeOfDay][google.type.TimeOfDay] in local time zone. + // + // Currently traffic model is restricted to hour level resolution. + google.type.TimeOfDay departure_time = 6; + } +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/histogram.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/histogram.proto new file mode 100644 index 0000000..df4fbbb --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/histogram.proto @@ -0,0 +1,52 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "HistogramProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// The histogram request. +message HistogramQuery { + // An expression specifies a histogram request against matching jobs for + // searches. + // + // See [SearchJobsRequest.histogram_queries][google.cloud.talent.v4.SearchJobsRequest.histogram_queries] for details about syntax. + string histogram_query = 1; +} + +// Histogram result that matches [HistogramQuery][google.cloud.talent.v4.HistogramQuery] specified in searches. +message HistogramQueryResult { + // Requested histogram expression. + string histogram_query = 1; + + // A map from the values of the facet associated with distinct values to the + // number of matching entries with corresponding value. + // + // The key format is: + // + // * (for string histogram) string values stored in the field. + // * (for named numeric bucket) name specified in `bucket()` function, like + // for `bucket(0, MAX, "non-negative")`, the key will be `non-negative`. + // * (for anonymous numeric bucket) range formatted as `-`, for + // example, `0-1000`, `MIN-0`, and `0-MAX`. + map histogram = 2; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/job.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/job.proto new file mode 100644 index 0000000..4c24f43 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/job.proto @@ -0,0 +1,342 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "JobProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A Job resource represents a job posting (also referred to as a "job listing" +// or "job requisition"). A job belongs to a [Company][google.cloud.talent.v4.Company], which is the hiring +// entity responsible for the job. +message Job { + option (google.api.resource) = { + type: "jobs.googleapis.com/Job" + pattern: "projects/{project}/tenants/{tenant}/jobs/{job}" + }; + + // Application related details of a job posting. + message ApplicationInfo { + // Use this field to specify email address(es) to which resumes or + // applications can be sent. + // + // The maximum number of allowed characters for each entry is 255. + repeated string emails = 1; + + // Use this field to provide instructions, such as "Mail your application + // to ...", that a candidate can follow to apply for the job. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 3,000. + string instruction = 2; + + // Use this URI field to direct an applicant to a website, for example to + // link to an online application form. + // + // The maximum number of allowed characters for each entry is 2,000. + repeated string uris = 3; + } + + // Derived details about the job posting. + message DerivedInfo { + // Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4.Job.addresses]. + // + // [locations][google.cloud.talent.v4.Job.DerivedInfo.locations] are exactly matched to [Job.addresses][google.cloud.talent.v4.Job.addresses] in the same + // order. + repeated Location locations = 1; + + // Job categories derived from [Job.title][google.cloud.talent.v4.Job.title] and [Job.description][google.cloud.talent.v4.Job.description]. + repeated JobCategory job_categories = 3; + } + + // Options for job processing. + message ProcessingOptions { + // If set to `true`, the service does not attempt to resolve a + // more precise address for the job. + bool disable_street_address_resolution = 1; + + // Option for job HTML content sanitization. Applied fields are: + // + // * description + // * applicationInfo.instruction + // * incentives + // * qualifications + // * responsibilities + // + // HTML tags in these fields may be stripped if sanitiazation isn't + // disabled. + // + // Defaults to [HtmlSanitization.SIMPLE_FORMATTING_ONLY][google.cloud.talent.v4.HtmlSanitization.SIMPLE_FORMATTING_ONLY]. + HtmlSanitization html_sanitization = 2; + } + + // Required during job update. + // + // The resource name for the job. This is generated by the service when a + // job is created. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + // example, "projects/foo/tenants/bar/jobs/baz". + // + // Use of this field in job queries and API calls is preferred over the use of + // [requisition_id][google.cloud.talent.v4.Job.requisition_id] since this value is unique. + string name = 1; + + // Required. The resource name of the company listing the job. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For + // example, "projects/foo/tenants/bar/companies/baz". + string company = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + } + ]; + + // Required. The requisition ID, also referred to as the posting ID, is assigned by the + // client to identify a job. This field is intended to be used by clients + // for client identification and tracking of postings. A job isn't allowed + // to be created if there is another job with the same [company][google.cloud.talent.v4.Job.name], + // [language_code][google.cloud.talent.v4.Job.language_code] and [requisition_id][google.cloud.talent.v4.Job.requisition_id]. + // + // The maximum number of allowed characters is 255. + string requisition_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The title of the job, such as "Software Engineer" + // + // The maximum number of allowed characters is 500. + string title = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The description of the job, which typically includes a multi-paragraph + // description of the company and related information. Separate fields are + // provided on the job object for [responsibilities][google.cloud.talent.v4.Job.responsibilities], + // [qualifications][google.cloud.talent.v4.Job.qualifications], and other job characteristics. Use of + // these separate job fields is recommended. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 100,000. + string description = 5 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // Location(s) where the employer is looking to hire for this job posting. + // + // Specifying the full street address(es) of the hiring location enables + // better API results, especially job searches by commute time. + // + // At most 50 locations are allowed for best search performance. If a job has + // more locations, it is suggested to split it into multiple jobs with unique + // [requisition_id][google.cloud.talent.v4.Job.requisition_id]s (e.g. 'ReqA' becomes 'ReqA-1', 'ReqA-2', and so on.) as + // multiple jobs with the same [company][google.cloud.talent.v4.Job.company], [language_code][google.cloud.talent.v4.Job.language_code] and + // [requisition_id][google.cloud.talent.v4.Job.requisition_id] are not allowed. If the original [requisition_id][google.cloud.talent.v4.Job.requisition_id] must + // be preserved, a custom field should be used for storage. It is also + // suggested to group the locations that close to each other in the same job + // for better search experience. + // + // The maximum number of allowed characters is 500. + repeated string addresses = 6; + + // Job application information. + ApplicationInfo application_info = 7; + + // The benefits included with the job. + repeated JobBenefit job_benefits = 8; + + // Job compensation information (a.k.a. "pay rate") i.e., the compensation + // that will paid to the employee. + CompensationInfo compensation_info = 9; + + // A map of fields to hold both filterable and non-filterable custom job + // attributes that are not covered by the provided structured fields. + // + // The keys of the map are strings up to 64 bytes and must match the + // pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, key0LikeThis or + // KEY_1_LIKE_THIS. + // + // At most 100 filterable and at most 100 unfilterable keys are supported. + // For filterable `string_values`, across all keys at most 200 values are + // allowed, with each string no more than 255 characters. For unfilterable + // `string_values`, the maximum total size of `string_values` across all keys + // is 50KB. + map custom_attributes = 10; + + // The desired education degrees for the job, such as Bachelors, Masters. + repeated DegreeType degree_types = 11; + + // The department or functional area within the company with the open + // position. + // + // The maximum number of allowed characters is 255. + string department = 12; + + // The employment type(s) of a job, for example, + // [full time][google.cloud.talent.v4.EmploymentType.FULL_TIME] or + // [part time][google.cloud.talent.v4.EmploymentType.PART_TIME]. + repeated EmploymentType employment_types = 13; + + // A description of bonus, commission, and other compensation + // incentives associated with the job not including salary or pay. + // + // The maximum number of allowed characters is 10,000. + string incentives = 14; + + // The language of the posting. This field is distinct from + // any requirements for fluency that are associated with the job. + // + // Language codes must be in BCP-47 format, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47){: + // class="external" target="_blank" }. + // + // If this field is unspecified and [Job.description][google.cloud.talent.v4.Job.description] is present, detected + // language code based on [Job.description][google.cloud.talent.v4.Job.description] is assigned, otherwise + // defaults to 'en_US'. + string language_code = 15; + + // The experience level associated with the job, such as "Entry Level". + JobLevel job_level = 16; + + // A promotion value of the job, as determined by the client. + // The value determines the sort order of the jobs returned when searching for + // jobs using the featured jobs search call, with higher promotional values + // being returned first and ties being resolved by relevance sort. Only the + // jobs with a promotionValue >0 are returned in a FEATURED_JOB_SEARCH. + // + // Default value is 0, and negative values are treated as 0. + int32 promotion_value = 17; + + // A description of the qualifications required to perform the + // job. The use of this field is recommended + // as an alternative to using the more general [description][google.cloud.talent.v4.Job.description] field. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 10,000. + string qualifications = 18; + + // A description of job responsibilities. The use of this field is + // recommended as an alternative to using the more general [description][google.cloud.talent.v4.Job.description] + // field. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 10,000. + string responsibilities = 19; + + // The job [PostingRegion][google.cloud.talent.v4.PostingRegion] (for example, state, country) throughout + // which the job is available. If this field is set, a [LocationFilter][google.cloud.talent.v4.LocationFilter] + // in a search query within the job region finds this job posting if an + // exact location match isn't specified. If this field is set to + // [PostingRegion.NATION][google.cloud.talent.v4.PostingRegion.NATION] or [PostingRegion.ADMINISTRATIVE_AREA][google.cloud.talent.v4.PostingRegion.ADMINISTRATIVE_AREA], + // setting job [Job.addresses][google.cloud.talent.v4.Job.addresses] to the same location level as this field + // is strongly recommended. + PostingRegion posting_region = 20; + + // Deprecated. The job is only visible to the owner. + // + // The visibility of the job. + // + // Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4.Visibility.ACCOUNT_ONLY] if not specified. + Visibility visibility = 21 [deprecated = true]; + + // The start timestamp of the job in UTC time zone. Typically this field + // is used for contracting engagements. Invalid timestamps are ignored. + google.protobuf.Timestamp job_start_time = 22; + + // The end timestamp of the job. Typically this field is used for contracting + // engagements. Invalid timestamps are ignored. + google.protobuf.Timestamp job_end_time = 23; + + // The timestamp this job posting was most recently published. The default + // value is the time the request arrives at the server. Invalid timestamps are + // ignored. + google.protobuf.Timestamp posting_publish_time = 24; + + // Strongly recommended for the best service experience. + // + // The expiration timestamp of the job. After this timestamp, the + // job is marked as expired, and it no longer appears in search results. The + // expired job can't be listed by the [ListJobs][google.cloud.talent.v4.JobService.ListJobs] API, + // but it can be retrieved with the [GetJob][google.cloud.talent.v4.JobService.GetJob] API or + // updated with the [UpdateJob][google.cloud.talent.v4.JobService.UpdateJob] API or deleted with + // the [DeleteJob][google.cloud.talent.v4.JobService.DeleteJob] API. An expired job can + // be updated and opened again by using a future expiration timestamp. + // Updating an expired job fails if there is another existing open job with + // same [company][google.cloud.talent.v4.Job.company], [language_code][google.cloud.talent.v4.Job.language_code] and [requisition_id][google.cloud.talent.v4.Job.requisition_id]. + // + // The expired jobs are retained in our system for 90 days. However, the + // overall expired job count cannot exceed 3 times the maximum number of + // open jobs over previous 7 days. If this threshold is exceeded, + // expired jobs are cleaned out in order of earliest expire time. + // Expired jobs are no longer accessible after they are cleaned + // out. + // + // Invalid timestamps are ignored, and treated as expire time not provided. + // + // If the timestamp is before the instant request is made, the job + // is treated as expired immediately on creation. This kind of job can + // not be updated. And when creating a job with past timestamp, the + // [posting_publish_time][google.cloud.talent.v4.Job.posting_publish_time] must be set before + // [posting_expire_time][google.cloud.talent.v4.Job.posting_expire_time]. The purpose of this feature is + // to allow other objects, such as [Application][], to refer a job + // that didn't exist in the system prior to becoming expired. If you + // want to modify a job that was expired on creation, + // delete it and create a new one. + // + // If this value isn't provided at the time of job creation or is invalid, + // the job posting expires after 30 days from the job's creation time. For + // example, if the job was created on 2017/01/01 13:00AM UTC with an + // unspecified expiration date, the job expires after 2017/01/31 13:00AM UTC. + // + // If this value isn't provided on job update, it depends on the field masks + // set by [UpdateJobRequest.update_mask][google.cloud.talent.v4.UpdateJobRequest.update_mask]. If the field masks include + // [job_end_time][google.cloud.talent.v4.Job.job_end_time], or the masks are empty meaning that every field is + // updated, the job posting expires after 30 days from the job's last + // update time. Otherwise the expiration date isn't updated. + google.protobuf.Timestamp posting_expire_time = 25; + + // Output only. The timestamp when this job posting was created. + google.protobuf.Timestamp posting_create_time = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this job posting was last updated. + google.protobuf.Timestamp posting_update_time = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Display name of the company listing the job. + string company_display_name = 28 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Derived details about the job posting. + DerivedInfo derived_info = 29 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Options for job processing. + ProcessingOptions processing_options = 30; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/job_service.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/job_service.proto new file mode 100644 index 0000000..3764292 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/job_service.proto @@ -0,0 +1,865 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/cloud/talent/v4/filters.proto"; +import "google/cloud/talent/v4/histogram.proto"; +import "google/cloud/talent/v4/job.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "JobServiceProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A service handles job management, including job CRUD, enumeration and search. +service JobService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new job. + // + // Typically, the job becomes searchable within 10 seconds, but it may take + // up to 5 minutes. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/jobs" + body: "job" + }; + option (google.api.method_signature) = "parent,job"; + } + + // Begins executing a batch create jobs operation. + rpc BatchCreateJobs(BatchCreateJobsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/jobs:batchCreate" + body: "*" + }; + option (google.api.method_signature) = "parent,jobs"; + option (google.longrunning.operation_info) = { + response_type: "BatchCreateJobsResponse" + metadata_type: "BatchOperationMetadata" + }; + } + + // Retrieves the specified job, whose status is OPEN or recently EXPIRED + // within the last 90 days. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v4/{name=projects/*/tenants/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified job. + // + // Typically, updated contents become visible in search results within 10 + // seconds, but it may take up to 5 minutes. + rpc UpdateJob(UpdateJobRequest) returns (Job) { + option (google.api.http) = { + patch: "/v4/{job.name=projects/*/tenants/*/jobs/*}" + body: "job" + }; + option (google.api.method_signature) = "job,update_mask"; + } + + // Begins executing a batch update jobs operation. + rpc BatchUpdateJobs(BatchUpdateJobsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/jobs:batchUpdate" + body: "*" + }; + option (google.api.method_signature) = "parent,jobs"; + option (google.longrunning.operation_info) = { + response_type: "BatchUpdateJobsResponse" + metadata_type: "BatchOperationMetadata" + }; + } + + // Deletes the specified job. + // + // Typically, the job becomes unsearchable within 10 seconds, but it may take + // up to 5 minutes. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4/{name=projects/*/tenants/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Begins executing a batch delete jobs operation. + rpc BatchDeleteJobs(BatchDeleteJobsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/jobs:batchDelete" + body: "*" + }; + option (google.api.method_signature) = "parent,names"; + option (google.longrunning.operation_info) = { + response_type: "BatchDeleteJobsResponse" + metadata_type: "BatchOperationMetadata" + }; + } + + // Lists jobs by filter. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v4/{parent=projects/*/tenants/*}/jobs" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. + // + // This call constrains the [visibility][google.cloud.talent.v4.Job.visibility] of jobs + // present in the database, and only returns jobs that the caller has + // permission to search against. + rpc SearchJobs(SearchJobsRequest) returns (SearchJobsResponse) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/jobs:search" + body: "*" + }; + } + + // Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. + // + // This API call is intended for the use case of targeting passive job + // seekers (for example, job seekers who have signed up to receive email + // alerts about potential job opportunities), it has different algorithmic + // adjustments that are designed to specifically target passive job seekers. + // + // This call constrains the [visibility][google.cloud.talent.v4.Job.visibility] of jobs + // present in the database, and only returns jobs the caller has + // permission to search against. + rpc SearchJobsForAlert(SearchJobsRequest) returns (SearchJobsResponse) { + option (google.api.http) = { + post: "/v4/{parent=projects/*/tenants/*}/jobs:searchForAlert" + body: "*" + }; + } +} + +// Create job request. +message CreateJobRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The Job to be created. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Get job request. +message GetJobRequest { + // Required. The resource name of the job to retrieve. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + // example, "projects/foo/tenants/bar/jobs/baz". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Job" + } + ]; +} + +// Update job request. +message UpdateJobRequest { + // Required. The Job to be updated. + Job job = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4.UpdateJobRequest.update_mask] is provided, only the specified fields in + // [job][google.cloud.talent.v4.UpdateJobRequest.job] are updated. Otherwise all the fields are updated. + // + // A field mask to restrict the fields that are updated. Only + // top level fields of [Job][google.cloud.talent.v4.Job] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Delete job request. +message DeleteJobRequest { + // Required. The resource name of the job to be deleted. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + // example, "projects/foo/tenants/bar/jobs/baz". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Job" + } + ]; +} + +// List jobs request. +message ListJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The filter string specifies the jobs to be enumerated. + // + // Supported operator: =, AND + // + // The fields eligible for filtering are: + // + // * `companyName` (Required) + // * `requisitionId` + // * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + // OPEN if no value is specified. + // + // Sample Query: + // + // * companyName = "projects/foo/tenants/bar/companies/baz" + // * companyName = "projects/foo/tenants/bar/companies/baz" AND + // requisitionId = "req-1" + // * companyName = "projects/foo/tenants/bar/companies/baz" AND + // status = "EXPIRED" + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // The starting point of a query result. + string page_token = 3; + + // The maximum number of jobs to be returned per page of results. + // + // If [job_view][google.cloud.talent.v4.ListJobsRequest.job_view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4.JobView.JOB_VIEW_ID_ONLY], the maximum allowed + // page size is 1000. Otherwise, the maximum allowed page size is 100. + // + // Default is 100 if empty or a number < 1 is specified. + int32 page_size = 4; + + // The desired job attributes returned for jobs in the + // search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4.JobView.JOB_VIEW_FULL] if no value is + // specified. + JobView job_view = 5; +} + +// An enum that specifies the job attributes that are returned in the +// [MatchingJob.job][google.cloud.talent.v4.SearchJobsResponse.MatchingJob.job] or +// [ListJobsResponse.jobs][google.cloud.talent.v4.ListJobsResponse.jobs] fields. +enum JobView { + // Default value. + JOB_VIEW_UNSPECIFIED = 0; + + // A ID only view of job, with following attributes: + // [Job.name][google.cloud.talent.v4.Job.name], [Job.requisition_id][google.cloud.talent.v4.Job.requisition_id], [Job.language_code][google.cloud.talent.v4.Job.language_code]. + JOB_VIEW_ID_ONLY = 1; + + // A minimal view of the job, with the following attributes: + // [Job.name][google.cloud.talent.v4.Job.name], [Job.requisition_id][google.cloud.talent.v4.Job.requisition_id], [Job.title][google.cloud.talent.v4.Job.title], + // [Job.company][google.cloud.talent.v4.Job.company], [Job.DerivedInfo.locations][google.cloud.talent.v4.Job.DerivedInfo.locations], [Job.language_code][google.cloud.talent.v4.Job.language_code]. + JOB_VIEW_MINIMAL = 2; + + // A small view of the job, with the following attributes in the search + // results: [Job.name][google.cloud.talent.v4.Job.name], [Job.requisition_id][google.cloud.talent.v4.Job.requisition_id], [Job.title][google.cloud.talent.v4.Job.title], + // [Job.company][google.cloud.talent.v4.Job.company], [Job.DerivedInfo.locations][google.cloud.talent.v4.Job.DerivedInfo.locations], [Job.visibility][google.cloud.talent.v4.Job.visibility], + // [Job.language_code][google.cloud.talent.v4.Job.language_code], [Job.description][google.cloud.talent.v4.Job.description]. + JOB_VIEW_SMALL = 3; + + // All available attributes are included in the search results. + JOB_VIEW_FULL = 4; +} + +// List jobs response. +message ListJobsResponse { + // The Jobs for a given company. + // + // The maximum number of items returned is based on the limit field + // provided in the request. + repeated Job jobs = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} + +// The Request body of the `SearchJobs` call. +message SearchJobsRequest { + // Custom ranking information for [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. + message CustomRankingInfo { + // The importance level for [CustomRankingInfo.ranking_expression][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression]. + enum ImportanceLevel { + // Default value if the importance level isn't specified. + IMPORTANCE_LEVEL_UNSPECIFIED = 0; + + // The given ranking expression is of None importance, existing relevance + // score (determined by API algorithm) dominates job's final ranking + // position. + NONE = 1; + + // The given ranking expression is of Low importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + LOW = 2; + + // The given ranking expression is of Mild importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + MILD = 3; + + // The given ranking expression is of Medium importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + MEDIUM = 4; + + // The given ranking expression is of High importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + HIGH = 5; + + // The given ranking expression is of Extreme importance, and dominates + // job's final ranking position with existing relevance + // score (determined by API algorithm) ignored. + EXTREME = 6; + } + + // Required. Controls over how important the score of + // [CustomRankingInfo.ranking_expression][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression] gets applied to job's final + // ranking position. + // + // An error is thrown if not specified. + ImportanceLevel importance_level = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Controls over how job documents get ranked on top of existing relevance + // score (determined by API algorithm). A combination of the ranking + // expression and relevance score is used to determine job's final ranking + // position. + // + // The syntax for this expression is a subset of Google SQL syntax. + // + // Supported operators are: +, -, *, /, where the left and right side of + // the operator is either a numeric [Job.custom_attributes][google.cloud.talent.v4.Job.custom_attributes] key, + // integer/double value or an expression that can be evaluated to a number. + // + // Parenthesis are supported to adjust calculation precedence. The + // expression must be < 100 characters in length. + // + // The expression is considered invalid for a job if the expression + // references custom attributes that are not populated on the job or if the + // expression results in a divide by zero. If an expression is invalid for a + // job, that job is demoted to the end of the results. + // + // Sample ranking expression + // (year + 25) * 0.25 - (freshness / 0.5) + string ranking_expression = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // A string-represented enumeration of the job search mode. The service + // operate differently for different modes of service. + enum SearchMode { + // The mode of the search method isn't specified. The default search + // behavior is identical to JOB_SEARCH search behavior. + SEARCH_MODE_UNSPECIFIED = 0; + + // The job search matches against all jobs, and featured jobs + // (jobs with promotionValue > 0) are not specially handled. + JOB_SEARCH = 1; + + // The job search matches only against featured jobs (jobs with a + // promotionValue > 0). This method doesn't return any jobs having a + // promotionValue <= 0. The search results order is determined by the + // promotionValue (jobs with a higher promotionValue are returned higher up + // in the search results), with relevance being used as a tiebreaker. + FEATURED_JOB_SEARCH = 2; + } + + // Controls whether highly similar jobs are returned next to each other in + // the search results. Jobs are identified as highly similar based on + // their titles, job categories, and locations. Highly similar results are + // clustered so that only one representative job of the cluster is + // displayed to the job seeker higher up in the results, with the other jobs + // being displayed lower down in the results. + enum DiversificationLevel { + // The diversification level isn't specified. + DIVERSIFICATION_LEVEL_UNSPECIFIED = 0; + + // Disables diversification. Jobs that would normally be pushed to the last + // page would not have their positions altered. This may result in highly + // similar jobs appearing in sequence in the search results. + DISABLED = 1; + + // Default diversifying behavior. The result list is ordered so that + // highly similar results are pushed to the end of the last page of search + // results. If you are using pageToken to page through the result set, + // latency might be lower but we can't guarantee that all results are + // returned. If you are using page offset, latency might be higher but all + // results are returned. + SIMPLE = 2; + } + + // Required. The resource name of the tenant to search within. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Mode of a search. + // + // Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4.SearchJobsRequest.SearchMode.JOB_SEARCH]. + SearchMode search_mode = 2; + + // Required. The meta information collected about the job searcher, used to improve the + // search quality of the service. The identifiers (such as `user_id`) are + // provided by users, and must be unique and consistent. + RequestMetadata request_metadata = 3 [(google.api.field_behavior) = REQUIRED]; + + // Query used to search against jobs, such as keyword, location filters, etc. + JobQuery job_query = 4; + + // Controls whether to broaden the search when it produces sparse results. + // Broadened queries append results to the end of the matching results + // list. + // + // Defaults to false. + bool enable_broadening = 5; + + // An expression specifies a histogram request against matching jobs. + // + // Expression syntax is an aggregation function call with histogram facets and + // other options. + // + // Available aggregation function calls are: + // * `count(string_histogram_facet)`: Count the number of matching entities, + // for each distinct attribute value. + // * `count(numeric_histogram_facet, list of buckets)`: Count the number of + // matching entities within each bucket. + // + // Data types: + // + // * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. + // * String: string like "any string with backslash escape for quote(\")." + // * Number: whole number and floating point number like 10, -1 and -0.01. + // * List: list of elements with comma(,) separator surrounded by square + // brackets, for example, [1, 2, 3] and ["one", "two", "three"]. + // + // Built-in constants: + // + // * MIN (minimum number similar to java Double.MIN_VALUE) + // * MAX (maximum number similar to java Double.MAX_VALUE) + // + // Built-in functions: + // + // * bucket(start, end[, label]): bucket built-in function creates a bucket + // with range of [start, end). Note that the end is exclusive, for example, + // bucket(1, MAX, "positive number") or bucket(1, 10). + // + // Job histogram facets: + // + // * company_display_name: histogram by [Job.company_display_name][google.cloud.talent.v4.Job.company_display_name]. + // * employment_type: histogram by [Job.employment_types][google.cloud.talent.v4.Job.employment_types], for example, + // "FULL_TIME", "PART_TIME". + // * company_size: histogram by [CompanySize][google.cloud.talent.v4.CompanySize], for example, "SMALL", + // "MEDIUM", "BIG". + // * publish_time_in_month: histogram by the [Job.posting_publish_time][google.cloud.talent.v4.Job.posting_publish_time] + // in months. + // Must specify list of numeric buckets in spec. + // * publish_time_in_year: histogram by the [Job.posting_publish_time][google.cloud.talent.v4.Job.posting_publish_time] + // in years. + // Must specify list of numeric buckets in spec. + // * degree_types: histogram by the [Job.degree_types][google.cloud.talent.v4.Job.degree_types], for example, + // "Bachelors", "Masters". + // * job_level: histogram by the [Job.job_level][google.cloud.talent.v4.Job.job_level], for example, "Entry + // Level". + // * country: histogram by the country code of jobs, for example, "US", "FR". + // * admin1: histogram by the admin1 code of jobs, which is a global + // placeholder referring to the state, province, or the particular term a + // country uses to define the geographic structure below the country level, + // for example, "CA", "IL". + // * city: histogram by a combination of the "city name, admin1 code". For + // example, "Mountain View, CA", "New York, NY". + // * admin1_country: histogram by a combination of the "admin1 code, country", + // for example, "CA, US", "IL, US". + // * city_coordinate: histogram by the city center's GPS coordinates (latitude + // and longitude), for example, 37.4038522,-122.0987765. Since the + // coordinates of a city center can change, customers may need to refresh + // them periodically. + // * locale: histogram by the [Job.language_code][google.cloud.talent.v4.Job.language_code], for example, "en-US", + // "fr-FR". + // * language: histogram by the language subtag of the [Job.language_code][google.cloud.talent.v4.Job.language_code], + // for example, "en", "fr". + // * category: histogram by the [JobCategory][google.cloud.talent.v4.JobCategory], for example, + // "COMPUTER_AND_IT", "HEALTHCARE". + // * base_compensation_unit: histogram by the + // [CompensationInfo.CompensationUnit][google.cloud.talent.v4.CompensationInfo.CompensationUnit] of base + // salary, for example, "WEEKLY", "MONTHLY". + // * base_compensation: histogram by the base salary. Must specify list of + // numeric buckets to group results by. + // * annualized_base_compensation: histogram by the base annualized salary. + // Must specify list of numeric buckets to group results by. + // * annualized_total_compensation: histogram by the total annualized salary. + // Must specify list of numeric buckets to group results by. + // * string_custom_attribute: histogram by string [Job.custom_attributes][google.cloud.talent.v4.Job.custom_attributes]. + // Values can be accessed via square bracket notations like + // string_custom_attribute["key1"]. + // * numeric_custom_attribute: histogram by numeric [Job.custom_attributes][google.cloud.talent.v4.Job.custom_attributes]. + // Values can be accessed via square bracket notations like + // numeric_custom_attribute["key1"]. Must specify list of numeric buckets to + // group results by. + // + // Example expressions: + // + // * `count(admin1)` + // * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), + // bucket(100000, MAX)])` + // * `count(string_custom_attribute["some-string-custom-attribute"])` + // * `count(numeric_custom_attribute["some-numeric-custom-attribute"], + // [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` + repeated HistogramQuery histogram_queries = 7; + + // The desired job attributes returned for jobs in the search response. + // Defaults to [JobView.JOB_VIEW_SMALL][google.cloud.talent.v4.JobView.JOB_VIEW_SMALL] if no value is specified. + JobView job_view = 8; + + // An integer that specifies the current offset (that is, starting result + // location, amongst the jobs deemed by the API as relevant) in search + // results. This field is only considered if [page_token][google.cloud.talent.v4.SearchJobsRequest.page_token] is unset. + // + // The maximum allowed value is 5000. Otherwise an error is thrown. + // + // For example, 0 means to return results starting from the first matching + // job, and 10 means to return from the 11th job. This can be used for + // pagination, (for example, pageSize = 10 and offset = 10 means to return + // from the second page). + int32 offset = 9; + + // A limit on the number of jobs returned in the search results. + // Increasing this value above the default value of 10 can increase search + // response time. The value can be between 1 and 100. + int32 max_page_size = 10; + + // The token specifying the current offset within + // search results. See [SearchJobsResponse.next_page_token][google.cloud.talent.v4.SearchJobsResponse.next_page_token] for + // an explanation of how to obtain the next set of query results. + string page_token = 11; + + // The criteria determining how search results are sorted. Default is + // `"relevance desc"`. + // + // Supported options are: + // + // * `"relevance desc"`: By relevance descending, as determined by the API + // algorithms. Relevance thresholding of query results is only available + // with this ordering. + // * `"posting_publish_time desc"`: By [Job.posting_publish_time][google.cloud.talent.v4.Job.posting_publish_time] + // descending. + // * `"posting_update_time desc"`: By [Job.posting_update_time][google.cloud.talent.v4.Job.posting_update_time] + // descending. + // * `"title"`: By [Job.title][google.cloud.talent.v4.Job.title] ascending. + // * `"title desc"`: By [Job.title][google.cloud.talent.v4.Job.title] descending. + // * `"annualized_base_compensation"`: By job's + // [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4.CompensationInfo.annualized_base_compensation_range] ascending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"annualized_base_compensation desc"`: By job's + // [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4.CompensationInfo.annualized_base_compensation_range] descending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"annualized_total_compensation"`: By job's + // [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4.CompensationInfo.annualized_total_compensation_range] ascending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"annualized_total_compensation desc"`: By job's + // [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4.CompensationInfo.annualized_total_compensation_range] descending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"custom_ranking desc"`: By the relevance score adjusted to the + // [SearchJobsRequest.CustomRankingInfo.ranking_expression][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression] with weight + // factor assigned by + // [SearchJobsRequest.CustomRankingInfo.importance_level][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.importance_level] in descending + // order. + // * Location sorting: Use the special syntax to order jobs by distance:
+ // `"distance_from('Hawaii')"`: Order by distance from Hawaii.
+ // `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
+ // `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by + // multiple locations. See details below.
+ // `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by + // multiple locations. See details below.
+ // The string can have a maximum of 256 characters. When multiple distance + // centers are provided, a job that is close to any of the distance centers + // would have a high rank. When a job has multiple locations, the job + // location closest to one of the distance centers will be used. Jobs that + // don't have locations will be ranked at the bottom. Distance is calculated + // with a precision of 11.3 meters (37.4 feet). Diversification strategy is + // still applied unless explicitly disabled in + // [diversification_level][google.cloud.talent.v4.SearchJobsRequest.diversification_level]. + string order_by = 12; + + // Controls whether highly similar jobs are returned next to each other in + // the search results. Jobs are identified as highly similar based on + // their titles, job categories, and locations. Highly similar results are + // clustered so that only one representative job of the cluster is + // displayed to the job seeker higher up in the results, with the other jobs + // being displayed lower down in the results. + // + // Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value + // is specified. + DiversificationLevel diversification_level = 13; + + // Controls over how job documents get ranked on top of existing relevance + // score (determined by API algorithm). + CustomRankingInfo custom_ranking_info = 14; + + // Controls whether to disable exact keyword match on [Job.title][google.cloud.talent.v4.Job.title], + // [Job.description][google.cloud.talent.v4.Job.description], [Job.company_display_name][google.cloud.talent.v4.Job.company_display_name], [Job.addresses][google.cloud.talent.v4.Job.addresses], + // [Job.qualifications][google.cloud.talent.v4.Job.qualifications]. When disable keyword match is turned off, a + // keyword match returns jobs that do not match given category filters when + // there are matching keywords. For example, for the query "program manager," + // a result is returned even if the job posting has the title "software + // developer," which doesn't fall into "program manager" ontology, but does + // have "program manager" appearing in its description. + // + // For queries like "cloud" that don't contain title or + // location specific ontology, jobs with "cloud" keyword matches are returned + // regardless of this flag's value. + // + // Use [Company.keyword_searchable_job_custom_attributes][google.cloud.talent.v4.Company.keyword_searchable_job_custom_attributes] if + // company-specific globally matched custom field/attribute string values are + // needed. Enabling keyword match improves recall of subsequent search + // requests. + // + // Defaults to false. + bool disable_keyword_match = 16; +} + +// Response for SearchJob method. +message SearchJobsResponse { + // Job entry with metadata inside [SearchJobsResponse][google.cloud.talent.v4.SearchJobsResponse]. + message MatchingJob { + // Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. + Job job = 1; + + // A summary of the job with core information that's displayed on the search + // results listing page. + string job_summary = 2; + + // Contains snippets of text from the [Job.title][google.cloud.talent.v4.Job.title] field most + // closely matching a search query's keywords, if available. The matching + // query keywords are enclosed in HTML bold tags. + string job_title_snippet = 3; + + // Contains snippets of text from the [Job.description][google.cloud.talent.v4.Job.description] and similar + // fields that most closely match a search query's keywords, if available. + // All HTML tags in the original fields are stripped when returned in this + // field, and matching query keywords are enclosed in HTML bold tags. + string search_text_snippet = 4; + + // Commute information which is generated based on specified + // [CommuteFilter][google.cloud.talent.v4.CommuteFilter]. + CommuteInfo commute_info = 5; + } + + // Commute details related to this job. + message CommuteInfo { + // Location used as the destination in the commute calculation. + Location job_location = 1; + + // The number of seconds required to travel to the job location from the + // query location. A duration of 0 seconds indicates that the job isn't + // reachable within the requested duration, but was returned as part of an + // expanded query. + google.protobuf.Duration travel_duration = 2; + } + + // The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. + repeated MatchingJob matching_jobs = 1; + + // The histogram results that match with specified + // [SearchJobsRequest.histogram_queries][google.cloud.talent.v4.SearchJobsRequest.histogram_queries]. + repeated HistogramQueryResult histogram_query_results = 2; + + // The token that specifies the starting position of the next page of results. + // This field is empty if there are no more results. + string next_page_token = 3; + + // The location filters that the service applied to the specified query. If + // any filters are lat-lng based, the [Location.location_type][google.cloud.talent.v4.Location.location_type] is + // [Location.LocationType.LOCATION_TYPE_UNSPECIFIED][google.cloud.talent.v4.Location.LocationType.LOCATION_TYPE_UNSPECIFIED]. + repeated Location location_filters = 4; + + // Number of jobs that match the specified query. + // + // Note: This size is precise only if the total is less than 100,000. + int32 total_size = 6; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 7; + + // If query broadening is enabled, we may append additional results from the + // broadened query. This number indicates how many of the jobs returned in the + // jobs field are from the broadened query. These results are always at the + // end of the jobs list. In particular, a value of 0, or if the field isn't + // set, all the jobs in the jobs list are from the original + // (without broadening) query. If this field is non-zero, subsequent requests + // with offset after this result set should contain all broadened results. + int32 broadened_query_jobs_count = 8; + + // The spell checking result, and correction. + SpellingCorrection spell_correction = 9; +} + +// Request to create a batch of jobs. +message BatchCreateJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The jobs to be created. + // A maximum of 200 jobs can be created in a batch. + repeated Job jobs = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update a batch of jobs. +message BatchUpdateJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The jobs to be updated. + // A maximum of 200 jobs can be updated in a batch. + repeated Job jobs = 2 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. Be aware that it will + // also increase latency when checking the status of a batch operation. + // + // If [update_mask][google.cloud.talent.v4.BatchUpdateJobsRequest.update_mask] is provided, only the specified fields in + // [Job][google.cloud.talent.v4.Job] are updated. Otherwise all the fields are updated. + // + // A field mask to restrict the fields that are updated. Only + // top level fields of [Job][google.cloud.talent.v4.Job] are supported. + // + // If [update_mask][google.cloud.talent.v4.BatchUpdateJobsRequest.update_mask] is provided, The [Job][google.cloud.talent.v4.Job] inside + // [JobResult][JobOperationResult.JobResult] + // will only contains fields that is updated, plus the Id of the Job. + // Otherwise, [Job][google.cloud.talent.v4.Job] will include all fields, which can yield a very + // large response. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to delete a batch of jobs. +message BatchDeleteJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + // + // The parent of all of the jobs specified in `names` must match this field. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // The names of the jobs to delete. + // + // The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + // For example, "projects/foo/tenants/bar/jobs/baz". + // + // A maximum of 200 jobs can be deleted in a batch. + repeated string names = 2 [(google.api.resource_reference) = { + type: "jobs.googleapis.com/Job" + }]; +} + +// Mutation result of a job from a batch operation. +message JobResult { + // Here [Job][google.cloud.talent.v4.Job] only contains basic information including [name][google.cloud.talent.v4.Job.name], + // [company][google.cloud.talent.v4.Job.company], [language_code][google.cloud.talent.v4.Job.language_code] + // and [requisition_id][google.cloud.talent.v4.Job.requisition_id], use getJob method to retrieve + // detailed information of the created/updated job. + Job job = 1; + + // The status of the job processed. This field is populated if the + // processing of the [job][google.cloud.talent.v4.JobResult.job] fails. + google.rpc.Status status = 2; +} + +// The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to +// replace [google.longrunning.Operation.response][google.longrunning.Operation.response] in case of success. +message BatchCreateJobsResponse { + // List of job mutation results from a batch create operation. It can change + // until operation status is FINISHED, FAILED or CANCELLED. + repeated JobResult job_results = 1; +} + +// The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to +// replace [google.longrunning.Operation.response][google.longrunning.Operation.response] in case of success. +message BatchUpdateJobsResponse { + // List of job mutation results from a batch update operation. It can change + // until operation status is FINISHED, FAILED or CANCELLED. + repeated JobResult job_results = 1; +} + +// The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to +// replace [google.longrunning.Operation.response][google.longrunning.Operation.response] in case of success. +message BatchDeleteJobsResponse { + // List of job mutation results from a batch delete operation. It can change + // until operation status is FINISHED, FAILED or CANCELLED. + repeated JobResult job_results = 1; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/tenant.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/tenant.proto new file mode 100644 index 0000000..bdfa832 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/tenant.proto @@ -0,0 +1,52 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "TenantProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A Tenant resource represents a tenant in the service. A tenant is a group or +// entity that shares common access with specific privileges for resources like +// jobs. Customer may create multiple tenants to provide data isolation for +// different groups. +message Tenant { + option (google.api.resource) = { + type: "jobs.googleapis.com/Tenant" + pattern: "projects/{project}/tenants/{tenant}" + }; + + // Required during tenant update. + // + // The resource name for a tenant. This is generated by the service when a + // tenant is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string name = 1; + + // Required. Client side tenant identifier, used to uniquely identify the tenant. + // + // The maximum number of allowed characters is 255. + string external_id = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v4/protos/google/cloud/talent/v4/tenant_service.proto b/owl-bot-staging/v4/protos/google/cloud/talent/v4/tenant_service.proto new file mode 100644 index 0000000..a82d094 --- /dev/null +++ b/owl-bot-staging/v4/protos/google/cloud/talent/v4/tenant_service.proto @@ -0,0 +1,176 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4/common.proto"; +import "google/cloud/talent/v4/tenant.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4;talent"; +option java_multiple_files = true; +option java_outer_classname = "TenantServiceProto"; +option java_package = "com.google.cloud.talent.v4"; +option objc_class_prefix = "CTS"; + +// A service that handles tenant management, including CRUD and enumeration. +service TenantService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new tenant entity. + rpc CreateTenant(CreateTenantRequest) returns (Tenant) { + option (google.api.http) = { + post: "/v4/{parent=projects/*}/tenants" + body: "tenant" + }; + option (google.api.method_signature) = "parent,tenant"; + } + + // Retrieves specified tenant. + rpc GetTenant(GetTenantRequest) returns (Tenant) { + option (google.api.http) = { + get: "/v4/{name=projects/*/tenants/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified tenant. + rpc UpdateTenant(UpdateTenantRequest) returns (Tenant) { + option (google.api.http) = { + patch: "/v4/{tenant.name=projects/*/tenants/*}" + body: "tenant" + }; + option (google.api.method_signature) = "tenant,update_mask"; + } + + // Deletes specified tenant. + rpc DeleteTenant(DeleteTenantRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4/{name=projects/*/tenants/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all tenants associated with the project. + rpc ListTenants(ListTenantsRequest) returns (ListTenantsResponse) { + option (google.api.http) = { + get: "/v4/{parent=projects/*}/tenants" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The Request of the CreateTenant method. +message CreateTenantRequest { + // Required. Resource name of the project under which the tenant is created. + // + // The format is "projects/{project_id}", for example, + // "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The tenant to be created. + Tenant tenant = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for getting a tenant by name. +message GetTenantRequest { + // Required. The resource name of the tenant to be retrieved. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; +} + +// Request for updating a specified tenant. +message UpdateTenantRequest { + // Required. The tenant resource to replace the current resource in the system. + Tenant tenant = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4.UpdateTenantRequest.update_mask] is provided, only the specified fields in + // [tenant][google.cloud.talent.v4.UpdateTenantRequest.tenant] are updated. Otherwise all the fields are updated. + // + // A field mask to specify the tenant fields to be updated. Only + // top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to delete a tenant. +message DeleteTenantRequest { + // Required. The resource name of the tenant to be deleted. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; +} + +// List tenants for which the client has ACL visibility. +message ListTenantsRequest { + // Required. Resource name of the project under which the tenant is created. + // + // The format is "projects/{project_id}", for example, + // "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The starting indicator from which to return results. + string page_token = 2; + + // The maximum number of tenants to be returned, at most 100. + // Default is 100 if a non-positive number is provided. + int32 page_size = 3; +} + +// The List tenants response object. +message ListTenantsResponse { + // Tenants for the current client. + repeated Tenant tenants = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} diff --git a/owl-bot-staging/v4/src/index.ts b/owl-bot-staging/v4/src/index.ts new file mode 100644 index 0000000..29686ba --- /dev/null +++ b/owl-bot-staging/v4/src/index.ts @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v4 from './v4'; +const CompanyServiceClient = v4.CompanyServiceClient; +type CompanyServiceClient = v4.CompanyServiceClient; +const CompletionClient = v4.CompletionClient; +type CompletionClient = v4.CompletionClient; +const EventServiceClient = v4.EventServiceClient; +type EventServiceClient = v4.EventServiceClient; +const JobServiceClient = v4.JobServiceClient; +type JobServiceClient = v4.JobServiceClient; +const TenantServiceClient = v4.TenantServiceClient; +type TenantServiceClient = v4.TenantServiceClient; +export {v4, CompanyServiceClient, CompletionClient, EventServiceClient, JobServiceClient, TenantServiceClient}; +export default {v4, CompanyServiceClient, CompletionClient, EventServiceClient, JobServiceClient, TenantServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v4/src/v4/company_service_client.ts b/owl-bot-staging/v4/src/v4/company_service_client.ts new file mode 100644 index 0000000..f7e8401 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/company_service_client.ts @@ -0,0 +1,961 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4/company_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './company_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service that handles company management, including CRUD and enumeration. + * @class + * @memberof v4 + */ +export class CompanyServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + companyServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompanyServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompanyServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + companyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCompanies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'companies') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4.CompanyService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.companyServiceStub) { + return this.companyServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4.CompanyService. + this.companyServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4.CompanyService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4.CompanyService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const companyServiceStubMethods = + ['createCompany', 'getCompany', 'updateCompany', 'deleteCompany', 'listCompanies']; + for (const methodName of companyServiceStubMethods) { + const callPromise = this.companyServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.companyServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createCompany( + request: protos.google.cloud.talent.v4.ICreateCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.ICreateCompanyRequest|undefined, {}|undefined + ]>; + createCompany( + request: protos.google.cloud.talent.v4.ICreateCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.ICreateCompanyRequest|null|undefined, + {}|null|undefined>): void; + createCompany( + request: protos.google.cloud.talent.v4.ICreateCompanyRequest, + callback: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.ICreateCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new company entity. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4.Company} request.company + * Required. The company to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Company]{@link google.cloud.talent.v4.Company}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createCompany(request); + */ + createCompany( + request: protos.google.cloud.talent.v4.ICreateCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.ICreateCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.ICreateCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.ICreateCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCompany(request, options, callback); + } + getCompany( + request: protos.google.cloud.talent.v4.IGetCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IGetCompanyRequest|undefined, {}|undefined + ]>; + getCompany( + request: protos.google.cloud.talent.v4.IGetCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IGetCompanyRequest|null|undefined, + {}|null|undefined>): void; + getCompany( + request: protos.google.cloud.talent.v4.IGetCompanyRequest, + callback: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IGetCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves specified company. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the company to be retrieved. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + * example, "projects/api-test-project/tenants/foo/companies/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Company]{@link google.cloud.talent.v4.Company}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getCompany(request); + */ + getCompany( + request: protos.google.cloud.talent.v4.IGetCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IGetCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IGetCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IGetCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCompany(request, options, callback); + } + updateCompany( + request: protos.google.cloud.talent.v4.IUpdateCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IUpdateCompanyRequest|undefined, {}|undefined + ]>; + updateCompany( + request: protos.google.cloud.talent.v4.IUpdateCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>): void; + updateCompany( + request: protos.google.cloud.talent.v4.IUpdateCompanyRequest, + callback: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified company. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4.Company} request.company + * Required. The company resource to replace the current resource in the system. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4.UpdateCompanyRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4.UpdateCompanyRequest.company|company} are updated. Otherwise all the fields are updated. + * + * A field mask to specify the company fields to be updated. Only + * top level fields of {@link google.cloud.talent.v4.Company|Company} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Company]{@link google.cloud.talent.v4.Company}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateCompany(request); + */ + updateCompany( + request: protos.google.cloud.talent.v4.IUpdateCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ICompany, + protos.google.cloud.talent.v4.IUpdateCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'company.name': request.company!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCompany(request, options, callback); + } + deleteCompany( + request: protos.google.cloud.talent.v4.IDeleteCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteCompanyRequest|undefined, {}|undefined + ]>; + deleteCompany( + request: protos.google.cloud.talent.v4.IDeleteCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>): void; + deleteCompany( + request: protos.google.cloud.talent.v4.IDeleteCompanyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes specified company. + * Prerequisite: The company has no jobs associated with it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the company to be deleted. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + * example, "projects/foo/tenants/bar/companies/baz". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteCompany(request); + */ + deleteCompany( + request: protos.google.cloud.talent.v4.IDeleteCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteCompany(request, options, callback); + } + + listCompanies( + request: protos.google.cloud.talent.v4.IListCompaniesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ICompany[], + protos.google.cloud.talent.v4.IListCompaniesRequest|null, + protos.google.cloud.talent.v4.IListCompaniesResponse + ]>; + listCompanies( + request: protos.google.cloud.talent.v4.IListCompaniesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4.IListCompaniesRequest, + protos.google.cloud.talent.v4.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4.ICompany>): void; + listCompanies( + request: protos.google.cloud.talent.v4.IListCompaniesRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4.IListCompaniesRequest, + protos.google.cloud.talent.v4.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4.ICompany>): void; +/** + * Lists all companies associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of companies to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {boolean} request.requireOpenJobs + * Set to true if the companies requested must have open jobs. + * + * Defaults to false. + * + * If true, at most {@link google.cloud.talent.v4.ListCompaniesRequest.page_size|page_size} of companies are fetched, among which + * only those with open jobs are returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Company]{@link google.cloud.talent.v4.Company}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCompaniesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCompanies( + request: protos.google.cloud.talent.v4.IListCompaniesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4.IListCompaniesRequest, + protos.google.cloud.talent.v4.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4.ICompany>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4.IListCompaniesRequest, + protos.google.cloud.talent.v4.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4.ICompany>): + Promise<[ + protos.google.cloud.talent.v4.ICompany[], + protos.google.cloud.talent.v4.IListCompaniesRequest|null, + protos.google.cloud.talent.v4.IListCompaniesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCompanies(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of companies to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {boolean} request.requireOpenJobs + * Set to true if the companies requested must have open jobs. + * + * Defaults to false. + * + * If true, at most {@link google.cloud.talent.v4.ListCompaniesRequest.page_size|page_size} of companies are fetched, among which + * only those with open jobs are returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Company]{@link google.cloud.talent.v4.Company} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCompaniesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCompaniesStream( + request?: protos.google.cloud.talent.v4.IListCompaniesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCompanies.createStream( + this.innerApiCalls.listCompanies as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCompanies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of companies to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {boolean} request.requireOpenJobs + * Set to true if the companies requested must have open jobs. + * + * Defaults to false. + * + * If true, at most {@link google.cloud.talent.v4.ListCompaniesRequest.page_size|page_size} of companies are fetched, among which + * only those with open jobs are returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Company]{@link google.cloud.talent.v4.Company}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listCompaniesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listCompaniesAsync( + request?: protos.google.cloud.talent.v4.IListCompaniesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCompanies.asyncIterate( + this.innerApiCalls['listCompanies'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified company resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + companyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.companyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).project; + } + + /** + * Parse the tenant from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).tenant; + } + + /** + * Parse the company from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).company; + } + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the tenant from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).tenant; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.companyServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4/src/v4/company_service_client_config.json b/owl-bot-staging/v4/src/v4/company_service_client_config.json new file mode 100644 index 0000000..df0be95 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/company_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.talent.v4.CompanyService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateCompany": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetCompany": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCompany": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCompany": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCompanies": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4/src/v4/company_service_proto_list.json b/owl-bot-staging/v4/src/v4/company_service_proto_list.json new file mode 100644 index 0000000..bcae136 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/company_service_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/talent/v4/common.proto", + "../../protos/google/cloud/talent/v4/company.proto", + "../../protos/google/cloud/talent/v4/company_service.proto", + "../../protos/google/cloud/talent/v4/completion_service.proto", + "../../protos/google/cloud/talent/v4/event.proto", + "../../protos/google/cloud/talent/v4/event_service.proto", + "../../protos/google/cloud/talent/v4/filters.proto", + "../../protos/google/cloud/talent/v4/histogram.proto", + "../../protos/google/cloud/talent/v4/job.proto", + "../../protos/google/cloud/talent/v4/job_service.proto", + "../../protos/google/cloud/talent/v4/tenant.proto", + "../../protos/google/cloud/talent/v4/tenant_service.proto" +] diff --git a/owl-bot-staging/v4/src/v4/completion_client.ts b/owl-bot-staging/v4/src/v4/completion_client.ts new file mode 100644 index 0000000..6490497 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/completion_client.ts @@ -0,0 +1,536 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4/completion_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './completion_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service handles auto completion. + * @class + * @memberof v4 + */ +export class CompletionClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + completionStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompletionClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompletionClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + companyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4.Completion', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.completionStub) { + return this.completionStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4.Completion. + this.completionStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4.Completion') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4.Completion, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const completionStubMethods = + ['completeQuery']; + for (const methodName of completionStubMethods) { + const callPromise = this.completionStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.completionStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + completeQuery( + request: protos.google.cloud.talent.v4.ICompleteQueryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ICompleteQueryResponse, + protos.google.cloud.talent.v4.ICompleteQueryRequest|undefined, {}|undefined + ]>; + completeQuery( + request: protos.google.cloud.talent.v4.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ICompleteQueryResponse, + protos.google.cloud.talent.v4.ICompleteQueryRequest|null|undefined, + {}|null|undefined>): void; + completeQuery( + request: protos.google.cloud.talent.v4.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.talent.v4.ICompleteQueryResponse, + protos.google.cloud.talent.v4.ICompleteQueryRequest|null|undefined, + {}|null|undefined>): void; +/** + * Completes the specified prefix with keyword suggestions. + * Intended for use by a job search auto-complete search box. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.tenant + * Required. Resource name of tenant the completion is performed within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {string} request.query + * Required. The query used to generate suggestions. + * + * The maximum number of allowed characters is 255. + * @param {string[]} request.languageCodes + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * + * The maximum number of allowed characters is 255. + * @param {number} request.pageSize + * Required. Completion result count. + * + * The maximum allowed page size is 10. + * @param {string} request.company + * If provided, restricts completion to specified company. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + * example, "projects/foo/tenants/bar/companies/baz". + * @param {google.cloud.talent.v4.CompleteQueryRequest.CompletionScope} request.scope + * The scope of the completion. The defaults is {@link google.cloud.talent.v4.CompleteQueryRequest.CompletionScope.PUBLIC|CompletionScope.PUBLIC}. + * @param {google.cloud.talent.v4.CompleteQueryRequest.CompletionType} request.type + * The completion topic. The default is {@link google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED|CompletionType.COMBINED}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompleteQueryResponse]{@link google.cloud.talent.v4.CompleteQueryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeQuery(request); + */ + completeQuery( + request: protos.google.cloud.talent.v4.ICompleteQueryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ICompleteQueryResponse, + protos.google.cloud.talent.v4.ICompleteQueryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ICompleteQueryResponse, + protos.google.cloud.talent.v4.ICompleteQueryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ICompleteQueryResponse, + protos.google.cloud.talent.v4.ICompleteQueryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'tenant': request.tenant || '', + }); + this.initialize(); + return this.innerApiCalls.completeQuery(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified company resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + companyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.companyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).project; + } + + /** + * Parse the tenant from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).tenant; + } + + /** + * Parse the company from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).company; + } + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the tenant from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).tenant; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.completionStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4/src/v4/completion_client_config.json b/owl-bot-staging/v4/src/v4/completion_client_config.json new file mode 100644 index 0000000..88a9a63 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/completion_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.talent.v4.Completion": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CompleteQuery": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4/src/v4/completion_proto_list.json b/owl-bot-staging/v4/src/v4/completion_proto_list.json new file mode 100644 index 0000000..bcae136 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/completion_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/talent/v4/common.proto", + "../../protos/google/cloud/talent/v4/company.proto", + "../../protos/google/cloud/talent/v4/company_service.proto", + "../../protos/google/cloud/talent/v4/completion_service.proto", + "../../protos/google/cloud/talent/v4/event.proto", + "../../protos/google/cloud/talent/v4/event_service.proto", + "../../protos/google/cloud/talent/v4/filters.proto", + "../../protos/google/cloud/talent/v4/histogram.proto", + "../../protos/google/cloud/talent/v4/job.proto", + "../../protos/google/cloud/talent/v4/job_service.proto", + "../../protos/google/cloud/talent/v4/tenant.proto", + "../../protos/google/cloud/talent/v4/tenant_service.proto" +] diff --git a/owl-bot-staging/v4/src/v4/event_service_client.ts b/owl-bot-staging/v4/src/v4/event_service_client.ts new file mode 100644 index 0000000..c23f4ff --- /dev/null +++ b/owl-bot-staging/v4/src/v4/event_service_client.ts @@ -0,0 +1,519 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4/event_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './event_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service handles client event report. + * @class + * @memberof v4 + */ +export class EventServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + eventServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EventServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EventServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + companyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4.EventService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.eventServiceStub) { + return this.eventServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4.EventService. + this.eventServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4.EventService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4.EventService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const eventServiceStubMethods = + ['createClientEvent']; + for (const methodName of eventServiceStubMethods) { + const callPromise = this.eventServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.eventServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createClientEvent( + request: protos.google.cloud.talent.v4.ICreateClientEventRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.IClientEvent, + protos.google.cloud.talent.v4.ICreateClientEventRequest|undefined, {}|undefined + ]>; + createClientEvent( + request: protos.google.cloud.talent.v4.ICreateClientEventRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.IClientEvent, + protos.google.cloud.talent.v4.ICreateClientEventRequest|null|undefined, + {}|null|undefined>): void; + createClientEvent( + request: protos.google.cloud.talent.v4.ICreateClientEventRequest, + callback: Callback< + protos.google.cloud.talent.v4.IClientEvent, + protos.google.cloud.talent.v4.ICreateClientEventRequest|null|undefined, + {}|null|undefined>): void; +/** + * Report events issued when end user interacts with customer's application + * that uses Cloud Talent Solution. You may inspect the created events in + * [self service + * tools](https://console.cloud.google.com/talent-solution/overview). + * [Learn + * more](https://cloud.google.com/talent-solution/docs/management-tools) + * about self service tools. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the event is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4.ClientEvent} request.clientEvent + * Required. Events issued when end user interacts with customer's application that + * uses Cloud Talent Solution. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ClientEvent]{@link google.cloud.talent.v4.ClientEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createClientEvent(request); + */ + createClientEvent( + request: protos.google.cloud.talent.v4.ICreateClientEventRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.IClientEvent, + protos.google.cloud.talent.v4.ICreateClientEventRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.IClientEvent, + protos.google.cloud.talent.v4.ICreateClientEventRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.IClientEvent, + protos.google.cloud.talent.v4.ICreateClientEventRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createClientEvent(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified company resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + companyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.companyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).project; + } + + /** + * Parse the tenant from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).tenant; + } + + /** + * Parse the company from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).company; + } + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the tenant from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).tenant; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.eventServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4/src/v4/event_service_client_config.json b/owl-bot-staging/v4/src/v4/event_service_client_config.json new file mode 100644 index 0000000..d74e3f6 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/event_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.talent.v4.EventService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateClientEvent": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4/src/v4/event_service_proto_list.json b/owl-bot-staging/v4/src/v4/event_service_proto_list.json new file mode 100644 index 0000000..bcae136 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/event_service_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/talent/v4/common.proto", + "../../protos/google/cloud/talent/v4/company.proto", + "../../protos/google/cloud/talent/v4/company_service.proto", + "../../protos/google/cloud/talent/v4/completion_service.proto", + "../../protos/google/cloud/talent/v4/event.proto", + "../../protos/google/cloud/talent/v4/event_service.proto", + "../../protos/google/cloud/talent/v4/filters.proto", + "../../protos/google/cloud/talent/v4/histogram.proto", + "../../protos/google/cloud/talent/v4/job.proto", + "../../protos/google/cloud/talent/v4/job_service.proto", + "../../protos/google/cloud/talent/v4/tenant.proto", + "../../protos/google/cloud/talent/v4/tenant_service.proto" +] diff --git a/owl-bot-staging/v4/src/v4/gapic_metadata.json b/owl-bot-staging/v4/src/v4/gapic_metadata.json new file mode 100644 index 0000000..4c06b32 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/gapic_metadata.json @@ -0,0 +1,311 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.talent.v4", + "libraryPackage": "@google-cloud/talent", + "services": { + "CompanyService": { + "clients": { + "grpc": { + "libraryClient": "CompanyServiceClient", + "rpcs": { + "CreateCompany": { + "methods": [ + "createCompany" + ] + }, + "GetCompany": { + "methods": [ + "getCompany" + ] + }, + "UpdateCompany": { + "methods": [ + "updateCompany" + ] + }, + "DeleteCompany": { + "methods": [ + "deleteCompany" + ] + }, + "ListCompanies": { + "methods": [ + "listCompanies", + "listCompaniesStream", + "listCompaniesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompanyServiceClient", + "rpcs": { + "CreateCompany": { + "methods": [ + "createCompany" + ] + }, + "GetCompany": { + "methods": [ + "getCompany" + ] + }, + "UpdateCompany": { + "methods": [ + "updateCompany" + ] + }, + "DeleteCompany": { + "methods": [ + "deleteCompany" + ] + }, + "ListCompanies": { + "methods": [ + "listCompanies", + "listCompaniesStream", + "listCompaniesAsync" + ] + } + } + } + } + }, + "Completion": { + "clients": { + "grpc": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + } + } + } + } + }, + "EventService": { + "clients": { + "grpc": { + "libraryClient": "EventServiceClient", + "rpcs": { + "CreateClientEvent": { + "methods": [ + "createClientEvent" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EventServiceClient", + "rpcs": { + "CreateClientEvent": { + "methods": [ + "createClientEvent" + ] + } + } + } + } + }, + "JobService": { + "clients": { + "grpc": { + "libraryClient": "JobServiceClient", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "SearchJobs": { + "methods": [ + "searchJobs" + ] + }, + "SearchJobsForAlert": { + "methods": [ + "searchJobsForAlert" + ] + }, + "BatchCreateJobs": { + "methods": [ + "batchCreateJobs" + ] + }, + "BatchUpdateJobs": { + "methods": [ + "batchUpdateJobs" + ] + }, + "BatchDeleteJobs": { + "methods": [ + "batchDeleteJobs" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "JobServiceClient", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "SearchJobs": { + "methods": [ + "searchJobs" + ] + }, + "SearchJobsForAlert": { + "methods": [ + "searchJobsForAlert" + ] + }, + "BatchCreateJobs": { + "methods": [ + "batchCreateJobs" + ] + }, + "BatchUpdateJobs": { + "methods": [ + "batchUpdateJobs" + ] + }, + "BatchDeleteJobs": { + "methods": [ + "batchDeleteJobs" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + } + } + }, + "TenantService": { + "clients": { + "grpc": { + "libraryClient": "TenantServiceClient", + "rpcs": { + "CreateTenant": { + "methods": [ + "createTenant" + ] + }, + "GetTenant": { + "methods": [ + "getTenant" + ] + }, + "UpdateTenant": { + "methods": [ + "updateTenant" + ] + }, + "DeleteTenant": { + "methods": [ + "deleteTenant" + ] + }, + "ListTenants": { + "methods": [ + "listTenants", + "listTenantsStream", + "listTenantsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TenantServiceClient", + "rpcs": { + "CreateTenant": { + "methods": [ + "createTenant" + ] + }, + "GetTenant": { + "methods": [ + "getTenant" + ] + }, + "UpdateTenant": { + "methods": [ + "updateTenant" + ] + }, + "DeleteTenant": { + "methods": [ + "deleteTenant" + ] + }, + "ListTenants": { + "methods": [ + "listTenants", + "listTenantsStream", + "listTenantsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v4/src/v4/index.ts b/owl-bot-staging/v4/src/v4/index.ts new file mode 100644 index 0000000..43e7c87 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/index.ts @@ -0,0 +1,23 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CompanyServiceClient} from './company_service_client'; +export {CompletionClient} from './completion_client'; +export {EventServiceClient} from './event_service_client'; +export {JobServiceClient} from './job_service_client'; +export {TenantServiceClient} from './tenant_service_client'; diff --git a/owl-bot-staging/v4/src/v4/job_service_client.ts b/owl-bot-staging/v4/src/v4/job_service_client.ts new file mode 100644 index 0000000..35e4a6a --- /dev/null +++ b/owl-bot-staging/v4/src/v4/job_service_client.ts @@ -0,0 +1,2009 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4/job_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './job_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * A service handles job management, including job CRUD, enumeration and search. + * @class + * @memberof v4 + */ +export class JobServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + jobServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of JobServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof JobServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + companyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const batchCreateJobsResponse = protoFilesRoot.lookup( + '.google.cloud.talent.v4.BatchCreateJobsResponse') as gax.protobuf.Type; + const batchCreateJobsMetadata = protoFilesRoot.lookup( + '.google.cloud.talent.v4.BatchOperationMetadata') as gax.protobuf.Type; + const batchUpdateJobsResponse = protoFilesRoot.lookup( + '.google.cloud.talent.v4.BatchUpdateJobsResponse') as gax.protobuf.Type; + const batchUpdateJobsMetadata = protoFilesRoot.lookup( + '.google.cloud.talent.v4.BatchOperationMetadata') as gax.protobuf.Type; + const batchDeleteJobsResponse = protoFilesRoot.lookup( + '.google.cloud.talent.v4.BatchDeleteJobsResponse') as gax.protobuf.Type; + const batchDeleteJobsMetadata = protoFilesRoot.lookup( + '.google.cloud.talent.v4.BatchOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchCreateJobs: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateJobsResponse.decode.bind(batchCreateJobsResponse), + batchCreateJobsMetadata.decode.bind(batchCreateJobsMetadata)), + batchUpdateJobs: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateJobsResponse.decode.bind(batchUpdateJobsResponse), + batchUpdateJobsMetadata.decode.bind(batchUpdateJobsMetadata)), + batchDeleteJobs: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteJobsResponse.decode.bind(batchDeleteJobsResponse), + batchDeleteJobsMetadata.decode.bind(batchDeleteJobsMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4.JobService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.jobServiceStub) { + return this.jobServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4.JobService. + this.jobServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4.JobService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4.JobService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const jobServiceStubMethods = + ['createJob', 'batchCreateJobs', 'getJob', 'updateJob', 'batchUpdateJobs', 'deleteJob', 'batchDeleteJobs', 'listJobs', 'searchJobs', 'searchJobsForAlert']; + for (const methodName of jobServiceStubMethods) { + const callPromise = this.jobServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.jobServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createJob( + request: protos.google.cloud.talent.v4.ICreateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.ICreateJobRequest|undefined, {}|undefined + ]>; + createJob( + request: protos.google.cloud.talent.v4.ICreateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request: protos.google.cloud.talent.v4.ICreateJobRequest, + callback: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new job. + * + * Typically, the job becomes searchable within 10 seconds, but it may take + * up to 5 minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4.Job} request.job + * Required. The Job to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.talent.v4.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createJob(request); + */ + createJob( + request: protos.google.cloud.talent.v4.ICreateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.ICreateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.ICreateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.ICreateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createJob(request, options, callback); + } + getJob( + request: protos.google.cloud.talent.v4.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.cloud.talent.v4.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.cloud.talent.v4.IGetJobRequest, + callback: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IGetJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified job, whose status is OPEN or recently EXPIRED + * within the last 90 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the job to retrieve. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + * example, "projects/foo/tenants/bar/jobs/baz". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.talent.v4.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getJob(request); + */ + getJob( + request: protos.google.cloud.talent.v4.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } + updateJob( + request: protos.google.cloud.talent.v4.IUpdateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IUpdateJobRequest|undefined, {}|undefined + ]>; + updateJob( + request: protos.google.cloud.talent.v4.IUpdateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request: protos.google.cloud.talent.v4.IUpdateJobRequest, + callback: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified job. + * + * Typically, updated contents become visible in search results within 10 + * seconds, but it may take up to 5 minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4.Job} request.job + * Required. The Job to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4.UpdateJobRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4.UpdateJobRequest.job|job} are updated. Otherwise all the fields are updated. + * + * A field mask to restrict the fields that are updated. Only + * top level fields of {@link google.cloud.talent.v4.Job|Job} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.talent.v4.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateJob(request); + */ + updateJob( + request: protos.google.cloud.talent.v4.IUpdateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IUpdateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IUpdateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.IJob, + protos.google.cloud.talent.v4.IUpdateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'job.name': request.job!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateJob(request, options, callback); + } + deleteJob( + request: protos.google.cloud.talent.v4.IDeleteJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteJobRequest|undefined, {}|undefined + ]>; + deleteJob( + request: protos.google.cloud.talent.v4.IDeleteJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request: protos.google.cloud.talent.v4.IDeleteJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified job. + * + * Typically, the job becomes unsearchable within 10 seconds, but it may take + * up to 5 minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the job to be deleted. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + * example, "projects/foo/tenants/bar/jobs/baz". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteJob(request); + */ + deleteJob( + request: protos.google.cloud.talent.v4.IDeleteJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteJob(request, options, callback); + } + searchJobs( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|undefined, {}|undefined + ]>; + searchJobs( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; + searchJobs( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + callback: Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Searches for jobs using the provided {@link google.cloud.talent.v4.SearchJobsRequest|SearchJobsRequest}. + * + * This call constrains the {@link google.cloud.talent.v4.Job.visibility|visibility} of jobs + * present in the database, and only returns jobs that the caller has + * permission to search against. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant to search within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4.SearchJobsRequest.SearchMode} request.searchMode + * Mode of a search. + * + * Defaults to {@link google.cloud.talent.v4.SearchJobsRequest.SearchMode.JOB_SEARCH|SearchMode.JOB_SEARCH}. + * @param {google.cloud.talent.v4.RequestMetadata} request.requestMetadata + * Required. The meta information collected about the job searcher, used to improve the + * search quality of the service. The identifiers (such as `user_id`) are + * provided by users, and must be unique and consistent. + * @param {google.cloud.talent.v4.JobQuery} request.jobQuery + * Query used to search against jobs, such as keyword, location filters, etc. + * @param {boolean} request.enableBroadening + * Controls whether to broaden the search when it produces sparse results. + * Broadened queries append results to the end of the matching results + * list. + * + * Defaults to false. + * @param {number[]} request.histogramQueries + * An expression specifies a histogram request against matching jobs. + * + * Expression syntax is an aggregation function call with histogram facets and + * other options. + * + * Available aggregation function calls are: + * * `count(string_histogram_facet)`: Count the number of matching entities, + * for each distinct attribute value. + * * `count(numeric_histogram_facet, list of buckets)`: Count the number of + * matching entities within each bucket. + * + * Data types: + * + * * Histogram facet: facet names with format {@link a-zA-Z0-9_|a-zA-Z}+. + * * String: string like "any string with backslash escape for quote(\")." + * * Number: whole number and floating point number like 10, -1 and -0.01. + * * List: list of elements with comma(,) separator surrounded by square + * brackets, for example, [1, 2, 3] and ["one", "two", "three"]. + * + * Built-in constants: + * + * * MIN (minimum number similar to java Double.MIN_VALUE) + * * MAX (maximum number similar to java Double.MAX_VALUE) + * + * Built-in functions: + * + * * bucket(start, end[, label]): bucket built-in function creates a bucket + * with range of [start, end). Note that the end is exclusive, for example, + * bucket(1, MAX, "positive number") or bucket(1, 10). + * + * Job histogram facets: + * + * * company_display_name: histogram by {@link google.cloud.talent.v4.Job.company_display_name|Job.company_display_name}. + * * employment_type: histogram by {@link google.cloud.talent.v4.Job.employment_types|Job.employment_types}, for example, + * "FULL_TIME", "PART_TIME". + * * company_size: histogram by {@link google.cloud.talent.v4.CompanySize|CompanySize}, for example, "SMALL", + * "MEDIUM", "BIG". + * * publish_time_in_month: histogram by the {@link google.cloud.talent.v4.Job.posting_publish_time|Job.posting_publish_time} + * in months. + * Must specify list of numeric buckets in spec. + * * publish_time_in_year: histogram by the {@link google.cloud.talent.v4.Job.posting_publish_time|Job.posting_publish_time} + * in years. + * Must specify list of numeric buckets in spec. + * * degree_types: histogram by the {@link google.cloud.talent.v4.Job.degree_types|Job.degree_types}, for example, + * "Bachelors", "Masters". + * * job_level: histogram by the {@link google.cloud.talent.v4.Job.job_level|Job.job_level}, for example, "Entry + * Level". + * * country: histogram by the country code of jobs, for example, "US", "FR". + * * admin1: histogram by the admin1 code of jobs, which is a global + * placeholder referring to the state, province, or the particular term a + * country uses to define the geographic structure below the country level, + * for example, "CA", "IL". + * * city: histogram by a combination of the "city name, admin1 code". For + * example, "Mountain View, CA", "New York, NY". + * * admin1_country: histogram by a combination of the "admin1 code, country", + * for example, "CA, US", "IL, US". + * * city_coordinate: histogram by the city center's GPS coordinates (latitude + * and longitude), for example, 37.4038522,-122.0987765. Since the + * coordinates of a city center can change, customers may need to refresh + * them periodically. + * * locale: histogram by the {@link google.cloud.talent.v4.Job.language_code|Job.language_code}, for example, "en-US", + * "fr-FR". + * * language: histogram by the language subtag of the {@link google.cloud.talent.v4.Job.language_code|Job.language_code}, + * for example, "en", "fr". + * * category: histogram by the {@link google.cloud.talent.v4.JobCategory|JobCategory}, for example, + * "COMPUTER_AND_IT", "HEALTHCARE". + * * base_compensation_unit: histogram by the + * {@link google.cloud.talent.v4.CompensationInfo.CompensationUnit|CompensationInfo.CompensationUnit} of base + * salary, for example, "WEEKLY", "MONTHLY". + * * base_compensation: histogram by the base salary. Must specify list of + * numeric buckets to group results by. + * * annualized_base_compensation: histogram by the base annualized salary. + * Must specify list of numeric buckets to group results by. + * * annualized_total_compensation: histogram by the total annualized salary. + * Must specify list of numeric buckets to group results by. + * * string_custom_attribute: histogram by string {@link google.cloud.talent.v4.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * string_custom_attribute["key1"]. + * * numeric_custom_attribute: histogram by numeric {@link google.cloud.talent.v4.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * numeric_custom_attribute["key1"]. Must specify list of numeric buckets to + * group results by. + * + * Example expressions: + * + * * `count(admin1)` + * * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), + * bucket(100000, MAX)])` + * * `count(string_custom_attribute["some-string-custom-attribute"])` + * * `count(numeric_custom_attribute["some-numeric-custom-attribute"], + * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` + * @param {google.cloud.talent.v4.JobView} request.jobView + * The desired job attributes returned for jobs in the search response. + * Defaults to {@link google.cloud.talent.v4.JobView.JOB_VIEW_SMALL|JobView.JOB_VIEW_SMALL} if no value is specified. + * @param {number} request.offset + * An integer that specifies the current offset (that is, starting result + * location, amongst the jobs deemed by the API as relevant) in search + * results. This field is only considered if {@link google.cloud.talent.v4.SearchJobsRequest.page_token|page_token} is unset. + * + * The maximum allowed value is 5000. Otherwise an error is thrown. + * + * For example, 0 means to return results starting from the first matching + * job, and 10 means to return from the 11th job. This can be used for + * pagination, (for example, pageSize = 10 and offset = 10 means to return + * from the second page). + * @param {number} request.maxPageSize + * A limit on the number of jobs returned in the search results. + * Increasing this value above the default value of 10 can increase search + * response time. The value can be between 1 and 100. + * @param {string} request.pageToken + * The token specifying the current offset within + * search results. See {@link google.cloud.talent.v4.SearchJobsResponse.next_page_token|SearchJobsResponse.next_page_token} for + * an explanation of how to obtain the next set of query results. + * @param {string} request.orderBy + * The criteria determining how search results are sorted. Default is + * `"relevance desc"`. + * + * Supported options are: + * + * * `"relevance desc"`: By relevance descending, as determined by the API + * algorithms. Relevance thresholding of query results is only available + * with this ordering. + * * `"posting_publish_time desc"`: By {@link google.cloud.talent.v4.Job.posting_publish_time|Job.posting_publish_time} + * descending. + * * `"posting_update_time desc"`: By {@link google.cloud.talent.v4.Job.posting_update_time|Job.posting_update_time} + * descending. + * * `"title"`: By {@link google.cloud.talent.v4.Job.title|Job.title} ascending. + * * `"title desc"`: By {@link google.cloud.talent.v4.Job.title|Job.title} descending. + * * `"annualized_base_compensation"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_base_compensation desc"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation desc"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"custom_ranking desc"`: By the relevance score adjusted to the + * {@link google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression|SearchJobsRequest.CustomRankingInfo.ranking_expression} with weight + * factor assigned by + * {@link google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.importance_level|SearchJobsRequest.CustomRankingInfo.importance_level} in descending + * order. + * * Location sorting: Use the special syntax to order jobs by distance:
+ * `"distance_from('Hawaii')"`: Order by distance from Hawaii.
+ * `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
+ * `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by + * multiple locations. See details below.
+ * `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by + * multiple locations. See details below.
+ * The string can have a maximum of 256 characters. When multiple distance + * centers are provided, a job that is close to any of the distance centers + * would have a high rank. When a job has multiple locations, the job + * location closest to one of the distance centers will be used. Jobs that + * don't have locations will be ranked at the bottom. Distance is calculated + * with a precision of 11.3 meters (37.4 feet). Diversification strategy is + * still applied unless explicitly disabled in + * {@link google.cloud.talent.v4.SearchJobsRequest.diversification_level|diversification_level}. + * @param {google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel} request.diversificationLevel + * Controls whether highly similar jobs are returned next to each other in + * the search results. Jobs are identified as highly similar based on + * their titles, job categories, and locations. Highly similar results are + * clustered so that only one representative job of the cluster is + * displayed to the job seeker higher up in the results, with the other jobs + * being displayed lower down in the results. + * + * Defaults to {@link google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel.SIMPLE|DiversificationLevel.SIMPLE} if no value + * is specified. + * @param {google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo} request.customRankingInfo + * Controls over how job documents get ranked on top of existing relevance + * score (determined by API algorithm). + * @param {boolean} request.disableKeywordMatch + * Controls whether to disable exact keyword match on {@link google.cloud.talent.v4.Job.title|Job.title}, + * {@link google.cloud.talent.v4.Job.description|Job.description}, {@link google.cloud.talent.v4.Job.company_display_name|Job.company_display_name}, {@link google.cloud.talent.v4.Job.addresses|Job.addresses}, + * {@link google.cloud.talent.v4.Job.qualifications|Job.qualifications}. When disable keyword match is turned off, a + * keyword match returns jobs that do not match given category filters when + * there are matching keywords. For example, for the query "program manager," + * a result is returned even if the job posting has the title "software + * developer," which doesn't fall into "program manager" ontology, but does + * have "program manager" appearing in its description. + * + * For queries like "cloud" that don't contain title or + * location specific ontology, jobs with "cloud" keyword matches are returned + * regardless of this flag's value. + * + * Use {@link google.cloud.talent.v4.Company.keyword_searchable_job_custom_attributes|Company.keyword_searchable_job_custom_attributes} if + * company-specific globally matched custom field/attribute string values are + * needed. Enabling keyword match improves recall of subsequent search + * requests. + * + * Defaults to false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SearchJobsResponse]{@link google.cloud.talent.v4.SearchJobsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.searchJobs(request); + */ + searchJobs( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchJobs(request, options, callback); + } + searchJobsForAlert( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|undefined, {}|undefined + ]>; + searchJobsForAlert( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; + searchJobsForAlert( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + callback: Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Searches for jobs using the provided {@link google.cloud.talent.v4.SearchJobsRequest|SearchJobsRequest}. + * + * This API call is intended for the use case of targeting passive job + * seekers (for example, job seekers who have signed up to receive email + * alerts about potential job opportunities), it has different algorithmic + * adjustments that are designed to specifically target passive job seekers. + * + * This call constrains the {@link google.cloud.talent.v4.Job.visibility|visibility} of jobs + * present in the database, and only returns jobs the caller has + * permission to search against. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant to search within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4.SearchJobsRequest.SearchMode} request.searchMode + * Mode of a search. + * + * Defaults to {@link google.cloud.talent.v4.SearchJobsRequest.SearchMode.JOB_SEARCH|SearchMode.JOB_SEARCH}. + * @param {google.cloud.talent.v4.RequestMetadata} request.requestMetadata + * Required. The meta information collected about the job searcher, used to improve the + * search quality of the service. The identifiers (such as `user_id`) are + * provided by users, and must be unique and consistent. + * @param {google.cloud.talent.v4.JobQuery} request.jobQuery + * Query used to search against jobs, such as keyword, location filters, etc. + * @param {boolean} request.enableBroadening + * Controls whether to broaden the search when it produces sparse results. + * Broadened queries append results to the end of the matching results + * list. + * + * Defaults to false. + * @param {number[]} request.histogramQueries + * An expression specifies a histogram request against matching jobs. + * + * Expression syntax is an aggregation function call with histogram facets and + * other options. + * + * Available aggregation function calls are: + * * `count(string_histogram_facet)`: Count the number of matching entities, + * for each distinct attribute value. + * * `count(numeric_histogram_facet, list of buckets)`: Count the number of + * matching entities within each bucket. + * + * Data types: + * + * * Histogram facet: facet names with format {@link a-zA-Z0-9_|a-zA-Z}+. + * * String: string like "any string with backslash escape for quote(\")." + * * Number: whole number and floating point number like 10, -1 and -0.01. + * * List: list of elements with comma(,) separator surrounded by square + * brackets, for example, [1, 2, 3] and ["one", "two", "three"]. + * + * Built-in constants: + * + * * MIN (minimum number similar to java Double.MIN_VALUE) + * * MAX (maximum number similar to java Double.MAX_VALUE) + * + * Built-in functions: + * + * * bucket(start, end[, label]): bucket built-in function creates a bucket + * with range of [start, end). Note that the end is exclusive, for example, + * bucket(1, MAX, "positive number") or bucket(1, 10). + * + * Job histogram facets: + * + * * company_display_name: histogram by {@link google.cloud.talent.v4.Job.company_display_name|Job.company_display_name}. + * * employment_type: histogram by {@link google.cloud.talent.v4.Job.employment_types|Job.employment_types}, for example, + * "FULL_TIME", "PART_TIME". + * * company_size: histogram by {@link google.cloud.talent.v4.CompanySize|CompanySize}, for example, "SMALL", + * "MEDIUM", "BIG". + * * publish_time_in_month: histogram by the {@link google.cloud.talent.v4.Job.posting_publish_time|Job.posting_publish_time} + * in months. + * Must specify list of numeric buckets in spec. + * * publish_time_in_year: histogram by the {@link google.cloud.talent.v4.Job.posting_publish_time|Job.posting_publish_time} + * in years. + * Must specify list of numeric buckets in spec. + * * degree_types: histogram by the {@link google.cloud.talent.v4.Job.degree_types|Job.degree_types}, for example, + * "Bachelors", "Masters". + * * job_level: histogram by the {@link google.cloud.talent.v4.Job.job_level|Job.job_level}, for example, "Entry + * Level". + * * country: histogram by the country code of jobs, for example, "US", "FR". + * * admin1: histogram by the admin1 code of jobs, which is a global + * placeholder referring to the state, province, or the particular term a + * country uses to define the geographic structure below the country level, + * for example, "CA", "IL". + * * city: histogram by a combination of the "city name, admin1 code". For + * example, "Mountain View, CA", "New York, NY". + * * admin1_country: histogram by a combination of the "admin1 code, country", + * for example, "CA, US", "IL, US". + * * city_coordinate: histogram by the city center's GPS coordinates (latitude + * and longitude), for example, 37.4038522,-122.0987765. Since the + * coordinates of a city center can change, customers may need to refresh + * them periodically. + * * locale: histogram by the {@link google.cloud.talent.v4.Job.language_code|Job.language_code}, for example, "en-US", + * "fr-FR". + * * language: histogram by the language subtag of the {@link google.cloud.talent.v4.Job.language_code|Job.language_code}, + * for example, "en", "fr". + * * category: histogram by the {@link google.cloud.talent.v4.JobCategory|JobCategory}, for example, + * "COMPUTER_AND_IT", "HEALTHCARE". + * * base_compensation_unit: histogram by the + * {@link google.cloud.talent.v4.CompensationInfo.CompensationUnit|CompensationInfo.CompensationUnit} of base + * salary, for example, "WEEKLY", "MONTHLY". + * * base_compensation: histogram by the base salary. Must specify list of + * numeric buckets to group results by. + * * annualized_base_compensation: histogram by the base annualized salary. + * Must specify list of numeric buckets to group results by. + * * annualized_total_compensation: histogram by the total annualized salary. + * Must specify list of numeric buckets to group results by. + * * string_custom_attribute: histogram by string {@link google.cloud.talent.v4.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * string_custom_attribute["key1"]. + * * numeric_custom_attribute: histogram by numeric {@link google.cloud.talent.v4.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * numeric_custom_attribute["key1"]. Must specify list of numeric buckets to + * group results by. + * + * Example expressions: + * + * * `count(admin1)` + * * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), + * bucket(100000, MAX)])` + * * `count(string_custom_attribute["some-string-custom-attribute"])` + * * `count(numeric_custom_attribute["some-numeric-custom-attribute"], + * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` + * @param {google.cloud.talent.v4.JobView} request.jobView + * The desired job attributes returned for jobs in the search response. + * Defaults to {@link google.cloud.talent.v4.JobView.JOB_VIEW_SMALL|JobView.JOB_VIEW_SMALL} if no value is specified. + * @param {number} request.offset + * An integer that specifies the current offset (that is, starting result + * location, amongst the jobs deemed by the API as relevant) in search + * results. This field is only considered if {@link google.cloud.talent.v4.SearchJobsRequest.page_token|page_token} is unset. + * + * The maximum allowed value is 5000. Otherwise an error is thrown. + * + * For example, 0 means to return results starting from the first matching + * job, and 10 means to return from the 11th job. This can be used for + * pagination, (for example, pageSize = 10 and offset = 10 means to return + * from the second page). + * @param {number} request.maxPageSize + * A limit on the number of jobs returned in the search results. + * Increasing this value above the default value of 10 can increase search + * response time. The value can be between 1 and 100. + * @param {string} request.pageToken + * The token specifying the current offset within + * search results. See {@link google.cloud.talent.v4.SearchJobsResponse.next_page_token|SearchJobsResponse.next_page_token} for + * an explanation of how to obtain the next set of query results. + * @param {string} request.orderBy + * The criteria determining how search results are sorted. Default is + * `"relevance desc"`. + * + * Supported options are: + * + * * `"relevance desc"`: By relevance descending, as determined by the API + * algorithms. Relevance thresholding of query results is only available + * with this ordering. + * * `"posting_publish_time desc"`: By {@link google.cloud.talent.v4.Job.posting_publish_time|Job.posting_publish_time} + * descending. + * * `"posting_update_time desc"`: By {@link google.cloud.talent.v4.Job.posting_update_time|Job.posting_update_time} + * descending. + * * `"title"`: By {@link google.cloud.talent.v4.Job.title|Job.title} ascending. + * * `"title desc"`: By {@link google.cloud.talent.v4.Job.title|Job.title} descending. + * * `"annualized_base_compensation"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_base_compensation desc"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation desc"`: By job's + * {@link google.cloud.talent.v4.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"custom_ranking desc"`: By the relevance score adjusted to the + * {@link google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression|SearchJobsRequest.CustomRankingInfo.ranking_expression} with weight + * factor assigned by + * {@link google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.importance_level|SearchJobsRequest.CustomRankingInfo.importance_level} in descending + * order. + * * Location sorting: Use the special syntax to order jobs by distance:
+ * `"distance_from('Hawaii')"`: Order by distance from Hawaii.
+ * `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
+ * `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by + * multiple locations. See details below.
+ * `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by + * multiple locations. See details below.
+ * The string can have a maximum of 256 characters. When multiple distance + * centers are provided, a job that is close to any of the distance centers + * would have a high rank. When a job has multiple locations, the job + * location closest to one of the distance centers will be used. Jobs that + * don't have locations will be ranked at the bottom. Distance is calculated + * with a precision of 11.3 meters (37.4 feet). Diversification strategy is + * still applied unless explicitly disabled in + * {@link google.cloud.talent.v4.SearchJobsRequest.diversification_level|diversification_level}. + * @param {google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel} request.diversificationLevel + * Controls whether highly similar jobs are returned next to each other in + * the search results. Jobs are identified as highly similar based on + * their titles, job categories, and locations. Highly similar results are + * clustered so that only one representative job of the cluster is + * displayed to the job seeker higher up in the results, with the other jobs + * being displayed lower down in the results. + * + * Defaults to {@link google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel.SIMPLE|DiversificationLevel.SIMPLE} if no value + * is specified. + * @param {google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo} request.customRankingInfo + * Controls over how job documents get ranked on top of existing relevance + * score (determined by API algorithm). + * @param {boolean} request.disableKeywordMatch + * Controls whether to disable exact keyword match on {@link google.cloud.talent.v4.Job.title|Job.title}, + * {@link google.cloud.talent.v4.Job.description|Job.description}, {@link google.cloud.talent.v4.Job.company_display_name|Job.company_display_name}, {@link google.cloud.talent.v4.Job.addresses|Job.addresses}, + * {@link google.cloud.talent.v4.Job.qualifications|Job.qualifications}. When disable keyword match is turned off, a + * keyword match returns jobs that do not match given category filters when + * there are matching keywords. For example, for the query "program manager," + * a result is returned even if the job posting has the title "software + * developer," which doesn't fall into "program manager" ontology, but does + * have "program manager" appearing in its description. + * + * For queries like "cloud" that don't contain title or + * location specific ontology, jobs with "cloud" keyword matches are returned + * regardless of this flag's value. + * + * Use {@link google.cloud.talent.v4.Company.keyword_searchable_job_custom_attributes|Company.keyword_searchable_job_custom_attributes} if + * company-specific globally matched custom field/attribute string values are + * needed. Enabling keyword match improves recall of subsequent search + * requests. + * + * Defaults to false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SearchJobsResponse]{@link google.cloud.talent.v4.SearchJobsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.searchJobsForAlert(request); + */ + searchJobsForAlert( + request: protos.google.cloud.talent.v4.ISearchJobsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ISearchJobsResponse, + protos.google.cloud.talent.v4.ISearchJobsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchJobsForAlert(request, options, callback); + } + + batchCreateJobs( + request: protos.google.cloud.talent.v4.IBatchCreateJobsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchCreateJobs( + request: protos.google.cloud.talent.v4.IBatchCreateJobsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateJobs( + request: protos.google.cloud.talent.v4.IBatchCreateJobsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Begins executing a batch create jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {number[]} request.jobs + * Required. The jobs to be created. + * A maximum of 200 jobs can be created in a batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchCreateJobs(request); + * const [response] = await operation.promise(); + */ + batchCreateJobs( + request: protos.google.cloud.talent.v4.IBatchCreateJobsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateJobs(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchCreateJobs()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchCreateJobsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchCreateJobsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchCreateJobs, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchUpdateJobs( + request: protos.google.cloud.talent.v4.IBatchUpdateJobsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateJobs( + request: protos.google.cloud.talent.v4.IBatchUpdateJobsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateJobs( + request: protos.google.cloud.talent.v4.IBatchUpdateJobsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Begins executing a batch update jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {number[]} request.jobs + * Required. The jobs to be updated. + * A maximum of 200 jobs can be updated in a batch. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. Be aware that it will + * also increase latency when checking the status of a batch operation. + * + * If {@link google.cloud.talent.v4.BatchUpdateJobsRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4.Job|Job} are updated. Otherwise all the fields are updated. + * + * A field mask to restrict the fields that are updated. Only + * top level fields of {@link google.cloud.talent.v4.Job|Job} are supported. + * + * If {@link google.cloud.talent.v4.BatchUpdateJobsRequest.update_mask|update_mask} is provided, The {@link google.cloud.talent.v4.Job|Job} inside + * {@link JobOperationResult.JobResult|JobResult} + * will only contains fields that is updated, plus the Id of the Job. + * Otherwise, {@link google.cloud.talent.v4.Job|Job} will include all fields, which can yield a very + * large response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateJobs(request); + * const [response] = await operation.promise(); + */ + batchUpdateJobs( + request: protos.google.cloud.talent.v4.IBatchUpdateJobsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateJobs(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateJobs()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateJobsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateJobsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateJobs, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchDeleteJobs( + request: protos.google.cloud.talent.v4.IBatchDeleteJobsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchDeleteJobs( + request: protos.google.cloud.talent.v4.IBatchDeleteJobsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchDeleteJobs( + request: protos.google.cloud.talent.v4.IBatchDeleteJobsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Begins executing a batch delete jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * + * The parent of all of the jobs specified in `names` must match this field. + * @param {string[]} request.names + * The names of the jobs to delete. + * + * The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + * For example, "projects/foo/tenants/bar/jobs/baz". + * + * A maximum of 200 jobs can be deleted in a batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchDeleteJobs(request); + * const [response] = await operation.promise(); + */ + batchDeleteJobs( + request: protos.google.cloud.talent.v4.IBatchDeleteJobsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteJobs(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchDeleteJobs()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchDeleteJobsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchDeleteJobsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchDeleteJobs, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listJobs( + request: protos.google.cloud.talent.v4.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.IJob[], + protos.google.cloud.talent.v4.IListJobsRequest|null, + protos.google.cloud.talent.v4.IListJobsResponse + ]>; + listJobs( + request: protos.google.cloud.talent.v4.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4.IListJobsRequest, + protos.google.cloud.talent.v4.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4.IJob>): void; + listJobs( + request: protos.google.cloud.talent.v4.IListJobsRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4.IListJobsRequest, + protos.google.cloud.talent.v4.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4.IJob>): void; +/** + * Lists jobs by filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If {@link google.cloud.talent.v4.ListJobsRequest.job_view|job_view} is set to {@link google.cloud.talent.v4.JobView.JOB_VIEW_ID_ONLY|JobView.JOB_VIEW_ID_ONLY}, the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to {@link google.cloud.talent.v4.JobView.JOB_VIEW_FULL|JobView.JOB_VIEW_FULL} if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Job]{@link google.cloud.talent.v4.Job}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobs( + request: protos.google.cloud.talent.v4.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4.IListJobsRequest, + protos.google.cloud.talent.v4.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4.IJob>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4.IListJobsRequest, + protos.google.cloud.talent.v4.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4.IJob>): + Promise<[ + protos.google.cloud.talent.v4.IJob[], + protos.google.cloud.talent.v4.IListJobsRequest|null, + protos.google.cloud.talent.v4.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If {@link google.cloud.talent.v4.ListJobsRequest.job_view|job_view} is set to {@link google.cloud.talent.v4.JobView.JOB_VIEW_ID_ONLY|JobView.JOB_VIEW_ID_ONLY}, the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to {@link google.cloud.talent.v4.JobView.JOB_VIEW_FULL|JobView.JOB_VIEW_FULL} if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Job]{@link google.cloud.talent.v4.Job} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobsStream( + request?: protos.google.cloud.talent.v4.IListJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If {@link google.cloud.talent.v4.ListJobsRequest.job_view|job_view} is set to {@link google.cloud.talent.v4.JobView.JOB_VIEW_ID_ONLY|JobView.JOB_VIEW_ID_ONLY}, the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to {@link google.cloud.talent.v4.JobView.JOB_VIEW_FULL|JobView.JOB_VIEW_FULL} if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Job]{@link google.cloud.talent.v4.Job}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listJobsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listJobsAsync( + request?: protos.google.cloud.talent.v4.IListJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified company resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + companyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.companyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).project; + } + + /** + * Parse the tenant from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).tenant; + } + + /** + * Parse the company from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).company; + } + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the tenant from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).tenant; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.jobServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4/src/v4/job_service_client_config.json b/owl-bot-staging/v4/src/v4/job_service_client_config.json new file mode 100644 index 0000000..cf9e478 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/job_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.talent.v4.JobService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateJob": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateJob": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchUpdateJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteJob": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchDeleteJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListJobs": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SearchJobsForAlert": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4/src/v4/job_service_proto_list.json b/owl-bot-staging/v4/src/v4/job_service_proto_list.json new file mode 100644 index 0000000..bcae136 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/job_service_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/talent/v4/common.proto", + "../../protos/google/cloud/talent/v4/company.proto", + "../../protos/google/cloud/talent/v4/company_service.proto", + "../../protos/google/cloud/talent/v4/completion_service.proto", + "../../protos/google/cloud/talent/v4/event.proto", + "../../protos/google/cloud/talent/v4/event_service.proto", + "../../protos/google/cloud/talent/v4/filters.proto", + "../../protos/google/cloud/talent/v4/histogram.proto", + "../../protos/google/cloud/talent/v4/job.proto", + "../../protos/google/cloud/talent/v4/job_service.proto", + "../../protos/google/cloud/talent/v4/tenant.proto", + "../../protos/google/cloud/talent/v4/tenant_service.proto" +] diff --git a/owl-bot-staging/v4/src/v4/tenant_service_client.ts b/owl-bot-staging/v4/src/v4/tenant_service_client.ts new file mode 100644 index 0000000..8fded13 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/tenant_service_client.ts @@ -0,0 +1,963 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4/tenant_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tenant_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service that handles tenant management, including CRUD and enumeration. + * @class + * @memberof v4 + */ +export class TenantServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + tenantServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TenantServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof TenantServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + companyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listTenants: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tenants') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4.TenantService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.tenantServiceStub) { + return this.tenantServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4.TenantService. + this.tenantServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4.TenantService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4.TenantService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const tenantServiceStubMethods = + ['createTenant', 'getTenant', 'updateTenant', 'deleteTenant', 'listTenants']; + for (const methodName of tenantServiceStubMethods) { + const callPromise = this.tenantServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.tenantServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createTenant( + request: protos.google.cloud.talent.v4.ICreateTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.ICreateTenantRequest|undefined, {}|undefined + ]>; + createTenant( + request: protos.google.cloud.talent.v4.ICreateTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.ICreateTenantRequest|null|undefined, + {}|null|undefined>): void; + createTenant( + request: protos.google.cloud.talent.v4.ICreateTenantRequest, + callback: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.ICreateTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new tenant entity. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {google.cloud.talent.v4.Tenant} request.tenant + * Required. The tenant to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Tenant]{@link google.cloud.talent.v4.Tenant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createTenant(request); + */ + createTenant( + request: protos.google.cloud.talent.v4.ICreateTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.ICreateTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.ICreateTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.ICreateTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createTenant(request, options, callback); + } + getTenant( + request: protos.google.cloud.talent.v4.IGetTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IGetTenantRequest|undefined, {}|undefined + ]>; + getTenant( + request: protos.google.cloud.talent.v4.IGetTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IGetTenantRequest|null|undefined, + {}|null|undefined>): void; + getTenant( + request: protos.google.cloud.talent.v4.IGetTenantRequest, + callback: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IGetTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves specified tenant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the tenant to be retrieved. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Tenant]{@link google.cloud.talent.v4.Tenant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getTenant(request); + */ + getTenant( + request: protos.google.cloud.talent.v4.IGetTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IGetTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IGetTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IGetTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getTenant(request, options, callback); + } + updateTenant( + request: protos.google.cloud.talent.v4.IUpdateTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IUpdateTenantRequest|undefined, {}|undefined + ]>; + updateTenant( + request: protos.google.cloud.talent.v4.IUpdateTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IUpdateTenantRequest|null|undefined, + {}|null|undefined>): void; + updateTenant( + request: protos.google.cloud.talent.v4.IUpdateTenantRequest, + callback: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IUpdateTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified tenant. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4.Tenant} request.tenant + * Required. The tenant resource to replace the current resource in the system. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4.UpdateTenantRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4.UpdateTenantRequest.tenant|tenant} are updated. Otherwise all the fields are updated. + * + * A field mask to specify the tenant fields to be updated. Only + * top level fields of {@link google.cloud.talent.v4.Tenant|Tenant} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Tenant]{@link google.cloud.talent.v4.Tenant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateTenant(request); + */ + updateTenant( + request: protos.google.cloud.talent.v4.IUpdateTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IUpdateTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IUpdateTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4.ITenant, + protos.google.cloud.talent.v4.IUpdateTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'tenant.name': request.tenant!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateTenant(request, options, callback); + } + deleteTenant( + request: protos.google.cloud.talent.v4.IDeleteTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteTenantRequest|undefined, {}|undefined + ]>; + deleteTenant( + request: protos.google.cloud.talent.v4.IDeleteTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteTenantRequest|null|undefined, + {}|null|undefined>): void; + deleteTenant( + request: protos.google.cloud.talent.v4.IDeleteTenantRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes specified tenant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the tenant to be deleted. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteTenant(request); + */ + deleteTenant( + request: protos.google.cloud.talent.v4.IDeleteTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4.IDeleteTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteTenant(request, options, callback); + } + + listTenants( + request: protos.google.cloud.talent.v4.IListTenantsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4.ITenant[], + protos.google.cloud.talent.v4.IListTenantsRequest|null, + protos.google.cloud.talent.v4.IListTenantsResponse + ]>; + listTenants( + request: protos.google.cloud.talent.v4.IListTenantsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4.IListTenantsRequest, + protos.google.cloud.talent.v4.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4.ITenant>): void; + listTenants( + request: protos.google.cloud.talent.v4.IListTenantsRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4.IListTenantsRequest, + protos.google.cloud.talent.v4.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4.ITenant>): void; +/** + * Lists all tenants associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of tenants to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Tenant]{@link google.cloud.talent.v4.Tenant}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTenantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTenants( + request: protos.google.cloud.talent.v4.IListTenantsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4.IListTenantsRequest, + protos.google.cloud.talent.v4.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4.ITenant>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4.IListTenantsRequest, + protos.google.cloud.talent.v4.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4.ITenant>): + Promise<[ + protos.google.cloud.talent.v4.ITenant[], + protos.google.cloud.talent.v4.IListTenantsRequest|null, + protos.google.cloud.talent.v4.IListTenantsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listTenants(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of tenants to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Tenant]{@link google.cloud.talent.v4.Tenant} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTenantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTenantsStream( + request?: protos.google.cloud.talent.v4.IListTenantsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTenants.createStream( + this.innerApiCalls.listTenants as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTenants`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of tenants to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Tenant]{@link google.cloud.talent.v4.Tenant}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listTenantsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listTenantsAsync( + request?: protos.google.cloud.talent.v4.IListTenantsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTenants.asyncIterate( + this.innerApiCalls['listTenants'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified company resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + companyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.companyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).project; + } + + /** + * Parse the tenant from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).tenant; + } + + /** + * Parse the company from Company resource. + * + * @param {string} companyName + * A fully-qualified path representing Company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromCompanyName(companyName: string) { + return this.pathTemplates.companyPathTemplate.match(companyName).company; + } + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the tenant from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).tenant; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.tenantServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4/src/v4/tenant_service_client_config.json b/owl-bot-staging/v4/src/v4/tenant_service_client_config.json new file mode 100644 index 0000000..478061c --- /dev/null +++ b/owl-bot-staging/v4/src/v4/tenant_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.talent.v4.TenantService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateTenant": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetTenant": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateTenant": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTenant": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListTenants": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4/src/v4/tenant_service_proto_list.json b/owl-bot-staging/v4/src/v4/tenant_service_proto_list.json new file mode 100644 index 0000000..bcae136 --- /dev/null +++ b/owl-bot-staging/v4/src/v4/tenant_service_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/talent/v4/common.proto", + "../../protos/google/cloud/talent/v4/company.proto", + "../../protos/google/cloud/talent/v4/company_service.proto", + "../../protos/google/cloud/talent/v4/completion_service.proto", + "../../protos/google/cloud/talent/v4/event.proto", + "../../protos/google/cloud/talent/v4/event_service.proto", + "../../protos/google/cloud/talent/v4/filters.proto", + "../../protos/google/cloud/talent/v4/histogram.proto", + "../../protos/google/cloud/talent/v4/job.proto", + "../../protos/google/cloud/talent/v4/job_service.proto", + "../../protos/google/cloud/talent/v4/tenant.proto", + "../../protos/google/cloud/talent/v4/tenant_service.proto" +] diff --git a/owl-bot-staging/v4/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v4/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..87bb86f --- /dev/null +++ b/owl-bot-staging/v4/system-test/fixtures/sample/src/index.js @@ -0,0 +1,31 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const talent = require('@google-cloud/talent'); + +function main() { + const companyServiceClient = new talent.CompanyServiceClient(); + const completionClient = new talent.CompletionClient(); + const eventServiceClient = new talent.EventServiceClient(); + const jobServiceClient = new talent.JobServiceClient(); + const tenantServiceClient = new talent.TenantServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v4/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v4/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..e5fe48b --- /dev/null +++ b/owl-bot-staging/v4/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {CompanyServiceClient, CompletionClient, EventServiceClient, JobServiceClient, TenantServiceClient} from '@google-cloud/talent'; + +// check that the client class type name can be used +function doStuffWithCompanyServiceClient(client: CompanyServiceClient) { + client.close(); +} +function doStuffWithCompletionClient(client: CompletionClient) { + client.close(); +} +function doStuffWithEventServiceClient(client: EventServiceClient) { + client.close(); +} +function doStuffWithJobServiceClient(client: JobServiceClient) { + client.close(); +} +function doStuffWithTenantServiceClient(client: TenantServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const companyServiceClient = new CompanyServiceClient(); + doStuffWithCompanyServiceClient(companyServiceClient); + // check that the client instance can be created + const completionClient = new CompletionClient(); + doStuffWithCompletionClient(completionClient); + // check that the client instance can be created + const eventServiceClient = new EventServiceClient(); + doStuffWithEventServiceClient(eventServiceClient); + // check that the client instance can be created + const jobServiceClient = new JobServiceClient(); + doStuffWithJobServiceClient(jobServiceClient); + // check that the client instance can be created + const tenantServiceClient = new TenantServiceClient(); + doStuffWithTenantServiceClient(tenantServiceClient); +} + +main(); diff --git a/owl-bot-staging/v4/system-test/install.ts b/owl-bot-staging/v4/system-test/install.ts new file mode 100644 index 0000000..1f850b5 --- /dev/null +++ b/owl-bot-staging/v4/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v4/test/gapic_company_service_v4.ts b/owl-bot-staging/v4/test/gapic_company_service_v4.ts new file mode 100644 index 0000000..ba1542c --- /dev/null +++ b/owl-bot-staging/v4/test/gapic_company_service_v4.ts @@ -0,0 +1,861 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as companyserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4.CompanyServiceClient', () => { + it('has servicePath', () => { + const servicePath = companyserviceModule.v4.CompanyServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = companyserviceModule.v4.CompanyServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = companyserviceModule.v4.CompanyServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new companyserviceModule.v4.CompanyServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.companyServiceStub, undefined); + await client.initialize(); + assert(client.companyServiceStub); + }); + + it('has close method', () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createCompany', () => { + it('invokes createCompany without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateCompanyRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Company()); + client.innerApiCalls.createCompany = stubSimpleCall(expectedResponse); + const [response] = await client.createCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCompany without error using callback', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateCompanyRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Company()); + client.innerApiCalls.createCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCompany( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ICompany|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCompany with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateCompanyRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCompany(request), expectedError); + assert((client.innerApiCalls.createCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getCompany', () => { + it('invokes getCompany without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Company()); + client.innerApiCalls.getCompany = stubSimpleCall(expectedResponse); + const [response] = await client.getCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCompany without error using callback', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Company()); + client.innerApiCalls.getCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCompany( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ICompany|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCompany with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCompany(request), expectedError); + assert((client.innerApiCalls.getCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateCompany', () => { + it('invokes updateCompany without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateCompanyRequest()); + request.company = {}; + request.company.name = ''; + const expectedHeaderRequestParams = "company.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Company()); + client.innerApiCalls.updateCompany = stubSimpleCall(expectedResponse); + const [response] = await client.updateCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCompany without error using callback', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateCompanyRequest()); + request.company = {}; + request.company.name = ''; + const expectedHeaderRequestParams = "company.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Company()); + client.innerApiCalls.updateCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCompany( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ICompany|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCompany with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateCompanyRequest()); + request.company = {}; + request.company.name = ''; + const expectedHeaderRequestParams = "company.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCompany(request), expectedError); + assert((client.innerApiCalls.updateCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteCompany', () => { + it('invokes deleteCompany without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCompany = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCompany without error using callback', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCompany( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCompany with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCompany(request), expectedError); + assert((client.innerApiCalls.deleteCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listCompanies', () => { + it('invokes listCompanies without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + ]; + client.innerApiCalls.listCompanies = stubSimpleCall(expectedResponse); + const [response] = await client.listCompanies(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCompanies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCompanies without error using callback', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + ]; + client.innerApiCalls.listCompanies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCompanies( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ICompany[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCompanies as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCompanies with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCompanies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCompanies(request), expectedError); + assert((client.innerApiCalls.listCompanies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCompaniesStream without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + ]; + client.descriptors.page.listCompanies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCompaniesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4.Company[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4.Company) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCompanies, request)); + assert.strictEqual( + (client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCompaniesStream with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCompanies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCompaniesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4.Company[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4.Company) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCompanies, request)); + assert.strictEqual( + (client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCompanies without error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4.Company()), + ]; + client.descriptors.page.listCompanies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4.ICompany[] = []; + const iterable = client.listCompaniesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCompanies with error', async () => { + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCompanies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCompaniesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4.ICompany[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('company', () => { + const fakePath = "/rendered/path/company"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.companyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.companyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('companyPath', () => { + const result = client.companyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.companyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCompanyName', () => { + const result = client.matchProjectFromCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromCompanyName', () => { + const result = client.matchTenantFromCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromCompanyName', () => { + const result = client.matchCompanyFromCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromJobName', () => { + const result = client.matchTenantFromJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new companyserviceModule.v4.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4/test/gapic_completion_v4.ts b/owl-bot-staging/v4/test/gapic_completion_v4.ts new file mode 100644 index 0000000..4435855 --- /dev/null +++ b/owl-bot-staging/v4/test/gapic_completion_v4.ts @@ -0,0 +1,337 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as completionModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v4.CompletionClient', () => { + it('has servicePath', () => { + const servicePath = completionModule.v4.CompletionClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = completionModule.v4.CompletionClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = completionModule.v4.CompletionClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new completionModule.v4.CompletionClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new completionModule.v4.CompletionClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new completionModule.v4.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.completionStub, undefined); + await client.initialize(); + assert(client.completionStub); + }); + + it('has close method', () => { + const client = new completionModule.v4.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionModule.v4.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionModule.v4.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('completeQuery', () => { + it('invokes completeQuery without error', async () => { + const client = new completionModule.v4.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CompleteQueryRequest()); + request.tenant = ''; + const expectedHeaderRequestParams = "tenant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.CompleteQueryResponse()); + client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); + const [response] = await client.completeQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes completeQuery without error using callback', async () => { + const client = new completionModule.v4.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CompleteQueryRequest()); + request.tenant = ''; + const expectedHeaderRequestParams = "tenant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.CompleteQueryResponse()); + client.innerApiCalls.completeQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeQuery( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ICompleteQueryResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes completeQuery with error', async () => { + const client = new completionModule.v4.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CompleteQueryRequest()); + request.tenant = ''; + const expectedHeaderRequestParams = "tenant="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeQuery(request), expectedError); + assert((client.innerApiCalls.completeQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('company', () => { + const fakePath = "/rendered/path/company"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new completionModule.v4.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.companyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.companyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('companyPath', () => { + const result = client.companyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.companyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCompanyName', () => { + const result = client.matchProjectFromCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromCompanyName', () => { + const result = client.matchTenantFromCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromCompanyName', () => { + const result = client.matchCompanyFromCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new completionModule.v4.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromJobName', () => { + const result = client.matchTenantFromJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new completionModule.v4.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4/test/gapic_event_service_v4.ts b/owl-bot-staging/v4/test/gapic_event_service_v4.ts new file mode 100644 index 0000000..99e8fa2 --- /dev/null +++ b/owl-bot-staging/v4/test/gapic_event_service_v4.ts @@ -0,0 +1,337 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as eventserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v4.EventServiceClient', () => { + it('has servicePath', () => { + const servicePath = eventserviceModule.v4.EventServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = eventserviceModule.v4.EventServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = eventserviceModule.v4.EventServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new eventserviceModule.v4.EventServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new eventserviceModule.v4.EventServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.eventServiceStub, undefined); + await client.initialize(); + assert(client.eventServiceStub); + }); + + it('has close method', () => { + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createClientEvent', () => { + it('invokes createClientEvent without error', async () => { + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateClientEventRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.ClientEvent()); + client.innerApiCalls.createClientEvent = stubSimpleCall(expectedResponse); + const [response] = await client.createClientEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createClientEvent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createClientEvent without error using callback', async () => { + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateClientEventRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.ClientEvent()); + client.innerApiCalls.createClientEvent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createClientEvent( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.IClientEvent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createClientEvent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createClientEvent with error', async () => { + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateClientEventRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientEvent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createClientEvent(request), expectedError); + assert((client.innerApiCalls.createClientEvent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('company', () => { + const fakePath = "/rendered/path/company"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.companyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.companyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('companyPath', () => { + const result = client.companyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.companyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCompanyName', () => { + const result = client.matchProjectFromCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromCompanyName', () => { + const result = client.matchTenantFromCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromCompanyName', () => { + const result = client.matchCompanyFromCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromJobName', () => { + const result = client.matchTenantFromJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new eventserviceModule.v4.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4/test/gapic_job_service_v4.ts b/owl-bot-staging/v4/test/gapic_job_service_v4.ts new file mode 100644 index 0000000..98c2aec --- /dev/null +++ b/owl-bot-staging/v4/test/gapic_job_service_v4.ts @@ -0,0 +1,1507 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as jobserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4.JobServiceClient', () => { + it('has servicePath', () => { + const servicePath = jobserviceModule.v4.JobServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = jobserviceModule.v4.JobServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = jobserviceModule.v4.JobServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new jobserviceModule.v4.JobServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new jobserviceModule.v4.JobServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.jobServiceStub, undefined); + await client.initialize(); + assert(client.jobServiceStub); + }); + + it('has close method', () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createJob', () => { + it('invokes createJob without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Job()); + client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); + const [response] = await client.createJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJob without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Job()); + client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJob( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createJob with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJob(request), expectedError); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Job()); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Job()); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getJob with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateJob', () => { + it('invokes updateJob without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Job()); + client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateJob without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Job()); + client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJob( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateJob with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJob(request), expectedError); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteJob', () => { + it('invokes deleteJob without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJob without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteJob with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJob(request), expectedError); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('searchJobs', () => { + it('invokes searchJobs without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsResponse()); + client.innerApiCalls.searchJobs = stubSimpleCall(expectedResponse); + const [response] = await client.searchJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchJobs without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsResponse()); + client.innerApiCalls.searchJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchJobs( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ISearchJobsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchJobs with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchJobs(request), expectedError); + assert((client.innerApiCalls.searchJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('searchJobsForAlert', () => { + it('invokes searchJobsForAlert without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsResponse()); + client.innerApiCalls.searchJobsForAlert = stubSimpleCall(expectedResponse); + const [response] = await client.searchJobsForAlert(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobsForAlert as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchJobsForAlert without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsResponse()); + client.innerApiCalls.searchJobsForAlert = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchJobsForAlert( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ISearchJobsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobsForAlert as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchJobsForAlert with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchJobsForAlert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchJobsForAlert(request), expectedError); + assert((client.innerApiCalls.searchJobsForAlert as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchCreateJobs', () => { + it('invokes batchCreateJobs without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateJobs = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateJobs(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateJobs without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateJobs = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateJobs( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchCreateJobs with call error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateJobs = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateJobs(request), expectedError); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateJobs with LRO error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateJobs = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateJobs(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchCreateJobsProgress without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchCreateJobsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateJobsProgress with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchCreateJobsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchUpdateJobs', () => { + it('invokes batchUpdateJobs without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateJobs(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateJobs without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateJobs( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateJobs with call error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateJobs(request), expectedError); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateJobs with LRO error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateJobs(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateJobsProgress without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateJobsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateJobsProgress with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateJobsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchDeleteJobs', () => { + it('invokes batchDeleteJobs without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteJobs = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteJobs(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteJobs without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchDeleteJobs = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteJobs( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteJobs with call error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteJobs = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteJobs(request), expectedError); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteJobs with LRO error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteJobs = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteJobs(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchDeleteJobsProgress without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteJobsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteJobsProgress with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchDeleteJobsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listJobs with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4.Job[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4.Job[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('company', () => { + const fakePath = "/rendered/path/company"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.companyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.companyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('companyPath', () => { + const result = client.companyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.companyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCompanyName', () => { + const result = client.matchProjectFromCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromCompanyName', () => { + const result = client.matchTenantFromCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromCompanyName', () => { + const result = client.matchCompanyFromCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromJobName', () => { + const result = client.matchTenantFromJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new jobserviceModule.v4.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4/test/gapic_tenant_service_v4.ts b/owl-bot-staging/v4/test/gapic_tenant_service_v4.ts new file mode 100644 index 0000000..748b840 --- /dev/null +++ b/owl-bot-staging/v4/test/gapic_tenant_service_v4.ts @@ -0,0 +1,891 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as tenantserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4.TenantServiceClient', () => { + it('has servicePath', () => { + const servicePath = tenantserviceModule.v4.TenantServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tenantserviceModule.v4.TenantServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tenantserviceModule.v4.TenantServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tenantserviceModule.v4.TenantServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.tenantServiceStub, undefined); + await client.initialize(); + assert(client.tenantServiceStub); + }); + + it('has close method', () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createTenant', () => { + it('invokes createTenant without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateTenantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()); + client.innerApiCalls.createTenant = stubSimpleCall(expectedResponse); + const [response] = await client.createTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTenant without error using callback', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateTenantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()); + client.innerApiCalls.createTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTenant( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ITenant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTenant with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.CreateTenantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTenant(request), expectedError); + assert((client.innerApiCalls.createTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getTenant', () => { + it('invokes getTenant without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()); + client.innerApiCalls.getTenant = stubSimpleCall(expectedResponse); + const [response] = await client.getTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTenant without error using callback', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()); + client.innerApiCalls.getTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTenant( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ITenant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getTenant with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.GetTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTenant(request), expectedError); + assert((client.innerApiCalls.getTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateTenant', () => { + it('invokes updateTenant without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateTenantRequest()); + request.tenant = {}; + request.tenant.name = ''; + const expectedHeaderRequestParams = "tenant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()); + client.innerApiCalls.updateTenant = stubSimpleCall(expectedResponse); + const [response] = await client.updateTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateTenant without error using callback', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateTenantRequest()); + request.tenant = {}; + request.tenant.name = ''; + const expectedHeaderRequestParams = "tenant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()); + client.innerApiCalls.updateTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTenant( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ITenant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateTenant with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.UpdateTenantRequest()); + request.tenant = {}; + request.tenant.name = ''; + const expectedHeaderRequestParams = "tenant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTenant(request), expectedError); + assert((client.innerApiCalls.updateTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteTenant', () => { + it('invokes deleteTenant without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTenant = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTenant without error using callback', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTenant( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteTenant with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.DeleteTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTenant(request), expectedError); + assert((client.innerApiCalls.deleteTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listTenants', () => { + it('invokes listTenants without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + ]; + client.innerApiCalls.listTenants = stubSimpleCall(expectedResponse); + const [response] = await client.listTenants(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTenants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTenants without error using callback', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + ]; + client.innerApiCalls.listTenants = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTenants( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4.ITenant[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTenants as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listTenants with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTenants = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTenants(request), expectedError); + assert((client.innerApiCalls.listTenants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTenantsStream without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + ]; + client.descriptors.page.listTenants.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTenantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4.Tenant[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4.Tenant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTenants, request)); + assert.strictEqual( + (client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTenantsStream with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listTenants.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTenantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4.Tenant[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4.Tenant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTenants, request)); + assert.strictEqual( + (client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTenants without error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4.Tenant()), + ]; + client.descriptors.page.listTenants.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4.ITenant[] = []; + const iterable = client.listTenantsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTenants with error', async () => { + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listTenants.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTenantsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4.ITenant[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('company', () => { + const fakePath = "/rendered/path/company"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.companyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.companyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('companyPath', () => { + const result = client.companyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.companyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCompanyName', () => { + const result = client.matchProjectFromCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromCompanyName', () => { + const result = client.matchTenantFromCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromCompanyName', () => { + const result = client.matchCompanyFromCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.companyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromJobName', () => { + const result = client.matchTenantFromJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new tenantserviceModule.v4.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4/tsconfig.json b/owl-bot-staging/v4/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v4/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v4/webpack.config.js b/owl-bot-staging/v4/webpack.config.js new file mode 100644 index 0000000..f38000f --- /dev/null +++ b/owl-bot-staging/v4/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'talent', + filename: './talent.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v4beta1/README.md b/owl-bot-staging/v4beta1/README.md new file mode 100644 index 0000000..29e9e27 --- /dev/null +++ b/owl-bot-staging/v4beta1/README.md @@ -0,0 +1 @@ +Talent: Nodejs Client diff --git a/owl-bot-staging/v4beta1/linkinator.config.json b/owl-bot-staging/v4beta1/linkinator.config.json new file mode 100644 index 0000000..29a223b --- /dev/null +++ b/owl-bot-staging/v4beta1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/owl-bot-staging/v4beta1/package.json b/owl-bot-staging/v4beta1/package.json new file mode 100644 index 0000000..2019a78 --- /dev/null +++ b/owl-bot-staging/v4beta1/package.json @@ -0,0 +1,70 @@ +{ + "name": "@google-cloud/talent", + "version": "0.1.0", + "description": "Talent client for Node.js", + "repository": "googleapis/nodejs-talent", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google talent", + "talent", + "application service", + "company service", + "completion", + "event service", + "job service", + "profile service", + "tenant service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.14.0" + }, + "devDependencies": { + "@types/mocha": "^8.2.2", + "@types/node": "^14.17.1", + "@types/sinon": "^10.0.0", + "c8": "^7.7.2", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.6", + "linkinator": "^2.13.6", + "mocha": "^8.4.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^10.0.0", + "ts-loader": "^9.2.2", + "typescript": "^4.2.4", + "webpack": "^5.37.1", + "webpack-cli": "^4.7.0" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/application.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/application.proto new file mode 100644 index 0000000..ccb4920 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/application.proto @@ -0,0 +1,183 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/date.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "ApplicationResourceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// Resource that represents a job application record of a candidate. +message Application { + option (google.api.resource) = { + type: "jobs.googleapis.com/Application" + pattern: "projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}" + }; + + // Enum that represents the application status. + enum ApplicationState { + // Default value. + APPLICATION_STATE_UNSPECIFIED = 0; + + // The current stage is in progress or pending, for example, interviews in + // progress. + IN_PROGRESS = 1; + + // The current stage was terminated by a candidate decision. + CANDIDATE_WITHDREW = 2; + + // The current stage was terminated by an employer or agency decision. + EMPLOYER_WITHDREW = 3; + + // The current stage is successfully completed, but the next stage (if + // applicable) has not begun. + COMPLETED = 4; + + // The current stage was closed without an exception, or terminated for + // reasons unrealated to the candidate. + CLOSED = 5; + } + + // The stage of the application. + enum ApplicationStage { + // Default value. + APPLICATION_STAGE_UNSPECIFIED = 0; + + // Candidate has applied or a recruiter put candidate into consideration but + // candidate is not yet screened / no decision has been made to move or not + // move the candidate to the next stage. + NEW = 1; + + // A recruiter decided to screen the candidate for this role. + SCREEN = 2; + + // Candidate is being / was sent to the customer / hiring manager for + // detailed review. + HIRING_MANAGER_REVIEW = 3; + + // Candidate was approved by the client / hiring manager and is being / was + // interviewed for the role. + INTERVIEW = 4; + + // Candidate will be / has been given an offer of employment. + OFFER_EXTENDED = 5; + + // Candidate has accepted their offer of employment. + OFFER_ACCEPTED = 6; + + // Candidate has begun (or completed) their employment or assignment with + // the employer. + STARTED = 7; + } + + // Required during application update. + // + // Resource name assigned to an application by the API. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + // For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". + string name = 1; + + // Required. Client side application identifier, used to uniquely identify the + // application. + // + // The maximum number of allowed characters is 255. + string external_id = 31 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Resource name of the candidate of this application. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + // For example, "projects/foo/tenants/bar/profiles/baz". + string profile = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Resource name of the job which the candidate applied for. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, + // "projects/foo/tenants/bar/jobs/baz". + string job = 4 [ + (google.api.resource_reference).type = "jobs.googleapis.com/Job", + (google.api.field_behavior) = REQUIRED + ]; + + // Resource name of the company which the candidate applied for. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". + // For example, "projects/foo/tenants/bar/companies/baz". + string company = 5 [ + (google.api.resource_reference) = { type: "jobs.googleapis.com/Company" } + ]; + + // The application date. + google.type.Date application_date = 7; + + // Required. What is the most recent stage of the application (that is, new, + // screen, send cv, hired, finished work)? This field is intentionally not + // comprehensive of every possible status, but instead, represents statuses + // that would be used to indicate to the ML models good / bad matches. + ApplicationStage stage = 11 [(google.api.field_behavior) = REQUIRED]; + + // The application state. + ApplicationState state = 13; + + // All interviews (screen, onsite, and so on) conducted as part of this + // application (includes details such as user conducting the interview, + // timestamp, feedback, and so on). + repeated Interview interviews = 16; + + // If the candidate is referred by a employee. + google.protobuf.BoolValue referral = 18; + + // Required. Reflects the time that the application was created. + google.protobuf.Timestamp create_time = 19 + [(google.api.field_behavior) = REQUIRED]; + + // The last update timestamp. + google.protobuf.Timestamp update_time = 20; + + // Free text reason behind the recruitement outcome (for example, reason for + // withdraw / reject, reason for an unsuccessful finish, and so on). + // + // Number of characters allowed is 100. + string outcome_notes = 21; + + // Outcome positiveness shows how positive the outcome is. + Outcome outcome = 22; + + // Output only. Indicates whether this job application is a match to + // application related filters. This value is only applicable in profile + // search response. + google.protobuf.BoolValue is_match = 28 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Job title snippet shows how the job title is related to a + // search query. It's empty if the job title isn't related to the search + // query. + string job_title_snippet = 29 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/application_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/application_service.proto new file mode 100644 index 0000000..c9f990d --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/application_service.proto @@ -0,0 +1,181 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/application.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "ApplicationServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service that handles application management, including CRUD and +// enumeration. +service ApplicationService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new application entity. + rpc CreateApplication(CreateApplicationRequest) returns (Application) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*/profiles/*}/applications" + body: "*" + }; + option (google.api.method_signature) = "parent,application"; + } + + // Retrieves specified application. + rpc GetApplication(GetApplicationRequest) returns (Application) { + option (google.api.http) = { + get: "/v4beta1/{name=projects/*/tenants/*/profiles/*/applications/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified application. + rpc UpdateApplication(UpdateApplicationRequest) returns (Application) { + option (google.api.http) = { + patch: "/v4beta1/{application.name=projects/*/tenants/*/profiles/*/applications/*}" + body: "*" + }; + option (google.api.method_signature) = "application"; + } + + // Deletes specified application. + rpc DeleteApplication(DeleteApplicationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4beta1/{name=projects/*/tenants/*/profiles/*/applications/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all applications associated with the profile. + rpc ListApplications(ListApplicationsRequest) returns (ListApplicationsResponse) { + option (google.api.http) = { + get: "/v4beta1/{parent=projects/*/tenants/*/profiles/*}/applications" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The Request of the CreateApplication method. +message CreateApplicationRequest { + // Required. Resource name of the profile under which the application is created. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + // For example, "projects/foo/tenants/bar/profiles/baz". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Profile" + } + ]; + + // Required. The application to be created. + Application application = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for getting a application by name. +message GetApplicationRequest { + // Required. The resource name of the application to be retrieved. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + // For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Application" + } + ]; +} + +// Request for updating a specified application. +message UpdateApplicationRequest { + // Required. The application resource to replace the current resource in the system. + Application application = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4beta1.UpdateApplicationRequest.update_mask] is provided, only the specified fields in + // [application][google.cloud.talent.v4beta1.UpdateApplicationRequest.application] are updated. Otherwise all the fields are updated. + // + // A field mask to specify the application fields to be updated. Only + // top level fields of [Application][google.cloud.talent.v4beta1.Application] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to delete a application. +message DeleteApplicationRequest { + // Required. The resource name of the application to be deleted. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + // For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Application" + } + ]; +} + +// List applications for which the client has ACL visibility. +message ListApplicationsRequest { + // Required. Resource name of the profile under which the application is created. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for + // example, "projects/foo/tenants/bar/profiles/baz". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Profile" + } + ]; + + // The starting indicator from which to return results. + string page_token = 2; + + // The maximum number of applications to be returned, at most 100. + // Default is 100 if a non-positive number is provided. + int32 page_size = 3; +} + +// The List applications response object. +message ListApplicationsResponse { + // Applications for the current client. + repeated Application applications = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/batch.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/batch.proto new file mode 100644 index 0000000..074e870 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/batch.proto @@ -0,0 +1,25 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "BatchProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/common.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/common.proto new file mode 100644 index 0000000..13f7742 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/common.proto @@ -0,0 +1,1073 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/date.proto"; +import "google/type/latlng.proto"; +import "google/type/money.proto"; +import "google/type/postal_address.proto"; +import "google/type/timeofday.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// Message representing a period of time between two timestamps. +message TimestampRange { + // Begin of the period (inclusive). + google.protobuf.Timestamp start_time = 1; + + // End of the period (exclusive). + google.protobuf.Timestamp end_time = 2; +} + +// A resource that represents a location with full geographic information. +message Location { + // An enum which represents the type of a location. + enum LocationType { + // Default value if the type isn't specified. + LOCATION_TYPE_UNSPECIFIED = 0; + + // A country level location. + COUNTRY = 1; + + // A state or equivalent level location. + ADMINISTRATIVE_AREA = 2; + + // A county or equivalent level location. + SUB_ADMINISTRATIVE_AREA = 3; + + // A city or equivalent level location. + LOCALITY = 4; + + // A postal code level location. + POSTAL_CODE = 5; + + // A sublocality is a subdivision of a locality, for example a city borough, + // ward, or arrondissement. Sublocalities are usually recognized by a local + // political authority. For example, Manhattan and Brooklyn are recognized + // as boroughs by the City of New York, and are therefore modeled as + // sublocalities. + SUB_LOCALITY = 6; + + // A district or equivalent level location. + SUB_LOCALITY_1 = 7; + + // A smaller district or equivalent level display. + SUB_LOCALITY_2 = 8; + + // A neighborhood level location. + NEIGHBORHOOD = 9; + + // A street address level location. + STREET_ADDRESS = 10; + } + + // The type of a location, which corresponds to the address lines field of + // [google.type.PostalAddress][google.type.PostalAddress]. For example, "Downtown, Atlanta, GA, USA" + // has a type of [LocationType.NEIGHBORHOOD][google.cloud.talent.v4beta1.Location.LocationType.NEIGHBORHOOD], and "Kansas City, KS, USA" + // has a type of [LocationType.LOCALITY][google.cloud.talent.v4beta1.Location.LocationType.LOCALITY]. + LocationType location_type = 1; + + // Postal address of the location that includes human readable information, + // such as postal delivery and payments addresses. Given a postal address, + // a postal service can deliver items to a premises, P.O. Box, or other + // delivery location. + google.type.PostalAddress postal_address = 2; + + // An object representing a latitude/longitude pair. + google.type.LatLng lat_lng = 3; + + // Radius in miles of the job location. This value is derived from the + // location bounding box in which a circle with the specified radius + // centered from [google.type.LatLng][google.type.LatLng] covers the area associated with the + // job location. + // For example, currently, "Mountain View, CA, USA" has a radius of + // 6.17 miles. + double radius_miles = 4; +} + +// An enum that represents the size of the company. +enum CompanySize { + // Default value if the size isn't specified. + COMPANY_SIZE_UNSPECIFIED = 0; + + // The company has less than 50 employees. + MINI = 1; + + // The company has between 50 and 99 employees. + SMALL = 2; + + // The company has between 100 and 499 employees. + SMEDIUM = 3; + + // The company has between 500 and 999 employees. + MEDIUM = 4; + + // The company has between 1,000 and 4,999 employees. + BIG = 5; + + // The company has between 5,000 and 9,999 employees. + BIGGER = 6; + + // The company has 10,000 or more employees. + GIANT = 7; +} + +// An enum that represents employee benefits included with the job. +enum JobBenefit { + // Default value if the type isn't specified. + JOB_BENEFIT_UNSPECIFIED = 0; + + // The job includes access to programs that support child care, such + // as daycare. + CHILD_CARE = 1; + + // The job includes dental services covered by a dental + // insurance plan. + DENTAL = 2; + + // The job offers specific benefits to domestic partners. + DOMESTIC_PARTNER = 3; + + // The job allows for a flexible work schedule. + FLEXIBLE_HOURS = 4; + + // The job includes health services covered by a medical insurance plan. + MEDICAL = 5; + + // The job includes a life insurance plan provided by the employer or + // available for purchase by the employee. + LIFE_INSURANCE = 6; + + // The job allows for a leave of absence to a parent to care for a newborn + // child. + PARENTAL_LEAVE = 7; + + // The job includes a workplace retirement plan provided by the + // employer or available for purchase by the employee. + RETIREMENT_PLAN = 8; + + // The job allows for paid time off due to illness. + SICK_DAYS = 9; + + // The job includes paid time off for vacation. + VACATION = 10; + + // The job includes vision services covered by a vision + // insurance plan. + VISION = 11; +} + +// Educational degree level defined in International Standard Classification +// of Education (ISCED). +enum DegreeType { + // Default value. Represents no degree, or early childhood education. + // Maps to ISCED code 0. + // Ex) Kindergarten + DEGREE_TYPE_UNSPECIFIED = 0; + + // Primary education which is typically the first stage of compulsory + // education. ISCED code 1. + // Ex) Elementary school + PRIMARY_EDUCATION = 1; + + // Lower secondary education; First stage of secondary education building on + // primary education, typically with a more subject-oriented curriculum. + // ISCED code 2. + // Ex) Middle school + LOWER_SECONDARY_EDUCATION = 2; + + // Middle education; Second/final stage of secondary education preparing for + // tertiary education and/or providing skills relevant to employment. + // Usually with an increased range of subject options and streams. ISCED + // code 3. + // Ex) High school + UPPER_SECONDARY_EDUCATION = 3; + + // Adult Remedial Education; Programmes providing learning experiences that + // build on secondary education and prepare for labour market entry and/or + // tertiary education. The content is broader than secondary but not as + // complex as tertiary education. ISCED code 4. + ADULT_REMEDIAL_EDUCATION = 4; + + // Associate's or equivalent; Short first tertiary programmes that are + // typically practically-based, occupationally-specific and prepare for + // labour market entry. These programmes may also provide a pathway to other + // tertiary programmes. ISCED code 5. + ASSOCIATES_OR_EQUIVALENT = 5; + + // Bachelor's or equivalent; Programmes designed to provide intermediate + // academic and/or professional knowledge, skills and competencies leading + // to a first tertiary degree or equivalent qualification. ISCED code 6. + BACHELORS_OR_EQUIVALENT = 6; + + // Master's or equivalent; Programmes designed to provide advanced academic + // and/or professional knowledge, skills and competencies leading to a + // second tertiary degree or equivalent qualification. ISCED code 7. + MASTERS_OR_EQUIVALENT = 7; + + // Doctoral or equivalent; Programmes designed primarily to lead to an + // advanced research qualification, usually concluding with the submission + // and defense of a substantive dissertation of publishable quality based on + // original research. ISCED code 8. + DOCTORAL_OR_EQUIVALENT = 8; +} + +// An enum that represents the employment type of a job. +enum EmploymentType { + // The default value if the employment type isn't specified. + EMPLOYMENT_TYPE_UNSPECIFIED = 0; + + // The job requires working a number of hours that constitute full + // time employment, typically 40 or more hours per week. + FULL_TIME = 1; + + // The job entails working fewer hours than a full time job, + // typically less than 40 hours a week. + PART_TIME = 2; + + // The job is offered as a contracted, as opposed to a salaried employee, + // position. + CONTRACTOR = 3; + + // The job is offered as a contracted position with the understanding + // that it's converted into a full-time position at the end of the + // contract. Jobs of this type are also returned by a search for + // [EmploymentType.CONTRACTOR][google.cloud.talent.v4beta1.EmploymentType.CONTRACTOR] jobs. + CONTRACT_TO_HIRE = 4; + + // The job is offered as a temporary employment opportunity, usually + // a short-term engagement. + TEMPORARY = 5; + + // The job is a fixed-term opportunity for students or entry-level job + // seekers to obtain on-the-job training, typically offered as a summer + // position. + INTERN = 6; + + // The is an opportunity for an individual to volunteer, where there's no + // expectation of compensation for the provided services. + VOLUNTEER = 7; + + // The job requires an employee to work on an as-needed basis with a + // flexible schedule. + PER_DIEM = 8; + + // The job involves employing people in remote areas and flying them + // temporarily to the work site instead of relocating employees and their + // families permanently. + FLY_IN_FLY_OUT = 9; + + // The job does not fit any of the other listed types. + OTHER_EMPLOYMENT_TYPE = 10; +} + +// An enum that represents the required experience level required for the job. +enum JobLevel { + // The default value if the level isn't specified. + JOB_LEVEL_UNSPECIFIED = 0; + + // Entry-level individual contributors, typically with less than 2 years of + // experience in a similar role. Includes interns. + ENTRY_LEVEL = 1; + + // Experienced individual contributors, typically with 2+ years of + // experience in a similar role. + EXPERIENCED = 2; + + // Entry- to mid-level managers responsible for managing a team of people. + MANAGER = 3; + + // Senior-level managers responsible for managing teams of managers. + DIRECTOR = 4; + + // Executive-level managers and above, including C-level positions. + EXECUTIVE = 5; +} + +// An enum that represents the categorization or primary focus of specific +// role. This value is different than the "industry" associated with a role, +// which is related to the categorization of the company listing the job. +enum JobCategory { + // The default value if the category isn't specified. + JOB_CATEGORY_UNSPECIFIED = 0; + + // An accounting and finance job, such as an Accountant. + ACCOUNTING_AND_FINANCE = 1; + + // An administrative and office job, such as an Administrative Assistant. + ADMINISTRATIVE_AND_OFFICE = 2; + + // An advertising and marketing job, such as Marketing Manager. + ADVERTISING_AND_MARKETING = 3; + + // An animal care job, such as Veterinarian. + ANIMAL_CARE = 4; + + // An art, fashion, or design job, such as Designer. + ART_FASHION_AND_DESIGN = 5; + + // A business operations job, such as Business Operations Manager. + BUSINESS_OPERATIONS = 6; + + // A cleaning and facilities job, such as Custodial Staff. + CLEANING_AND_FACILITIES = 7; + + // A computer and IT job, such as Systems Administrator. + COMPUTER_AND_IT = 8; + + // A construction job, such as General Laborer. + CONSTRUCTION = 9; + + // A customer service job, such s Cashier. + CUSTOMER_SERVICE = 10; + + // An education job, such as School Teacher. + EDUCATION = 11; + + // An entertainment and travel job, such as Flight Attendant. + ENTERTAINMENT_AND_TRAVEL = 12; + + // A farming or outdoor job, such as Park Ranger. + FARMING_AND_OUTDOORS = 13; + + // A healthcare job, such as Registered Nurse. + HEALTHCARE = 14; + + // A human resources job, such as Human Resources Director. + HUMAN_RESOURCES = 15; + + // An installation, maintenance, or repair job, such as Electrician. + INSTALLATION_MAINTENANCE_AND_REPAIR = 16; + + // A legal job, such as Law Clerk. + LEGAL = 17; + + // A management job, often used in conjunction with another category, + // such as Store Manager. + MANAGEMENT = 18; + + // A manufacturing or warehouse job, such as Assembly Technician. + MANUFACTURING_AND_WAREHOUSE = 19; + + // A media, communications, or writing job, such as Media Relations. + MEDIA_COMMUNICATIONS_AND_WRITING = 20; + + // An oil, gas or mining job, such as Offshore Driller. + OIL_GAS_AND_MINING = 21; + + // A personal care and services job, such as Hair Stylist. + PERSONAL_CARE_AND_SERVICES = 22; + + // A protective services job, such as Security Guard. + PROTECTIVE_SERVICES = 23; + + // A real estate job, such as Buyer's Agent. + REAL_ESTATE = 24; + + // A restaurant and hospitality job, such as Restaurant Server. + RESTAURANT_AND_HOSPITALITY = 25; + + // A sales and/or retail job, such Sales Associate. + SALES_AND_RETAIL = 26; + + // A science and engineering job, such as Lab Technician. + SCIENCE_AND_ENGINEERING = 27; + + // A social services or non-profit job, such as Case Worker. + SOCIAL_SERVICES_AND_NON_PROFIT = 28; + + // A sports, fitness, or recreation job, such as Personal Trainer. + SPORTS_FITNESS_AND_RECREATION = 29; + + // A transportation or logistics job, such as Truck Driver. + TRANSPORTATION_AND_LOGISTICS = 30; +} + +// An enum that represents the job posting region. In most cases, job postings +// don't need to specify a region. If a region is given, jobs are +// eligible for searches in the specified region. +enum PostingRegion { + // If the region is unspecified, the job is only returned if it + // matches the [LocationFilter][google.cloud.talent.v4beta1.LocationFilter]. + POSTING_REGION_UNSPECIFIED = 0; + + // In addition to exact location matching, job posting is returned when the + // [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] in the search query is in the same administrative area + // as the returned job posting. For example, if a `ADMINISTRATIVE_AREA` job + // is posted in "CA, USA", it's returned if [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] has + // "Mountain View". + // + // Administrative area refers to top-level administrative subdivision of this + // country. For example, US state, IT region, UK constituent nation and + // JP prefecture. + ADMINISTRATIVE_AREA = 1; + + // In addition to exact location matching, job is returned when + // [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] in search query is in the same country as this job. + // For example, if a `NATION_WIDE` job is posted in "USA", it's + // returned if [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] has 'Mountain View'. + NATION = 2; + + // Job allows employees to work remotely (telecommute). + // If locations are provided with this value, the job is + // considered as having a location, but telecommuting is allowed. + TELECOMMUTE = 3; +} + +// Deprecated. All resources are only visible to the owner. +// +// An enum that represents who has view access to the resource. +enum Visibility { + option deprecated = true; + + // Default value. + VISIBILITY_UNSPECIFIED = 0; + + // The resource is only visible to the GCP account who owns it. + ACCOUNT_ONLY = 1; + + // The resource is visible to the owner and may be visible to other + // applications and processes at Google. + SHARED_WITH_GOOGLE = 2; + + // The resource is visible to the owner and may be visible to all other API + // clients. + SHARED_WITH_PUBLIC = 3; +} + +// Enum that represents the usage of the contact information. +enum ContactInfoUsage { + // Default value. + CONTACT_INFO_USAGE_UNSPECIFIED = 0; + + // Personal use. + PERSONAL = 1; + + // Work use. + WORK = 2; + + // School use. + SCHOOL = 3; +} + +// Option for HTML content sanitization on user input fields, for example, job +// description. By setting this option, user can determine whether and how +// sanitization is performed on these fields. +enum HtmlSanitization { + // Default value. + HTML_SANITIZATION_UNSPECIFIED = 0; + + // Disables sanitization on HTML input. + HTML_SANITIZATION_DISABLED = 1; + + // Sanitizes HTML input, only accepts bold, italic, ordered list, and + // unordered list markup tags. + SIMPLE_FORMATTING_ONLY = 2; +} + +// Method for commute. +enum CommuteMethod { + // Commute method isn't specified. + COMMUTE_METHOD_UNSPECIFIED = 0; + + // Commute time is calculated based on driving time. + DRIVING = 1; + + // Commute time is calculated based on public transit including bus, metro, + // subway, and so on. + TRANSIT = 2; + + // Commute time is calculated based on walking time. + WALKING = 3; + + // Commute time is calculated based on biking time. + CYCLING = 4; +} + +// Meta information related to the job searcher or entity +// conducting the job search. This information is used to improve the +// performance of the service. +message RequestMetadata { + // Required if [allow_missing_ids][google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids] is unset or `false`. + // + // The client-defined scope or source of the service call, which typically + // is the domain on + // which the service has been implemented and is currently being run. + // + // For example, if the service is being run by client Foo, Inc., on + // job board www.foo.com and career site www.bar.com, then this field is + // set to "foo.com" for use on the job board, and "bar.com" for use on the + // career site. + // + // Note that any improvements to the model for a particular tenant site rely + // on this field being set correctly to a unique domain. + // + // The maximum number of allowed characters is 255. + string domain = 1; + + // Required if [allow_missing_ids][google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids] is unset or `false`. + // + // A unique session identification string. A session is defined as the + // duration of an end user's interaction with the service over a certain + // period. + // Obfuscate this field for privacy concerns before + // providing it to the service. + // + // Note that any improvements to the model for a particular tenant site rely + // on this field being set correctly to a unique session ID. + // + // The maximum number of allowed characters is 255. + string session_id = 2; + + // Required if [allow_missing_ids][google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids] is unset or `false`. + // + // A unique user identification string, as determined by the client. + // To have the strongest positive impact on search quality + // make sure the client-level is unique. + // Obfuscate this field for privacy concerns before + // providing it to the service. + // + // Note that any improvements to the model for a particular tenant site rely + // on this field being set correctly to a unique user ID. + // + // The maximum number of allowed characters is 255. + string user_id = 3; + + // Only set when any of [domain][google.cloud.talent.v4beta1.RequestMetadata.domain], [session_id][google.cloud.talent.v4beta1.RequestMetadata.session_id] and [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] isn't + // available for some reason. It is highly recommended not to set this field + // and provide accurate [domain][google.cloud.talent.v4beta1.RequestMetadata.domain], [session_id][google.cloud.talent.v4beta1.RequestMetadata.session_id] and [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] for the + // best service experience. + bool allow_missing_ids = 4; + + // The type of device used by the job seeker at the time of the call to the + // service. + DeviceInfo device_info = 5; +} + +// Additional information returned to client, such as debugging information. +message ResponseMetadata { + // A unique id associated with this call. + // This id is logged for tracking purposes. + string request_id = 1; +} + +// Device information collected from the job seeker, candidate, or +// other entity conducting the job search. Providing this information improves +// the quality of the search results across devices. +message DeviceInfo { + // An enumeration describing an API access portal and exposure mechanism. + enum DeviceType { + // The device type isn't specified. + DEVICE_TYPE_UNSPECIFIED = 0; + + // A desktop web browser, such as, Chrome, Firefox, Safari, or Internet + // Explorer) + WEB = 1; + + // A mobile device web browser, such as a phone or tablet with a Chrome + // browser. + MOBILE_WEB = 2; + + // An Android device native application. + ANDROID = 3; + + // An iOS device native application. + IOS = 4; + + // A bot, as opposed to a device operated by human beings, such as a web + // crawler. + BOT = 5; + + // Other devices types. + OTHER = 6; + } + + // Type of the device. + DeviceType device_type = 1; + + // A device-specific ID. The ID must be a unique identifier that + // distinguishes the device from other devices. + string id = 2; +} + +// Custom attribute values that are either filterable or non-filterable. +message CustomAttribute { + // Exactly one of [string_values][google.cloud.talent.v4beta1.CustomAttribute.string_values] or [long_values][google.cloud.talent.v4beta1.CustomAttribute.long_values] must be specified. + // + // This field is used to perform a string match (`CASE_SENSITIVE_MATCH` or + // `CASE_INSENSITIVE_MATCH`) search. + // For filterable `string_value`s, a maximum total number of 200 values + // is allowed, with each `string_value` has a byte size of no more than + // 500B. For unfilterable `string_values`, the maximum total byte size of + // unfilterable `string_values` is 50KB. + // + // Empty string isn't allowed. + repeated string string_values = 1; + + // Exactly one of [string_values][google.cloud.talent.v4beta1.CustomAttribute.string_values] or [long_values][google.cloud.talent.v4beta1.CustomAttribute.long_values] must be specified. + // + // This field is used to perform number range search. + // (`EQ`, `GT`, `GE`, `LE`, `LT`) over filterable `long_value`. + // + // Currently at most 1 [long_values][google.cloud.talent.v4beta1.CustomAttribute.long_values] is supported. + repeated int64 long_values = 2; + + // If the `filterable` flag is true, custom field values are searchable. + // If false, values are not searchable. + // + // Default is false. + bool filterable = 3; +} + +// Spell check result. +message SpellingCorrection { + // Indicates if the query was corrected by the spell checker. + bool corrected = 1; + + // Correction output consisting of the corrected keyword string. + string corrected_text = 2; + + // Corrected output with html tags to highlight the corrected words. + // Corrected words are called out with the "..." html tags. + // + // For example, the user input query is "software enginear", where the second + // word, "enginear," is incorrect. It should be "engineer". When spelling + // correction is enabled, this value is + // "software engineer". + string corrected_html = 3; +} + +// Job compensation details. +message CompensationInfo { + // A compensation entry that represents one component of compensation, such + // as base pay, bonus, or other compensation type. + // + // Annualization: One compensation entry can be annualized if + // - it contains valid [amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] or [range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range]. + // - and its [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year] is set or can be derived. + // Its annualized range is determined as ([amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] or [range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range]) times + // [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. + message CompensationEntry { + // Compensation type. + // + // Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. + CompensationType type = 1; + + // Frequency of the specified amount. + // + // Default is [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED]. + CompensationUnit unit = 2; + + // Compensation amount. It could be a fixed amount or a floating range. + oneof compensation_amount { + // Compensation amount. + google.type.Money amount = 3; + + // Compensation range. + CompensationRange range = 4; + } + + // Compensation description. For example, could + // indicate equity terms or provide additional context to an estimated + // bonus. + string description = 5; + + // Expected number of units paid each year. If not specified, when + // [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types] is FULLTIME, a default value is inferred + // based on [unit][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.unit]. Default values: + // - HOURLY: 2080 + // - DAILY: 260 + // - WEEKLY: 52 + // - MONTHLY: 12 + // - ANNUAL: 1 + google.protobuf.DoubleValue expected_units_per_year = 6; + } + + // Compensation range. + message CompensationRange { + // The maximum amount of compensation. If left empty, the value is set + // to a maximal compensation value and the currency code is set to + // match the [currency code][google.type.Money.currency_code] of + // min_compensation. + google.type.Money max_compensation = 2; + + // The minimum amount of compensation. If left empty, the value is set + // to zero and the currency code is set to match the + // [currency code][google.type.Money.currency_code] of max_compensation. + google.type.Money min_compensation = 1; + } + + // The type of compensation. + // + // For compensation amounts specified in non-monetary amounts, + // describe the compensation scheme in the [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description]. + // + // For example, tipping format is described in + // [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description] (for example, "expect 15-20% tips based + // on customer bill.") and an estimate of the tips provided in + // [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] or [CompensationEntry.range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range] ($10 per hour). + // + // For example, equity is described in [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description] + // (for example, "1% - 2% equity vesting over 4 years, 1 year cliff") and + // value estimated in [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] or + // [CompensationEntry.range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range]. If no value estimate is possible, units are + // [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED] and then further + // clarified in [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description] field. + enum CompensationType { + // Default value. + COMPENSATION_TYPE_UNSPECIFIED = 0; + + // Base compensation: Refers to the fixed amount of money paid to an + // employee by an employer in return for work performed. Base compensation + // does not include benefits, bonuses or any other potential compensation + // from an employer. + BASE = 1; + + // Bonus. + BONUS = 2; + + // Signing bonus. + SIGNING_BONUS = 3; + + // Equity. + EQUITY = 4; + + // Profit sharing. + PROFIT_SHARING = 5; + + // Commission. + COMMISSIONS = 6; + + // Tips. + TIPS = 7; + + // Other compensation type. + OTHER_COMPENSATION_TYPE = 8; + } + + // Pay frequency. + enum CompensationUnit { + // Default value. + COMPENSATION_UNIT_UNSPECIFIED = 0; + + // Hourly. + HOURLY = 1; + + // Daily. + DAILY = 2; + + // Weekly + WEEKLY = 3; + + // Monthly. + MONTHLY = 4; + + // Yearly. + YEARLY = 5; + + // One time. + ONE_TIME = 6; + + // Other compensation units. + OTHER_COMPENSATION_UNIT = 7; + } + + // Job compensation information. + // + // At most one entry can be of type + // [CompensationInfo.CompensationType.BASE][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.BASE], which is + // referred as **base compensation entry** for the job. + repeated CompensationEntry entries = 1; + + // Output only. Annualized base compensation range. Computed as base compensation entry's + // [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] times + // [CompensationEntry.expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. + // + // See [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for explanation on compensation annualization. + CompensationRange annualized_base_compensation_range = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Annualized total compensation range. Computed as all compensation entries' + // [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] times + // [CompensationEntry.expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. + // + // See [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for explanation on compensation annualization. + CompensationRange annualized_total_compensation_range = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Resource that represents a license or certification. +message Certification { + // Name of license or certification. + // + // Number of characters allowed is 100. + string display_name = 1; + + // Acquisition date or effective date of license or certification. + google.type.Date acquire_date = 2; + + // Expiration date of license of certification. + google.type.Date expire_date = 3; + + // Authority of license, such as government. + // + // Number of characters allowed is 100. + string authority = 4; + + // Description of license or certification. + // + // Number of characters allowed is 100,000. + string description = 5; +} + +// Resource that represents a skill of a candidate. +message Skill { + // Skill display name. + // + // For example, "Java", "Python". + // + // Number of characters allowed is 100. + string display_name = 1; + + // The last time this skill was used. + google.type.Date last_used_date = 2; + + // Skill proficiency level which indicates how proficient the candidate is at + // this skill. + SkillProficiencyLevel level = 3; + + // A paragraph describes context of this skill. + // + // Number of characters allowed is 100,000. + string context = 4; + + // Output only. Skill name snippet shows how the [display_name][google.cloud.talent.v4beta1.Skill.display_name] is related to a search + // query. It's empty if the [display_name][google.cloud.talent.v4beta1.Skill.display_name] isn't related to the search + // query. + string skill_name_snippet = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Details of an interview. +message Interview { + // The rating on this interview. + Rating rating = 6; + + // Required. The overall decision resulting from this interview (positive, negative, + // nuetral). + Outcome outcome = 7 [(google.api.field_behavior) = REQUIRED]; +} + +// The details of the score received for an assessment or interview. +message Rating { + // Overall score. + double overall = 1; + + // The minimum value for the score. + double min = 2; + + // The maximum value for the score. + double max = 3; + + // The steps within the score (for example, interval = 1 max = 5 + // min = 1 indicates that the score can be 1, 2, 3, 4, or 5) + double interval = 4; +} + +// Metadata used for long running operations returned by CTS batch APIs. +// It's used to replace [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. +message BatchOperationMetadata { + enum State { + // Default value. + STATE_UNSPECIFIED = 0; + + // The batch operation is being prepared for processing. + INITIALIZING = 1; + + // The batch operation is actively being processed. + PROCESSING = 2; + + // The batch operation is processed, and at least one item has been + // successfully processed. + SUCCEEDED = 3; + + // The batch operation is done and no item has been successfully processed. + FAILED = 4; + + // The batch operation is in the process of cancelling after + // [google.longrunning.Operations.CancelOperation][google.longrunning.Operations.CancelOperation] is called. + CANCELLING = 5; + + // The batch operation is done after + // [google.longrunning.Operations.CancelOperation][google.longrunning.Operations.CancelOperation] is called. Any items + // processed before cancelling are returned in the response. + CANCELLED = 6; + } + + // The state of a long running operation. + State state = 1; + + // More detailed information about operation state. + string state_description = 2; + + // Count of successful item(s) inside an operation. + int32 success_count = 3; + + // Count of failed item(s) inside an operation. + int32 failure_count = 4; + + // Count of total item(s) inside an operation. + int32 total_count = 5; + + // The time when the batch operation is created. + google.protobuf.Timestamp create_time = 6; + + // The time when the batch operation status is updated. The metadata and the + // [update_time][google.cloud.talent.v4beta1.BatchOperationMetadata.update_time] is refreshed every minute otherwise cached data is + // returned. + google.protobuf.Timestamp update_time = 7; + + // The time when the batch operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to `true`. + google.protobuf.Timestamp end_time = 8; +} + +// Enum that represents the skill proficiency level. +enum SkillProficiencyLevel { + // Default value. + SKILL_PROFICIENCY_LEVEL_UNSPECIFIED = 0; + + // Lacks any proficiency in this skill. + UNSKILLED = 6; + + // Have a common knowledge or an understanding of basic techniques and + // concepts. + FUNDAMENTAL_AWARENESS = 1; + + // Have the level of experience gained in a classroom and/or experimental + // scenarios or as a trainee on-the-job. + NOVICE = 2; + + // Be able to successfully complete tasks in this skill as requested. Help + // from an expert may be required from time to time, but can usually perform + // skill independently. + INTERMEDIATE = 3; + + // Can perform the actions associated with this skill without assistance. + ADVANCED = 4; + + // Known as an expert in this area. + EXPERT = 5; +} + +// The overall outcome /decision / result indicator. +enum Outcome { + // Default value. + OUTCOME_UNSPECIFIED = 0; + + // A positive outcome / passing indicator (for example, candidate was + // recommended for hiring or to be moved forward in the hiring process, + // candidate passed a test). + POSITIVE = 1; + + // A neutral outcome / no clear indicator (for example, no strong + // reccommendation either to move forward / not move forward, neutral score). + NEUTRAL = 2; + + // A negative outcome / failing indicator (for example, candidate was + // recommended to NOT move forward in the hiring process, failed a test). + NEGATIVE = 3; + + // The assessment outcome is not available or otherwise unknown (for example, + // candidate did not complete assessment). + OUTCOME_NOT_AVAILABLE = 4; +} + +// The type of candidate availability signal. +enum AvailabilitySignalType { + // Default value. + AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED = 0; + + // Job application signal. + // + // In the context of [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals], this signal is related + // to the candidate's most recent application. + // [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is + // calculated from max([Application.create_time][google.cloud.talent.v4beta1.Application.create_time]) from all [Application][google.cloud.talent.v4beta1.Application] + // records where [Application.source][google.cloud.talent.v4beta1.Application.source] is any of the following: + // [APPLY_DIRECT_WEB][google.cloud.talent.v4beta1.Application.ApplicationSource.APPLY_DIRECT_WEB] + // [APPLY_DIRECT_MOBILE_WEB][google.cloud.talent.v4beta1.Application.ApplicationSource.APPLY_DIRECT_MOBILE_WEB] + // [APPLY_DIRECT_MOBILE_APP][google.cloud.talent.v4beta1.Application.ApplicationSource.APPLY_DIRECT_MOBILE_APP] + // [APPLY_DIRECT_IN_PERSON][google.cloud.talent.v4beta1.Application.ApplicationSource.APPLY_DIRECT_IN_PERSON] + // [APPLY_INDIRECT][google.cloud.talent.v4beta1.Application.ApplicationSource.APPLY_INDIRECT] + // + // In the context of [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter], the filter is applied on + // [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals] where + // [type][google.cloud.talent.v4beta1.AvailabilitySignal.type] is JOB_APPLICATION. + JOB_APPLICATION = 1; + + // Resume update signal. + // + // In the context of [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals], this signal is related + // to the candidate's most recent update to their resume. + // For a [SummarizedProfile.summary][google.cloud.talent.v4beta1.SummarizedProfile.summary], + // [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is + // calculated from max([Profile.resume_update_time][google.cloud.talent.v4beta1.Profile.resume_update_time]) from all + // [SummarizedProfile.profiles][google.cloud.talent.v4beta1.SummarizedProfile.profiles]. + // + // In the context of [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter], the filter is applied on + // [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals] where + // [type][google.cloud.talent.v4beta1.AvailabilitySignal.type] is RESUME_UPDATE. + RESUME_UPDATE = 2; + + // Candidate update signal. + // + // In the context of [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals], this signal is related + // to the candidate's most recent update to their profile. + // For a [SummarizedProfile.summary][google.cloud.talent.v4beta1.SummarizedProfile.summary], + // [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is + // calculated from max([Profile.candidate_update_time][google.cloud.talent.v4beta1.Profile.candidate_update_time]) from all + // [SummarizedProfile.profiles][google.cloud.talent.v4beta1.SummarizedProfile.profiles]. + // + // In the context of [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter], the filter is applied on + // [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals] where + // [type][google.cloud.talent.v4beta1.AvailabilitySignal.type] is CANDIDATE_UPDATE. + CANDIDATE_UPDATE = 3; + + // Client submission signal. + // + // In the context of [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals], this signal is related + // to the candidate's most recent submission. + // [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is + // calculated from max([Application.create_time][google.cloud.talent.v4beta1.Application.create_time]) from all [Application][google.cloud.talent.v4beta1.Application] + // records where [Application.stage][google.cloud.talent.v4beta1.Application.stage] is any of the following: + // [HIRING_MANAGER_REVIEW][google.cloud.talent.v4beta1.Application.ApplicationStage.HIRING_MANAGER_REVIEW] + // [INTERVIEW][google.cloud.talent.v4beta1.Application.ApplicationStage.INTERVIEW] + // [OFFER_EXTENDED][google.cloud.talent.v4beta1.Application.ApplicationStage.OFFER_EXTENDED] + // [OFFER_ACCEPTED][google.cloud.talent.v4beta1.Application.ApplicationStage.OFFER_ACCEPTED] + // [STARTED][google.cloud.talent.v4beta1.Application.ApplicationStage.STARTED] + // + // In the context of [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter], the filter is applied on + // [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals] where + // [type][google.cloud.talent.v4beta1.AvailabilitySignal.type] is CLIENT_SUBMISSION. + CLIENT_SUBMISSION = 4; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/company.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/company.proto new file mode 100644 index 0000000..c689457 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/company.proto @@ -0,0 +1,119 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "CompanyResourceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A Company resource represents a company in the service. A company is the +// entity that owns job postings, that is, the hiring entity responsible for +// employing applicants for the job position. +message Company { + option (google.api.resource) = { + type: "jobs.googleapis.com/Company" + pattern: "projects/{project}/tenants/{tenant}/companies/{company}" + pattern: "projects/{project}/companies/{company}" + }; + + // Derived details about the company. + message DerivedInfo { + // A structured headquarters location of the company, resolved from + // [Company.headquarters_address][google.cloud.talent.v4beta1.Company.headquarters_address] if provided. + Location headquarters_location = 1; + } + + // Required during company update. + // + // The resource name for a company. This is generated by the service when a + // company is created. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/foo/tenants/bar/companies/baz". + // + // If tenant id is unspecified, the default tenant is used. For + // example, "projects/foo/companies/bar". + string name = 1; + + // Required. The display name of the company, for example, "Google LLC". + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Client side company identifier, used to uniquely identify the + // company. + // + // The maximum number of allowed characters is 255. + string external_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // The employer's company size. + CompanySize size = 4; + + // The street address of the company's main headquarters, which may be + // different from the job location. The service attempts + // to geolocate the provided address, and populates a more specific + // location wherever possible in [DerivedInfo.headquarters_location][google.cloud.talent.v4beta1.Company.DerivedInfo.headquarters_location]. + string headquarters_address = 5; + + // Set to true if it is the hiring agency that post jobs for other + // employers. + // + // Defaults to false if not provided. + bool hiring_agency = 6; + + // Equal Employment Opportunity legal disclaimer text to be + // associated with all jobs, and typically to be displayed in all + // roles. + // + // The maximum number of allowed characters is 500. + string eeo_text = 7; + + // The URI representing the company's primary web site or home page, + // for example, "https://www.google.com". + // + // The maximum number of allowed characters is 255. + string website_uri = 8; + + // The URI to employer's career site or careers page on the employer's web + // site, for example, "https://careers.google.com". + string career_site_uri = 9; + + // A URI that hosts the employer's company logo. + string image_uri = 10; + + // A list of keys of filterable [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes], whose + // corresponding `string_values` are used in keyword searches. Jobs with + // `string_values` under these specified field keys are returned if any + // of the values match the search keyword. Custom field values with + // parenthesis, brackets and special symbols are not searchable as-is, + // and those keyword queries must be surrounded by quotes. + repeated string keyword_searchable_job_custom_attributes = 11; + + // Output only. Derived details about the company. + DerivedInfo derived_info = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether a company is flagged to be suspended from + // public availability by the service when job content appears suspicious, + // abusive, or spammy. + bool suspended = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/company_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/company_service.proto new file mode 100644 index 0000000..ac6a7d7 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/company_service.proto @@ -0,0 +1,214 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/cloud/talent/v4beta1/company.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "CompanyServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service that handles company management, including CRUD and enumeration. +service CompanyService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new company entity. + rpc CreateCompany(CreateCompanyRequest) returns (Company) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/companies" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/companies" + body: "*" + } + }; + option (google.api.method_signature) = "parent,company"; + } + + // Retrieves specified company. + rpc GetCompany(GetCompanyRequest) returns (Company) { + option (google.api.http) = { + get: "/v4beta1/{name=projects/*/tenants/*/companies/*}" + additional_bindings { + get: "/v4beta1/{name=projects/*/companies/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified company. + rpc UpdateCompany(UpdateCompanyRequest) returns (Company) { + option (google.api.http) = { + patch: "/v4beta1/{company.name=projects/*/tenants/*/companies/*}" + body: "*" + additional_bindings { + patch: "/v4beta1/{company.name=projects/*/companies/*}" + body: "*" + } + }; + option (google.api.method_signature) = "company"; + } + + // Deletes specified company. + // Prerequisite: The company has no jobs associated with it. + rpc DeleteCompany(DeleteCompanyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4beta1/{name=projects/*/tenants/*/companies/*}" + additional_bindings { + delete: "/v4beta1/{name=projects/*/companies/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists all companies associated with the project. + rpc ListCompanies(ListCompaniesRequest) returns (ListCompaniesResponse) { + option (google.api.http) = { + get: "/v4beta1/{parent=projects/*/tenants/*}/companies" + additional_bindings { + get: "/v4beta1/{parent=projects/*}/companies" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// The Request of the CreateCompany method. +message CreateCompanyRequest { + // Required. Resource name of the tenant under which the company is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created, for example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Company" + } + ]; + + // Required. The company to be created. + Company company = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for getting a company by name. +message GetCompanyRequest { + // Required. The resource name of the company to be retrieved. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/api-test-project/tenants/foo/companies/bar". + // + // If tenant id is unspecified, the default tenant is used, for + // example, "projects/api-test-project/companies/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + } + ]; +} + +// Request for updating a specified company. +message UpdateCompanyRequest { + // Required. The company resource to replace the current resource in the system. + Company company = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4beta1.UpdateCompanyRequest.update_mask] is provided, only the specified fields in + // [company][google.cloud.talent.v4beta1.UpdateCompanyRequest.company] are updated. Otherwise all the fields are updated. + // + // A field mask to specify the company fields to be updated. Only + // top level fields of [Company][google.cloud.talent.v4beta1.Company] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to delete a company. +message DeleteCompanyRequest { + // Required. The resource name of the company to be deleted. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/foo/tenants/bar/companies/baz". + // + // If tenant id is unspecified, the default tenant is used, for + // example, "projects/foo/companies/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + } + ]; +} + +// List companies for which the client has ACL visibility. +message ListCompaniesRequest { + // Required. Resource name of the tenant under which the company is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenant/bar". + // + // If tenant id is unspecified, the default tenant will be used, for + // example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Company" + } + ]; + + // The starting indicator from which to return results. + string page_token = 2; + + // The maximum number of companies to be returned, at most 100. + // Default is 100 if a non-positive number is provided. + int32 page_size = 3; + + // Set to true if the companies requested must have open jobs. + // + // Defaults to false. + // + // If true, at most [page_size][google.cloud.talent.v4beta1.ListCompaniesRequest.page_size] of companies are fetched, among which + // only those with open jobs are returned. + bool require_open_jobs = 4; +} + +// The List companies response object. +message ListCompaniesResponse { + // Companies for the current client. + repeated Company companies = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/completion_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/completion_service.proto new file mode 100644 index 0000000..2e45ac7 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/completion_service.proto @@ -0,0 +1,163 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/api/client.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "CompletionServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service handles auto completion. +service Completion { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Completes the specified prefix with keyword suggestions. + // Intended for use by a job search auto-complete search box. + rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { + option (google.api.http) = { + get: "/v4beta1/{parent=projects/*/tenants/*}:complete" + additional_bindings { + get: "/v4beta1/{parent=projects/*}:complete" + } + }; + } +} + +// Auto-complete parameters. +message CompleteQueryRequest { + // Enum to specify the scope of completion. + enum CompletionScope { + // Default value. + COMPLETION_SCOPE_UNSPECIFIED = 0; + + // Suggestions are based only on the data provided by the client. + TENANT = 1; + + // Suggestions are based on all jobs data in the system that's visible to + // the client + PUBLIC = 2; + } + + // Enum to specify auto-completion topics. + enum CompletionType { + // Default value. + COMPLETION_TYPE_UNSPECIFIED = 0; + + // Suggest job titles for jobs autocomplete. + // + // For [CompletionType.JOB_TITLE][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.JOB_TITLE] type, only open jobs with the same + // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] are returned. + JOB_TITLE = 1; + + // Suggest company names for jobs autocomplete. + // + // For [CompletionType.COMPANY_NAME][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMPANY_NAME] type, + // only companies having open jobs with the same [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] are + // returned. + COMPANY_NAME = 2; + + // Suggest both job titles and company names for jobs autocomplete. + // + // For [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED] type, only open jobs with the same + // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] or companies having open jobs with the same + // [language_codes][google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes] are returned. + COMBINED = 3; + } + + // Required. Resource name of tenant the completion is performed within. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenant/bar". + // + // If tenant id is unspecified, the default tenant is used, for + // example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Company" + } + ]; + + // Required. The query used to generate suggestions. + // + // The maximum number of allowed characters is 255. + string query = 2 [(google.api.field_behavior) = REQUIRED]; + + // The list of languages of the query. This is + // the BCP-47 language code, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // The maximum number of allowed characters is 255. + repeated string language_codes = 3; + + // Required. Completion result count. + // + // The maximum allowed page size is 10. + int32 page_size = 4 [(google.api.field_behavior) = REQUIRED]; + + // If provided, restricts completion to specified company. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + // example, "projects/foo/tenants/bar/companies/baz". + // + // If tenant id is unspecified, the default tenant is used, for + // example, "projects/foo". + string company = 5 [(google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + }]; + + // The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC]. + CompletionScope scope = 6; + + // The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED]. + CompletionType type = 7; +} + +// Response of auto-complete query. +message CompleteQueryResponse { + // Resource that represents completion results. + message CompletionResult { + // The suggestion for the query. + string suggestion = 1; + + // The completion topic. + CompleteQueryRequest.CompletionType type = 2; + + // The URI of the company image for + // [COMPANY_NAME][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMPANY_NAME]. + string image_uri = 3; + } + + // Results of the matching job/company candidates. + repeated CompletionResult completion_results = 1; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 2; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/event.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/event.proto new file mode 100644 index 0000000..c5a7155 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/event.proto @@ -0,0 +1,234 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "EventProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// An event issued when an end user interacts with the application that +// implements Cloud Talent Solution. Providing this information improves the +// quality of results for the API clients, enabling the +// service to perform optimally. The number of events sent must be consistent +// with other calls, such as job searches, issued to the service by the client. +message ClientEvent { + // Strongly recommended for the best service experience. + // + // A unique ID generated in the API responses. It can be found in + // [ResponseMetadata.request_id][google.cloud.talent.v4beta1.ResponseMetadata.request_id]. + string request_id = 1; + + // Required. A unique identifier, generated by the client application. + string event_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The timestamp of the event. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. + // + // The detail information of a specific event type. + oneof event { + // An event issued when a job seeker interacts with the application that + // implements Cloud Talent Solution. + JobEvent job_event = 5; + + // An event issued when a profile searcher interacts with the application + // that implements Cloud Talent Solution. + ProfileEvent profile_event = 6; + } + + // Notes about the event provided by recruiters or other users, for example, + // feedback on why a profile was bookmarked. + string event_notes = 9; +} + +// An event issued when a job seeker interacts with the application that +// implements Cloud Talent Solution. +message JobEvent { + // An enumeration of an event attributed to the behavior of the end user, + // such as a job seeker. + enum JobEventType { + // The event is unspecified by other provided values. + JOB_EVENT_TYPE_UNSPECIFIED = 0; + + // The job seeker or other entity interacting with the service has + // had a job rendered in their view, such as in a list of search results in + // a compressed or clipped format. This event is typically associated with + // the viewing of a jobs list on a single page by a job seeker. + IMPRESSION = 1; + + // The job seeker, or other entity interacting with the service, has + // viewed the details of a job, including the full description. This + // event doesn't apply to the viewing a snippet of a job appearing as a + // part of the job search results. Viewing a snippet is associated with an + // [impression][google.cloud.talent.v4beta1.JobEvent.JobEventType.IMPRESSION]). + VIEW = 2; + + // The job seeker or other entity interacting with the service + // performed an action to view a job and was redirected to a different + // website for job. + VIEW_REDIRECT = 3; + + // The job seeker or other entity interacting with the service + // began the process or demonstrated the intention of applying for a job. + APPLICATION_START = 4; + + // The job seeker or other entity interacting with the service + // submitted an application for a job. + APPLICATION_FINISH = 5; + + // The job seeker or other entity interacting with the service + // submitted an application for a job with a single click without + // entering information. If a job seeker performs this action, send only + // this event to the service. Do not also send + // [JobEventType.APPLICATION_START][google.cloud.talent.v4beta1.JobEvent.JobEventType.APPLICATION_START] or [JobEventType.APPLICATION_FINISH][google.cloud.talent.v4beta1.JobEvent.JobEventType.APPLICATION_FINISH] + // events. + APPLICATION_QUICK_SUBMISSION = 6; + + // The job seeker or other entity interacting with the service + // performed an action to apply to a job and was redirected to a different + // website to complete the application. + APPLICATION_REDIRECT = 7; + + // The job seeker or other entity interacting with the service began the + // process or demonstrated the intention of applying for a job from the + // search results page without viewing the details of the job posting. + // If sending this event, JobEventType.VIEW event shouldn't be sent. + APPLICATION_START_FROM_SEARCH = 8; + + // The job seeker, or other entity interacting with the service, performs an + // action with a single click from the search results page to apply to a job + // (without viewing the details of the job posting), and is redirected + // to a different website to complete the application. If a candidate + // performs this action, send only this event to the service. Do not also + // send [JobEventType.APPLICATION_START][google.cloud.talent.v4beta1.JobEvent.JobEventType.APPLICATION_START], + // [JobEventType.APPLICATION_FINISH][google.cloud.talent.v4beta1.JobEvent.JobEventType.APPLICATION_FINISH] or [JobEventType.VIEW][google.cloud.talent.v4beta1.JobEvent.JobEventType.VIEW] events. + APPLICATION_REDIRECT_FROM_SEARCH = 9; + + // This event should be used when a company submits an application + // on behalf of a job seeker. This event is intended for use by staffing + // agencies attempting to place candidates. + APPLICATION_COMPANY_SUBMIT = 10; + + // The job seeker or other entity interacting with the service demonstrated + // an interest in a job by bookmarking or saving it. + BOOKMARK = 11; + + // The job seeker or other entity interacting with the service was + // sent a notification, such as an email alert or device notification, + // containing one or more jobs listings generated by the service. + NOTIFICATION = 12; + + // The job seeker or other entity interacting with the service was + // employed by the hiring entity (employer). Send this event + // only if the job seeker was hired through an application that was + // initiated by a search conducted through the Cloud Talent Solution + // service. + HIRED = 13; + + // A recruiter or staffing agency submitted an application on behalf of the + // candidate after interacting with the service to identify a suitable job + // posting. + SENT_CV = 14; + + // The entity interacting with the service (for example, the job seeker), + // was granted an initial interview by the hiring entity (employer). This + // event should only be sent if the job seeker was granted an interview as + // part of an application that was initiated by a search conducted through / + // recommendation provided by the Cloud Talent Solution service. + INTERVIEW_GRANTED = 15; + } + + // Required. The type of the event (see [JobEventType][google.cloud.talent.v4beta1.JobEvent.JobEventType]). + JobEventType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The [job name(s)][google.cloud.talent.v4beta1.Job.name] associated with this event. + // For example, if this is an [impression][google.cloud.talent.v4beta1.JobEvent.JobEventType.IMPRESSION] event, + // this field contains the identifiers of all jobs shown to the job seeker. + // If this was a [view][google.cloud.talent.v4beta1.JobEvent.JobEventType.VIEW] event, this field contains the + // identifier of the viewed job. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for + // example, "projects/foo/tenants/bar/jobs/baz". + repeated string jobs = 2 [(google.api.field_behavior) = REQUIRED]; + + // The [profile name][google.cloud.talent.v4beta1.Profile.name] associated with this client event. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + // for example, "projects/foo/tenants/bar/profiles/baz". + string profile = 3; +} + +// An event issued when a profile searcher interacts with the application +// that implements Cloud Talent Solution. +message ProfileEvent { + // The enum represents types of client events for a candidate profile. + enum ProfileEventType { + // Default value. + PROFILE_EVENT_TYPE_UNSPECIFIED = 0; + + // Send this event when a [ProfileEvent.profiles][google.cloud.talent.v4beta1.ProfileEvent.profiles] was sent as a part of + // a result set for a CTS API call and was rendered in the end user's UI + // (that is, the [ProfileEvent.recruiter][google.cloud.talent.v4beta1.ProfileEvent.recruiter]). + IMPRESSION = 1; + + // The VIEW event records the action of a candidate's profile being + // viewed by an end user. This is critical to tracking product metrics and + // should be sent for every profile VIEW that happens in your system, + // whether the event is associated with an API call (for example, a + // recruiter making a request for a result set and clicking on a profile) + // or not (a recruiter using the system to view profile details without + // making a request). + // + // For a VIEW events associated with API calls, the + // [ClientEvent.request_id][google.cloud.talent.v4beta1.ClientEvent.request_id] should be populated. If the VIEW is not + // associated with an API call, [request_id][google.cloud.talent.v4beta1.ClientEvent.request_id] should + // not be populated. + // + // This event requires a valid recruiter and one valid ID in profiles. + VIEW = 2; + + // The profile is bookmarked. + BOOKMARK = 3; + } + + // Required. Type of event. + ProfileEventType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The [profile name(s)][google.cloud.talent.v4beta1.Profile.name] associated with this client event. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + // for example, "projects/foo/tenants/bar/profiles/baz". + repeated string profiles = 2 [(google.api.field_behavior) = REQUIRED]; + + // The [job name(s)][google.cloud.talent.v4beta1.Job.name] associated with this client event. Leave it + // empty if the event isn't associated with a job. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for + // example, "projects/foo/tenants/bar/jobs/baz". + repeated string jobs = 6; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/event_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/event_service.proto new file mode 100644 index 0000000..4577352 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/event_service.proto @@ -0,0 +1,75 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/event.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "EventServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service handles client event report. +service EventService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Report events issued when end user interacts with customer's application + // that uses Cloud Talent Solution. You may inspect the created events in + // [self service + // tools](https://console.cloud.google.com/talent-solution/overview). + // [Learn + // more](https://cloud.google.com/talent-solution/docs/management-tools) + // about self service tools. + rpc CreateClientEvent(CreateClientEventRequest) returns (ClientEvent) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/clientEvents" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/clientEvents" + body: "*" + } + }; + option (google.api.method_signature) = "parent,client_event"; + } +} + +// The report event request. +message CreateClientEventRequest { + // Required. Resource name of the tenant under which the event is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created, for example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Company" + } + ]; + + // Required. Events issued when end user interacts with customer's application that + // uses Cloud Talent Solution. + ClientEvent client_event = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/filters.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/filters.proto new file mode 100644 index 0000000..a8cebd7 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/filters.proto @@ -0,0 +1,780 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/date.proto"; +import "google/type/latlng.proto"; +import "google/type/timeofday.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "FiltersProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// The query required to perform a search query. +message JobQuery { + // The query string that matches against the job title, description, and + // location fields. + // + // The maximum number of allowed characters is 255. + string query = 1; + + // The language code of [query][google.cloud.talent.v4beta1.JobQuery.query]. For example, "en-US". This field helps to + // better interpret the query. + // + // If a value isn't specified, the query language code is automatically + // detected, which may not be accurate. + // + // Language code should be in BCP-47 format, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + string query_language_code = 14; + + // This filter specifies the company entities to search against. + // + // If a value isn't specified, jobs are searched for against all + // companies. + // + // If multiple values are specified, jobs are searched against the + // companies specified. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For + // example, "projects/foo/tenants/bar/companies/baz". + // + // If tenant id is unspecified, the default tenant is used. For + // example, "projects/foo/companies/bar". + // + // At most 20 company filters are allowed. + repeated string companies = 2; + + // The location filter specifies geo-regions containing the jobs to + // search against. See [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] for more information. + // + // If a location value isn't specified, jobs fitting the other search + // criteria are retrieved regardless of where they're located. + // + // If multiple values are specified, jobs are retrieved from any of the + // specified locations. If different values are specified for the + // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] parameter, the maximum provided + // distance is used for all locations. + // + // At most 5 location filters are allowed. + repeated LocationFilter location_filters = 3; + + // The category filter specifies the categories of jobs to search against. + // See [JobCategory][google.cloud.talent.v4beta1.JobCategory] for more information. + // + // If a value isn't specified, jobs from any category are searched against. + // + // If multiple values are specified, jobs from any of the specified + // categories are searched against. + repeated JobCategory job_categories = 4; + + // Allows filtering jobs by commute time with different travel methods (for + // example, driving or public transit). + // + // Note: This only works when you specify a [CommuteMethod][google.cloud.talent.v4beta1.CommuteMethod]. In this case, + // [location_filters][google.cloud.talent.v4beta1.JobQuery.location_filters] is ignored. + // + // Currently we don't support sorting by commute time. + CommuteFilter commute_filter = 5; + + // This filter specifies the exact company [Company.display_name][google.cloud.talent.v4beta1.Company.display_name] + // of the jobs to search against. + // + // If a value isn't specified, jobs within the search results are + // associated with any company. + // + // If multiple values are specified, jobs within the search results may be + // associated with any of the specified companies. + // + // At most 20 company display name filters are allowed. + repeated string company_display_names = 6; + + // This search filter is applied only to + // [Job.compensation_info][google.cloud.talent.v4beta1.Job.compensation_info]. For example, if the filter is specified + // as "Hourly job with per-hour compensation > $15", only jobs meeting + // these criteria are searched. If a filter isn't defined, all open jobs + // are searched. + CompensationFilter compensation_filter = 7; + + // This filter specifies a structured syntax to match against the + // [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes] marked as `filterable`. + // + // The syntax for this expression is a subset of SQL syntax. + // + // Supported operators are: `=`, `!=`, `<`, `<=`, `>`, and `>=` where the + // left of the operator is a custom field key and the right of the operator + // is a number or a quoted string. You must escape backslash (\\) and + // quote (\") characters. + // + // Supported functions are `LOWER([field_name])` to + // perform a case insensitive match and `EMPTY([field_name])` to filter on the + // existence of a key. + // + // Boolean expressions (AND/OR/NOT) are supported up to 3 levels of + // nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 100 + // comparisons or functions are allowed in the expression. The expression + // must be < 6000 bytes in length. + // + // Sample Query: + // `(LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND + // driving_years > 10` + string custom_attribute_filter = 8; + + // This flag controls the spell-check feature. If false, the + // service attempts to correct a misspelled query, + // for example, "enginee" is corrected to "engineer". + // + // Defaults to false: a spell check is performed. + bool disable_spell_check = 9; + + // The employment type filter specifies the employment type of jobs to + // search against, such as [EmploymentType.FULL_TIME][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME]. + // + // If a value isn't specified, jobs in the search results includes any + // employment type. + // + // If multiple values are specified, jobs in the search results include + // any of the specified employment types. + repeated EmploymentType employment_types = 10; + + // This filter specifies the locale of jobs to search against, + // for example, "en-US". + // + // If a value isn't specified, the search results can contain jobs in any + // locale. + // + // + // Language codes should be in BCP-47 format, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // At most 10 language code filters are allowed. + repeated string language_codes = 11; + + // Jobs published within a range specified by this filter are searched + // against. + TimestampRange publish_time_range = 12; + + // This filter specifies a list of job names to be excluded during search. + // + // At most 400 excluded job names are allowed. + repeated string excluded_jobs = 13; +} + +// Filters to apply when performing the search query. +message ProfileQuery { + // Keywords to match any text fields of profiles. + // + // For example, "software engineer in Palo Alto". + string query = 1; + + // The location filter specifies geo-regions containing the profiles to + // search against. + // + // One of [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] or [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] must be + // provided or an error is thrown. If both [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] and + // [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] are provided, an error is thrown. + // + // The following logic is used to determine which locations in + // the profile to filter against: + // + // 1. All of the profile's geocoded [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where + // [Address.usage][google.cloud.talent.v4beta1.Address.usage] is PERSONAL and [Address.current][google.cloud.talent.v4beta1.Address.current] is true. + // + // 2. If the above set of locations is empty, all of the profile's geocoded + // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where [Address.usage][google.cloud.talent.v4beta1.Address.usage] is + // CONTACT_INFO_USAGE_UNSPECIFIED and [Address.current][google.cloud.talent.v4beta1.Address.current] is true. + // + // 3. If the above set of locations is empty, all of the profile's geocoded + // [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where [Address.usage][google.cloud.talent.v4beta1.Address.usage] is PERSONAL or + // CONTACT_INFO_USAGE_UNSPECIFIED and [Address.current][google.cloud.talent.v4beta1.Address.current] is not set. + // + // This means that any profiles without any [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] that match + // any of the above criteria will not be included in a search with location + // filter. Furthermore, any [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] where [Address.usage][google.cloud.talent.v4beta1.Address.usage] is + // WORK or SCHOOL or where [Address.current][google.cloud.talent.v4beta1.Address.current] is false are not considered for + // location filter. + // + // If a location filter isn't specified, profiles fitting the other search + // criteria are retrieved regardless of where they're located. + // + // If [LocationFilter.negated][google.cloud.talent.v4beta1.LocationFilter.negated] is specified, the result doesn't contain + // profiles from that location. + // + // If [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] is provided, the + // [LocationType][google.cloud.talent.v4beta1.Location.LocationType], center + // point (latitude and longitude), and radius are automatically detected by + // the Google Maps Geocoding API and included as well. If + // [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] cannot be geocoded, the filter + // falls back to keyword search. + // + // If the detected + // [LocationType][google.cloud.talent.v4beta1.Location.LocationType] is + // [LocationType.SUB_ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.Location.LocationType.SUB_ADMINISTRATIVE_AREA], + // [LocationType.ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.Location.LocationType.ADMINISTRATIVE_AREA], + // or + // [LocationType.COUNTRY][google.cloud.talent.v4beta1.Location.LocationType.COUNTRY], + // the filter is performed against the detected location name (using exact + // text matching). Otherwise, the filter is performed against the detected + // center point and a radius of detected location radius + + // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]. + // + // If [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] is provided, + // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is the additional radius on top of the + // radius of the location geocoded from [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]. If + // [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] is provided, + // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is the only radius that is used. + // + // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is 10 by default. Note that the value + // of [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is 0 if it is unset, so the server + // does not differentiate [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] that is + // explicitly set to 0 and [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] that is not + // set. Which means that if [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is explicitly + // set to 0, the server will use the default value of + // [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] which is 10. To work around this and + // effectively set [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] to 0, we recommend + // setting [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] to a very small decimal number + // (such as 0.00001). + // + // If [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is negative, an error is thrown. + repeated LocationFilter location_filters = 2; + + // Job title filter specifies job titles of profiles to match on. + // + // If a job title isn't specified, profiles with any titles are retrieved. + // + // If multiple values are specified, profiles are retrieved with any of the + // specified job titles. + // + // If [JobTitleFilter.negated][google.cloud.talent.v4beta1.JobTitleFilter.negated] is specified, the result won't contain + // profiles with the job titles. + // + // For example, search for profiles with a job title "Product Manager". + repeated JobTitleFilter job_title_filters = 3; + + // Employer filter specifies employers of profiles to match on. + // + // If an employer filter isn't specified, profiles with any employers are + // retrieved. + // + // If multiple employer filters are specified, profiles with any matching + // employers are retrieved. + // + // If [EmployerFilter.negated][google.cloud.talent.v4beta1.EmployerFilter.negated] is specified, the result won't contain + // profiles that match the employers. + // + // For example, search for profiles that have working experience at "Google + // LLC". + repeated EmployerFilter employer_filters = 4; + + // Education filter specifies education of profiles to match on. + // + // If an education filter isn't specified, profiles with any education are + // retrieved. + // + // If multiple education filters are specified, profiles that match any + // education filters are retrieved. + // + // If [EducationFilter.negated][google.cloud.talent.v4beta1.EducationFilter.negated] is specified, the result won't contain + // profiles that match the educations. + // + // For example, search for profiles with a master degree. + repeated EducationFilter education_filters = 5; + + // Skill filter specifies skill of profiles to match on. + // + // If a skill filter isn't specified, profiles with any skills are retrieved. + // + // If multiple skill filters are specified, profiles that match any skill + // filters are retrieved. + // + // If [SkillFilter.negated][google.cloud.talent.v4beta1.SkillFilter.negated] is specified, the result won't contain profiles + // that match the skills. + // + // For example, search for profiles that have "Java" and "Python" in skill + // list. + repeated SkillFilter skill_filters = 6; + + // Work experience filter specifies the total working experience of profiles + // to match on. + // + // If a work experience filter isn't specified, profiles with any + // professional experience are retrieved. + // + // If multiple work experience filters are specified, profiles that match any + // work experience filters are retrieved. + // + // For example, search for profiles with 10 years of work experience. + repeated WorkExperienceFilter work_experience_filter = 7; + + // Time filter specifies the create/update timestamp of the profiles to match + // on. + // + // For example, search for profiles created since "2018-1-1". + repeated TimeFilter time_filters = 8; + + // The hirable filter specifies the profile's hirable status to match on. + google.protobuf.BoolValue hirable_filter = 9; + + // The application date filters specify application date ranges to match on. + repeated ApplicationDateFilter application_date_filters = 10; + + // The application outcome notes filters specify the notes for the outcome of + // the job application. + repeated ApplicationOutcomeNotesFilter application_outcome_notes_filters = 11; + + // The application job filters specify the job applied for in the application. + repeated ApplicationJobFilter application_job_filters = 13; + + // This filter specifies a structured syntax to match against the + // [Profile.custom_attributes][google.cloud.talent.v4beta1.Profile.custom_attributes] that are marked as `filterable`. + // + // The syntax for this expression is a subset of Google SQL syntax. + // + // String custom attributes: supported operators are =, != where the left of + // the operator is a custom field key and the right of the operator is a + // string (surrounded by quotes) value. + // + // Numeric custom attributes: Supported operators are '>', '<' or '=' + // operators where the left of the operator is a custom field key and the + // right of the operator is a numeric value. + // + // Supported functions are LOWER() to + // perform case insensitive match and EMPTY() to filter on the + // existence of a key. + // + // Boolean expressions (AND/OR/NOT) are supported up to 3 levels of + // nesting (for example "((A AND B AND C) OR NOT D) AND E"), and there can be + // a maximum of 50 comparisons/functions in the expression. The expression + // must be < 2000 characters in length. + // + // Sample Query: + // (key1 = "TEST" OR LOWER(key1)="test" OR NOT EMPTY(key1)) + string custom_attribute_filter = 15; + + // Deprecated. Use availability_filters instead. + // + // The candidate availability filter which filters based on availability + // signals. + // + // Signal 1: Number of days since most recent job application. See + // [Availability.JobApplicationAvailabilitySignal][google.cloud.talent.v4beta1.Availability.JobApplicationAvailabilitySignal] for the details of this + // signal. + // + // Signal 2: Number of days since last profile update. See + // [Availability.ProfileUpdateAvailabilitySignal][google.cloud.talent.v4beta1.Availability.ProfileUpdateAvailabilitySignal] + // for the details of this signal. + // + // The candidate availability filter helps a recruiter understand if a + // specific candidate is likely to be actively seeking new job opportunities + // based on an aggregated set of signals. Specifically, the intent is NOT to + // indicate the candidate's potential qualification / interest / close ability + // for a specific job. + CandidateAvailabilityFilter candidate_availability_filter = 16 [deprecated = true]; + + // The availability filter which filters based on + // [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals]. + // + // The availability filter helps a recruiter understand if a + // specific candidate is likely to be actively seeking new job opportunities + // based on an aggregated set of signals. Specifically, the intent is NOT to + // indicate the candidate's potential qualification / interest / close ability + // for a specific job. + // + // There can be at most one [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] per + // [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type]. If there are multiple + // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] for a [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type], + // an error is thrown. + repeated AvailabilityFilter availability_filters = 18; + + // Person name filter specifies person name of profiles to match on. + // + // If multiple person name filters are specified, profiles that match any + // person name filters are retrieved. + // + // For example, search for profiles of candidates with name "John Smith". + repeated PersonNameFilter person_name_filters = 17; +} + +// Geographic region of the search. +message LocationFilter { + // Specify whether to include telecommute jobs. + enum TelecommutePreference { + // Default value if the telecommute preference isn't specified. + TELECOMMUTE_PREFERENCE_UNSPECIFIED = 0; + + // Exclude telecommute jobs. + TELECOMMUTE_EXCLUDED = 1; + + // Allow telecommute jobs. + TELECOMMUTE_ALLOWED = 2; + } + + // The address name, such as "Mountain View" or "Bay Area". + string address = 1; + + // CLDR region code of the country/region of the address. This is used + // to address ambiguity of the user-input location, for example, "Liverpool" + // against "Liverpool, NY, US" or "Liverpool, UK". + // + // Set this field to bias location resolution toward a specific country + // or territory. If this field is not set, application behavior is biased + // toward the United States by default. + // + // See + // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + // for details. Example: "CH" for Switzerland. + // Note that this filter is not applicable for Profile Search related queries. + string region_code = 2; + + // The latitude and longitude of the geographic center to search from. This + // field is ignored if `address` is provided. + google.type.LatLng lat_lng = 3; + + // The distance_in_miles is applied when the location being searched for is + // identified as a city or smaller. This field is ignored if the location + // being searched for is a state or larger. + double distance_in_miles = 4; + + // Allows the client to return jobs without a + // set location, specifically, telecommuting jobs (telecommuting is considered + // by the service as a special location. + // [Job.posting_region][google.cloud.talent.v4beta1.Job.posting_region] indicates if a job permits telecommuting. + // If this field is set to [TelecommutePreference.TELECOMMUTE_ALLOWED][google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference.TELECOMMUTE_ALLOWED], + // telecommuting jobs are searched, and [address][google.cloud.talent.v4beta1.LocationFilter.address] and [lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] are + // ignored. If not set or set to + // [TelecommutePreference.TELECOMMUTE_EXCLUDED][google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference.TELECOMMUTE_EXCLUDED], telecommute job are not + // searched. + // + // This filter can be used by itself to search exclusively for telecommuting + // jobs, or it can be combined with another location + // filter to search for a combination of job locations, + // such as "Mountain View" or "telecommuting" jobs. However, when used in + // combination with other location filters, telecommuting jobs can be + // treated as less relevant than other jobs in the search response. + // + // This field is only used for job search requests. + TelecommutePreference telecommute_preference = 5; + + // Whether to apply negation to the filter so profiles matching the filter + // are excluded. + // + // Currently only supported in profile search. + bool negated = 6; +} + +// Filter on job compensation type and amount. +message CompensationFilter { + // Specify the type of filtering. + enum FilterType { + // Filter type unspecified. Position holder, INVALID, should never be used. + FILTER_TYPE_UNSPECIFIED = 0; + + // Filter by `base compensation entry's` unit. A job is a match if and + // only if the job contains a base CompensationEntry and the base + // CompensationEntry's unit matches provided [units][google.cloud.talent.v4beta1.CompensationFilter.units]. + // Populate one or more [units][google.cloud.talent.v4beta1.CompensationFilter.units]. + // + // See [CompensationInfo.CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for definition of + // base compensation entry. + UNIT_ONLY = 1; + + // Filter by `base compensation entry's` unit and amount / range. A job + // is a match if and only if the job contains a base CompensationEntry, and + // the base entry's unit matches provided + // [CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit] and + // amount or range overlaps with provided + // [CompensationRange][google.cloud.talent.v4beta1.CompensationInfo.CompensationRange]. + // + // See [CompensationInfo.CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for definition of + // base compensation entry. + // + // Set exactly one [units][google.cloud.talent.v4beta1.CompensationFilter.units] and populate [range][google.cloud.talent.v4beta1.CompensationFilter.range]. + UNIT_AND_AMOUNT = 2; + + // Filter by annualized base compensation amount and `base compensation + // entry's` unit. Populate [range][google.cloud.talent.v4beta1.CompensationFilter.range] and zero or more [units][google.cloud.talent.v4beta1.CompensationFilter.units]. + ANNUALIZED_BASE_AMOUNT = 3; + + // Filter by annualized total compensation amount and `base compensation + // entry's` unit . Populate [range][google.cloud.talent.v4beta1.CompensationFilter.range] and zero or more [units][google.cloud.talent.v4beta1.CompensationFilter.units]. + ANNUALIZED_TOTAL_AMOUNT = 4; + } + + // Required. Type of filter. + FilterType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specify desired `base compensation entry's` + // [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit]. + repeated CompensationInfo.CompensationUnit units = 2 [(google.api.field_behavior) = REQUIRED]; + + // Compensation range. + CompensationInfo.CompensationRange range = 3; + + // If set to true, jobs with unspecified compensation range fields are + // included. + bool include_jobs_with_unspecified_compensation_range = 4; +} + +// Parameters needed for commute search. +message CommuteFilter { + // The traffic density to use when calculating commute time. + enum RoadTraffic { + // Road traffic situation isn't specified. + ROAD_TRAFFIC_UNSPECIFIED = 0; + + // Optimal commute time without considering any traffic impact. + TRAFFIC_FREE = 1; + + // Commute time calculation takes in account the peak traffic impact. + BUSY_HOUR = 2; + } + + // Required. The method of transportation to calculate the commute time for. + CommuteMethod commute_method = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The latitude and longitude of the location to calculate the + // commute time from. + google.type.LatLng start_coordinates = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The maximum travel time in seconds. The maximum allowed value is `3600s` + // (one hour). Format is `123s`. + google.protobuf.Duration travel_duration = 3 [(google.api.field_behavior) = REQUIRED]; + + // If `true`, jobs without street level addresses may also be returned. + // For city level addresses, the city center is used. For state and coarser + // level addresses, text matching is used. + // If this field is set to `false` or isn't specified, only jobs that include + // street level addresses will be returned by commute search. + bool allow_imprecise_addresses = 4; + + // Traffic factor to take into account while searching by commute. + oneof traffic_option { + // Specifies the traffic density to use when calculating commute time. + RoadTraffic road_traffic = 5; + + // The departure time used to calculate traffic impact, represented as + // [google.type.TimeOfDay][google.type.TimeOfDay] in local time zone. + // + // Currently traffic model is restricted to hour level resolution. + google.type.TimeOfDay departure_time = 6; + } +} + +// Job title of the search. +message JobTitleFilter { + // Required. The job title. For example, "Software engineer", or "Product manager". + string job_title = 1 [(google.api.field_behavior) = REQUIRED]; + + // Whether to apply negation to the filter so profiles matching the filter + // are excluded. + bool negated = 2; +} + +// Skill filter of the search. +message SkillFilter { + // Required. The skill name. For example, "java", "j2ee", and so on. + string skill = 1 [(google.api.field_behavior) = REQUIRED]; + + // Whether to apply negation to the filter so profiles matching the filter + // are excluded. + bool negated = 2; +} + +// Employer filter of the search. +message EmployerFilter { + // Enum indicating which set of [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records] to search + // against. + enum EmployerFilterMode { + // Default value. + EMPLOYER_FILTER_MODE_UNSPECIFIED = 0; + + // Apply to all employers in [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records]. + ALL_EMPLOYMENT_RECORDS = 1; + + // Apply only to current employer in [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records]. + CURRENT_EMPLOYMENT_RECORDS_ONLY = 2; + + // Apply only to past (not current) employers in + // [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records]. + PAST_EMPLOYMENT_RECORDS_ONLY = 3; + } + + // Required. The name of the employer, for example "Google", "Alphabet". + string employer = 1 [(google.api.field_behavior) = REQUIRED]; + + // Define set of [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord]s to search against. + // + // Defaults to [EmployerFilterMode.ALL_EMPLOYMENT_RECORDS][google.cloud.talent.v4beta1.EmployerFilter.EmployerFilterMode.ALL_EMPLOYMENT_RECORDS]. + EmployerFilterMode mode = 2; + + // Whether to apply negation to the filter so profiles matching the filter + // is excluded. + bool negated = 3; +} + +// Education filter of the search. +message EducationFilter { + // The school name. For example "MIT", "University of California, Berkeley". + string school = 1; + + // The field of study. This is to search against value provided in + // [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree.fields_of_study]. + // For example "Computer Science", "Mathematics". + string field_of_study = 2; + + // Education degree in ISCED code. Each value in degree covers a specific + // level of education, without any expansion to upper nor lower levels of + // education degree. + DegreeType degree_type = 3; + + // Whether to apply negation to the filter so profiles matching the filter + // is excluded. + bool negated = 6; +} + +// Work experience filter. +// +// This filter is used to search for profiles with working experience length +// between [min_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.min_experience] and [max_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience]. +message WorkExperienceFilter { + // The minimum duration of the work experience (inclusive). + google.protobuf.Duration min_experience = 1; + + // The maximum duration of the work experience (exclusive). + google.protobuf.Duration max_experience = 2; +} + +// Application Date Range Filter. +// +// The API matches profiles with [Application.application_date][google.cloud.talent.v4beta1.Application.application_date] between +// start date and end date (both boundaries are inclusive). The filter is +// ignored if both [start_date][google.cloud.talent.v4beta1.ApplicationDateFilter.start_date] and [end_date][google.cloud.talent.v4beta1.ApplicationDateFilter.end_date] are missing. +message ApplicationDateFilter { + // Start date. If it's missing, The API matches profiles with application date + // not after the end date. + google.type.Date start_date = 1; + + // End date. If it's missing, The API matches profiles with application date + // not before the start date. + google.type.Date end_date = 2; +} + +// Outcome Notes Filter. +message ApplicationOutcomeNotesFilter { + // Required. User entered or selected outcome reason. The API does an exact match on the + // [Application.outcome_notes][google.cloud.talent.v4beta1.Application.outcome_notes] in profiles. + string outcome_notes = 1 [(google.api.field_behavior) = REQUIRED]; + + // If true, The API excludes all candidates with any + // [Application.outcome_notes][google.cloud.talent.v4beta1.Application.outcome_notes] matching the outcome reason specified in + // the filter. + bool negated = 2; +} + +// Filter on the job information of Application. +message ApplicationJobFilter { + // The job requisition id in the application. The API does an exact match on + // the [Job.requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] of [Application.job][google.cloud.talent.v4beta1.Application.job] in profiles. + string job_requisition_id = 2; + + // The job title in the application. The API does an exact match on the + // [Job.title][google.cloud.talent.v4beta1.Job.title] of [Application.job][google.cloud.talent.v4beta1.Application.job] in profiles. + string job_title = 3; + + // If true, the API excludes all profiles with any [Application.job][google.cloud.talent.v4beta1.Application.job] + // matching the filters. + bool negated = 4; +} + +// Filter on create timestamp or update timestamp of profiles. +message TimeFilter { + // Time fields can be used in TimeFilter. + enum TimeField { + // Default value. + TIME_FIELD_UNSPECIFIED = 0; + + // Earliest profile create time. + CREATE_TIME = 1; + + // Latest profile update time. + UPDATE_TIME = 2; + } + + // Start timestamp, matching profiles with the start time. If this field + // missing, The API matches profiles with create / update timestamp before the + // end timestamp. + google.protobuf.Timestamp start_time = 1; + + // End timestamp, matching profiles with the end time. If this field + // missing, The API matches profiles with create / update timestamp after the + // start timestamp. + google.protobuf.Timestamp end_time = 2; + + // Specifies which time field to filter profiles. + // + // Defaults to [TimeField.CREATE_TIME][google.cloud.talent.v4beta1.TimeFilter.TimeField.CREATE_TIME]. + TimeField time_field = 3; +} + +// Deprecated. Use AvailabilityFilter instead. +// +// Filter on availability signals. +message CandidateAvailabilityFilter { + option deprecated = true; + + // It is false by default. If true, API excludes all the potential available + // profiles. + bool negated = 1; +} + +// Filter on availability signals. +message AvailabilityFilter { + // Required. Type of signal to apply filter on. + AvailabilitySignalType signal_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Range of times to filter candidate signals by. + TimestampRange range = 2 [(google.api.field_behavior) = REQUIRED]; + + // If multiple [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] are provided, the default + // behavior is to OR all filters, but if this field is set to true, this + // particular [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] will be AND'ed against other + // [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter]. + bool required = 3; +} + +// Filter on person name. +message PersonNameFilter { + // Required. The person name. For example, "John Smith". + // + // Can be any combination of [PersonName.structured_name.given_name][], + // [PersonName.structured_name.middle_initial][], + // [PersonName.structured_name.family_name][], and + // [PersonName.formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name]. + string person_name = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/histogram.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/histogram.proto new file mode 100644 index 0000000..1093869 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/histogram.proto @@ -0,0 +1,53 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "HistogramProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// The histogram request. +message HistogramQuery { + // An expression specifies a histogram request against matching resources + // (for example, jobs, profiles) for searches. + // + // See [SearchJobsRequest.histogram_queries][google.cloud.talent.v4beta1.SearchJobsRequest.histogram_queries] and + // [SearchProfilesRequest.histogram_queries][google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries] for details about syntax. + string histogram_query = 1; +} + +// Histogram result that matches [HistogramQuery][google.cloud.talent.v4beta1.HistogramQuery] specified in searches. +message HistogramQueryResult { + // Requested histogram expression. + string histogram_query = 1; + + // A map from the values of the facet associated with distinct values to the + // number of matching entries with corresponding value. + // + // The key format is: + // + // * (for string histogram) string values stored in the field. + // * (for named numeric bucket) name specified in `bucket()` function, like + // for `bucket(0, MAX, "non-negative")`, the key will be `non-negative`. + // * (for anonymous numeric bucket) range formatted as `-`, for + // example, `0-1000`, `MIN-0`, and `0-MAX`. + map histogram = 2; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/job.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/job.proto new file mode 100644 index 0000000..b2ffa2b --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/job.proto @@ -0,0 +1,350 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/postal_address.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "JobResourceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A Job resource represents a job posting (also referred to as a "job listing" +// or "job requisition"). A job belongs to a [Company][google.cloud.talent.v4beta1.Company], which is the hiring +// entity responsible for the job. +message Job { + option (google.api.resource) = { + type: "jobs.googleapis.com/Job" + pattern: "projects/{project}/tenants/{tenant}/jobs/{job}" + pattern: "projects/{project}/jobs/{job}" + }; + + // Application related details of a job posting. + message ApplicationInfo { + // Use this field to specify email address(es) to which resumes or + // applications can be sent. + // + // The maximum number of allowed characters for each entry is 255. + repeated string emails = 1; + + // Use this field to provide instructions, such as "Mail your application + // to ...", that a candidate can follow to apply for the job. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 3,000. + string instruction = 2; + + // Use this URI field to direct an applicant to a website, for example to + // link to an online application form. + // + // The maximum number of allowed characters for each entry is 2,000. + repeated string uris = 3; + } + + // Derived details about the job posting. + message DerivedInfo { + // Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4beta1.Job.addresses]. + // + // [locations][google.cloud.talent.v4beta1.Job.DerivedInfo.locations] are exactly matched to [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] in the same + // order. + repeated Location locations = 1; + + // Job categories derived from [Job.title][google.cloud.talent.v4beta1.Job.title] and [Job.description][google.cloud.talent.v4beta1.Job.description]. + repeated JobCategory job_categories = 3; + } + + // Options for job processing. + message ProcessingOptions { + // If set to `true`, the service does not attempt to resolve a + // more precise address for the job. + bool disable_street_address_resolution = 1; + + // Option for job HTML content sanitization. Applied fields are: + // + // * description + // * applicationInfo.instruction + // * incentives + // * qualifications + // * responsibilities + // + // HTML tags in these fields may be stripped if sanitiazation isn't + // disabled. + // + // Defaults to [HtmlSanitization.SIMPLE_FORMATTING_ONLY][google.cloud.talent.v4beta1.HtmlSanitization.SIMPLE_FORMATTING_ONLY]. + HtmlSanitization html_sanitization = 2; + } + + // Required during job update. + // + // The resource name for the job. This is generated by the service when a + // job is created. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + // example, "projects/foo/tenants/bar/jobs/baz". + // + // If tenant id is unspecified, the default tenant is used. For + // example, "projects/foo/jobs/bar". + // + // Use of this field in job queries and API calls is preferred over the use of + // [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] since this value is unique. + string name = 1; + + // Required. The resource name of the company listing the job. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For + // example, "projects/foo/tenants/bar/companies/baz". + // + // If tenant id is unspecified, the default tenant is used. For + // example, "projects/foo/companies/bar". + string company = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Company" + } + ]; + + // Required. The requisition ID, also referred to as the posting ID, is assigned by the + // client to identify a job. This field is intended to be used by clients + // for client identification and tracking of postings. A job isn't allowed + // to be created if there is another job with the same [company][google.cloud.talent.v4beta1.Job.name], + // [language_code][google.cloud.talent.v4beta1.Job.language_code] and [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id]. + // + // The maximum number of allowed characters is 255. + string requisition_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The title of the job, such as "Software Engineer" + // + // The maximum number of allowed characters is 500. + string title = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The description of the job, which typically includes a multi-paragraph + // description of the company and related information. Separate fields are + // provided on the job object for [responsibilities][google.cloud.talent.v4beta1.Job.responsibilities], + // [qualifications][google.cloud.talent.v4beta1.Job.qualifications], and other job characteristics. Use of + // these separate job fields is recommended. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 100,000. + string description = 5 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // Location(s) where the employer is looking to hire for this job posting. + // + // Specifying the full street address(es) of the hiring location enables + // better API results, especially job searches by commute time. + // + // At most 50 locations are allowed for best search performance. If a job has + // more locations, it is suggested to split it into multiple jobs with unique + // [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id]s (e.g. 'ReqA' becomes 'ReqA-1', 'ReqA-2', and so on.) as + // multiple jobs with the same [company][google.cloud.talent.v4beta1.Job.company], [language_code][google.cloud.talent.v4beta1.Job.language_code] and + // [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] are not allowed. If the original [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] must + // be preserved, a custom field should be used for storage. It is also + // suggested to group the locations that close to each other in the same job + // for better search experience. + // + // The maximum number of allowed characters is 500. + repeated string addresses = 6; + + // Job application information. + ApplicationInfo application_info = 7; + + // The benefits included with the job. + repeated JobBenefit job_benefits = 8; + + // Job compensation information (a.k.a. "pay rate") i.e., the compensation + // that will paid to the employee. + CompensationInfo compensation_info = 9; + + // A map of fields to hold both filterable and non-filterable custom job + // attributes that are not covered by the provided structured fields. + // + // The keys of the map are strings up to 64 bytes and must match the + // pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, key0LikeThis or + // KEY_1_LIKE_THIS. + // + // At most 100 filterable and at most 100 unfilterable keys are supported. + // For filterable `string_values`, across all keys at most 200 values are + // allowed, with each string no more than 255 characters. For unfilterable + // `string_values`, the maximum total size of `string_values` across all keys + // is 50KB. + map custom_attributes = 10; + + // The desired education degrees for the job, such as Bachelors, Masters. + repeated DegreeType degree_types = 11; + + // The department or functional area within the company with the open + // position. + // + // The maximum number of allowed characters is 255. + string department = 12; + + // The employment type(s) of a job, for example, + // [full time][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME] or + // [part time][google.cloud.talent.v4beta1.EmploymentType.PART_TIME]. + repeated EmploymentType employment_types = 13; + + // A description of bonus, commission, and other compensation + // incentives associated with the job not including salary or pay. + // + // The maximum number of allowed characters is 10,000. + string incentives = 14; + + // The language of the posting. This field is distinct from + // any requirements for fluency that are associated with the job. + // + // Language codes must be in BCP-47 format, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47){: + // class="external" target="_blank" }. + // + // If this field is unspecified and [Job.description][google.cloud.talent.v4beta1.Job.description] is present, detected + // language code based on [Job.description][google.cloud.talent.v4beta1.Job.description] is assigned, otherwise + // defaults to 'en_US'. + string language_code = 15; + + // The experience level associated with the job, such as "Entry Level". + JobLevel job_level = 16; + + // A promotion value of the job, as determined by the client. + // The value determines the sort order of the jobs returned when searching for + // jobs using the featured jobs search call, with higher promotional values + // being returned first and ties being resolved by relevance sort. Only the + // jobs with a promotionValue >0 are returned in a FEATURED_JOB_SEARCH. + // + // Default value is 0, and negative values are treated as 0. + int32 promotion_value = 17; + + // A description of the qualifications required to perform the + // job. The use of this field is recommended + // as an alternative to using the more general [description][google.cloud.talent.v4beta1.Job.description] field. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 10,000. + string qualifications = 18; + + // A description of job responsibilities. The use of this field is + // recommended as an alternative to using the more general [description][google.cloud.talent.v4beta1.Job.description] + // field. + // + // This field accepts and sanitizes HTML input, and also accepts + // bold, italic, ordered list, and unordered list markup tags. + // + // The maximum number of allowed characters is 10,000. + string responsibilities = 19; + + // The job [PostingRegion][google.cloud.talent.v4beta1.PostingRegion] (for example, state, country) throughout + // which the job is available. If this field is set, a [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] + // in a search query within the job region finds this job posting if an + // exact location match isn't specified. If this field is set to + // [PostingRegion.NATION][google.cloud.talent.v4beta1.PostingRegion.NATION] or [PostingRegion.ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.PostingRegion.ADMINISTRATIVE_AREA], + // setting job [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] to the same location level as this field + // is strongly recommended. + PostingRegion posting_region = 20; + + // Deprecated. The job is only visible to the owner. + // + // The visibility of the job. + // + // Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4beta1.Visibility.ACCOUNT_ONLY] if not specified. + Visibility visibility = 21 [deprecated = true]; + + // The start timestamp of the job in UTC time zone. Typically this field + // is used for contracting engagements. Invalid timestamps are ignored. + google.protobuf.Timestamp job_start_time = 22; + + // The end timestamp of the job. Typically this field is used for contracting + // engagements. Invalid timestamps are ignored. + google.protobuf.Timestamp job_end_time = 23; + + // The timestamp this job posting was most recently published. The default + // value is the time the request arrives at the server. Invalid timestamps are + // ignored. + google.protobuf.Timestamp posting_publish_time = 24; + + // Strongly recommended for the best service experience. + // + // The expiration timestamp of the job. After this timestamp, the + // job is marked as expired, and it no longer appears in search results. The + // expired job can't be listed by the [ListJobs][google.cloud.talent.v4beta1.JobService.ListJobs] API, + // but it can be retrieved with the [GetJob][google.cloud.talent.v4beta1.JobService.GetJob] API or + // updated with the [UpdateJob][google.cloud.talent.v4beta1.JobService.UpdateJob] API or deleted with + // the [DeleteJob][google.cloud.talent.v4beta1.JobService.DeleteJob] API. An expired job can + // be updated and opened again by using a future expiration timestamp. + // Updating an expired job fails if there is another existing open job with + // same [company][google.cloud.talent.v4beta1.Job.company], [language_code][google.cloud.talent.v4beta1.Job.language_code] and [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id]. + // + // The expired jobs are retained in our system for 90 days. However, the + // overall expired job count cannot exceed 3 times the maximum number of + // open jobs over previous 7 days. If this threshold is exceeded, + // expired jobs are cleaned out in order of earliest expire time. + // Expired jobs are no longer accessible after they are cleaned + // out. + // + // Invalid timestamps are ignored, and treated as expire time not provided. + // + // If the timestamp is before the instant request is made, the job + // is treated as expired immediately on creation. This kind of job can + // not be updated. And when creating a job with past timestamp, the + // [posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] must be set before + // [posting_expire_time][google.cloud.talent.v4beta1.Job.posting_expire_time]. The purpose of this feature is + // to allow other objects, such as [Application][google.cloud.talent.v4beta1.Application], to refer a job + // that didn't exist in the system prior to becoming expired. If you + // want to modify a job that was expired on creation, + // delete it and create a new one. + // + // If this value isn't provided at the time of job creation or is invalid, + // the job posting expires after 30 days from the job's creation time. For + // example, if the job was created on 2017/01/01 13:00AM UTC with an + // unspecified expiration date, the job expires after 2017/01/31 13:00AM UTC. + // + // If this value isn't provided on job update, it depends on the field masks + // set by [UpdateJobRequest.update_mask][google.cloud.talent.v4beta1.UpdateJobRequest.update_mask]. If the field masks include + // [job_end_time][google.cloud.talent.v4beta1.Job.job_end_time], or the masks are empty meaning that every field is + // updated, the job posting expires after 30 days from the job's last + // update time. Otherwise the expiration date isn't updated. + google.protobuf.Timestamp posting_expire_time = 25; + + // Output only. The timestamp when this job posting was created. + google.protobuf.Timestamp posting_create_time = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp when this job posting was last updated. + google.protobuf.Timestamp posting_update_time = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Display name of the company listing the job. + string company_display_name = 28 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Derived details about the job posting. + DerivedInfo derived_info = 29 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Options for job processing. + ProcessingOptions processing_options = 30; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/job_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/job_service.proto new file mode 100644 index 0000000..148e648 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/job_service.proto @@ -0,0 +1,910 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/cloud/talent/v4beta1/filters.proto"; +import "google/cloud/talent/v4beta1/histogram.proto"; +import "google/cloud/talent/v4beta1/job.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "JobServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service handles job management, including job CRUD, enumeration and search. +service JobService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new job. + // + // Typically, the job becomes searchable within 10 seconds, but it may take + // up to 5 minutes. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/jobs" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/jobs" + body: "*" + } + }; + option (google.api.method_signature) = "parent,job"; + } + + // Begins executing a batch create jobs operation. + rpc BatchCreateJobs(BatchCreateJobsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/jobs:batchCreate" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/jobs:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,jobs"; + option (google.longrunning.operation_info) = { + response_type: "JobOperationResult" + metadata_type: "BatchOperationMetadata" + }; + } + + // Retrieves the specified job, whose status is OPEN or recently EXPIRED + // within the last 90 days. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v4beta1/{name=projects/*/tenants/*/jobs/*}" + additional_bindings { + get: "/v4beta1/{name=projects/*/jobs/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified job. + // + // Typically, updated contents become visible in search results within 10 + // seconds, but it may take up to 5 minutes. + rpc UpdateJob(UpdateJobRequest) returns (Job) { + option (google.api.http) = { + patch: "/v4beta1/{job.name=projects/*/tenants/*/jobs/*}" + body: "*" + additional_bindings { + patch: "/v4beta1/{job.name=projects/*/jobs/*}" + body: "*" + } + }; + option (google.api.method_signature) = "job"; + } + + // Begins executing a batch update jobs operation. + rpc BatchUpdateJobs(BatchUpdateJobsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/jobs:batchUpdate" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/jobs:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,jobs"; + option (google.longrunning.operation_info) = { + response_type: "JobOperationResult" + metadata_type: "BatchOperationMetadata" + }; + } + + // Deletes the specified job. + // + // Typically, the job becomes unsearchable within 10 seconds, but it may take + // up to 5 minutes. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4beta1/{name=projects/*/tenants/*/jobs/*}" + additional_bindings { + delete: "/v4beta1/{name=projects/*/jobs/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter. + rpc BatchDeleteJobs(BatchDeleteJobsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/jobs:batchDelete" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/jobs:batchDelete" + } + }; + option (google.api.method_signature) = "parent,filter"; + } + + // Lists jobs by filter. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v4beta1/{parent=projects/*/tenants/*}/jobs" + additional_bindings { + get: "/v4beta1/{parent=projects/*}/jobs" + } + }; + option (google.api.method_signature) = "parent,filter"; + } + + // Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + // + // This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + // present in the database, and only returns jobs that the caller has + // permission to search against. + rpc SearchJobs(SearchJobsRequest) returns (SearchJobsResponse) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/jobs:search" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/jobs:search" + body: "*" + } + }; + } + + // Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + // + // This API call is intended for the use case of targeting passive job + // seekers (for example, job seekers who have signed up to receive email + // alerts about potential job opportunities), and has different algorithmic + // adjustments that are targeted to passive job seekers. + // + // This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + // present in the database, and only returns jobs the caller has + // permission to search against. + rpc SearchJobsForAlert(SearchJobsRequest) returns (SearchJobsResponse) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/jobs:searchForAlert" + body: "*" + additional_bindings { + post: "/v4beta1/{parent=projects/*}/jobs:searchForAlert" + body: "*" + } + }; + } +} + +// Create job request. +message CreateJobRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenant/bar". If tenant id is unspecified a default tenant + // is created. For example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The Job to be created. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Get job request. +message GetJobRequest { + // Required. The resource name of the job to retrieve. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + // example, "projects/foo/tenants/bar/jobs/baz". + // + // If tenant id is unspecified, the default tenant is used. For + // example, "projects/foo/jobs/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Job" + } + ]; +} + +// Update job request. +message UpdateJobRequest { + // Required. The Job to be updated. + Job job = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4beta1.UpdateJobRequest.update_mask] is provided, only the specified fields in + // [job][google.cloud.talent.v4beta1.UpdateJobRequest.job] are updated. Otherwise all the fields are updated. + // + // A field mask to restrict the fields that are updated. Only + // top level fields of [Job][google.cloud.talent.v4beta1.Job] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Delete job request. +message DeleteJobRequest { + // Required. The resource name of the job to be deleted. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + // example, "projects/foo/tenants/bar/jobs/baz". + // + // If tenant id is unspecified, the default tenant is used. For + // example, "projects/foo/jobs/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Job" + } + ]; +} + +// Batch delete jobs request. +message BatchDeleteJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created. For example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The filter string specifies the jobs to be deleted. + // + // Supported operator: =, AND + // + // The fields eligible for filtering are: + // + // * `companyName` (Required) + // * `requisitionId` (Required) + // + // Sample Query: companyName = "projects/foo/companies/bar" AND + // requisitionId = "req-1" + string filter = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// List jobs request. +message ListJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created. For example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The filter string specifies the jobs to be enumerated. + // + // Supported operator: =, AND + // + // The fields eligible for filtering are: + // + // * `companyName` (Required) + // * `requisitionId` + // * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + // OPEN if no value is specified. + // + // Sample Query: + // + // * companyName = "projects/foo/tenants/bar/companies/baz" + // * companyName = "projects/foo/tenants/bar/companies/baz" AND + // requisitionId = "req-1" + // * companyName = "projects/foo/tenants/bar/companies/baz" AND + // status = "EXPIRED" + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // The starting point of a query result. + string page_token = 3; + + // The maximum number of jobs to be returned per page of results. + // + // If [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job_view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY], the maximum allowed + // page size is 1000. Otherwise, the maximum allowed page size is 100. + // + // Default is 100 if empty or a number < 1 is specified. + int32 page_size = 4; + + // The desired job attributes returned for jobs in the + // search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] if no value is + // specified. + JobView job_view = 5; +} + +// An enum that specifies the job attributes that are returned in the +// [MatchingJob.job][google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.job] or +// [ListJobsResponse.jobs][google.cloud.talent.v4beta1.ListJobsResponse.jobs] fields. +enum JobView { + // Default value. + JOB_VIEW_UNSPECIFIED = 0; + + // A ID only view of job, with following attributes: + // [Job.name][google.cloud.talent.v4beta1.Job.name], [Job.requisition_id][google.cloud.talent.v4beta1.Job.requisition_id], [Job.language_code][google.cloud.talent.v4beta1.Job.language_code]. + JOB_VIEW_ID_ONLY = 1; + + // A minimal view of the job, with the following attributes: + // [Job.name][google.cloud.talent.v4beta1.Job.name], [Job.requisition_id][google.cloud.talent.v4beta1.Job.requisition_id], [Job.title][google.cloud.talent.v4beta1.Job.title], + // [Job.company][google.cloud.talent.v4beta1.Job.company], [Job.DerivedInfo.locations][google.cloud.talent.v4beta1.Job.DerivedInfo.locations], [Job.language_code][google.cloud.talent.v4beta1.Job.language_code]. + JOB_VIEW_MINIMAL = 2; + + // A small view of the job, with the following attributes in the search + // results: [Job.name][google.cloud.talent.v4beta1.Job.name], [Job.requisition_id][google.cloud.talent.v4beta1.Job.requisition_id], [Job.title][google.cloud.talent.v4beta1.Job.title], + // [Job.company][google.cloud.talent.v4beta1.Job.company], [Job.DerivedInfo.locations][google.cloud.talent.v4beta1.Job.DerivedInfo.locations], [Job.visibility][google.cloud.talent.v4beta1.Job.visibility], + // [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], [Job.description][google.cloud.talent.v4beta1.Job.description]. + JOB_VIEW_SMALL = 3; + + // All available attributes are included in the search results. + JOB_VIEW_FULL = 4; +} + +// List jobs response. +message ListJobsResponse { + // The Jobs for a given company. + // + // The maximum number of items returned is based on the limit field + // provided in the request. + repeated Job jobs = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} + +// The Request body of the `SearchJobs` call. +message SearchJobsRequest { + // Custom ranking information for [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + message CustomRankingInfo { + // The importance level for [CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression]. + enum ImportanceLevel { + // Default value if the importance level isn't specified. + IMPORTANCE_LEVEL_UNSPECIFIED = 0; + + // The given ranking expression is of None importance, existing relevance + // score (determined by API algorithm) dominates job's final ranking + // position. + NONE = 1; + + // The given ranking expression is of Low importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + LOW = 2; + + // The given ranking expression is of Mild importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + MILD = 3; + + // The given ranking expression is of Medium importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + MEDIUM = 4; + + // The given ranking expression is of High importance in terms of job's + // final ranking position compared to existing relevance + // score (determined by API algorithm). + HIGH = 5; + + // The given ranking expression is of Extreme importance, and dominates + // job's final ranking position with existing relevance + // score (determined by API algorithm) ignored. + EXTREME = 6; + } + + // Required. Controls over how important the score of + // [CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression] gets applied to job's final + // ranking position. + // + // An error is thrown if not specified. + ImportanceLevel importance_level = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Controls over how job documents get ranked on top of existing relevance + // score (determined by API algorithm). A combination of the ranking + // expression and relevance score is used to determine job's final ranking + // position. + // + // The syntax for this expression is a subset of Google SQL syntax. + // + // Supported operators are: +, -, *, /, where the left and right side of + // the operator is either a numeric [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes] key, + // integer/double value or an expression that can be evaluated to a number. + // + // Parenthesis are supported to adjust calculation precedence. The + // expression must be < 100 characters in length. + // + // The expression is considered invalid for a job if the expression + // references custom attributes that are not populated on the job or if the + // expression results in a divide by zero. If an expression is invalid for a + // job, that job is demoted to the end of the results. + // + // Sample ranking expression + // (year + 25) * 0.25 - (freshness / 0.5) + string ranking_expression = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // A string-represented enumeration of the job search mode. The service + // operate differently for different modes of service. + enum SearchMode { + // The mode of the search method isn't specified. The default search + // behavior is identical to JOB_SEARCH search behavior. + SEARCH_MODE_UNSPECIFIED = 0; + + // The job search matches against all jobs, and featured jobs + // (jobs with promotionValue > 0) are not specially handled. + JOB_SEARCH = 1; + + // The job search matches only against featured jobs (jobs with a + // promotionValue > 0). This method doesn't return any jobs having a + // promotionValue <= 0. The search results order is determined by the + // promotionValue (jobs with a higher promotionValue are returned higher up + // in the search results), with relevance being used as a tiebreaker. + FEATURED_JOB_SEARCH = 2; + } + + // Controls whether highly similar jobs are returned next to each other in + // the search results. Jobs are identified as highly similar based on + // their titles, job categories, and locations. Highly similar results are + // clustered so that only one representative job of the cluster is + // displayed to the job seeker higher up in the results, with the other jobs + // being displayed lower down in the results. + enum DiversificationLevel { + // The diversification level isn't specified. + DIVERSIFICATION_LEVEL_UNSPECIFIED = 0; + + // Disables diversification. Jobs that would normally be pushed to the last + // page would not have their positions altered. This may result in highly + // similar jobs appearing in sequence in the search results. + DISABLED = 1; + + // Default diversifying behavior. The result list is ordered so that + // highly similar results are pushed to the end of the last page of search + // results. If you are using pageToken to page through the result set, + // latency might be lower but we can't guarantee that all results are + // returned. If you are using page offset, latency might be higher but all + // results are returned. + SIMPLE = 2; + } + + // Required. The resource name of the tenant to search within. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created. For example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Mode of a search. + // + // Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. + SearchMode search_mode = 2; + + // Required. The meta information collected about the job searcher, used to improve the + // search quality of the service. The identifiers (such as `user_id`) are + // provided by users, and must be unique and consistent. + RequestMetadata request_metadata = 3 [(google.api.field_behavior) = REQUIRED]; + + // Query used to search against jobs, such as keyword, location filters, etc. + JobQuery job_query = 4; + + // Controls whether to broaden the search when it produces sparse results. + // Broadened queries append results to the end of the matching results + // list. + // + // Defaults to false. + bool enable_broadening = 5; + + // Controls if the search job request requires the return of a precise + // count of the first 300 results. Setting this to `true` ensures + // consistency in the number of results per page. Best practice is to set this + // value to true if a client allows users to jump directly to a + // non-sequential search results page. + // + // Enabling this flag may adversely impact performance. + // + // Defaults to false. + bool require_precise_result_size = 6; + + // An expression specifies a histogram request against matching jobs. + // + // Expression syntax is an aggregation function call with histogram facets and + // other options. + // + // Available aggregation function calls are: + // * `count(string_histogram_facet)`: Count the number of matching entities, + // for each distinct attribute value. + // * `count(numeric_histogram_facet, list of buckets)`: Count the number of + // matching entities within each bucket. + // + // Data types: + // + // * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. + // * String: string like "any string with backslash escape for quote(\")." + // * Number: whole number and floating point number like 10, -1 and -0.01. + // * List: list of elements with comma(,) separator surrounded by square + // brackets, for example, [1, 2, 3] and ["one", "two", "three"]. + // + // Built-in constants: + // + // * MIN (minimum number similar to java Double.MIN_VALUE) + // * MAX (maximum number similar to java Double.MAX_VALUE) + // + // Built-in functions: + // + // * bucket(start, end[, label]): bucket built-in function creates a bucket + // with range of [start, end). Note that the end is exclusive, for example, + // bucket(1, MAX, "positive number") or bucket(1, 10). + // + // Job histogram facets: + // + // * company_display_name: histogram by [Job.company_display_name][google.cloud.talent.v4beta1.Job.company_display_name]. + // * employment_type: histogram by [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types], for example, + // "FULL_TIME", "PART_TIME". + // * company_size: histogram by [CompanySize][google.cloud.talent.v4beta1.CompanySize], for example, "SMALL", + // "MEDIUM", "BIG". + // * publish_time_in_month: histogram by the [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + // in months. + // Must specify list of numeric buckets in spec. + // * publish_time_in_year: histogram by the [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + // in years. + // Must specify list of numeric buckets in spec. + // * degree_types: histogram by the [Job.degree_types][google.cloud.talent.v4beta1.Job.degree_types], for example, + // "Bachelors", "Masters". + // * job_level: histogram by the [Job.job_level][google.cloud.talent.v4beta1.Job.job_level], for example, "Entry + // Level". + // * country: histogram by the country code of jobs, for example, "US", "FR". + // * admin1: histogram by the admin1 code of jobs, which is a global + // placeholder referring to the state, province, or the particular term a + // country uses to define the geographic structure below the country level, + // for example, "CA", "IL". + // * city: histogram by a combination of the "city name, admin1 code". For + // example, "Mountain View, CA", "New York, NY". + // * admin1_country: histogram by a combination of the "admin1 code, country", + // for example, "CA, US", "IL, US". + // * city_coordinate: histogram by the city center's GPS coordinates (latitude + // and longitude), for example, 37.4038522,-122.0987765. Since the + // coordinates of a city center can change, customers may need to refresh + // them periodically. + // * locale: histogram by the [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], for example, "en-US", + // "fr-FR". + // * language: histogram by the language subtag of the [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], + // for example, "en", "fr". + // * category: histogram by the [JobCategory][google.cloud.talent.v4beta1.JobCategory], for example, + // "COMPUTER_AND_IT", "HEALTHCARE". + // * base_compensation_unit: histogram by the + // [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit] of base + // salary, for example, "WEEKLY", "MONTHLY". + // * base_compensation: histogram by the base salary. Must specify list of + // numeric buckets to group results by. + // * annualized_base_compensation: histogram by the base annualized salary. + // Must specify list of numeric buckets to group results by. + // * annualized_total_compensation: histogram by the total annualized salary. + // Must specify list of numeric buckets to group results by. + // * string_custom_attribute: histogram by string [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]. + // Values can be accessed via square bracket notations like + // string_custom_attribute["key1"]. + // * numeric_custom_attribute: histogram by numeric [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]. + // Values can be accessed via square bracket notations like + // numeric_custom_attribute["key1"]. Must specify list of numeric buckets to + // group results by. + // + // Example expressions: + // + // * `count(admin1)` + // * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), + // bucket(100000, MAX)])` + // * `count(string_custom_attribute["some-string-custom-attribute"])` + // * `count(numeric_custom_attribute["some-numeric-custom-attribute"], + // [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` + repeated HistogramQuery histogram_queries = 7; + + // The desired job attributes returned for jobs in the search response. + // Defaults to [JobView.JOB_VIEW_SMALL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL] if no value is specified. + JobView job_view = 8; + + // An integer that specifies the current offset (that is, starting result + // location, amongst the jobs deemed by the API as relevant) in search + // results. This field is only considered if [page_token][google.cloud.talent.v4beta1.SearchJobsRequest.page_token] is unset. + // + // The maximum allowed value is 5000. Otherwise an error is thrown. + // + // For example, 0 means to return results starting from the first matching + // job, and 10 means to return from the 11th job. This can be used for + // pagination, (for example, pageSize = 10 and offset = 10 means to return + // from the second page). + int32 offset = 9; + + // A limit on the number of jobs returned in the search results. + // Increasing this value above the default value of 10 can increase search + // response time. The value can be between 1 and 100. + int32 page_size = 10; + + // The token specifying the current offset within + // search results. See [SearchJobsResponse.next_page_token][google.cloud.talent.v4beta1.SearchJobsResponse.next_page_token] for + // an explanation of how to obtain the next set of query results. + string page_token = 11; + + // The criteria determining how search results are sorted. Default is + // `"relevance desc"`. + // + // Supported options are: + // + // * `"relevance desc"`: By relevance descending, as determined by the API + // algorithms. Relevance thresholding of query results is only available + // with this ordering. + // * `"posting_publish_time desc"`: By [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + // descending. + // * `"posting_update_time desc"`: By [Job.posting_update_time][google.cloud.talent.v4beta1.Job.posting_update_time] + // descending. + // * `"title"`: By [Job.title][google.cloud.talent.v4beta1.Job.title] ascending. + // * `"title desc"`: By [Job.title][google.cloud.talent.v4beta1.Job.title] descending. + // * `"annualized_base_compensation"`: By job's + // [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range] ascending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"annualized_base_compensation desc"`: By job's + // [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range] descending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"annualized_total_compensation"`: By job's + // [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range] ascending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"annualized_total_compensation desc"`: By job's + // [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range] descending. Jobs + // whose annualized base compensation is unspecified are put at the end of + // search results. + // * `"custom_ranking desc"`: By the relevance score adjusted to the + // [SearchJobsRequest.CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression] with weight + // factor assigned by + // [SearchJobsRequest.CustomRankingInfo.importance_level][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.importance_level] in descending + // order. + // * Location sorting: Use the special syntax to order jobs by distance:
+ // `"distance_from('Hawaii')"`: Order by distance from Hawaii.
+ // `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
+ // `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by + // multiple locations. See details below.
+ // `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by + // multiple locations. See details below.
+ // The string can have a maximum of 256 characters. When multiple distance + // centers are provided, a job that is close to any of the distance centers + // would have a high rank. When a job has multiple locations, the job + // location closest to one of the distance centers will be used. Jobs that + // don't have locations will be ranked at the bottom. Distance is calculated + // with a precision of 11.3 meters (37.4 feet). Diversification strategy is + // still applied unless explicitly disabled in + // [diversification_level][google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level]. + string order_by = 12; + + // Controls whether highly similar jobs are returned next to each other in + // the search results. Jobs are identified as highly similar based on + // their titles, job categories, and locations. Highly similar results are + // clustered so that only one representative job of the cluster is + // displayed to the job seeker higher up in the results, with the other jobs + // being displayed lower down in the results. + // + // Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value + // is specified. + DiversificationLevel diversification_level = 13; + + // Controls over how job documents get ranked on top of existing relevance + // score (determined by API algorithm). + CustomRankingInfo custom_ranking_info = 14; + + // Controls whether to disable exact keyword match on [Job.title][google.cloud.talent.v4beta1.Job.title], + // [Job.description][google.cloud.talent.v4beta1.Job.description], [Job.company_display_name][google.cloud.talent.v4beta1.Job.company_display_name], [Job.addresses][google.cloud.talent.v4beta1.Job.addresses], + // [Job.qualifications][google.cloud.talent.v4beta1.Job.qualifications]. When disable keyword match is turned off, a + // keyword match returns jobs that do not match given category filters when + // there are matching keywords. For example, for the query "program manager," + // a result is returned even if the job posting has the title "software + // developer," which doesn't fall into "program manager" ontology, but does + // have "program manager" appearing in its description. + // + // For queries like "cloud" that don't contain title or + // location specific ontology, jobs with "cloud" keyword matches are returned + // regardless of this flag's value. + // + // Use [Company.keyword_searchable_job_custom_attributes][google.cloud.talent.v4beta1.Company.keyword_searchable_job_custom_attributes] if + // company-specific globally matched custom field/attribute string values are + // needed. Enabling keyword match improves recall of subsequent search + // requests. + // + // Defaults to false. + bool disable_keyword_match = 16; +} + +// Response for SearchJob method. +message SearchJobsResponse { + // Job entry with metadata inside [SearchJobsResponse][google.cloud.talent.v4beta1.SearchJobsResponse]. + message MatchingJob { + // Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + Job job = 1; + + // A summary of the job with core information that's displayed on the search + // results listing page. + string job_summary = 2; + + // Contains snippets of text from the [Job.title][google.cloud.talent.v4beta1.Job.title] field most + // closely matching a search query's keywords, if available. The matching + // query keywords are enclosed in HTML bold tags. + string job_title_snippet = 3; + + // Contains snippets of text from the [Job.description][google.cloud.talent.v4beta1.Job.description] and similar + // fields that most closely match a search query's keywords, if available. + // All HTML tags in the original fields are stripped when returned in this + // field, and matching query keywords are enclosed in HTML bold tags. + string search_text_snippet = 4; + + // Commute information which is generated based on specified + // [CommuteFilter][google.cloud.talent.v4beta1.CommuteFilter]. + CommuteInfo commute_info = 5; + } + + // Commute details related to this job. + message CommuteInfo { + // Location used as the destination in the commute calculation. + Location job_location = 1; + + // The number of seconds required to travel to the job location from the + // query location. A duration of 0 seconds indicates that the job isn't + // reachable within the requested duration, but was returned as part of an + // expanded query. + google.protobuf.Duration travel_duration = 2; + } + + // The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + repeated MatchingJob matching_jobs = 1; + + // The histogram results that match with specified + // [SearchJobsRequest.histogram_queries][google.cloud.talent.v4beta1.SearchJobsRequest.histogram_queries]. + repeated HistogramQueryResult histogram_query_results = 2; + + // The token that specifies the starting position of the next page of results. + // This field is empty if there are no more results. + string next_page_token = 3; + + // The location filters that the service applied to the specified query. If + // any filters are lat-lng based, the [Location.location_type][google.cloud.talent.v4beta1.Location.location_type] is + // [Location.LocationType.LOCATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.Location.LocationType.LOCATION_TYPE_UNSPECIFIED]. + repeated Location location_filters = 4; + + // An estimation of the number of jobs that match the specified query. + // + // This number isn't guaranteed to be accurate. For accurate results, + // see [SearchJobsRequest.require_precise_result_size][google.cloud.talent.v4beta1.SearchJobsRequest.require_precise_result_size]. + int32 estimated_total_size = 5; + + // The precise result count, which is available only if the client set + // [SearchJobsRequest.require_precise_result_size][google.cloud.talent.v4beta1.SearchJobsRequest.require_precise_result_size] to `true`, or if the + // response is the last page of results. Otherwise, the value is `-1`. + int32 total_size = 6; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 7; + + // If query broadening is enabled, we may append additional results from the + // broadened query. This number indicates how many of the jobs returned in the + // jobs field are from the broadened query. These results are always at the + // end of the jobs list. In particular, a value of 0, or if the field isn't + // set, all the jobs in the jobs list are from the original + // (without broadening) query. If this field is non-zero, subsequent requests + // with offset after this result set should contain all broadened results. + int32 broadened_query_jobs_count = 8; + + // The spell checking result, and correction. + SpellingCorrection spell_correction = 9; +} + +// Request to create a batch of jobs. +message BatchCreateJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created. For example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The jobs to be created. + repeated Job jobs = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update a batch of jobs. +message BatchUpdateJobsRequest { + // Required. The resource name of the tenant under which the job is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + // is created. For example, "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Job" + } + ]; + + // Required. The jobs to be updated. + repeated Job jobs = 2 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. Be aware that it will + // also increase latency when checking the status of a batch operation. + // + // If [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] is provided, only the specified fields in + // [Job][google.cloud.talent.v4beta1.Job] are updated. Otherwise all the fields are updated. + // + // A field mask to restrict the fields that are updated. Only + // top level fields of [Job][google.cloud.talent.v4beta1.Job] are supported. + // + // If [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] is provided, The [Job][google.cloud.talent.v4beta1.Job] inside + // [JobResult][google.cloud.talent.v4beta1.JobOperationResult.JobResult] + // will only contains fields that is updated, plus the Id of the Job. + // Otherwise, [Job][google.cloud.talent.v4beta1.Job] will include all fields, which can yield a very + // large response. + google.protobuf.FieldMask update_mask = 3; +} + +// The result of [JobService.BatchCreateJobs][google.cloud.talent.v4beta1.JobService.BatchCreateJobs] or +// [JobService.BatchUpdateJobs][google.cloud.talent.v4beta1.JobService.BatchUpdateJobs] APIs. It's used to +// replace [google.longrunning.Operation.response][google.longrunning.Operation.response] in case of success. +message JobOperationResult { + // Mutation result of a job. + message JobResult { + // Here [Job][google.cloud.talent.v4beta1.Job] only contains basic information including [name][google.cloud.talent.v4beta1.Job.name], + // [company][google.cloud.talent.v4beta1.Job.company], [language_code][google.cloud.talent.v4beta1.Job.language_code] + // and [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id], use getJob method to retrieve + // detailed information of the created/updated job. + Job job = 1; + + // The status of the job processed. This field is populated if the + // processing of the [job][google.cloud.talent.v4beta1.JobOperationResult.JobResult.job] fails. + google.rpc.Status status = 2; + } + + // List of job mutation results from a batch mutate operation. It can change + // until operation status is FINISHED, FAILED or CANCELLED. + repeated JobResult job_results = 1; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/profile.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/profile.proto new file mode 100644 index 0000000..e087a8c --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/profile.proto @@ -0,0 +1,783 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/date.proto"; +import "google/type/postal_address.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "ProfileResourceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// Cloud Profile Discovery API definition + +// A resource that represents the profile for a job candidate (also referred to +// as a "single-source profile"). +message Profile { + option (google.api.resource) = { + type: "jobs.googleapis.com/Profile" + pattern: "projects/{project}/tenants/{tenant}/profiles/{profile}" + }; + + // Required during profile update. + // + // Resource name assigned to a profile by the API. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + // for example, "projects/foo/tenants/bar/profiles/baz". + string name = 1; + + // Profile's id in client system, if available. This value is unique for each + // profile inside a tenant. An error is thrown if another profile with the + // same external_id is created. + // + // The maximum number of bytes allowed is 100. + string external_id = 2; + + // The source description indicating where the profile is acquired. + // + // For example, if a candidate profile is acquired from a resume, the user can + // input "resume" here to indicate the source. + // + // The maximum number of bytes allowed is 100. + string source = 3; + + // The URI set by clients that links to this profile's client-side copy. + // + // The maximum number of bytes allowed is 4000. + string uri = 4; + + // The cluster id of the profile to associate with other profile(s) for the + // same candidate. + // + // This field should be generated by the customer. If a value is not provided, + // a random UUID is assigned to this field of the profile. + // + // This is used to link multiple profiles to the same candidate. For example, + // a client has a candidate with two profiles, where one was created recently + // and the other one was created 5 years ago. These two profiles may be very + // different. The clients can create the first profile and get a generated + // [group_id][google.cloud.talent.v4beta1.Profile.group_id], and assign it when the second profile is created, + // indicating these two profiles are referring to the same candidate. + string group_id = 5; + + // Indicates the hirable status of the candidate. + google.protobuf.BoolValue is_hirable = 6; + + // The timestamp when the profile was first created at this source. + google.protobuf.Timestamp create_time = 7; + + // The timestamp when the profile was last updated at this source. + google.protobuf.Timestamp update_time = 8; + + // The timestamp when the profile was last updated as a result of a direct or + // indirect action by a candidate. + // + // These actions include: + // + // * Direct actions such as the candidate submitting a new resume as part of a + // job application to the agency, using a self-service tool such as a website + // to update their profile, and so on. + // * Indirect actions by the candidate such as uploading a resume to a job + // board that is collected by the agency through a feed, providing a resume to + // a recruiter who then uploads it into the ATS, and so on. + // * Updates made to the candidate's profile by the recruiter as a result of + // interacting with the candidate (for example adding a skill or work + // preference, and so on). Changes to [recruiting_notes][google.cloud.talent.v4beta1.Profile.recruiting_notes] are specifically + // excluded from this action type. + // + // Note: [candidate_update_time][google.cloud.talent.v4beta1.Profile.candidate_update_time] must be greater than or equal to + // [resume_update_time][google.cloud.talent.v4beta1.Profile.resume_update_time] or an error is thrown. + google.protobuf.Timestamp candidate_update_time = 67; + + // The timestamp when the candidate's resume was added or updated on the + // candidate's profile. Whether that resume was directly uploaded by a + // candidate, pulled from a 3rd party job board feed, added by a recruiter, + // and so on. + // + // If this field is updated, it's expected that [resume][google.cloud.talent.v4beta1.Profile.resume] is provided in + // the create or update calls. + google.protobuf.Timestamp resume_update_time = 68; + + // The resume representing this profile. + Resume resume = 53; + + // The names of the candidate this profile references. + // + // Currently only one person name is supported. + repeated PersonName person_names = 11; + + // The candidate's postal addresses. It's highly recommended to + // input this information as accurately as possible to help improve search + // quality. Here are some recommendations: + // + // * Provide [Address.usage][google.cloud.talent.v4beta1.Address.usage] if possible, especially if the address is + // PERSONAL. During a search only personal addresses are considered. If there + // is no such address, all addresses with unspecified usage are assumed to be + // personal. + // * Provide [Address.current][google.cloud.talent.v4beta1.Address.current] for the current address if possible. During + // a search, only current addresses are considered. If there is no such + // address, all addresses are assumed to be current. + // + // When displaying a candidate's addresses, it is sometimes desirable to limit + // the number of addresses shown. In these cases we recommend that you display + // the addresses in the following order of priority: + // 1. [Address.usage][google.cloud.talent.v4beta1.Address.usage] is PERSONAL and [Address.current][google.cloud.talent.v4beta1.Address.current] is true. + // 2. [Address.usage][google.cloud.talent.v4beta1.Address.usage] is PERSONAL and [Address.current][google.cloud.talent.v4beta1.Address.current] is false or not + // set. + // 3. [Address.usage][google.cloud.talent.v4beta1.Address.usage] is CONTACT_INFO_USAGE_UNSPECIFIED and + // [Address.current][google.cloud.talent.v4beta1.Address.current] is true. + // 4. [Address.usage][google.cloud.talent.v4beta1.Address.usage] is CONTACT_INFO_USAGE_UNSPECIFIED and + // [Address.current][google.cloud.talent.v4beta1.Address.current] is false or not set. + repeated Address addresses = 12; + + // The candidate's email addresses. + repeated Email email_addresses = 13; + + // The candidate's phone number(s). + repeated Phone phone_numbers = 14; + + // The candidate's personal URIs. + repeated PersonalUri personal_uris = 15; + + // Available contact information besides [addresses][google.cloud.talent.v4beta1.Profile.addresses], [email_addresses][google.cloud.talent.v4beta1.Profile.email_addresses], + // [phone_numbers][google.cloud.talent.v4beta1.Profile.phone_numbers] and [personal_uris][google.cloud.talent.v4beta1.Profile.personal_uris]. For example, Hang-out, Skype. + repeated AdditionalContactInfo additional_contact_info = 16; + + // The employment history records of the candidate. It's highly recommended + // to input this information as accurately as possible to help improve search + // quality. Here are some recommendations: + // + // * Specify the start and end dates of the employment records. + // * List different employment types separately, no matter how minor the + // change is. + // For example, only job title is changed from "software engineer" to "senior + // software engineer". + // * Provide [EmploymentRecord.is_current][google.cloud.talent.v4beta1.EmploymentRecord.is_current] for the current employment if + // possible. If not, it's inferred from user inputs. + // + // The limitation for max number of employment records is 100. + repeated EmploymentRecord employment_records = 17; + + // The education history record of the candidate. It's highly recommended to + // input this information as accurately as possible to help improve search + // quality. Here are some recommendations: + // + // * Specify the start and end dates of the education records. + // * List each education type separately, no matter how minor the change is. + // For example, the profile contains the education experience from the same + // school but different degrees. + // * Provide [EducationRecord.is_current][google.cloud.talent.v4beta1.EducationRecord.is_current] for the current education if + // possible. If not, it's inferred from user inputs. + // + // The limitation for max number of education records is 100. + repeated EducationRecord education_records = 18; + + // The skill set of the candidate. It's highly recommended to provide as + // much information as possible to help improve the search quality. + // + // The limitation for max number of skills is 500. + repeated Skill skills = 19; + + // The individual or collaborative activities which the candidate has + // participated in, for example, open-source projects, class assignments that + // aren't listed in [employment_records][google.cloud.talent.v4beta1.Profile.employment_records]. + // + // The limitation for max number of activities is 50. + repeated Activity activities = 20; + + // The publications published by the candidate. + // + // The limitation for max number of publications is 50. + repeated Publication publications = 21; + + // The patents acquired by the candidate. + repeated Patent patents = 22; + + // The certifications acquired by the candidate. + repeated Certification certifications = 23; + + // Output only. The resource names of the candidate's applications. + repeated string applications = 47 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The resource names of the candidate's assignments. + repeated string assignments = 48 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A map of fields to hold both filterable and non-filterable custom profile + // attributes that aren't covered by the provided structured fields. See + // [CustomAttribute][google.cloud.talent.v4beta1.CustomAttribute] for more details. + // + // At most 100 filterable and at most 100 unfilterable keys are supported. If + // limit is exceeded, an error is thrown. Custom attributes are `unfilterable` + // by default. These are filterable when the `filterable` flag is set to + // `true`. + // + // Numeric custom attributes: each key can only map to one numeric value, + // otherwise an error is thrown. Client can also filter on numeric custom + // attributes using '>', '<' or '=' operators. + // + // String custom attributes: each key can map up to 50 string values. For + // filterable string value, each value has a byte size of no more than 256B. + // For unfilterable string values, the maximum byte size of a single key is + // 64B. An error is thrown for any request exceeding the limit. + // The maximum total byte size is 10KB. + map custom_attributes = 26; + + // Output only. Indicates if a summarized profile was created as part of the + // profile creation API call. This flag does not indicate whether a profile is + // searchable or not. + bool processed = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Keyword snippet shows how the search result is related to a + // search query. This is only returned in [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. + string keyword_snippet = 28 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Candidate's availability signals. + repeated AvailabilitySignal availability_signals = 70 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Derived locations of the profile, resolved from [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses]. + // + // [derived_addresses][google.cloud.talent.v4beta1.Profile.derived_addresses] are exactly matched to [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] in the + // same order. + repeated Location derived_addresses = 64 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Candidate availability signal. +message AvailabilitySignal { + // Type of signal. + AvailabilitySignalType type = 1; + + // Timestamp of when the given availability activity last happened. + google.protobuf.Timestamp last_update_time = 2; + + // Indicates if the [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is within + // [AvailabilityFilter.range][google.cloud.talent.v4beta1.AvailabilityFilter.range]. + // + // Returned only in a search response when there is an [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] + // in [ProfileQuery.availability_filters][google.cloud.talent.v4beta1.ProfileQuery.availability_filters] where + // [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type] matches [type][google.cloud.talent.v4beta1.AvailabilitySignal.type]. + google.protobuf.BoolValue filter_satisfied = 3; +} + +// Resource that represents a resume. +message Resume { + // The format of a structured resume. + enum ResumeType { + // Default value. + RESUME_TYPE_UNSPECIFIED = 0; + + // The profile contents in HR-XML format. + // See https://schemas.liquid-technologies.com/hr-xml/2007-04-15/ for more + // information about Human Resources XML. + HRXML = 1; + + // Resume type not specified. + OTHER_RESUME_TYPE = 2; + } + + // Users can create a profile with only this field field, if [resume_type][google.cloud.talent.v4beta1.Resume.resume_type] + // is [HRXML][google.cloud.talent.v4beta1.Resume.ResumeType.HRXML]. For example, the API parses this field and + // creates a profile + // with all structured fields populated. [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord], + // [EducationRecord][google.cloud.talent.v4beta1.EducationRecord], and so on. An error is thrown if this field cannot be + // parsed. + // + // Note that the use of the functionality offered by this field to extract + // data from resumes is an Alpha feature and as such is not covered by any + // SLA. + string structured_resume = 1; + + // The format of [structured_resume][google.cloud.talent.v4beta1.Resume.structured_resume]. + ResumeType resume_type = 2; +} + +// Resource that represents the name of a person. +message PersonName { + // Resource that represents a person's structured name. + message PersonStructuredName { + // Given/first name. + // + // It's derived from [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] if not provided. + // + // Number of characters allowed is 100. + string given_name = 1; + + // Preferred given/first name or nickname. + // + // Number of characters allowed is 100. + string preferred_name = 6; + + // Middle initial. + // + // It's derived from [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] if not provided. + // + // Number of characters allowed is 20. + string middle_initial = 2; + + // Family/last name. + // + // It's derived from [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] if not provided. + // + // Number of characters allowed is 100. + string family_name = 3; + + // Suffixes. + // + // Number of characters allowed is 20. + repeated string suffixes = 4; + + // Prefixes. + // + // Number of characters allowed is 20. + repeated string prefixes = 5; + } + + // The name of a person. It can be one of + // [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] or + // [structured_name][google.cloud.talent.v4beta1.PersonName.structured_name]. + oneof person_name { + // A string represents a person's full name. For example, "Dr. John Smith". + // + // Number of characters allowed is 100. + string formatted_name = 1; + + // A person's name in a structured way (last name, first name, suffix, and + // so on.) + PersonStructuredName structured_name = 2; + } + + // Preferred name for the person. This field is ignored if [structured_name][google.cloud.talent.v4beta1.PersonName.structured_name] + // is provided. + // + // Number of characters allowed is 100. + string preferred_name = 3; +} + +// Resource that represents a address. +message Address { + // The usage of the address. For example, SCHOOL, WORK, PERSONAL. + ContactInfoUsage usage = 1; + + // The address of a person. It can be one of + // [unstructured_address][google.cloud.talent.v4beta1.Address.unstructured_address] or + // [structured_address][google.cloud.talent.v4beta1.Address.structured_address]. + oneof address { + // Unstructured address. + // + // For example, "1600 Amphitheatre Pkwy, Mountain View, CA 94043", + // "Sunnyvale, California". + // + // Number of characters allowed is 100. + string unstructured_address = 2; + + // Structured address that contains street address, city, state, country, + // and so on. + google.type.PostalAddress structured_address = 3; + } + + // Indicates if it's the person's current address. + google.protobuf.BoolValue current = 4; +} + +// Resource that represents a person's email address. +message Email { + // The usage of the email address. For example, SCHOOL, WORK, PERSONAL. + ContactInfoUsage usage = 1; + + // Email address. + // + // Number of characters allowed is 4,000. + string email_address = 2; +} + +// Resource that represents a person's telephone number. +message Phone { + // Enum that represents the type of the telephone. + enum PhoneType { + // Default value. + PHONE_TYPE_UNSPECIFIED = 0; + + // A landline. + LANDLINE = 1; + + // A mobile. + MOBILE = 2; + + // A fax. + FAX = 3; + + // A pager. + PAGER = 4; + + // A TTY (test telephone) or TDD (telecommunication device for the deaf). + TTY_OR_TDD = 5; + + // A voicemail. + VOICEMAIL = 6; + + // A virtual telephone number is a number that can be routed to another + // number and managed by the user via Web, SMS, IVR, and so on. It is + // associated with a particular person, and may be routed to either a MOBILE + // or LANDLINE number. The [phone usage][google.cloud.talent.v4beta1.ContactInfoUsage] should + // be set to PERSONAL for these phone types. Some more information can be + // found here: https://en.wikipedia.org/wiki/Personal_Numbers + VIRTUAL = 7; + + // Voice over IP numbers. This includes TSoIP (Telephony Service over IP). + VOIP = 8; + + // In some regions (e.g. the USA), it is impossible to distinguish between + // fixed-line and mobile numbers by looking at the phone number itself. + MOBILE_OR_LANDLINE = 9; + } + + // The usage of the phone. For example, SCHOOL, WORK, PERSONAL. + ContactInfoUsage usage = 1; + + // The phone type. For example, LANDLINE, MOBILE, FAX. + PhoneType type = 2; + + // Phone number. + // + // Any phone formats are supported and only exact matches are performed on + // searches. For example, if a phone number in profile is provided in the + // format of "(xxx)xxx-xxxx", in profile searches the same phone format + // has to be provided. + // + // Number of characters allowed is 20. + string number = 3; + + // When this number is available. Any descriptive string is expected. + // + // Number of characters allowed is 100. + string when_available = 4; +} + +// Resource that represents a valid URI for a personal use. +message PersonalUri { + // The personal URI. + // + // Number of characters allowed is 4,000. + string uri = 1; +} + +// Resource that represents contact information other than phone, email, +// URI and addresses. +message AdditionalContactInfo { + // The usage of this contact method. For example, SCHOOL, WORK, PERSONAL. + ContactInfoUsage usage = 1; + + // The name of the contact method. + // + // For example, "hangout", "skype". + // + // Number of characters allowed is 100. + string name = 2; + + // The contact id. + // + // Number of characters allowed is 100. + string contact_id = 3; +} + +// Resource that represents an employment record of a candidate. +message EmploymentRecord { + // Start date of the employment. + google.type.Date start_date = 1; + + // End date of the employment. + google.type.Date end_date = 2; + + // The name of the employer company/organization. + // + // For example, "Google", "Alphabet", and so on. + // + // Number of characters allowed is 250. + string employer_name = 3; + + // The division name of the employment. + // + // For example, division, department, client, and so on. + // + // Number of characters allowed is 100. + string division_name = 4; + + // The physical address of the employer. + Address address = 5; + + // The job title of the employment. + // + // For example, "Software Engineer", "Data Scientist", and so on. + // + // Number of characters allowed is 250. + string job_title = 6; + + // The description of job content. + // + // Number of characters allowed is 100,000. + string job_description = 7; + + // If the jobs is a supervisor position. + google.protobuf.BoolValue is_supervisor = 8; + + // If this employment is self-employed. + google.protobuf.BoolValue is_self_employed = 9; + + // If this employment is current. + google.protobuf.BoolValue is_current = 10; + + // Output only. The job title snippet shows how the [job_title][google.cloud.talent.v4beta1.EmploymentRecord.job_title] is related + // to a search query. It's empty if the [job_title][google.cloud.talent.v4beta1.EmploymentRecord.job_title] isn't related to the + // search query. + string job_title_snippet = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The job description snippet shows how the [job_description][google.cloud.talent.v4beta1.EmploymentRecord.job_description] + // is related to a search query. It's empty if the [job_description][google.cloud.talent.v4beta1.EmploymentRecord.job_description] isn't + // related to the search query. + string job_description_snippet = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The employer name snippet shows how the [employer_name][google.cloud.talent.v4beta1.EmploymentRecord.employer_name] is + // related to a search query. It's empty if the [employer_name][google.cloud.talent.v4beta1.EmploymentRecord.employer_name] isn't + // related to the search query. + string employer_name_snippet = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Resource that represents an education record of a candidate. +message EducationRecord { + // The start date of the education. + google.type.Date start_date = 1; + + // The end date of the education. + google.type.Date end_date = 2; + + // The expected graduation date if currently pursuing a degree. + google.type.Date expected_graduation_date = 3; + + // The name of the school or institution. + // + // For example, "Stanford University", "UC Berkeley", and so on. + // + // Number of characters allowed is 250. + string school_name = 4; + + // The physical address of the education institution. + Address address = 5; + + // The degree information. It can be one of + // [degree_description][google.cloud.talent.v4beta1.EducationRecord.degree_description] or + // [structured_degree][google.cloud.talent.v4beta1.EducationRecord.structured_degree]. + oneof degree { + // The full description of the degree. + // + // For example, "Master of Science in Computer Science", "B.S in Math". + // + // Number of characters allowed is 100. + string degree_description = 6; + + // The structured notation of the degree. + Degree structured_degree = 7; + } + + // The description of the education. + // + // Number of characters allowed is 100,000. + string description = 8; + + // If this education is current. + google.protobuf.BoolValue is_current = 9; + + // Output only. The school name snippet shows how the [school_name][google.cloud.talent.v4beta1.EducationRecord.school_name] is related to a + // search query in search result. It's empty if the [school_name][google.cloud.talent.v4beta1.EducationRecord.school_name] isn't + // related to the search query. + string school_name_snippet = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The job description snippet shows how the [Degree][google.cloud.talent.v4beta1.Degree] is related to a search + // query in search result. It's empty if the [Degree][google.cloud.talent.v4beta1.Degree] isn't related to the + // search query. + string degree_snippet = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Resource that represents a degree pursuing or acquired by a candidate. +message Degree { + // ISCED degree type. + DegreeType degree_type = 1; + + // Full Degree name. + // + // For example, "B.S.", "Master of Arts", and so on. + // + // Number of characters allowed is 100. + string degree_name = 2; + + // Fields of study for the degree. + // + // For example, "Computer science", "engineering". + // + // Number of characters allowed is 100. + repeated string fields_of_study = 3; +} + +// Resource that represents an individual or collaborative activity participated +// in by a candidate, for example, an open-source project, a class assignment, +// and so on. +message Activity { + // Activity display name. + // + // Number of characters allowed is 100. + string display_name = 1; + + // Activity description. + // + // Number of characters allowed is 100,000. + string description = 2; + + // Activity URI. + // + // Number of characters allowed is 4,000. + string uri = 3; + + // The first creation date of the activity. + google.type.Date create_date = 4; + + // The last update date of the activity. + google.type.Date update_date = 5; + + // A list of team members involved in this activity. + // + // Number of characters allowed is 100. + // + // The limitation for max number of team members is 50. + repeated string team_members = 6; + + // A list of skills used in this activity. + // + // The limitation for max number of skills used is 50. + repeated Skill skills_used = 7; + + // Output only. Activity name snippet shows how the [display_name][google.cloud.talent.v4beta1.Activity.display_name] is related to a search + // query. It's empty if the [display_name][google.cloud.talent.v4beta1.Activity.display_name] isn't related to the search + // query. + string activity_name_snippet = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Activity description snippet shows how the + // [description][google.cloud.talent.v4beta1.Activity.description] is related to a search query. It's empty if the + // [description][google.cloud.talent.v4beta1.Activity.description] isn't related to the search query. + string activity_description_snippet = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Skill used snippet shows how the corresponding + // [skills_used][google.cloud.talent.v4beta1.Activity.skills_used] are related to a search query. It's empty if the + // corresponding [skills_used][google.cloud.talent.v4beta1.Activity.skills_used] are not related to the search query. + repeated string skills_used_snippet = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Resource that represents a publication resource of a candidate. +message Publication { + // A list of author names. + // + // Number of characters allowed is 100. + repeated string authors = 1; + + // The title of the publication. + // + // Number of characters allowed is 100. + string title = 2; + + // The description of the publication. + // + // Number of characters allowed is 100,000. + string description = 3; + + // The journal name of the publication. + // + // Number of characters allowed is 100. + string journal = 4; + + // Volume number. + // + // Number of characters allowed is 100. + string volume = 5; + + // The publisher of the journal. + // + // Number of characters allowed is 100. + string publisher = 6; + + // The publication date. + google.type.Date publication_date = 7; + + // The publication type. + // + // Number of characters allowed is 100. + string publication_type = 8; + + // ISBN number. + // + // Number of characters allowed is 100. + string isbn = 9; +} + +// Resource that represents the patent acquired by a candidate. +message Patent { + // Name of the patent. + // + // Number of characters allowed is 100. + string display_name = 1; + + // A list of inventors' names. + // + // Number of characters allowed for each is 100. + repeated string inventors = 2; + + // The status of the patent. + // + // Number of characters allowed is 100. + string patent_status = 3; + + // The date the last time the status of the patent was checked. + google.type.Date patent_status_date = 4; + + // The date that the patent was filed. + google.type.Date patent_filing_date = 5; + + // The name of the patent office. + // + // Number of characters allowed is 100. + string patent_office = 6; + + // The number of the patent. + // + // Number of characters allowed is 100. + string patent_number = 7; + + // The description of the patent. + // + // Number of characters allowed is 100,000. + string patent_description = 8; + + // The skills used in this patent. + repeated Skill skills_used = 9; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/profile_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/profile_service.proto new file mode 100644 index 0000000..4a153fd --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/profile_service.proto @@ -0,0 +1,467 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/cloud/talent/v4beta1/filters.proto"; +import "google/cloud/talent/v4beta1/histogram.proto"; +import "google/cloud/talent/v4beta1/profile.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "ProfileServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service that handles profile management, including profile CRUD, +// enumeration and search. +service ProfileService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Lists profiles by filter. The order is unspecified. + rpc ListProfiles(ListProfilesRequest) returns (ListProfilesResponse) { + option (google.api.http) = { + get: "/v4beta1/{parent=projects/*/tenants/*}/profiles" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates and returns a new profile. + rpc CreateProfile(CreateProfileRequest) returns (Profile) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}/profiles" + body: "*" + }; + option (google.api.method_signature) = "parent,profile"; + } + + // Gets the specified profile. + rpc GetProfile(GetProfileRequest) returns (Profile) { + option (google.api.http) = { + get: "/v4beta1/{name=projects/*/tenants/*/profiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the specified profile and returns the updated result. + rpc UpdateProfile(UpdateProfileRequest) returns (Profile) { + option (google.api.http) = { + patch: "/v4beta1/{profile.name=projects/*/tenants/*/profiles/*}" + body: "*" + }; + option (google.api.method_signature) = "profile"; + } + + // Deletes the specified profile. + // Prerequisite: The profile has no associated applications or assignments + // associated. + rpc DeleteProfile(DeleteProfileRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4beta1/{name=projects/*/tenants/*/profiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Searches for profiles within a tenant. + // + // For example, search by raw queries "software engineer in Mountain View" or + // search by structured filters (location filter, education filter, etc.). + // + // See [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] for more information. + rpc SearchProfiles(SearchProfilesRequest) returns (SearchProfilesResponse) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*/tenants/*}:search" + body: "*" + }; + } +} + +// List profiles request. +message ListProfilesRequest { + // Required. The resource name of the tenant under which the profile is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "jobs.googleapis.com/Profile" + } + ]; + + // The filter string specifies the profiles to be enumerated. + // + // Supported operator: =, AND + // + // The field(s) eligible for filtering are: + // + // * `externalId` + // * `groupId` + // + // externalId and groupId cannot be specified at the same time. If both + // externalId and groupId are provided, the API will return a bad request + // error. + // + // Sample Query: + // + // * externalId = "externalId-1" + // * groupId = "groupId-1" + string filter = 5; + + // The token that specifies the current offset (that is, starting result). + // + // Please set the value to [ListProfilesResponse.next_page_token][google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token] to + // continue the list. + string page_token = 2; + + // The maximum number of profiles to be returned, at most 100. + // + // Default is 100 unless a positive number smaller than 100 is specified. + int32 page_size = 3; + + // A field mask to specify the profile fields to be listed in response. + // All fields are listed if it is unset. + // + // Valid values are: + // + // * name + google.protobuf.FieldMask read_mask = 4; +} + +// The List profiles response object. +message ListProfilesResponse { + // Profiles for the specific tenant. + repeated Profile profiles = 1; + + // A token to retrieve the next page of results. This is empty if there are no + // more results. + string next_page_token = 2; +} + +// Create profile request. +message CreateProfileRequest { + // Required. The name of the tenant this profile belongs to. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // Required. The profile to be created. + Profile profile = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Get profile request. +message GetProfileRequest { + // Required. Resource name of the profile to get. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For + // example, "projects/foo/tenants/bar/profiles/baz". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Profile" + } + ]; +} + +// Update profile request +message UpdateProfileRequest { + // Required. Profile to be updated. + Profile profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // A field mask to specify the profile fields to update. + // + // A full update is performed if it is unset. + google.protobuf.FieldMask update_mask = 2; +} + +// Delete profile request. +message DeleteProfileRequest { + // Required. Resource name of the profile to be deleted. + // + // The format is + // "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For + // example, "projects/foo/tenants/bar/profiles/baz". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Profile" + } + ]; +} + +// The request body of the `SearchProfiles` call. +message SearchProfilesRequest { + // Required. The resource name of the tenant to search within. + // + // The format is "projects/{project_id}/tenants/{tenant_id}". For example, + // "projects/foo/tenants/bar". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; + + // Required. The meta information collected about the profile search user. This is used + // to improve the search quality of the service. These values are provided by + // users, and must be precise and consistent. + RequestMetadata request_metadata = 2 [(google.api.field_behavior) = REQUIRED]; + + // Search query to execute. See [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for more details. + ProfileQuery profile_query = 3; + + // A limit on the number of profiles returned in the search results. + // A value above the default value 10 can increase search response time. + // + // The maximum value allowed is 100. Otherwise an error is thrown. + int32 page_size = 4; + + // The pageToken, similar to offset enables users of the API to paginate + // through the search results. To retrieve the first page of results, set the + // pageToken to empty. The search response includes a + // [nextPageToken][google.cloud.talent.v4beta1.SearchProfilesResponse.next_page_token] field that can be + // used to populate the pageToken field for the next page of results. Using + // pageToken instead of offset increases the performance of the API, + // especially compared to larger offset values. + string page_token = 5; + + // An integer that specifies the current offset (that is, starting result) in + // search results. This field is only considered if [page_token][google.cloud.talent.v4beta1.SearchProfilesRequest.page_token] is unset. + // + // The maximum allowed value is 5000. Otherwise an error is thrown. + // + // For example, 0 means to search from the first profile, and 10 means to + // search from the 11th profile. This can be used for pagination, for example + // pageSize = 10 and offset = 10 means to search from the second page. + int32 offset = 6; + + // This flag controls the spell-check feature. If `false`, the + // service attempts to correct a misspelled query. + // + // For example, "enginee" is corrected to "engineer". + bool disable_spell_check = 7; + + // The criteria that determines how search results are sorted. + // Defaults is "relevance desc" if no value is specified. + // + // Supported options are: + // + // * "relevance desc": By descending relevance, as determined by the API + // algorithms. + // * "update_date desc": Sort by [Profile.update_time][google.cloud.talent.v4beta1.Profile.update_time] in descending order + // (recently updated profiles first). + // * "create_date desc": Sort by [Profile.create_time][google.cloud.talent.v4beta1.Profile.create_time] in descending order + // (recently created profiles first). + // * "first_name": Sort by [PersonName.PersonStructuredName.given_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name] in + // ascending order. + // * "first_name desc": Sort by [PersonName.PersonStructuredName.given_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name] + // in descending order. + // * "last_name": Sort by [PersonName.PersonStructuredName.family_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name] in + // ascending order. + // * "last_name desc": Sort by [PersonName.PersonStructuredName.family_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name] + // in ascending order. + string order_by = 8; + + // When sort by field is based on alphabetical order, sort values case + // sensitively (based on ASCII) when the value is set to true. Default value + // is case in-sensitive sort (false). + bool case_sensitive_sort = 9; + + // A list of expressions specifies histogram requests against matching + // profiles for [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. + // + // The expression syntax looks like a function definition with parameters. + // + // Function syntax: function_name(histogram_facet[, list of buckets]) + // + // Data types: + // + // * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. + // * String: string like "any string with backslash escape for quote(\")." + // * Number: whole number and floating point number like 10, -1 and -0.01. + // * List: list of elements with comma(,) separator surrounded by square + // brackets. For example, [1, 2, 3] and ["one", "two", "three"]. + // + // Built-in constants: + // + // * MIN (minimum number similar to java Double.MIN_VALUE) + // * MAX (maximum number similar to java Double.MAX_VALUE) + // + // Built-in functions: + // + // * bucket(start, end[, label]) + // Bucket build-in function creates a bucket with range of [start, end). Note + // that the end is exclusive. + // For example, bucket(1, MAX, "positive number") or bucket(1, 10). + // + // Histogram Facets: + // + // * admin1: Admin1 is a global placeholder for referring to state, province, + // or the particular term a country uses to define the geographic structure + // below the country level. Examples include states codes such as "CA", "IL", + // "NY", and provinces, such as "BC". + // * locality: Locality is a global placeholder for referring to city, town, + // or the particular term a country uses to define the geographic structure + // below the admin1 level. Examples include city names such as + // "Mountain View" and "New York". + // * extended_locality: Extended locality is concatenated version of admin1 + // and locality with comma separator. For example, "Mountain View, CA" and + // "New York, NY". + // * postal_code: Postal code of profile which follows locale code. + // * country: Country code (ISO-3166-1 alpha-2 code) of profile, such as US, + // JP, GB. + // * job_title: Normalized job titles specified in EmploymentHistory. + // * company_name: Normalized company name of profiles to match on. + // * institution: The school name. For example, "MIT", + // "University of California, Berkeley" + // * degree: Highest education degree in ISCED code. Each value in degree + // covers a specific level of education, without any expansion to upper nor + // lower levels of education degree. + // * experience_in_months: experience in months. 0 means 0 month to 1 month + // (exclusive). + // * application_date: The application date specifies application start dates. + // See [ApplicationDateFilter][google.cloud.talent.v4beta1.ApplicationDateFilter] for more details. + // * application_outcome_notes: The application outcome reason specifies the + // reasons behind the outcome of the job application. + // See [ApplicationOutcomeNotesFilter][google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter] for more details. + // * application_job_title: The application job title specifies the job + // applied for in the application. + // See [ApplicationJobFilter][google.cloud.talent.v4beta1.ApplicationJobFilter] for more details. + // * hirable_status: Hirable status specifies the profile's hirable status. + // * string_custom_attribute: String custom attributes. Values can be accessed + // via square bracket notation like string_custom_attribute["key1"]. + // * numeric_custom_attribute: Numeric custom attributes. Values can be + // accessed via square bracket notation like numeric_custom_attribute["key1"]. + // + // Example expressions: + // + // * count(admin1) + // * count(experience_in_months, [bucket(0, 12, "1 year"), + // bucket(12, 36, "1-3 years"), bucket(36, MAX, "3+ years")]) + // * count(string_custom_attribute["assigned_recruiter"]) + // * count(numeric_custom_attribute["favorite_number"], + // [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")]) + repeated HistogramQuery histogram_queries = 10; + + // An id that uniquely identifies the result set of a + // [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles] call. The id should be + // retrieved from the + // [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse] message returned from a previous + // invocation of [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles]. + // + // A result set is an ordered list of search results. + // + // If this field is not set, a new result set is computed based on the + // [profile_query][google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query]. A new [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id] is returned as a handle to + // access this result set. + // + // If this field is set, the service will ignore the resource and + // [profile_query][google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query] values, and simply retrieve a page of results from the + // corresponding result set. In this case, one and only one of [page_token][google.cloud.talent.v4beta1.SearchProfilesRequest.page_token] + // or [offset][google.cloud.talent.v4beta1.SearchProfilesRequest.offset] must be set. + // + // A typical use case is to invoke [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] without this + // field, then use the resulting [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id] in + // [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse] to page through the results. + string result_set_id = 12; + + // This flag is used to indicate whether the service will attempt to + // understand synonyms and terms related to the search query or treat the + // query "as is" when it generates a set of results. By default this flag is + // set to false, thus allowing expanded results to also be returned. For + // example a search for "software engineer" might also return candidates who + // have experience in jobs similar to software engineer positions. By setting + // this flag to true, the service will only attempt to deliver candidates has + // software engineer in his/her global fields by treating "software engineer" + // as a keyword. + // + // It is recommended to provide a feature in the UI (such as a checkbox) to + // allow recruiters to set this flag to true if they intend to search for + // longer boolean strings. + bool strict_keywords_search = 13; +} + +// Response of SearchProfiles method. +message SearchProfilesResponse { + // An estimation of the number of profiles that match the specified query. + // + // This number isn't guaranteed to be accurate. + int64 estimated_total_size = 1; + + // The spell checking result, and correction. + SpellingCorrection spell_correction = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; + + // A token to retrieve the next page of results. This is empty if there are no + // more results. + string next_page_token = 4; + + // The histogram results that match with specified + // [SearchProfilesRequest.histogram_queries][google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries]. + repeated HistogramQueryResult histogram_query_results = 5; + + // The profile entities that match the specified [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. + repeated SummarizedProfile summarized_profiles = 6; + + // An id that uniquely identifies the result set of a + // [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles] call for consistent + // results. + string result_set_id = 7; +} + +// Profile entry with metadata inside [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. +message SummarizedProfile { + // A list of profiles that are linked by [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id]. + repeated Profile profiles = 1; + + // A profile summary shows the profile summary and how the profile matches the + // search query. + // + // In profile summary, the profiles with the same [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id] are + // merged together. Among profiles, same education/employment records may be + // slightly different but they are merged into one with best efforts. + // + // For example, in one profile the school name is "UC Berkeley" and the field + // study is "Computer Science" and in another one the school name is + // "University of California at Berkeley" and the field study is "CS". The API + // merges these two inputs into one and selects one value for each field. For + // example, the school name in summary is set to "University of California at + // Berkeley" and the field of study is set to "Computer Science". + Profile summary = 2; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/tenant.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/tenant.proto new file mode 100644 index 0000000..0328c14 --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/tenant.proto @@ -0,0 +1,81 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "TenantResourceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A Tenant resource represents a tenant in the service. A tenant is a group or +// entity that shares common access with specific privileges for resources like +// profiles. Customer may create multiple tenants to provide data isolation for +// different groups. +message Tenant { + option (google.api.resource) = { + type: "jobs.googleapis.com/Tenant" + pattern: "projects/{project}/tenants/{tenant}" + }; + + // Enum that represents how user data owned by the tenant is used. + enum DataUsageType { + // Default value. + DATA_USAGE_TYPE_UNSPECIFIED = 0; + + // Data owned by this tenant is used to improve search/recommendation + // quality across tenants. + AGGREGATED = 1; + + // Data owned by this tenant is used to improve search/recommendation + // quality for this tenant only. + ISOLATED = 2; + } + + // Required during tenant update. + // + // The resource name for a tenant. This is generated by the service when a + // tenant is created. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string name = 1; + + // Required. Client side tenant identifier, used to uniquely identify the tenant. + // + // The maximum number of allowed characters is 255. + string external_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Indicates whether data owned by this tenant may be used to provide product + // improvements across other tenants. + // + // Defaults behavior is [DataUsageType.ISOLATED][google.cloud.talent.v4beta1.Tenant.DataUsageType.ISOLATED] if it's unset. + DataUsageType usage_type = 3; + + // A list of keys of filterable [Profile.custom_attributes][google.cloud.talent.v4beta1.Profile.custom_attributes], whose + // corresponding `string_values` are used in keyword searches. Profiles with + // `string_values` under these specified field keys are returned if any + // of the values match the search keyword. Custom field values with + // parenthesis, brackets and special symbols are not searchable as-is, + // and must be surrounded by quotes. + repeated string keyword_searchable_profile_custom_attributes = 4; +} diff --git a/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/tenant_service.proto b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/tenant_service.proto new file mode 100644 index 0000000..3eb260d --- /dev/null +++ b/owl-bot-staging/v4beta1/protos/google/cloud/talent/v4beta1/tenant_service.proto @@ -0,0 +1,176 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.talent.v4beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/talent/v4beta1/common.proto"; +import "google/cloud/talent/v4beta1/tenant.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent"; +option java_multiple_files = true; +option java_outer_classname = "TenantServiceProto"; +option java_package = "com.google.cloud.talent.v4beta1"; +option objc_class_prefix = "CTS"; + +// A service that handles tenant management, including CRUD and enumeration. +service TenantService { + option (google.api.default_host) = "jobs.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/jobs"; + + // Creates a new tenant entity. + rpc CreateTenant(CreateTenantRequest) returns (Tenant) { + option (google.api.http) = { + post: "/v4beta1/{parent=projects/*}/tenants" + body: "*" + }; + option (google.api.method_signature) = "parent,tenant"; + } + + // Retrieves specified tenant. + rpc GetTenant(GetTenantRequest) returns (Tenant) { + option (google.api.http) = { + get: "/v4beta1/{name=projects/*/tenants/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates specified tenant. + rpc UpdateTenant(UpdateTenantRequest) returns (Tenant) { + option (google.api.http) = { + patch: "/v4beta1/{tenant.name=projects/*/tenants/*}" + body: "*" + }; + option (google.api.method_signature) = "tenant"; + } + + // Deletes specified tenant. + rpc DeleteTenant(DeleteTenantRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v4beta1/{name=projects/*/tenants/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all tenants associated with the project. + rpc ListTenants(ListTenantsRequest) returns (ListTenantsResponse) { + option (google.api.http) = { + get: "/v4beta1/{parent=projects/*}/tenants" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The Request of the CreateTenant method. +message CreateTenantRequest { + // Required. Resource name of the project under which the tenant is created. + // + // The format is "projects/{project_id}", for example, + // "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The tenant to be created. + Tenant tenant = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for getting a tenant by name. +message GetTenantRequest { + // Required. The resource name of the tenant to be retrieved. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; +} + +// Request for updating a specified tenant. +message UpdateTenantRequest { + // Required. The tenant resource to replace the current resource in the system. + Tenant tenant = 1 [(google.api.field_behavior) = REQUIRED]; + + // Strongly recommended for the best service experience. + // + // If [update_mask][google.cloud.talent.v4beta1.UpdateTenantRequest.update_mask] is provided, only the specified fields in + // [tenant][google.cloud.talent.v4beta1.UpdateTenantRequest.tenant] are updated. Otherwise all the fields are updated. + // + // A field mask to specify the tenant fields to be updated. Only + // top level fields of [Tenant][google.cloud.talent.v4beta1.Tenant] are supported. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to delete a tenant. +message DeleteTenantRequest { + // Required. The resource name of the tenant to be deleted. + // + // The format is "projects/{project_id}/tenants/{tenant_id}", for example, + // "projects/foo/tenants/bar". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "jobs.googleapis.com/Tenant" + } + ]; +} + +// List tenants for which the client has ACL visibility. +message ListTenantsRequest { + // Required. Resource name of the project under which the tenant is created. + // + // The format is "projects/{project_id}", for example, + // "projects/foo". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The starting indicator from which to return results. + string page_token = 2; + + // The maximum number of tenants to be returned, at most 100. + // Default is 100 if a non-positive number is provided. + int32 page_size = 3; +} + +// The List tenants response object. +message ListTenantsResponse { + // Tenants for the current client. + repeated Tenant tenants = 1; + + // A token to retrieve the next page of results. + string next_page_token = 2; + + // Additional information for the API invocation, such as the request + // tracking id. + ResponseMetadata metadata = 3; +} diff --git a/owl-bot-staging/v4beta1/src/index.ts b/owl-bot-staging/v4beta1/src/index.ts new file mode 100644 index 0000000..421b48b --- /dev/null +++ b/owl-bot-staging/v4beta1/src/index.ts @@ -0,0 +1,37 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v4beta1 from './v4beta1'; +const ApplicationServiceClient = v4beta1.ApplicationServiceClient; +type ApplicationServiceClient = v4beta1.ApplicationServiceClient; +const CompanyServiceClient = v4beta1.CompanyServiceClient; +type CompanyServiceClient = v4beta1.CompanyServiceClient; +const CompletionClient = v4beta1.CompletionClient; +type CompletionClient = v4beta1.CompletionClient; +const EventServiceClient = v4beta1.EventServiceClient; +type EventServiceClient = v4beta1.EventServiceClient; +const JobServiceClient = v4beta1.JobServiceClient; +type JobServiceClient = v4beta1.JobServiceClient; +const ProfileServiceClient = v4beta1.ProfileServiceClient; +type ProfileServiceClient = v4beta1.ProfileServiceClient; +const TenantServiceClient = v4beta1.TenantServiceClient; +type TenantServiceClient = v4beta1.TenantServiceClient; +export {v4beta1, ApplicationServiceClient, CompanyServiceClient, CompletionClient, EventServiceClient, JobServiceClient, ProfileServiceClient, TenantServiceClient}; +export default {v4beta1, ApplicationServiceClient, CompanyServiceClient, CompletionClient, EventServiceClient, JobServiceClient, ProfileServiceClient, TenantServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/application_service_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/application_service_client.ts new file mode 100644 index 0000000..fb58828 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/application_service_client.ts @@ -0,0 +1,1139 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/application_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './application_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service that handles application management, including CRUD and + * enumeration. + * @class + * @memberof v4beta1 + */ +export class ApplicationServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + applicationServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ApplicationServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ApplicationServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listApplications: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'applications') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.ApplicationService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.applicationServiceStub) { + return this.applicationServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.ApplicationService. + this.applicationServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.ApplicationService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.ApplicationService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const applicationServiceStubMethods = + ['createApplication', 'getApplication', 'updateApplication', 'deleteApplication', 'listApplications']; + for (const methodName of applicationServiceStubMethods) { + const callPromise = this.applicationServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.applicationServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createApplication( + request: protos.google.cloud.talent.v4beta1.ICreateApplicationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.ICreateApplicationRequest|undefined, {}|undefined + ]>; + createApplication( + request: protos.google.cloud.talent.v4beta1.ICreateApplicationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.ICreateApplicationRequest|null|undefined, + {}|null|undefined>): void; + createApplication( + request: protos.google.cloud.talent.v4beta1.ICreateApplicationRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.ICreateApplicationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new application entity. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the profile under which the application is created. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + * For example, "projects/foo/tenants/bar/profiles/baz". + * @param {google.cloud.talent.v4beta1.Application} request.application + * Required. The application to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Application]{@link google.cloud.talent.v4beta1.Application}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createApplication(request); + */ + createApplication( + request: protos.google.cloud.talent.v4beta1.ICreateApplicationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.ICreateApplicationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.ICreateApplicationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.ICreateApplicationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createApplication(request, options, callback); + } + getApplication( + request: protos.google.cloud.talent.v4beta1.IGetApplicationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IGetApplicationRequest|undefined, {}|undefined + ]>; + getApplication( + request: protos.google.cloud.talent.v4beta1.IGetApplicationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IGetApplicationRequest|null|undefined, + {}|null|undefined>): void; + getApplication( + request: protos.google.cloud.talent.v4beta1.IGetApplicationRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IGetApplicationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves specified application. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the application to be retrieved. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + * For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Application]{@link google.cloud.talent.v4beta1.Application}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getApplication(request); + */ + getApplication( + request: protos.google.cloud.talent.v4beta1.IGetApplicationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IGetApplicationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IGetApplicationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IGetApplicationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getApplication(request, options, callback); + } + updateApplication( + request: protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest|undefined, {}|undefined + ]>; + updateApplication( + request: protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest|null|undefined, + {}|null|undefined>): void; + updateApplication( + request: protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified application. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4beta1.Application} request.application + * Required. The application resource to replace the current resource in the system. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4beta1.UpdateApplicationRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4beta1.UpdateApplicationRequest.application|application} are updated. Otherwise all the fields are updated. + * + * A field mask to specify the application fields to be updated. Only + * top level fields of {@link google.cloud.talent.v4beta1.Application|Application} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Application]{@link google.cloud.talent.v4beta1.Application}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateApplication(request); + */ + updateApplication( + request: protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication, + protos.google.cloud.talent.v4beta1.IUpdateApplicationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'application.name': request.application!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateApplication(request, options, callback); + } + deleteApplication( + request: protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest|undefined, {}|undefined + ]>; + deleteApplication( + request: protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest|null|undefined, + {}|null|undefined>): void; + deleteApplication( + request: protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes specified application. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the application to be deleted. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + * For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteApplication(request); + */ + deleteApplication( + request: protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteApplicationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteApplication(request, options, callback); + } + + listApplications( + request: protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication[], + protos.google.cloud.talent.v4beta1.IListApplicationsRequest|null, + protos.google.cloud.talent.v4beta1.IListApplicationsResponse + ]>; + listApplications( + request: protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + protos.google.cloud.talent.v4beta1.IListApplicationsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IApplication>): void; + listApplications( + request: protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + protos.google.cloud.talent.v4beta1.IListApplicationsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IApplication>): void; +/** + * Lists all applications associated with the profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the profile under which the application is created. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for + * example, "projects/foo/tenants/bar/profiles/baz". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of applications to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Application]{@link google.cloud.talent.v4beta1.Application}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApplicationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApplications( + request: protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + protos.google.cloud.talent.v4beta1.IListApplicationsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IApplication>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + protos.google.cloud.talent.v4beta1.IListApplicationsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IApplication>): + Promise<[ + protos.google.cloud.talent.v4beta1.IApplication[], + protos.google.cloud.talent.v4beta1.IListApplicationsRequest|null, + protos.google.cloud.talent.v4beta1.IListApplicationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listApplications(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the profile under which the application is created. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for + * example, "projects/foo/tenants/bar/profiles/baz". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of applications to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Application]{@link google.cloud.talent.v4beta1.Application} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApplicationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApplicationsStream( + request?: protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listApplications.createStream( + this.innerApiCalls.listApplications as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApplications`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the profile under which the application is created. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for + * example, "projects/foo/tenants/bar/profiles/baz". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of applications to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Application]{@link google.cloud.talent.v4beta1.Application}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listApplicationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listApplicationsAsync( + request?: protos.google.cloud.talent.v4beta1.IListApplicationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listApplications.asyncIterate( + this.innerApiCalls['listApplications'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.applicationServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/application_service_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/application_service_client_config.json new file mode 100644 index 0000000..81ea716 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/application_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.ApplicationService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateApplication": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetApplication": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateApplication": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteApplication": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListApplications": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/application_service_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/application_service_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/application_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/src/v4beta1/company_service_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/company_service_client.ts new file mode 100644 index 0000000..656117f --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/company_service_client.ts @@ -0,0 +1,1198 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/company_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './company_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service that handles company management, including CRUD and enumeration. + * @class + * @memberof v4beta1 + */ +export class CompanyServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + companyServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompanyServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompanyServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCompanies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'companies') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.CompanyService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.companyServiceStub) { + return this.companyServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.CompanyService. + this.companyServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.CompanyService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.CompanyService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const companyServiceStubMethods = + ['createCompany', 'getCompany', 'updateCompany', 'deleteCompany', 'listCompanies']; + for (const methodName of companyServiceStubMethods) { + const callPromise = this.companyServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.companyServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createCompany( + request: protos.google.cloud.talent.v4beta1.ICreateCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.ICreateCompanyRequest|undefined, {}|undefined + ]>; + createCompany( + request: protos.google.cloud.talent.v4beta1.ICreateCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.ICreateCompanyRequest|null|undefined, + {}|null|undefined>): void; + createCompany( + request: protos.google.cloud.talent.v4beta1.ICreateCompanyRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.ICreateCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new company entity. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created, for example, "projects/foo". + * @param {google.cloud.talent.v4beta1.Company} request.company + * Required. The company to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Company]{@link google.cloud.talent.v4beta1.Company}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createCompany(request); + */ + createCompany( + request: protos.google.cloud.talent.v4beta1.ICreateCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.ICreateCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.ICreateCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.ICreateCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createCompany(request, options, callback); + } + getCompany( + request: protos.google.cloud.talent.v4beta1.IGetCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IGetCompanyRequest|undefined, {}|undefined + ]>; + getCompany( + request: protos.google.cloud.talent.v4beta1.IGetCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IGetCompanyRequest|null|undefined, + {}|null|undefined>): void; + getCompany( + request: protos.google.cloud.talent.v4beta1.IGetCompanyRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IGetCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves specified company. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the company to be retrieved. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + * example, "projects/api-test-project/tenants/foo/companies/bar". + * + * If tenant id is unspecified, the default tenant is used, for + * example, "projects/api-test-project/companies/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Company]{@link google.cloud.talent.v4beta1.Company}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getCompany(request); + */ + getCompany( + request: protos.google.cloud.talent.v4beta1.IGetCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IGetCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IGetCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IGetCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCompany(request, options, callback); + } + updateCompany( + request: protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest|undefined, {}|undefined + ]>; + updateCompany( + request: protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>): void; + updateCompany( + request: protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified company. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4beta1.Company} request.company + * Required. The company resource to replace the current resource in the system. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4beta1.UpdateCompanyRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4beta1.UpdateCompanyRequest.company|company} are updated. Otherwise all the fields are updated. + * + * A field mask to specify the company fields to be updated. Only + * top level fields of {@link google.cloud.talent.v4beta1.Company|Company} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Company]{@link google.cloud.talent.v4beta1.Company}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateCompany(request); + */ + updateCompany( + request: protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany, + protos.google.cloud.talent.v4beta1.IUpdateCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'company.name': request.company!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCompany(request, options, callback); + } + deleteCompany( + request: protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest|undefined, {}|undefined + ]>; + deleteCompany( + request: protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>): void; + deleteCompany( + request: protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes specified company. + * Prerequisite: The company has no jobs associated with it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the company to be deleted. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + * example, "projects/foo/tenants/bar/companies/baz". + * + * If tenant id is unspecified, the default tenant is used, for + * example, "projects/foo/companies/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteCompany(request); + */ + deleteCompany( + request: protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteCompanyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteCompany(request, options, callback); + } + + listCompanies( + request: protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany[], + protos.google.cloud.talent.v4beta1.IListCompaniesRequest|null, + protos.google.cloud.talent.v4beta1.IListCompaniesResponse + ]>; + listCompanies( + request: protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + protos.google.cloud.talent.v4beta1.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ICompany>): void; + listCompanies( + request: protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + protos.google.cloud.talent.v4beta1.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ICompany>): void; +/** + * Lists all companies associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenant/bar". + * + * If tenant id is unspecified, the default tenant will be used, for + * example, "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of companies to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {boolean} request.requireOpenJobs + * Set to true if the companies requested must have open jobs. + * + * Defaults to false. + * + * If true, at most {@link google.cloud.talent.v4beta1.ListCompaniesRequest.page_size|page_size} of companies are fetched, among which + * only those with open jobs are returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Company]{@link google.cloud.talent.v4beta1.Company}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCompaniesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCompanies( + request: protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + protos.google.cloud.talent.v4beta1.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ICompany>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + protos.google.cloud.talent.v4beta1.IListCompaniesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ICompany>): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompany[], + protos.google.cloud.talent.v4beta1.IListCompaniesRequest|null, + protos.google.cloud.talent.v4beta1.IListCompaniesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCompanies(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenant/bar". + * + * If tenant id is unspecified, the default tenant will be used, for + * example, "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of companies to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {boolean} request.requireOpenJobs + * Set to true if the companies requested must have open jobs. + * + * Defaults to false. + * + * If true, at most {@link google.cloud.talent.v4beta1.ListCompaniesRequest.page_size|page_size} of companies are fetched, among which + * only those with open jobs are returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Company]{@link google.cloud.talent.v4beta1.Company} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCompaniesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCompaniesStream( + request?: protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCompanies.createStream( + this.innerApiCalls.listCompanies as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCompanies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the company is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenant/bar". + * + * If tenant id is unspecified, the default tenant will be used, for + * example, "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of companies to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {boolean} request.requireOpenJobs + * Set to true if the companies requested must have open jobs. + * + * Defaults to false. + * + * If true, at most {@link google.cloud.talent.v4beta1.ListCompaniesRequest.page_size|page_size} of companies are fetched, among which + * only those with open jobs are returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Company]{@link google.cloud.talent.v4beta1.Company}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listCompaniesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listCompaniesAsync( + request?: protos.google.cloud.talent.v4beta1.IListCompaniesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCompanies.asyncIterate( + this.innerApiCalls['listCompanies'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.companyServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/company_service_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/company_service_client_config.json new file mode 100644 index 0000000..ed5285c --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/company_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.CompanyService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateCompany": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetCompany": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCompany": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteCompany": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCompanies": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/company_service_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/company_service_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/company_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/src/v4beta1/completion_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/completion_client.ts new file mode 100644 index 0000000..89b3911 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/completion_client.ts @@ -0,0 +1,763 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/completion_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './completion_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service handles auto completion. + * @class + * @memberof v4beta1 + */ +export class CompletionClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + completionStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompletionClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompletionClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.Completion', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.completionStub) { + return this.completionStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.Completion. + this.completionStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.Completion') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.Completion, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const completionStubMethods = + ['completeQuery']; + for (const methodName of completionStubMethods) { + const callPromise = this.completionStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.completionStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + completeQuery( + request: protos.google.cloud.talent.v4beta1.ICompleteQueryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompleteQueryResponse, + protos.google.cloud.talent.v4beta1.ICompleteQueryRequest|undefined, {}|undefined + ]>; + completeQuery( + request: protos.google.cloud.talent.v4beta1.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompleteQueryResponse, + protos.google.cloud.talent.v4beta1.ICompleteQueryRequest|null|undefined, + {}|null|undefined>): void; + completeQuery( + request: protos.google.cloud.talent.v4beta1.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ICompleteQueryResponse, + protos.google.cloud.talent.v4beta1.ICompleteQueryRequest|null|undefined, + {}|null|undefined>): void; +/** + * Completes the specified prefix with keyword suggestions. + * Intended for use by a job search auto-complete search box. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of tenant the completion is performed within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenant/bar". + * + * If tenant id is unspecified, the default tenant is used, for + * example, "projects/foo". + * @param {string} request.query + * Required. The query used to generate suggestions. + * + * The maximum number of allowed characters is 255. + * @param {string[]} request.languageCodes + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * + * The maximum number of allowed characters is 255. + * @param {number} request.pageSize + * Required. Completion result count. + * + * The maximum allowed page size is 10. + * @param {string} request.company + * If provided, restricts completion to specified company. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + * example, "projects/foo/tenants/bar/companies/baz". + * + * If tenant id is unspecified, the default tenant is used, for + * example, "projects/foo". + * @param {google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope} request.scope + * The scope of the completion. The defaults is {@link google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC|CompletionScope.PUBLIC}. + * @param {google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType} request.type + * The completion topic. The default is {@link google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED|CompletionType.COMBINED}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompleteQueryResponse]{@link google.cloud.talent.v4beta1.CompleteQueryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeQuery(request); + */ + completeQuery( + request: protos.google.cloud.talent.v4beta1.ICompleteQueryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ICompleteQueryResponse, + protos.google.cloud.talent.v4beta1.ICompleteQueryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ICompleteQueryResponse, + protos.google.cloud.talent.v4beta1.ICompleteQueryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ICompleteQueryResponse, + protos.google.cloud.talent.v4beta1.ICompleteQueryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.completeQuery(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.completionStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/completion_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/completion_client_config.json new file mode 100644 index 0000000..cf9b157 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/completion_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.Completion": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CompleteQuery": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/completion_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/completion_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/completion_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/src/v4beta1/event_service_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/event_service_client.ts new file mode 100644 index 0000000..d38122c --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/event_service_client.ts @@ -0,0 +1,741 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/event_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './event_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service handles client event report. + * @class + * @memberof v4beta1 + */ +export class EventServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + eventServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EventServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EventServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.EventService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.eventServiceStub) { + return this.eventServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.EventService. + this.eventServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.EventService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.EventService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const eventServiceStubMethods = + ['createClientEvent']; + for (const methodName of eventServiceStubMethods) { + const callPromise = this.eventServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.eventServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createClientEvent( + request: protos.google.cloud.talent.v4beta1.ICreateClientEventRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IClientEvent, + protos.google.cloud.talent.v4beta1.ICreateClientEventRequest|undefined, {}|undefined + ]>; + createClientEvent( + request: protos.google.cloud.talent.v4beta1.ICreateClientEventRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IClientEvent, + protos.google.cloud.talent.v4beta1.ICreateClientEventRequest|null|undefined, + {}|null|undefined>): void; + createClientEvent( + request: protos.google.cloud.talent.v4beta1.ICreateClientEventRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IClientEvent, + protos.google.cloud.talent.v4beta1.ICreateClientEventRequest|null|undefined, + {}|null|undefined>): void; +/** + * Report events issued when end user interacts with customer's application + * that uses Cloud Talent Solution. You may inspect the created events in + * [self service + * tools](https://console.cloud.google.com/talent-solution/overview). + * [Learn + * more](https://cloud.google.com/talent-solution/docs/management-tools) + * about self service tools. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the tenant under which the event is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created, for example, "projects/foo". + * @param {google.cloud.talent.v4beta1.ClientEvent} request.clientEvent + * Required. Events issued when end user interacts with customer's application that + * uses Cloud Talent Solution. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ClientEvent]{@link google.cloud.talent.v4beta1.ClientEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createClientEvent(request); + */ + createClientEvent( + request: protos.google.cloud.talent.v4beta1.ICreateClientEventRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IClientEvent, + protos.google.cloud.talent.v4beta1.ICreateClientEventRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IClientEvent, + protos.google.cloud.talent.v4beta1.ICreateClientEventRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IClientEvent, + protos.google.cloud.talent.v4beta1.ICreateClientEventRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createClientEvent(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.eventServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/event_service_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/event_service_client_config.json new file mode 100644 index 0000000..ab17889 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/event_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.EventService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateClientEvent": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/event_service_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/event_service_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/event_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/src/v4beta1/gapic_metadata.json b/owl-bot-staging/v4beta1/src/v4beta1/gapic_metadata.json new file mode 100644 index 0000000..bfc7b95 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/gapic_metadata.json @@ -0,0 +1,457 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.talent.v4beta1", + "libraryPackage": "@google-cloud/talent", + "services": { + "ApplicationService": { + "clients": { + "grpc": { + "libraryClient": "ApplicationServiceClient", + "rpcs": { + "CreateApplication": { + "methods": [ + "createApplication" + ] + }, + "GetApplication": { + "methods": [ + "getApplication" + ] + }, + "UpdateApplication": { + "methods": [ + "updateApplication" + ] + }, + "DeleteApplication": { + "methods": [ + "deleteApplication" + ] + }, + "ListApplications": { + "methods": [ + "listApplications", + "listApplicationsStream", + "listApplicationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ApplicationServiceClient", + "rpcs": { + "CreateApplication": { + "methods": [ + "createApplication" + ] + }, + "GetApplication": { + "methods": [ + "getApplication" + ] + }, + "UpdateApplication": { + "methods": [ + "updateApplication" + ] + }, + "DeleteApplication": { + "methods": [ + "deleteApplication" + ] + }, + "ListApplications": { + "methods": [ + "listApplications", + "listApplicationsStream", + "listApplicationsAsync" + ] + } + } + } + } + }, + "CompanyService": { + "clients": { + "grpc": { + "libraryClient": "CompanyServiceClient", + "rpcs": { + "CreateCompany": { + "methods": [ + "createCompany" + ] + }, + "GetCompany": { + "methods": [ + "getCompany" + ] + }, + "UpdateCompany": { + "methods": [ + "updateCompany" + ] + }, + "DeleteCompany": { + "methods": [ + "deleteCompany" + ] + }, + "ListCompanies": { + "methods": [ + "listCompanies", + "listCompaniesStream", + "listCompaniesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompanyServiceClient", + "rpcs": { + "CreateCompany": { + "methods": [ + "createCompany" + ] + }, + "GetCompany": { + "methods": [ + "getCompany" + ] + }, + "UpdateCompany": { + "methods": [ + "updateCompany" + ] + }, + "DeleteCompany": { + "methods": [ + "deleteCompany" + ] + }, + "ListCompanies": { + "methods": [ + "listCompanies", + "listCompaniesStream", + "listCompaniesAsync" + ] + } + } + } + } + }, + "Completion": { + "clients": { + "grpc": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + } + } + } + } + }, + "EventService": { + "clients": { + "grpc": { + "libraryClient": "EventServiceClient", + "rpcs": { + "CreateClientEvent": { + "methods": [ + "createClientEvent" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EventServiceClient", + "rpcs": { + "CreateClientEvent": { + "methods": [ + "createClientEvent" + ] + } + } + } + } + }, + "JobService": { + "clients": { + "grpc": { + "libraryClient": "JobServiceClient", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "BatchDeleteJobs": { + "methods": [ + "batchDeleteJobs" + ] + }, + "SearchJobs": { + "methods": [ + "searchJobs" + ] + }, + "SearchJobsForAlert": { + "methods": [ + "searchJobsForAlert" + ] + }, + "BatchCreateJobs": { + "methods": [ + "batchCreateJobs" + ] + }, + "BatchUpdateJobs": { + "methods": [ + "batchUpdateJobs" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "JobServiceClient", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "UpdateJob": { + "methods": [ + "updateJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "BatchDeleteJobs": { + "methods": [ + "batchDeleteJobs" + ] + }, + "SearchJobs": { + "methods": [ + "searchJobs" + ] + }, + "SearchJobsForAlert": { + "methods": [ + "searchJobsForAlert" + ] + }, + "BatchCreateJobs": { + "methods": [ + "batchCreateJobs" + ] + }, + "BatchUpdateJobs": { + "methods": [ + "batchUpdateJobs" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + } + } + } + } + }, + "ProfileService": { + "clients": { + "grpc": { + "libraryClient": "ProfileServiceClient", + "rpcs": { + "CreateProfile": { + "methods": [ + "createProfile" + ] + }, + "GetProfile": { + "methods": [ + "getProfile" + ] + }, + "UpdateProfile": { + "methods": [ + "updateProfile" + ] + }, + "DeleteProfile": { + "methods": [ + "deleteProfile" + ] + }, + "SearchProfiles": { + "methods": [ + "searchProfiles" + ] + }, + "ListProfiles": { + "methods": [ + "listProfiles", + "listProfilesStream", + "listProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ProfileServiceClient", + "rpcs": { + "CreateProfile": { + "methods": [ + "createProfile" + ] + }, + "GetProfile": { + "methods": [ + "getProfile" + ] + }, + "UpdateProfile": { + "methods": [ + "updateProfile" + ] + }, + "DeleteProfile": { + "methods": [ + "deleteProfile" + ] + }, + "SearchProfiles": { + "methods": [ + "searchProfiles" + ] + }, + "ListProfiles": { + "methods": [ + "listProfiles", + "listProfilesStream", + "listProfilesAsync" + ] + } + } + } + } + }, + "TenantService": { + "clients": { + "grpc": { + "libraryClient": "TenantServiceClient", + "rpcs": { + "CreateTenant": { + "methods": [ + "createTenant" + ] + }, + "GetTenant": { + "methods": [ + "getTenant" + ] + }, + "UpdateTenant": { + "methods": [ + "updateTenant" + ] + }, + "DeleteTenant": { + "methods": [ + "deleteTenant" + ] + }, + "ListTenants": { + "methods": [ + "listTenants", + "listTenantsStream", + "listTenantsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TenantServiceClient", + "rpcs": { + "CreateTenant": { + "methods": [ + "createTenant" + ] + }, + "GetTenant": { + "methods": [ + "getTenant" + ] + }, + "UpdateTenant": { + "methods": [ + "updateTenant" + ] + }, + "DeleteTenant": { + "methods": [ + "deleteTenant" + ] + }, + "ListTenants": { + "methods": [ + "listTenants", + "listTenantsStream", + "listTenantsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/index.ts b/owl-bot-staging/v4beta1/src/v4beta1/index.ts new file mode 100644 index 0000000..e67ab3d --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/index.ts @@ -0,0 +1,25 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {ApplicationServiceClient} from './application_service_client'; +export {CompanyServiceClient} from './company_service_client'; +export {CompletionClient} from './completion_client'; +export {EventServiceClient} from './event_service_client'; +export {JobServiceClient} from './job_service_client'; +export {ProfileServiceClient} from './profile_service_client'; +export {TenantServiceClient} from './tenant_service_client'; diff --git a/owl-bot-staging/v4beta1/src/v4beta1/job_service_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/job_service_client.ts new file mode 100644 index 0000000..ddf6893 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/job_service_client.ts @@ -0,0 +1,2208 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/job_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './job_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * A service handles job management, including job CRUD, enumeration and search. + * @class + * @memberof v4beta1 + */ +export class JobServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + jobServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of JobServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof JobServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const batchCreateJobsResponse = protoFilesRoot.lookup( + '.google.cloud.talent.v4beta1.JobOperationResult') as gax.protobuf.Type; + const batchCreateJobsMetadata = protoFilesRoot.lookup( + '.google.cloud.talent.v4beta1.BatchOperationMetadata') as gax.protobuf.Type; + const batchUpdateJobsResponse = protoFilesRoot.lookup( + '.google.cloud.talent.v4beta1.JobOperationResult') as gax.protobuf.Type; + const batchUpdateJobsMetadata = protoFilesRoot.lookup( + '.google.cloud.talent.v4beta1.BatchOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchCreateJobs: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateJobsResponse.decode.bind(batchCreateJobsResponse), + batchCreateJobsMetadata.decode.bind(batchCreateJobsMetadata)), + batchUpdateJobs: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateJobsResponse.decode.bind(batchUpdateJobsResponse), + batchUpdateJobsMetadata.decode.bind(batchUpdateJobsMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.JobService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.jobServiceStub) { + return this.jobServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.JobService. + this.jobServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.JobService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.JobService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const jobServiceStubMethods = + ['createJob', 'batchCreateJobs', 'getJob', 'updateJob', 'batchUpdateJobs', 'deleteJob', 'batchDeleteJobs', 'listJobs', 'searchJobs', 'searchJobsForAlert']; + for (const methodName of jobServiceStubMethods) { + const callPromise = this.jobServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.jobServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createJob( + request: protos.google.cloud.talent.v4beta1.ICreateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.ICreateJobRequest|undefined, {}|undefined + ]>; + createJob( + request: protos.google.cloud.talent.v4beta1.ICreateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request: protos.google.cloud.talent.v4beta1.ICreateJobRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new job. + * + * Typically, the job becomes searchable within 10 seconds, but it may take + * up to 5 minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified a default tenant + * is created. For example, "projects/foo". + * @param {google.cloud.talent.v4beta1.Job} request.job + * Required. The Job to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.talent.v4beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createJob(request); + */ + createJob( + request: protos.google.cloud.talent.v4beta1.ICreateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.ICreateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.ICreateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createJob(request, options, callback); + } + getJob( + request: protos.google.cloud.talent.v4beta1.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.cloud.talent.v4beta1.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.cloud.talent.v4beta1.IGetJobRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves the specified job, whose status is OPEN or recently EXPIRED + * within the last 90 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the job to retrieve. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + * example, "projects/foo/tenants/bar/jobs/baz". + * + * If tenant id is unspecified, the default tenant is used. For + * example, "projects/foo/jobs/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.talent.v4beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getJob(request); + */ + getJob( + request: protos.google.cloud.talent.v4beta1.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } + updateJob( + request: protos.google.cloud.talent.v4beta1.IUpdateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IUpdateJobRequest|undefined, {}|undefined + ]>; + updateJob( + request: protos.google.cloud.talent.v4beta1.IUpdateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; + updateJob( + request: protos.google.cloud.talent.v4beta1.IUpdateJobRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified job. + * + * Typically, updated contents become visible in search results within 10 + * seconds, but it may take up to 5 minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4beta1.Job} request.job + * Required. The Job to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4beta1.UpdateJobRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4beta1.UpdateJobRequest.job|job} are updated. Otherwise all the fields are updated. + * + * A field mask to restrict the fields that are updated. Only + * top level fields of {@link google.cloud.talent.v4beta1.Job|Job} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Job]{@link google.cloud.talent.v4beta1.Job}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateJob(request); + */ + updateJob( + request: protos.google.cloud.talent.v4beta1.IUpdateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IUpdateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob, + protos.google.cloud.talent.v4beta1.IUpdateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'job.name': request.job!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateJob(request, options, callback); + } + deleteJob( + request: protos.google.cloud.talent.v4beta1.IDeleteJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteJobRequest|undefined, {}|undefined + ]>; + deleteJob( + request: protos.google.cloud.talent.v4beta1.IDeleteJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request: protos.google.cloud.talent.v4beta1.IDeleteJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified job. + * + * Typically, the job becomes unsearchable within 10 seconds, but it may take + * up to 5 minutes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the job to be deleted. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For + * example, "projects/foo/tenants/bar/jobs/baz". + * + * If tenant id is unspecified, the default tenant is used. For + * example, "projects/foo/jobs/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteJob(request); + */ + deleteJob( + request: protos.google.cloud.talent.v4beta1.IDeleteJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteJob(request, options, callback); + } + batchDeleteJobs( + request: protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest|undefined, {}|undefined + ]>; + batchDeleteJobs( + request: protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest|null|undefined, + {}|null|undefined>): void; + batchDeleteJobs( + request: protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a list of {@link google.cloud.talent.v4beta1.Job|Job}s by filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be deleted. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` (Required) + * + * Sample Query: companyName = "projects/foo/companies/bar" AND + * requisitionId = "req-1" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.batchDeleteJobs(request); + */ + batchDeleteJobs( + request: protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IBatchDeleteJobsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchDeleteJobs(request, options, callback); + } + searchJobs( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|undefined, {}|undefined + ]>; + searchJobs( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; + searchJobs( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Searches for jobs using the provided {@link google.cloud.talent.v4beta1.SearchJobsRequest|SearchJobsRequest}. + * + * This call constrains the {@link google.cloud.talent.v4beta1.Job.visibility|visibility} of jobs + * present in the database, and only returns jobs that the caller has + * permission to search against. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant to search within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode} request.searchMode + * Mode of a search. + * + * Defaults to {@link google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH|SearchMode.JOB_SEARCH}. + * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata + * Required. The meta information collected about the job searcher, used to improve the + * search quality of the service. The identifiers (such as `user_id`) are + * provided by users, and must be unique and consistent. + * @param {google.cloud.talent.v4beta1.JobQuery} request.jobQuery + * Query used to search against jobs, such as keyword, location filters, etc. + * @param {boolean} request.enableBroadening + * Controls whether to broaden the search when it produces sparse results. + * Broadened queries append results to the end of the matching results + * list. + * + * Defaults to false. + * @param {boolean} request.requirePreciseResultSize + * Controls if the search job request requires the return of a precise + * count of the first 300 results. Setting this to `true` ensures + * consistency in the number of results per page. Best practice is to set this + * value to true if a client allows users to jump directly to a + * non-sequential search results page. + * + * Enabling this flag may adversely impact performance. + * + * Defaults to false. + * @param {number[]} request.histogramQueries + * An expression specifies a histogram request against matching jobs. + * + * Expression syntax is an aggregation function call with histogram facets and + * other options. + * + * Available aggregation function calls are: + * * `count(string_histogram_facet)`: Count the number of matching entities, + * for each distinct attribute value. + * * `count(numeric_histogram_facet, list of buckets)`: Count the number of + * matching entities within each bucket. + * + * Data types: + * + * * Histogram facet: facet names with format {@link a-zA-Z0-9_|a-zA-Z}+. + * * String: string like "any string with backslash escape for quote(\")." + * * Number: whole number and floating point number like 10, -1 and -0.01. + * * List: list of elements with comma(,) separator surrounded by square + * brackets, for example, [1, 2, 3] and ["one", "two", "three"]. + * + * Built-in constants: + * + * * MIN (minimum number similar to java Double.MIN_VALUE) + * * MAX (maximum number similar to java Double.MAX_VALUE) + * + * Built-in functions: + * + * * bucket(start, end[, label]): bucket built-in function creates a bucket + * with range of [start, end). Note that the end is exclusive, for example, + * bucket(1, MAX, "positive number") or bucket(1, 10). + * + * Job histogram facets: + * + * * company_display_name: histogram by {@link google.cloud.talent.v4beta1.Job.company_display_name|Job.company_display_name}. + * * employment_type: histogram by {@link google.cloud.talent.v4beta1.Job.employment_types|Job.employment_types}, for example, + * "FULL_TIME", "PART_TIME". + * * company_size: histogram by {@link google.cloud.talent.v4beta1.CompanySize|CompanySize}, for example, "SMALL", + * "MEDIUM", "BIG". + * * publish_time_in_month: histogram by the {@link google.cloud.talent.v4beta1.Job.posting_publish_time|Job.posting_publish_time} + * in months. + * Must specify list of numeric buckets in spec. + * * publish_time_in_year: histogram by the {@link google.cloud.talent.v4beta1.Job.posting_publish_time|Job.posting_publish_time} + * in years. + * Must specify list of numeric buckets in spec. + * * degree_types: histogram by the {@link google.cloud.talent.v4beta1.Job.degree_types|Job.degree_types}, for example, + * "Bachelors", "Masters". + * * job_level: histogram by the {@link google.cloud.talent.v4beta1.Job.job_level|Job.job_level}, for example, "Entry + * Level". + * * country: histogram by the country code of jobs, for example, "US", "FR". + * * admin1: histogram by the admin1 code of jobs, which is a global + * placeholder referring to the state, province, or the particular term a + * country uses to define the geographic structure below the country level, + * for example, "CA", "IL". + * * city: histogram by a combination of the "city name, admin1 code". For + * example, "Mountain View, CA", "New York, NY". + * * admin1_country: histogram by a combination of the "admin1 code, country", + * for example, "CA, US", "IL, US". + * * city_coordinate: histogram by the city center's GPS coordinates (latitude + * and longitude), for example, 37.4038522,-122.0987765. Since the + * coordinates of a city center can change, customers may need to refresh + * them periodically. + * * locale: histogram by the {@link google.cloud.talent.v4beta1.Job.language_code|Job.language_code}, for example, "en-US", + * "fr-FR". + * * language: histogram by the language subtag of the {@link google.cloud.talent.v4beta1.Job.language_code|Job.language_code}, + * for example, "en", "fr". + * * category: histogram by the {@link google.cloud.talent.v4beta1.JobCategory|JobCategory}, for example, + * "COMPUTER_AND_IT", "HEALTHCARE". + * * base_compensation_unit: histogram by the + * {@link google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit|CompensationInfo.CompensationUnit} of base + * salary, for example, "WEEKLY", "MONTHLY". + * * base_compensation: histogram by the base salary. Must specify list of + * numeric buckets to group results by. + * * annualized_base_compensation: histogram by the base annualized salary. + * Must specify list of numeric buckets to group results by. + * * annualized_total_compensation: histogram by the total annualized salary. + * Must specify list of numeric buckets to group results by. + * * string_custom_attribute: histogram by string {@link google.cloud.talent.v4beta1.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * string_custom_attribute["key1"]. + * * numeric_custom_attribute: histogram by numeric {@link google.cloud.talent.v4beta1.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * numeric_custom_attribute["key1"]. Must specify list of numeric buckets to + * group results by. + * + * Example expressions: + * + * * `count(admin1)` + * * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), + * bucket(100000, MAX)])` + * * `count(string_custom_attribute["some-string-custom-attribute"])` + * * `count(numeric_custom_attribute["some-numeric-custom-attribute"], + * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the search response. + * Defaults to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL|JobView.JOB_VIEW_SMALL} if no value is specified. + * @param {number} request.offset + * An integer that specifies the current offset (that is, starting result + * location, amongst the jobs deemed by the API as relevant) in search + * results. This field is only considered if {@link google.cloud.talent.v4beta1.SearchJobsRequest.page_token|page_token} is unset. + * + * The maximum allowed value is 5000. Otherwise an error is thrown. + * + * For example, 0 means to return results starting from the first matching + * job, and 10 means to return from the 11th job. This can be used for + * pagination, (for example, pageSize = 10 and offset = 10 means to return + * from the second page). + * @param {number} request.pageSize + * A limit on the number of jobs returned in the search results. + * Increasing this value above the default value of 10 can increase search + * response time. The value can be between 1 and 100. + * @param {string} request.pageToken + * The token specifying the current offset within + * search results. See {@link google.cloud.talent.v4beta1.SearchJobsResponse.next_page_token|SearchJobsResponse.next_page_token} for + * an explanation of how to obtain the next set of query results. + * @param {string} request.orderBy + * The criteria determining how search results are sorted. Default is + * `"relevance desc"`. + * + * Supported options are: + * + * * `"relevance desc"`: By relevance descending, as determined by the API + * algorithms. Relevance thresholding of query results is only available + * with this ordering. + * * `"posting_publish_time desc"`: By {@link google.cloud.talent.v4beta1.Job.posting_publish_time|Job.posting_publish_time} + * descending. + * * `"posting_update_time desc"`: By {@link google.cloud.talent.v4beta1.Job.posting_update_time|Job.posting_update_time} + * descending. + * * `"title"`: By {@link google.cloud.talent.v4beta1.Job.title|Job.title} ascending. + * * `"title desc"`: By {@link google.cloud.talent.v4beta1.Job.title|Job.title} descending. + * * `"annualized_base_compensation"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_base_compensation desc"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation desc"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"custom_ranking desc"`: By the relevance score adjusted to the + * {@link google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression|SearchJobsRequest.CustomRankingInfo.ranking_expression} with weight + * factor assigned by + * {@link google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.importance_level|SearchJobsRequest.CustomRankingInfo.importance_level} in descending + * order. + * * Location sorting: Use the special syntax to order jobs by distance:
+ * `"distance_from('Hawaii')"`: Order by distance from Hawaii.
+ * `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
+ * `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by + * multiple locations. See details below.
+ * `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by + * multiple locations. See details below.
+ * The string can have a maximum of 256 characters. When multiple distance + * centers are provided, a job that is close to any of the distance centers + * would have a high rank. When a job has multiple locations, the job + * location closest to one of the distance centers will be used. Jobs that + * don't have locations will be ranked at the bottom. Distance is calculated + * with a precision of 11.3 meters (37.4 feet). Diversification strategy is + * still applied unless explicitly disabled in + * {@link google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level|diversification_level}. + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel} request.diversificationLevel + * Controls whether highly similar jobs are returned next to each other in + * the search results. Jobs are identified as highly similar based on + * their titles, job categories, and locations. Highly similar results are + * clustered so that only one representative job of the cluster is + * displayed to the job seeker higher up in the results, with the other jobs + * being displayed lower down in the results. + * + * Defaults to {@link google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE|DiversificationLevel.SIMPLE} if no value + * is specified. + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo} request.customRankingInfo + * Controls over how job documents get ranked on top of existing relevance + * score (determined by API algorithm). + * @param {boolean} request.disableKeywordMatch + * Controls whether to disable exact keyword match on {@link google.cloud.talent.v4beta1.Job.title|Job.title}, + * {@link google.cloud.talent.v4beta1.Job.description|Job.description}, {@link google.cloud.talent.v4beta1.Job.company_display_name|Job.company_display_name}, {@link google.cloud.talent.v4beta1.Job.addresses|Job.addresses}, + * {@link google.cloud.talent.v4beta1.Job.qualifications|Job.qualifications}. When disable keyword match is turned off, a + * keyword match returns jobs that do not match given category filters when + * there are matching keywords. For example, for the query "program manager," + * a result is returned even if the job posting has the title "software + * developer," which doesn't fall into "program manager" ontology, but does + * have "program manager" appearing in its description. + * + * For queries like "cloud" that don't contain title or + * location specific ontology, jobs with "cloud" keyword matches are returned + * regardless of this flag's value. + * + * Use {@link google.cloud.talent.v4beta1.Company.keyword_searchable_job_custom_attributes|Company.keyword_searchable_job_custom_attributes} if + * company-specific globally matched custom field/attribute string values are + * needed. Enabling keyword match improves recall of subsequent search + * requests. + * + * Defaults to false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SearchJobsResponse]{@link google.cloud.talent.v4beta1.SearchJobsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.searchJobs(request); + */ + searchJobs( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchJobs(request, options, callback); + } + searchJobsForAlert( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|undefined, {}|undefined + ]>; + searchJobsForAlert( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; + searchJobsForAlert( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Searches for jobs using the provided {@link google.cloud.talent.v4beta1.SearchJobsRequest|SearchJobsRequest}. + * + * This API call is intended for the use case of targeting passive job + * seekers (for example, job seekers who have signed up to receive email + * alerts about potential job opportunities), and has different algorithmic + * adjustments that are targeted to passive job seekers. + * + * This call constrains the {@link google.cloud.talent.v4beta1.Job.visibility|visibility} of jobs + * present in the database, and only returns jobs the caller has + * permission to search against. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant to search within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode} request.searchMode + * Mode of a search. + * + * Defaults to {@link google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH|SearchMode.JOB_SEARCH}. + * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata + * Required. The meta information collected about the job searcher, used to improve the + * search quality of the service. The identifiers (such as `user_id`) are + * provided by users, and must be unique and consistent. + * @param {google.cloud.talent.v4beta1.JobQuery} request.jobQuery + * Query used to search against jobs, such as keyword, location filters, etc. + * @param {boolean} request.enableBroadening + * Controls whether to broaden the search when it produces sparse results. + * Broadened queries append results to the end of the matching results + * list. + * + * Defaults to false. + * @param {boolean} request.requirePreciseResultSize + * Controls if the search job request requires the return of a precise + * count of the first 300 results. Setting this to `true` ensures + * consistency in the number of results per page. Best practice is to set this + * value to true if a client allows users to jump directly to a + * non-sequential search results page. + * + * Enabling this flag may adversely impact performance. + * + * Defaults to false. + * @param {number[]} request.histogramQueries + * An expression specifies a histogram request against matching jobs. + * + * Expression syntax is an aggregation function call with histogram facets and + * other options. + * + * Available aggregation function calls are: + * * `count(string_histogram_facet)`: Count the number of matching entities, + * for each distinct attribute value. + * * `count(numeric_histogram_facet, list of buckets)`: Count the number of + * matching entities within each bucket. + * + * Data types: + * + * * Histogram facet: facet names with format {@link a-zA-Z0-9_|a-zA-Z}+. + * * String: string like "any string with backslash escape for quote(\")." + * * Number: whole number and floating point number like 10, -1 and -0.01. + * * List: list of elements with comma(,) separator surrounded by square + * brackets, for example, [1, 2, 3] and ["one", "two", "three"]. + * + * Built-in constants: + * + * * MIN (minimum number similar to java Double.MIN_VALUE) + * * MAX (maximum number similar to java Double.MAX_VALUE) + * + * Built-in functions: + * + * * bucket(start, end[, label]): bucket built-in function creates a bucket + * with range of [start, end). Note that the end is exclusive, for example, + * bucket(1, MAX, "positive number") or bucket(1, 10). + * + * Job histogram facets: + * + * * company_display_name: histogram by {@link google.cloud.talent.v4beta1.Job.company_display_name|Job.company_display_name}. + * * employment_type: histogram by {@link google.cloud.talent.v4beta1.Job.employment_types|Job.employment_types}, for example, + * "FULL_TIME", "PART_TIME". + * * company_size: histogram by {@link google.cloud.talent.v4beta1.CompanySize|CompanySize}, for example, "SMALL", + * "MEDIUM", "BIG". + * * publish_time_in_month: histogram by the {@link google.cloud.talent.v4beta1.Job.posting_publish_time|Job.posting_publish_time} + * in months. + * Must specify list of numeric buckets in spec. + * * publish_time_in_year: histogram by the {@link google.cloud.talent.v4beta1.Job.posting_publish_time|Job.posting_publish_time} + * in years. + * Must specify list of numeric buckets in spec. + * * degree_types: histogram by the {@link google.cloud.talent.v4beta1.Job.degree_types|Job.degree_types}, for example, + * "Bachelors", "Masters". + * * job_level: histogram by the {@link google.cloud.talent.v4beta1.Job.job_level|Job.job_level}, for example, "Entry + * Level". + * * country: histogram by the country code of jobs, for example, "US", "FR". + * * admin1: histogram by the admin1 code of jobs, which is a global + * placeholder referring to the state, province, or the particular term a + * country uses to define the geographic structure below the country level, + * for example, "CA", "IL". + * * city: histogram by a combination of the "city name, admin1 code". For + * example, "Mountain View, CA", "New York, NY". + * * admin1_country: histogram by a combination of the "admin1 code, country", + * for example, "CA, US", "IL, US". + * * city_coordinate: histogram by the city center's GPS coordinates (latitude + * and longitude), for example, 37.4038522,-122.0987765. Since the + * coordinates of a city center can change, customers may need to refresh + * them periodically. + * * locale: histogram by the {@link google.cloud.talent.v4beta1.Job.language_code|Job.language_code}, for example, "en-US", + * "fr-FR". + * * language: histogram by the language subtag of the {@link google.cloud.talent.v4beta1.Job.language_code|Job.language_code}, + * for example, "en", "fr". + * * category: histogram by the {@link google.cloud.talent.v4beta1.JobCategory|JobCategory}, for example, + * "COMPUTER_AND_IT", "HEALTHCARE". + * * base_compensation_unit: histogram by the + * {@link google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit|CompensationInfo.CompensationUnit} of base + * salary, for example, "WEEKLY", "MONTHLY". + * * base_compensation: histogram by the base salary. Must specify list of + * numeric buckets to group results by. + * * annualized_base_compensation: histogram by the base annualized salary. + * Must specify list of numeric buckets to group results by. + * * annualized_total_compensation: histogram by the total annualized salary. + * Must specify list of numeric buckets to group results by. + * * string_custom_attribute: histogram by string {@link google.cloud.talent.v4beta1.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * string_custom_attribute["key1"]. + * * numeric_custom_attribute: histogram by numeric {@link google.cloud.talent.v4beta1.Job.custom_attributes|Job.custom_attributes}. + * Values can be accessed via square bracket notations like + * numeric_custom_attribute["key1"]. Must specify list of numeric buckets to + * group results by. + * + * Example expressions: + * + * * `count(admin1)` + * * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), + * bucket(100000, MAX)])` + * * `count(string_custom_attribute["some-string-custom-attribute"])` + * * `count(numeric_custom_attribute["some-numeric-custom-attribute"], + * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the search response. + * Defaults to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL|JobView.JOB_VIEW_SMALL} if no value is specified. + * @param {number} request.offset + * An integer that specifies the current offset (that is, starting result + * location, amongst the jobs deemed by the API as relevant) in search + * results. This field is only considered if {@link google.cloud.talent.v4beta1.SearchJobsRequest.page_token|page_token} is unset. + * + * The maximum allowed value is 5000. Otherwise an error is thrown. + * + * For example, 0 means to return results starting from the first matching + * job, and 10 means to return from the 11th job. This can be used for + * pagination, (for example, pageSize = 10 and offset = 10 means to return + * from the second page). + * @param {number} request.pageSize + * A limit on the number of jobs returned in the search results. + * Increasing this value above the default value of 10 can increase search + * response time. The value can be between 1 and 100. + * @param {string} request.pageToken + * The token specifying the current offset within + * search results. See {@link google.cloud.talent.v4beta1.SearchJobsResponse.next_page_token|SearchJobsResponse.next_page_token} for + * an explanation of how to obtain the next set of query results. + * @param {string} request.orderBy + * The criteria determining how search results are sorted. Default is + * `"relevance desc"`. + * + * Supported options are: + * + * * `"relevance desc"`: By relevance descending, as determined by the API + * algorithms. Relevance thresholding of query results is only available + * with this ordering. + * * `"posting_publish_time desc"`: By {@link google.cloud.talent.v4beta1.Job.posting_publish_time|Job.posting_publish_time} + * descending. + * * `"posting_update_time desc"`: By {@link google.cloud.talent.v4beta1.Job.posting_update_time|Job.posting_update_time} + * descending. + * * `"title"`: By {@link google.cloud.talent.v4beta1.Job.title|Job.title} ascending. + * * `"title desc"`: By {@link google.cloud.talent.v4beta1.Job.title|Job.title} descending. + * * `"annualized_base_compensation"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_base_compensation desc"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range|CompensationInfo.annualized_base_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} ascending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"annualized_total_compensation desc"`: By job's + * {@link google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range|CompensationInfo.annualized_total_compensation_range} descending. Jobs + * whose annualized base compensation is unspecified are put at the end of + * search results. + * * `"custom_ranking desc"`: By the relevance score adjusted to the + * {@link google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression|SearchJobsRequest.CustomRankingInfo.ranking_expression} with weight + * factor assigned by + * {@link google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.importance_level|SearchJobsRequest.CustomRankingInfo.importance_level} in descending + * order. + * * Location sorting: Use the special syntax to order jobs by distance:
+ * `"distance_from('Hawaii')"`: Order by distance from Hawaii.
+ * `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
+ * `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by + * multiple locations. See details below.
+ * `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by + * multiple locations. See details below.
+ * The string can have a maximum of 256 characters. When multiple distance + * centers are provided, a job that is close to any of the distance centers + * would have a high rank. When a job has multiple locations, the job + * location closest to one of the distance centers will be used. Jobs that + * don't have locations will be ranked at the bottom. Distance is calculated + * with a precision of 11.3 meters (37.4 feet). Diversification strategy is + * still applied unless explicitly disabled in + * {@link google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level|diversification_level}. + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel} request.diversificationLevel + * Controls whether highly similar jobs are returned next to each other in + * the search results. Jobs are identified as highly similar based on + * their titles, job categories, and locations. Highly similar results are + * clustered so that only one representative job of the cluster is + * displayed to the job seeker higher up in the results, with the other jobs + * being displayed lower down in the results. + * + * Defaults to {@link google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE|DiversificationLevel.SIMPLE} if no value + * is specified. + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo} request.customRankingInfo + * Controls over how job documents get ranked on top of existing relevance + * score (determined by API algorithm). + * @param {boolean} request.disableKeywordMatch + * Controls whether to disable exact keyword match on {@link google.cloud.talent.v4beta1.Job.title|Job.title}, + * {@link google.cloud.talent.v4beta1.Job.description|Job.description}, {@link google.cloud.talent.v4beta1.Job.company_display_name|Job.company_display_name}, {@link google.cloud.talent.v4beta1.Job.addresses|Job.addresses}, + * {@link google.cloud.talent.v4beta1.Job.qualifications|Job.qualifications}. When disable keyword match is turned off, a + * keyword match returns jobs that do not match given category filters when + * there are matching keywords. For example, for the query "program manager," + * a result is returned even if the job posting has the title "software + * developer," which doesn't fall into "program manager" ontology, but does + * have "program manager" appearing in its description. + * + * For queries like "cloud" that don't contain title or + * location specific ontology, jobs with "cloud" keyword matches are returned + * regardless of this flag's value. + * + * Use {@link google.cloud.talent.v4beta1.Company.keyword_searchable_job_custom_attributes|Company.keyword_searchable_job_custom_attributes} if + * company-specific globally matched custom field/attribute string values are + * needed. Enabling keyword match improves recall of subsequent search + * requests. + * + * Defaults to false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SearchJobsResponse]{@link google.cloud.talent.v4beta1.SearchJobsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.searchJobsForAlert(request); + */ + searchJobsForAlert( + request: protos.google.cloud.talent.v4beta1.ISearchJobsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ISearchJobsResponse, + protos.google.cloud.talent.v4beta1.ISearchJobsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchJobsForAlert(request, options, callback); + } + + batchCreateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchCreateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Begins executing a batch create jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {number[]} request.jobs + * Required. The jobs to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchCreateJobs(request); + * const [response] = await operation.promise(); + */ + batchCreateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateJobs(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchCreateJobs()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchCreateJobsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchCreateJobsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchCreateJobs, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + batchUpdateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchUpdateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchUpdateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Begins executing a batch update jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {number[]} request.jobs + * Required. The jobs to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. Be aware that it will + * also increase latency when checking the status of a batch operation. + * + * If {@link google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4beta1.Job|Job} are updated. Otherwise all the fields are updated. + * + * A field mask to restrict the fields that are updated. Only + * top level fields of {@link google.cloud.talent.v4beta1.Job|Job} are supported. + * + * If {@link google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask|update_mask} is provided, The {@link google.cloud.talent.v4beta1.Job|Job} inside + * {@link google.cloud.talent.v4beta1.JobOperationResult.JobResult|JobResult} + * will only contains fields that is updated, plus the Id of the Job. + * Otherwise, {@link google.cloud.talent.v4beta1.Job|Job} will include all fields, which can yield a very + * large response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchUpdateJobs(request); + * const [response] = await operation.promise(); + */ + batchUpdateJobs( + request: protos.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchUpdateJobs(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchUpdateJobs()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchUpdateJobsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchUpdateJobsProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.batchUpdateJobs, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listJobs( + request: protos.google.cloud.talent.v4beta1.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob[], + protos.google.cloud.talent.v4beta1.IListJobsRequest|null, + protos.google.cloud.talent.v4beta1.IListJobsResponse + ]>; + listJobs( + request: protos.google.cloud.talent.v4beta1.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListJobsRequest, + protos.google.cloud.talent.v4beta1.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IJob>): void; + listJobs( + request: protos.google.cloud.talent.v4beta1.IListJobsRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListJobsRequest, + protos.google.cloud.talent.v4beta1.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IJob>): void; +/** + * Lists jobs by filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If {@link google.cloud.talent.v4beta1.ListJobsRequest.job_view|job_view} is set to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY|JobView.JOB_VIEW_ID_ONLY}, the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL|JobView.JOB_VIEW_FULL} if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Job]{@link google.cloud.talent.v4beta1.Job}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobs( + request: protos.google.cloud.talent.v4beta1.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4beta1.IListJobsRequest, + protos.google.cloud.talent.v4beta1.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IJob>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListJobsRequest, + protos.google.cloud.talent.v4beta1.IListJobsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IJob>): + Promise<[ + protos.google.cloud.talent.v4beta1.IJob[], + protos.google.cloud.talent.v4beta1.IListJobsRequest|null, + protos.google.cloud.talent.v4beta1.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If {@link google.cloud.talent.v4beta1.ListJobsRequest.job_view|job_view} is set to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY|JobView.JOB_VIEW_ID_ONLY}, the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL|JobView.JOB_VIEW_FULL} if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Job]{@link google.cloud.talent.v4beta1.Job} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listJobsStream( + request?: protos.google.cloud.talent.v4beta1.IListJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If {@link google.cloud.talent.v4beta1.ListJobsRequest.job_view|job_view} is set to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY|JobView.JOB_VIEW_ID_ONLY}, the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to {@link google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL|JobView.JOB_VIEW_FULL} if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Job]{@link google.cloud.talent.v4beta1.Job}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listJobsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listJobsAsync( + request?: protos.google.cloud.talent.v4beta1.IListJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.jobServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/job_service_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/job_service_client_config.json new file mode 100644 index 0000000..48bb7c6 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/job_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.JobService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateJob": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateJob": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchUpdateJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteJob": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchDeleteJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListJobs": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchJobs": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SearchJobsForAlert": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/job_service_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/job_service_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/job_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/src/v4beta1/profile_service_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/profile_service_client.ts new file mode 100644 index 0000000..f877f3b --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/profile_service_client.ts @@ -0,0 +1,1492 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/profile_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './profile_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service that handles profile management, including profile CRUD, + * enumeration and search. + * @class + * @memberof v4beta1 + */ +export class ProfileServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + profileServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProfileServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ProfileServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'profiles') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.ProfileService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.profileServiceStub) { + return this.profileServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.ProfileService. + this.profileServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.ProfileService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.ProfileService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const profileServiceStubMethods = + ['listProfiles', 'createProfile', 'getProfile', 'updateProfile', 'deleteProfile', 'searchProfiles']; + for (const methodName of profileServiceStubMethods) { + const callPromise = this.profileServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.profileServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProfile( + request: protos.google.cloud.talent.v4beta1.ICreateProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.ICreateProfileRequest|undefined, {}|undefined + ]>; + createProfile( + request: protos.google.cloud.talent.v4beta1.ICreateProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.ICreateProfileRequest|null|undefined, + {}|null|undefined>): void; + createProfile( + request: protos.google.cloud.talent.v4beta1.ICreateProfileRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.ICreateProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates and returns a new profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the tenant this profile belongs to. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4beta1.Profile} request.profile + * Required. The profile to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Profile]{@link google.cloud.talent.v4beta1.Profile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createProfile(request); + */ + createProfile( + request: protos.google.cloud.talent.v4beta1.ICreateProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.ICreateProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.ICreateProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.ICreateProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createProfile(request, options, callback); + } + getProfile( + request: protos.google.cloud.talent.v4beta1.IGetProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IGetProfileRequest|undefined, {}|undefined + ]>; + getProfile( + request: protos.google.cloud.talent.v4beta1.IGetProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IGetProfileRequest|null|undefined, + {}|null|undefined>): void; + getProfile( + request: protos.google.cloud.talent.v4beta1.IGetProfileRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IGetProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets the specified profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the profile to get. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For + * example, "projects/foo/tenants/bar/profiles/baz". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Profile]{@link google.cloud.talent.v4beta1.Profile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getProfile(request); + */ + getProfile( + request: protos.google.cloud.talent.v4beta1.IGetProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IGetProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IGetProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IGetProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getProfile(request, options, callback); + } + updateProfile( + request: protos.google.cloud.talent.v4beta1.IUpdateProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IUpdateProfileRequest|undefined, {}|undefined + ]>; + updateProfile( + request: protos.google.cloud.talent.v4beta1.IUpdateProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IUpdateProfileRequest|null|undefined, + {}|null|undefined>): void; + updateProfile( + request: protos.google.cloud.talent.v4beta1.IUpdateProfileRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IUpdateProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the specified profile and returns the updated result. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4beta1.Profile} request.profile + * Required. Profile to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * A field mask to specify the profile fields to update. + * + * A full update is performed if it is unset. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Profile]{@link google.cloud.talent.v4beta1.Profile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateProfile(request); + */ + updateProfile( + request: protos.google.cloud.talent.v4beta1.IUpdateProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IUpdateProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IUpdateProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile, + protos.google.cloud.talent.v4beta1.IUpdateProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'profile.name': request.profile!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateProfile(request, options, callback); + } + deleteProfile( + request: protos.google.cloud.talent.v4beta1.IDeleteProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteProfileRequest|undefined, {}|undefined + ]>; + deleteProfile( + request: protos.google.cloud.talent.v4beta1.IDeleteProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteProfileRequest|null|undefined, + {}|null|undefined>): void; + deleteProfile( + request: protos.google.cloud.talent.v4beta1.IDeleteProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteProfileRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes the specified profile. + * Prerequisite: The profile has no associated applications or assignments + * associated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the profile to be deleted. + * + * The format is + * "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For + * example, "projects/foo/tenants/bar/profiles/baz". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteProfile(request); + */ + deleteProfile( + request: protos.google.cloud.talent.v4beta1.IDeleteProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteProfile(request, options, callback); + } + searchProfiles( + request: protos.google.cloud.talent.v4beta1.ISearchProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ISearchProfilesResponse, + protos.google.cloud.talent.v4beta1.ISearchProfilesRequest|undefined, {}|undefined + ]>; + searchProfiles( + request: protos.google.cloud.talent.v4beta1.ISearchProfilesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ISearchProfilesResponse, + protos.google.cloud.talent.v4beta1.ISearchProfilesRequest|null|undefined, + {}|null|undefined>): void; + searchProfiles( + request: protos.google.cloud.talent.v4beta1.ISearchProfilesRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ISearchProfilesResponse, + protos.google.cloud.talent.v4beta1.ISearchProfilesRequest|null|undefined, + {}|null|undefined>): void; +/** + * Searches for profiles within a tenant. + * + * For example, search by raw queries "software engineer in Mountain View" or + * search by structured filters (location filter, education filter, etc.). + * + * See {@link google.cloud.talent.v4beta1.SearchProfilesRequest|SearchProfilesRequest} for more information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant to search within. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata + * Required. The meta information collected about the profile search user. This is used + * to improve the search quality of the service. These values are provided by + * users, and must be precise and consistent. + * @param {google.cloud.talent.v4beta1.ProfileQuery} request.profileQuery + * Search query to execute. See {@link google.cloud.talent.v4beta1.ProfileQuery|ProfileQuery} for more details. + * @param {number} request.pageSize + * A limit on the number of profiles returned in the search results. + * A value above the default value 10 can increase search response time. + * + * The maximum value allowed is 100. Otherwise an error is thrown. + * @param {string} request.pageToken + * The pageToken, similar to offset enables users of the API to paginate + * through the search results. To retrieve the first page of results, set the + * pageToken to empty. The search response includes a + * {@link google.cloud.talent.v4beta1.SearchProfilesResponse.next_page_token|nextPageToken} field that can be + * used to populate the pageToken field for the next page of results. Using + * pageToken instead of offset increases the performance of the API, + * especially compared to larger offset values. + * @param {number} request.offset + * An integer that specifies the current offset (that is, starting result) in + * search results. This field is only considered if {@link google.cloud.talent.v4beta1.SearchProfilesRequest.page_token|page_token} is unset. + * + * The maximum allowed value is 5000. Otherwise an error is thrown. + * + * For example, 0 means to search from the first profile, and 10 means to + * search from the 11th profile. This can be used for pagination, for example + * pageSize = 10 and offset = 10 means to search from the second page. + * @param {boolean} request.disableSpellCheck + * This flag controls the spell-check feature. If `false`, the + * service attempts to correct a misspelled query. + * + * For example, "enginee" is corrected to "engineer". + * @param {string} request.orderBy + * The criteria that determines how search results are sorted. + * Defaults is "relevance desc" if no value is specified. + * + * Supported options are: + * + * * "relevance desc": By descending relevance, as determined by the API + * algorithms. + * * "update_date desc": Sort by {@link google.cloud.talent.v4beta1.Profile.update_time|Profile.update_time} in descending order + * (recently updated profiles first). + * * "create_date desc": Sort by {@link google.cloud.talent.v4beta1.Profile.create_time|Profile.create_time} in descending order + * (recently created profiles first). + * * "first_name": Sort by {@link google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name|PersonName.PersonStructuredName.given_name} in + * ascending order. + * * "first_name desc": Sort by {@link google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name|PersonName.PersonStructuredName.given_name} + * in descending order. + * * "last_name": Sort by {@link google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name|PersonName.PersonStructuredName.family_name} in + * ascending order. + * * "last_name desc": Sort by {@link google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name|PersonName.PersonStructuredName.family_name} + * in ascending order. + * @param {boolean} request.caseSensitiveSort + * When sort by field is based on alphabetical order, sort values case + * sensitively (based on ASCII) when the value is set to true. Default value + * is case in-sensitive sort (false). + * @param {number[]} request.histogramQueries + * A list of expressions specifies histogram requests against matching + * profiles for {@link google.cloud.talent.v4beta1.SearchProfilesRequest|SearchProfilesRequest}. + * + * The expression syntax looks like a function definition with parameters. + * + * Function syntax: function_name(histogram_facet[, list of buckets]) + * + * Data types: + * + * * Histogram facet: facet names with format {@link a-zA-Z0-9_|a-zA-Z}+. + * * String: string like "any string with backslash escape for quote(\")." + * * Number: whole number and floating point number like 10, -1 and -0.01. + * * List: list of elements with comma(,) separator surrounded by square + * brackets. For example, [1, 2, 3] and ["one", "two", "three"]. + * + * Built-in constants: + * + * * MIN (minimum number similar to java Double.MIN_VALUE) + * * MAX (maximum number similar to java Double.MAX_VALUE) + * + * Built-in functions: + * + * * bucket(start, end[, label]) + * Bucket build-in function creates a bucket with range of [start, end). Note + * that the end is exclusive. + * For example, bucket(1, MAX, "positive number") or bucket(1, 10). + * + * Histogram Facets: + * + * * admin1: Admin1 is a global placeholder for referring to state, province, + * or the particular term a country uses to define the geographic structure + * below the country level. Examples include states codes such as "CA", "IL", + * "NY", and provinces, such as "BC". + * * locality: Locality is a global placeholder for referring to city, town, + * or the particular term a country uses to define the geographic structure + * below the admin1 level. Examples include city names such as + * "Mountain View" and "New York". + * * extended_locality: Extended locality is concatenated version of admin1 + * and locality with comma separator. For example, "Mountain View, CA" and + * "New York, NY". + * * postal_code: Postal code of profile which follows locale code. + * * country: Country code (ISO-3166-1 alpha-2 code) of profile, such as US, + * JP, GB. + * * job_title: Normalized job titles specified in EmploymentHistory. + * * company_name: Normalized company name of profiles to match on. + * * institution: The school name. For example, "MIT", + * "University of California, Berkeley" + * * degree: Highest education degree in ISCED code. Each value in degree + * covers a specific level of education, without any expansion to upper nor + * lower levels of education degree. + * * experience_in_months: experience in months. 0 means 0 month to 1 month + * (exclusive). + * * application_date: The application date specifies application start dates. + * See {@link google.cloud.talent.v4beta1.ApplicationDateFilter|ApplicationDateFilter} for more details. + * * application_outcome_notes: The application outcome reason specifies the + * reasons behind the outcome of the job application. + * See {@link google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter|ApplicationOutcomeNotesFilter} for more details. + * * application_job_title: The application job title specifies the job + * applied for in the application. + * See {@link google.cloud.talent.v4beta1.ApplicationJobFilter|ApplicationJobFilter} for more details. + * * hirable_status: Hirable status specifies the profile's hirable status. + * * string_custom_attribute: String custom attributes. Values can be accessed + * via square bracket notation like string_custom_attribute["key1"]. + * * numeric_custom_attribute: Numeric custom attributes. Values can be + * accessed via square bracket notation like numeric_custom_attribute["key1"]. + * + * Example expressions: + * + * * count(admin1) + * * count(experience_in_months, [bucket(0, 12, "1 year"), + * bucket(12, 36, "1-3 years"), bucket(36, MAX, "3+ years")]) + * * count(string_custom_attribute["assigned_recruiter"]) + * * count(numeric_custom_attribute["favorite_number"], + * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")]) + * @param {string} request.resultSetId + * An id that uniquely identifies the result set of a + * {@link google.cloud.talent.v4beta1.ProfileService.SearchProfiles|SearchProfiles} call. The id should be + * retrieved from the + * {@link google.cloud.talent.v4beta1.SearchProfilesResponse|SearchProfilesResponse} message returned from a previous + * invocation of {@link google.cloud.talent.v4beta1.ProfileService.SearchProfiles|SearchProfiles}. + * + * A result set is an ordered list of search results. + * + * If this field is not set, a new result set is computed based on the + * {@link google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query|profile_query}. A new {@link google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id|result_set_id} is returned as a handle to + * access this result set. + * + * If this field is set, the service will ignore the resource and + * {@link google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query|profile_query} values, and simply retrieve a page of results from the + * corresponding result set. In this case, one and only one of {@link google.cloud.talent.v4beta1.SearchProfilesRequest.page_token|page_token} + * or {@link google.cloud.talent.v4beta1.SearchProfilesRequest.offset|offset} must be set. + * + * A typical use case is to invoke {@link google.cloud.talent.v4beta1.SearchProfilesRequest|SearchProfilesRequest} without this + * field, then use the resulting {@link google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id|result_set_id} in + * {@link google.cloud.talent.v4beta1.SearchProfilesResponse|SearchProfilesResponse} to page through the results. + * @param {boolean} request.strictKeywordsSearch + * This flag is used to indicate whether the service will attempt to + * understand synonyms and terms related to the search query or treat the + * query "as is" when it generates a set of results. By default this flag is + * set to false, thus allowing expanded results to also be returned. For + * example a search for "software engineer" might also return candidates who + * have experience in jobs similar to software engineer positions. By setting + * this flag to true, the service will only attempt to deliver candidates has + * software engineer in his/her global fields by treating "software engineer" + * as a keyword. + * + * It is recommended to provide a feature in the UI (such as a checkbox) to + * allow recruiters to set this flag to true if they intend to search for + * longer boolean strings. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SearchProfilesResponse]{@link google.cloud.talent.v4beta1.SearchProfilesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.searchProfiles(request); + */ + searchProfiles( + request: protos.google.cloud.talent.v4beta1.ISearchProfilesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ISearchProfilesResponse, + protos.google.cloud.talent.v4beta1.ISearchProfilesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ISearchProfilesResponse, + protos.google.cloud.talent.v4beta1.ISearchProfilesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ISearchProfilesResponse, + protos.google.cloud.talent.v4beta1.ISearchProfilesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.searchProfiles(request, options, callback); + } + + listProfiles( + request: protos.google.cloud.talent.v4beta1.IListProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile[], + protos.google.cloud.talent.v4beta1.IListProfilesRequest|null, + protos.google.cloud.talent.v4beta1.IListProfilesResponse + ]>; + listProfiles( + request: protos.google.cloud.talent.v4beta1.IListProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListProfilesRequest, + protos.google.cloud.talent.v4beta1.IListProfilesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IProfile>): void; + listProfiles( + request: protos.google.cloud.talent.v4beta1.IListProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListProfilesRequest, + protos.google.cloud.talent.v4beta1.IListProfilesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IProfile>): void; +/** + * Lists profiles by filter. The order is unspecified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the profile is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * The filter string specifies the profiles to be enumerated. + * + * Supported operator: =, AND + * + * The field(s) eligible for filtering are: + * + * * `externalId` + * * `groupId` + * + * externalId and groupId cannot be specified at the same time. If both + * externalId and groupId are provided, the API will return a bad request + * error. + * + * Sample Query: + * + * * externalId = "externalId-1" + * * groupId = "groupId-1" + * @param {string} request.pageToken + * The token that specifies the current offset (that is, starting result). + * + * Please set the value to {@link google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token|ListProfilesResponse.next_page_token} to + * continue the list. + * @param {number} request.pageSize + * The maximum number of profiles to be returned, at most 100. + * + * Default is 100 unless a positive number smaller than 100 is specified. + * @param {google.protobuf.FieldMask} request.readMask + * A field mask to specify the profile fields to be listed in response. + * All fields are listed if it is unset. + * + * Valid values are: + * + * * name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Profile]{@link google.cloud.talent.v4beta1.Profile}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProfiles( + request: protos.google.cloud.talent.v4beta1.IListProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4beta1.IListProfilesRequest, + protos.google.cloud.talent.v4beta1.IListProfilesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IProfile>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListProfilesRequest, + protos.google.cloud.talent.v4beta1.IListProfilesResponse|null|undefined, + protos.google.cloud.talent.v4beta1.IProfile>): + Promise<[ + protos.google.cloud.talent.v4beta1.IProfile[], + protos.google.cloud.talent.v4beta1.IListProfilesRequest|null, + protos.google.cloud.talent.v4beta1.IListProfilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProfiles(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the profile is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * The filter string specifies the profiles to be enumerated. + * + * Supported operator: =, AND + * + * The field(s) eligible for filtering are: + * + * * `externalId` + * * `groupId` + * + * externalId and groupId cannot be specified at the same time. If both + * externalId and groupId are provided, the API will return a bad request + * error. + * + * Sample Query: + * + * * externalId = "externalId-1" + * * groupId = "groupId-1" + * @param {string} request.pageToken + * The token that specifies the current offset (that is, starting result). + * + * Please set the value to {@link google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token|ListProfilesResponse.next_page_token} to + * continue the list. + * @param {number} request.pageSize + * The maximum number of profiles to be returned, at most 100. + * + * Default is 100 unless a positive number smaller than 100 is specified. + * @param {google.protobuf.FieldMask} request.readMask + * A field mask to specify the profile fields to be listed in response. + * All fields are listed if it is unset. + * + * Valid values are: + * + * * name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Profile]{@link google.cloud.talent.v4beta1.Profile} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listProfilesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProfilesStream( + request?: protos.google.cloud.talent.v4beta1.IListProfilesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProfiles.createStream( + this.innerApiCalls.listProfiles as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listProfiles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the profile is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * The filter string specifies the profiles to be enumerated. + * + * Supported operator: =, AND + * + * The field(s) eligible for filtering are: + * + * * `externalId` + * * `groupId` + * + * externalId and groupId cannot be specified at the same time. If both + * externalId and groupId are provided, the API will return a bad request + * error. + * + * Sample Query: + * + * * externalId = "externalId-1" + * * groupId = "groupId-1" + * @param {string} request.pageToken + * The token that specifies the current offset (that is, starting result). + * + * Please set the value to {@link google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token|ListProfilesResponse.next_page_token} to + * continue the list. + * @param {number} request.pageSize + * The maximum number of profiles to be returned, at most 100. + * + * Default is 100 unless a positive number smaller than 100 is specified. + * @param {google.protobuf.FieldMask} request.readMask + * A field mask to specify the profile fields to be listed in response. + * All fields are listed if it is unset. + * + * Valid values are: + * + * * name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Profile]{@link google.cloud.talent.v4beta1.Profile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listProfilesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listProfilesAsync( + request?: protos.google.cloud.talent.v4beta1.IListProfilesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProfiles.asyncIterate( + this.innerApiCalls['listProfiles'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.profileServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/profile_service_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/profile_service_client_config.json new file mode 100644 index 0000000..960b96b --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/profile_service_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.ProfileService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListProfiles": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateProfile": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProfile": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProfile": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProfile": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchProfiles": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/profile_service_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/profile_service_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/profile_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_client.ts b/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_client.ts new file mode 100644 index 0000000..62549f9 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_client.ts @@ -0,0 +1,1158 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v4beta1/tenant_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tenant_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A service that handles tenant management, including CRUD and enumeration. + * @class + * @memberof v4beta1 + */ +export class TenantServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + tenantServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TenantServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof TenantServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + applicationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}' + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/profiles/{profile}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/companies/{company}' + ), + projectJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/jobs/{job}' + ), + projectTenantCompanyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/companies/{company}' + ), + projectTenantJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}/jobs/{job}' + ), + tenantPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/tenants/{tenant}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listTenants: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tenants') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.talent.v4beta1.TenantService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.tenantServiceStub) { + return this.tenantServiceStub; + } + + // Put together the "service stub" for + // google.cloud.talent.v4beta1.TenantService. + this.tenantServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.talent.v4beta1.TenantService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.talent.v4beta1.TenantService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const tenantServiceStubMethods = + ['createTenant', 'getTenant', 'updateTenant', 'deleteTenant', 'listTenants']; + for (const methodName of tenantServiceStubMethods) { + const callPromise = this.tenantServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.tenantServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'jobs.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'jobs.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/jobs' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createTenant( + request: protos.google.cloud.talent.v4beta1.ICreateTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.ICreateTenantRequest|undefined, {}|undefined + ]>; + createTenant( + request: protos.google.cloud.talent.v4beta1.ICreateTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.ICreateTenantRequest|null|undefined, + {}|null|undefined>): void; + createTenant( + request: protos.google.cloud.talent.v4beta1.ICreateTenantRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.ICreateTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new tenant entity. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {google.cloud.talent.v4beta1.Tenant} request.tenant + * Required. The tenant to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Tenant]{@link google.cloud.talent.v4beta1.Tenant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createTenant(request); + */ + createTenant( + request: protos.google.cloud.talent.v4beta1.ICreateTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.ICreateTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.ICreateTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.ICreateTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createTenant(request, options, callback); + } + getTenant( + request: protos.google.cloud.talent.v4beta1.IGetTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IGetTenantRequest|undefined, {}|undefined + ]>; + getTenant( + request: protos.google.cloud.talent.v4beta1.IGetTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IGetTenantRequest|null|undefined, + {}|null|undefined>): void; + getTenant( + request: protos.google.cloud.talent.v4beta1.IGetTenantRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IGetTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Retrieves specified tenant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the tenant to be retrieved. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Tenant]{@link google.cloud.talent.v4beta1.Tenant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getTenant(request); + */ + getTenant( + request: protos.google.cloud.talent.v4beta1.IGetTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IGetTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IGetTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IGetTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getTenant(request, options, callback); + } + updateTenant( + request: protos.google.cloud.talent.v4beta1.IUpdateTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IUpdateTenantRequest|undefined, {}|undefined + ]>; + updateTenant( + request: protos.google.cloud.talent.v4beta1.IUpdateTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IUpdateTenantRequest|null|undefined, + {}|null|undefined>): void; + updateTenant( + request: protos.google.cloud.talent.v4beta1.IUpdateTenantRequest, + callback: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IUpdateTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates specified tenant. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.talent.v4beta1.Tenant} request.tenant + * Required. The tenant resource to replace the current resource in the system. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. + * + * If {@link google.cloud.talent.v4beta1.UpdateTenantRequest.update_mask|update_mask} is provided, only the specified fields in + * {@link google.cloud.talent.v4beta1.UpdateTenantRequest.tenant|tenant} are updated. Otherwise all the fields are updated. + * + * A field mask to specify the tenant fields to be updated. Only + * top level fields of {@link google.cloud.talent.v4beta1.Tenant|Tenant} are supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Tenant]{@link google.cloud.talent.v4beta1.Tenant}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateTenant(request); + */ + updateTenant( + request: protos.google.cloud.talent.v4beta1.IUpdateTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IUpdateTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IUpdateTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant, + protos.google.cloud.talent.v4beta1.IUpdateTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'tenant.name': request.tenant!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateTenant(request, options, callback); + } + deleteTenant( + request: protos.google.cloud.talent.v4beta1.IDeleteTenantRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteTenantRequest|undefined, {}|undefined + ]>; + deleteTenant( + request: protos.google.cloud.talent.v4beta1.IDeleteTenantRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteTenantRequest|null|undefined, + {}|null|undefined>): void; + deleteTenant( + request: protos.google.cloud.talent.v4beta1.IDeleteTenantRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteTenantRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes specified tenant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the tenant to be deleted. + * + * The format is "projects/{project_id}/tenants/{tenant_id}", for example, + * "projects/foo/tenants/bar". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteTenant(request); + */ + deleteTenant( + request: protos.google.cloud.talent.v4beta1.IDeleteTenantRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteTenantRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteTenantRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.talent.v4beta1.IDeleteTenantRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteTenant(request, options, callback); + } + + listTenants( + request: protos.google.cloud.talent.v4beta1.IListTenantsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant[], + protos.google.cloud.talent.v4beta1.IListTenantsRequest|null, + protos.google.cloud.talent.v4beta1.IListTenantsResponse + ]>; + listTenants( + request: protos.google.cloud.talent.v4beta1.IListTenantsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListTenantsRequest, + protos.google.cloud.talent.v4beta1.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ITenant>): void; + listTenants( + request: protos.google.cloud.talent.v4beta1.IListTenantsRequest, + callback: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListTenantsRequest, + protos.google.cloud.talent.v4beta1.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ITenant>): void; +/** + * Lists all tenants associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of tenants to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Tenant]{@link google.cloud.talent.v4beta1.Tenant}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTenantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTenants( + request: protos.google.cloud.talent.v4beta1.IListTenantsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.talent.v4beta1.IListTenantsRequest, + protos.google.cloud.talent.v4beta1.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ITenant>, + callback?: PaginationCallback< + protos.google.cloud.talent.v4beta1.IListTenantsRequest, + protos.google.cloud.talent.v4beta1.IListTenantsResponse|null|undefined, + protos.google.cloud.talent.v4beta1.ITenant>): + Promise<[ + protos.google.cloud.talent.v4beta1.ITenant[], + protos.google.cloud.talent.v4beta1.IListTenantsRequest|null, + protos.google.cloud.talent.v4beta1.IListTenantsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listTenants(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of tenants to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Tenant]{@link google.cloud.talent.v4beta1.Tenant} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTenantsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTenantsStream( + request?: protos.google.cloud.talent.v4beta1.IListTenantsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTenants.createStream( + this.innerApiCalls.listTenants as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTenants`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the project under which the tenant is created. + * + * The format is "projects/{project_id}", for example, + * "projects/foo". + * @param {string} request.pageToken + * The starting indicator from which to return results. + * @param {number} request.pageSize + * The maximum number of tenants to be returned, at most 100. + * Default is 100 if a non-positive number is provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Tenant]{@link google.cloud.talent.v4beta1.Tenant}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listTenantsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listTenantsAsync( + request?: protos.google.cloud.talent.v4beta1.IListTenantsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTenants.asyncIterate( + this.innerApiCalls['listTenants'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified application resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @param {string} application + * @returns {string} Resource name string. + */ + applicationPath(project:string,tenant:string,profile:string,application:string) { + return this.pathTemplates.applicationPathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + application: application, + }); + } + + /** + * Parse the project from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + } + + /** + * Parse the tenant from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).tenant; + } + + /** + * Parse the profile from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).profile; + } + + /** + * Parse the application from Application resource. + * + * @param {string} applicationName + * A fully-qualified path representing Application resource. + * @returns {string} A string representing the application. + */ + matchApplicationFromApplicationName(applicationName: string) { + return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} profile + * @returns {string} Resource name string. + */ + profilePath(project:string,tenant:string,profile:string) { + return this.pathTemplates.profilePathTemplate.render({ + project: project, + tenant: tenant, + profile: profile, + }); + } + + /** + * Parse the project from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).project; + } + + /** + * Parse the tenant from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).tenant; + } + + /** + * Parse the profile from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the profile. + */ + matchProfileFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).profile; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectCompany resource name string. + * + * @param {string} project + * @param {string} company + * @returns {string} Resource name string. + */ + projectCompanyPath(project:string,company:string) { + return this.pathTemplates.projectCompanyPathTemplate.render({ + project: project, + company: company, + }); + } + + /** + * Parse the project from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).project; + } + + /** + * Parse the company from ProjectCompany resource. + * + * @param {string} projectCompanyName + * A fully-qualified path representing project_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectCompanyName(projectCompanyName: string) { + return this.pathTemplates.projectCompanyPathTemplate.match(projectCompanyName).company; + } + + /** + * Return a fully-qualified projectJob resource name string. + * + * @param {string} project + * @param {string} job + * @returns {string} Resource name string. + */ + projectJobPath(project:string,job:string) { + return this.pathTemplates.projectJobPathTemplate.render({ + project: project, + job: job, + }); + } + + /** + * Parse the project from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).project; + } + + /** + * Parse the job from ProjectJob resource. + * + * @param {string} projectJobName + * A fully-qualified path representing project_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectJobName(projectJobName: string) { + return this.pathTemplates.projectJobPathTemplate.match(projectJobName).job; + } + + /** + * Return a fully-qualified projectTenantCompany resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} company + * @returns {string} Resource name string. + */ + projectTenantCompanyPath(project:string,tenant:string,company:string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.render({ + project: project, + tenant: tenant, + company: company, + }); + } + + /** + * Parse the project from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).project; + } + + /** + * Parse the tenant from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).tenant; + } + + /** + * Parse the company from ProjectTenantCompany resource. + * + * @param {string} projectTenantCompanyName + * A fully-qualified path representing project_tenant_company resource. + * @returns {string} A string representing the company. + */ + matchCompanyFromProjectTenantCompanyName(projectTenantCompanyName: string) { + return this.pathTemplates.projectTenantCompanyPathTemplate.match(projectTenantCompanyName).company; + } + + /** + * Return a fully-qualified projectTenantJob resource name string. + * + * @param {string} project + * @param {string} tenant + * @param {string} job + * @returns {string} Resource name string. + */ + projectTenantJobPath(project:string,tenant:string,job:string) { + return this.pathTemplates.projectTenantJobPathTemplate.render({ + project: project, + tenant: tenant, + job: job, + }); + } + + /** + * Parse the project from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).project; + } + + /** + * Parse the tenant from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).tenant; + } + + /** + * Parse the job from ProjectTenantJob resource. + * + * @param {string} projectTenantJobName + * A fully-qualified path representing project_tenant_job resource. + * @returns {string} A string representing the job. + */ + matchJobFromProjectTenantJobName(projectTenantJobName: string) { + return this.pathTemplates.projectTenantJobPathTemplate.match(projectTenantJobName).job; + } + + /** + * Return a fully-qualified tenant resource name string. + * + * @param {string} project + * @param {string} tenant + * @returns {string} Resource name string. + */ + tenantPath(project:string,tenant:string) { + return this.pathTemplates.tenantPathTemplate.render({ + project: project, + tenant: tenant, + }); + } + + /** + * Parse the project from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).project; + } + + /** + * Parse the tenant from Tenant resource. + * + * @param {string} tenantName + * A fully-qualified path representing Tenant resource. + * @returns {string} A string representing the tenant. + */ + matchTenantFromTenantName(tenantName: string) { + return this.pathTemplates.tenantPathTemplate.match(tenantName).tenant; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.tenantServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_client_config.json b/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_client_config.json new file mode 100644 index 0000000..09363cf --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.talent.v4beta1.TenantService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateTenant": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetTenant": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateTenant": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTenant": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListTenants": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_proto_list.json b/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_proto_list.json new file mode 100644 index 0000000..b0ff236 --- /dev/null +++ b/owl-bot-staging/v4beta1/src/v4beta1/tenant_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/talent/v4beta1/application.proto", + "../../protos/google/cloud/talent/v4beta1/application_service.proto", + "../../protos/google/cloud/talent/v4beta1/batch.proto", + "../../protos/google/cloud/talent/v4beta1/common.proto", + "../../protos/google/cloud/talent/v4beta1/company.proto", + "../../protos/google/cloud/talent/v4beta1/company_service.proto", + "../../protos/google/cloud/talent/v4beta1/completion_service.proto", + "../../protos/google/cloud/talent/v4beta1/event.proto", + "../../protos/google/cloud/talent/v4beta1/event_service.proto", + "../../protos/google/cloud/talent/v4beta1/filters.proto", + "../../protos/google/cloud/talent/v4beta1/histogram.proto", + "../../protos/google/cloud/talent/v4beta1/job.proto", + "../../protos/google/cloud/talent/v4beta1/job_service.proto", + "../../protos/google/cloud/talent/v4beta1/profile.proto", + "../../protos/google/cloud/talent/v4beta1/profile_service.proto", + "../../protos/google/cloud/talent/v4beta1/tenant.proto", + "../../protos/google/cloud/talent/v4beta1/tenant_service.proto" +] diff --git a/owl-bot-staging/v4beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v4beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..ad0170f --- /dev/null +++ b/owl-bot-staging/v4beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,33 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const talent = require('@google-cloud/talent'); + +function main() { + const applicationServiceClient = new talent.ApplicationServiceClient(); + const companyServiceClient = new talent.CompanyServiceClient(); + const completionClient = new talent.CompletionClient(); + const eventServiceClient = new talent.EventServiceClient(); + const jobServiceClient = new talent.JobServiceClient(); + const profileServiceClient = new talent.ProfileServiceClient(); + const tenantServiceClient = new talent.TenantServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v4beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v4beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..db3ce9d --- /dev/null +++ b/owl-bot-staging/v4beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {ApplicationServiceClient, CompanyServiceClient, CompletionClient, EventServiceClient, JobServiceClient, ProfileServiceClient, TenantServiceClient} from '@google-cloud/talent'; + +// check that the client class type name can be used +function doStuffWithApplicationServiceClient(client: ApplicationServiceClient) { + client.close(); +} +function doStuffWithCompanyServiceClient(client: CompanyServiceClient) { + client.close(); +} +function doStuffWithCompletionClient(client: CompletionClient) { + client.close(); +} +function doStuffWithEventServiceClient(client: EventServiceClient) { + client.close(); +} +function doStuffWithJobServiceClient(client: JobServiceClient) { + client.close(); +} +function doStuffWithProfileServiceClient(client: ProfileServiceClient) { + client.close(); +} +function doStuffWithTenantServiceClient(client: TenantServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const applicationServiceClient = new ApplicationServiceClient(); + doStuffWithApplicationServiceClient(applicationServiceClient); + // check that the client instance can be created + const companyServiceClient = new CompanyServiceClient(); + doStuffWithCompanyServiceClient(companyServiceClient); + // check that the client instance can be created + const completionClient = new CompletionClient(); + doStuffWithCompletionClient(completionClient); + // check that the client instance can be created + const eventServiceClient = new EventServiceClient(); + doStuffWithEventServiceClient(eventServiceClient); + // check that the client instance can be created + const jobServiceClient = new JobServiceClient(); + doStuffWithJobServiceClient(jobServiceClient); + // check that the client instance can be created + const profileServiceClient = new ProfileServiceClient(); + doStuffWithProfileServiceClient(profileServiceClient); + // check that the client instance can be created + const tenantServiceClient = new TenantServiceClient(); + doStuffWithTenantServiceClient(tenantServiceClient); +} + +main(); diff --git a/owl-bot-staging/v4beta1/system-test/install.ts b/owl-bot-staging/v4beta1/system-test/install.ts new file mode 100644 index 0000000..1f850b5 --- /dev/null +++ b/owl-bot-staging/v4beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_application_service_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_application_service_v4beta1.ts new file mode 100644 index 0000000..afb4c8c --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_application_service_v4beta1.ts @@ -0,0 +1,1037 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as applicationserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4beta1.ApplicationServiceClient', () => { + it('has servicePath', () => { + const servicePath = applicationserviceModule.v4beta1.ApplicationServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = applicationserviceModule.v4beta1.ApplicationServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = applicationserviceModule.v4beta1.ApplicationServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.applicationServiceStub, undefined); + await client.initialize(); + assert(client.applicationServiceStub); + }); + + it('has close method', () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createApplication', () => { + it('invokes createApplication without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateApplicationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()); + client.innerApiCalls.createApplication = stubSimpleCall(expectedResponse); + const [response] = await client.createApplication(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createApplication without error using callback', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateApplicationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()); + client.innerApiCalls.createApplication = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApplication( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IApplication|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createApplication with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateApplicationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createApplication = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApplication(request), expectedError); + assert((client.innerApiCalls.createApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getApplication', () => { + it('invokes getApplication without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetApplicationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()); + client.innerApiCalls.getApplication = stubSimpleCall(expectedResponse); + const [response] = await client.getApplication(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getApplication without error using callback', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetApplicationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()); + client.innerApiCalls.getApplication = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApplication( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IApplication|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getApplication with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetApplicationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getApplication = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApplication(request), expectedError); + assert((client.innerApiCalls.getApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateApplication', () => { + it('invokes updateApplication without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateApplicationRequest()); + request.application = {}; + request.application.name = ''; + const expectedHeaderRequestParams = "application.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()); + client.innerApiCalls.updateApplication = stubSimpleCall(expectedResponse); + const [response] = await client.updateApplication(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateApplication without error using callback', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateApplicationRequest()); + request.application = {}; + request.application.name = ''; + const expectedHeaderRequestParams = "application.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()); + client.innerApiCalls.updateApplication = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApplication( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IApplication|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateApplication with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateApplicationRequest()); + request.application = {}; + request.application.name = ''; + const expectedHeaderRequestParams = "application.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplication = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApplication(request), expectedError); + assert((client.innerApiCalls.updateApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteApplication', () => { + it('invokes deleteApplication without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteApplicationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteApplication = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApplication(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteApplication without error using callback', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteApplicationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteApplication = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApplication( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteApplication with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteApplicationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApplication = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApplication(request), expectedError); + assert((client.innerApiCalls.deleteApplication as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listApplications', () => { + it('invokes listApplications without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + ]; + client.innerApiCalls.listApplications = stubSimpleCall(expectedResponse); + const [response] = await client.listApplications(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listApplications as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listApplications without error using callback', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + ]; + client.innerApiCalls.listApplications = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApplications( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IApplication[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listApplications as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listApplications with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listApplications = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApplications(request), expectedError); + assert((client.innerApiCalls.listApplications as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listApplicationsStream without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + ]; + client.descriptors.page.listApplications.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApplicationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Application[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Application) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApplications, request)); + assert.strictEqual( + (client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listApplicationsStream with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listApplications.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApplicationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Application[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Application) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApplications, request)); + assert.strictEqual( + (client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listApplications without error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Application()), + ]; + client.descriptors.page.listApplications.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4beta1.IApplication[] = []; + const iterable = client.listApplicationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApplications.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listApplications.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listApplications with error', async () => { + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListApplicationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listApplications.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApplicationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4beta1.IApplication[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApplications.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listApplications.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new applicationserviceModule.v4beta1.ApplicationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_company_service_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_company_service_v4beta1.ts new file mode 100644 index 0000000..f76b7e4 --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_company_service_v4beta1.ts @@ -0,0 +1,1067 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as companyserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4beta1.CompanyServiceClient', () => { + it('has servicePath', () => { + const servicePath = companyserviceModule.v4beta1.CompanyServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = companyserviceModule.v4beta1.CompanyServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = companyserviceModule.v4beta1.CompanyServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.companyServiceStub, undefined); + await client.initialize(); + assert(client.companyServiceStub); + }); + + it('has close method', () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createCompany', () => { + it('invokes createCompany without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateCompanyRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()); + client.innerApiCalls.createCompany = stubSimpleCall(expectedResponse); + const [response] = await client.createCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createCompany without error using callback', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateCompanyRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()); + client.innerApiCalls.createCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCompany( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ICompany|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createCompany with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateCompanyRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createCompany(request), expectedError); + assert((client.innerApiCalls.createCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getCompany', () => { + it('invokes getCompany without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()); + client.innerApiCalls.getCompany = stubSimpleCall(expectedResponse); + const [response] = await client.getCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getCompany without error using callback', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()); + client.innerApiCalls.getCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCompany( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ICompany|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getCompany with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCompany(request), expectedError); + assert((client.innerApiCalls.getCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateCompany', () => { + it('invokes updateCompany without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateCompanyRequest()); + request.company = {}; + request.company.name = ''; + const expectedHeaderRequestParams = "company.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()); + client.innerApiCalls.updateCompany = stubSimpleCall(expectedResponse); + const [response] = await client.updateCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateCompany without error using callback', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateCompanyRequest()); + request.company = {}; + request.company.name = ''; + const expectedHeaderRequestParams = "company.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()); + client.innerApiCalls.updateCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCompany( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ICompany|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateCompany with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateCompanyRequest()); + request.company = {}; + request.company.name = ''; + const expectedHeaderRequestParams = "company.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateCompany(request), expectedError); + assert((client.innerApiCalls.updateCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteCompany', () => { + it('invokes deleteCompany without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCompany = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCompany(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteCompany without error using callback', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteCompany = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCompany( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteCompany with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteCompanyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCompany = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteCompany(request), expectedError); + assert((client.innerApiCalls.deleteCompany as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listCompanies', () => { + it('invokes listCompanies without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + ]; + client.innerApiCalls.listCompanies = stubSimpleCall(expectedResponse); + const [response] = await client.listCompanies(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCompanies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCompanies without error using callback', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + ]; + client.innerApiCalls.listCompanies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCompanies( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ICompany[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCompanies as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCompanies with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCompanies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCompanies(request), expectedError); + assert((client.innerApiCalls.listCompanies as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCompaniesStream without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + ]; + client.descriptors.page.listCompanies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCompaniesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Company[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Company) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCompanies, request)); + assert.strictEqual( + (client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCompaniesStream with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCompanies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCompaniesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Company[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Company) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCompanies, request)); + assert.strictEqual( + (client.descriptors.page.listCompanies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCompanies without error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Company()), + ]; + client.descriptors.page.listCompanies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4beta1.ICompany[] = []; + const iterable = client.listCompaniesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCompanies with error', async () => { + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListCompaniesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCompanies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCompaniesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4beta1.ICompany[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCompanies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new companyserviceModule.v4beta1.CompanyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_completion_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_completion_v4beta1.ts new file mode 100644 index 0000000..9a5a55c --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_completion_v4beta1.ts @@ -0,0 +1,543 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as completionModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v4beta1.CompletionClient', () => { + it('has servicePath', () => { + const servicePath = completionModule.v4beta1.CompletionClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = completionModule.v4beta1.CompletionClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = completionModule.v4beta1.CompletionClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new completionModule.v4beta1.CompletionClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new completionModule.v4beta1.CompletionClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new completionModule.v4beta1.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.completionStub, undefined); + await client.initialize(); + assert(client.completionStub); + }); + + it('has close method', () => { + const client = new completionModule.v4beta1.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('completeQuery', () => { + it('invokes completeQuery without error', async () => { + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CompleteQueryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CompleteQueryResponse()); + client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); + const [response] = await client.completeQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes completeQuery without error using callback', async () => { + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CompleteQueryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CompleteQueryResponse()); + client.innerApiCalls.completeQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeQuery( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ICompleteQueryResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.completeQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes completeQuery with error', async () => { + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CompleteQueryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeQuery(request), expectedError); + assert((client.innerApiCalls.completeQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new completionModule.v4beta1.CompletionClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_event_service_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_event_service_v4beta1.ts new file mode 100644 index 0000000..5a68f82 --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_event_service_v4beta1.ts @@ -0,0 +1,543 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as eventserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v4beta1.EventServiceClient', () => { + it('has servicePath', () => { + const servicePath = eventserviceModule.v4beta1.EventServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = eventserviceModule.v4beta1.EventServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = eventserviceModule.v4beta1.EventServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new eventserviceModule.v4beta1.EventServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new eventserviceModule.v4beta1.EventServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.eventServiceStub, undefined); + await client.initialize(); + assert(client.eventServiceStub); + }); + + it('has close method', () => { + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createClientEvent', () => { + it('invokes createClientEvent without error', async () => { + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateClientEventRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ClientEvent()); + client.innerApiCalls.createClientEvent = stubSimpleCall(expectedResponse); + const [response] = await client.createClientEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createClientEvent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createClientEvent without error using callback', async () => { + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateClientEventRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ClientEvent()); + client.innerApiCalls.createClientEvent = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createClientEvent( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IClientEvent|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createClientEvent as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createClientEvent with error', async () => { + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateClientEventRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createClientEvent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createClientEvent(request), expectedError); + assert((client.innerApiCalls.createClientEvent as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new eventserviceModule.v4beta1.EventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_job_service_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_job_service_v4beta1.ts new file mode 100644 index 0000000..2265013 --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_job_service_v4beta1.ts @@ -0,0 +1,1623 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as jobserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4beta1.JobServiceClient', () => { + it('has servicePath', () => { + const servicePath = jobserviceModule.v4beta1.JobServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = jobserviceModule.v4beta1.JobServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = jobserviceModule.v4beta1.JobServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new jobserviceModule.v4beta1.JobServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.jobServiceStub, undefined); + await client.initialize(); + assert(client.jobServiceStub); + }); + + it('has close method', () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createJob', () => { + it('invokes createJob without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()); + client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); + const [response] = await client.createJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJob without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()); + client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJob( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createJob with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJob(request), expectedError); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getJob with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateJob', () => { + it('invokes updateJob without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()); + client.innerApiCalls.updateJob = stubSimpleCall(expectedResponse); + const [response] = await client.updateJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateJob without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()); + client.innerApiCalls.updateJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateJob( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateJob with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateJobRequest()); + request.job = {}; + request.job.name = ''; + const expectedHeaderRequestParams = "job.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateJob(request), expectedError); + assert((client.innerApiCalls.updateJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteJob', () => { + it('invokes deleteJob without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJob without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJob( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteJob with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJob(request), expectedError); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchDeleteJobs', () => { + it('invokes batchDeleteJobs without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.batchDeleteJobs = stubSimpleCall(expectedResponse); + const [response] = await client.batchDeleteJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteJobs without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.batchDeleteJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteJobs( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteJobs with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchDeleteJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchDeleteJobs(request), expectedError); + assert((client.innerApiCalls.batchDeleteJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('searchJobs', () => { + it('invokes searchJobs without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsResponse()); + client.innerApiCalls.searchJobs = stubSimpleCall(expectedResponse); + const [response] = await client.searchJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchJobs without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsResponse()); + client.innerApiCalls.searchJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchJobs( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ISearchJobsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchJobs with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchJobs(request), expectedError); + assert((client.innerApiCalls.searchJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('searchJobsForAlert', () => { + it('invokes searchJobsForAlert without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsResponse()); + client.innerApiCalls.searchJobsForAlert = stubSimpleCall(expectedResponse); + const [response] = await client.searchJobsForAlert(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobsForAlert as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchJobsForAlert without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsResponse()); + client.innerApiCalls.searchJobsForAlert = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchJobsForAlert( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ISearchJobsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchJobsForAlert as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchJobsForAlert with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchJobsForAlert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchJobsForAlert(request), expectedError); + assert((client.innerApiCalls.searchJobsForAlert as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchCreateJobs', () => { + it('invokes batchCreateJobs without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateJobs = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateJobs(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateJobs without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchCreateJobs = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateJobs( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchCreateJobs with call error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateJobs = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateJobs(request), expectedError); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateJobs with LRO error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchCreateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateJobs = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateJobs(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchCreateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchCreateJobsProgress without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchCreateJobsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateJobsProgress with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchCreateJobsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchUpdateJobs', () => { + it('invokes batchUpdateJobs without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateJobs(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateJobs without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateJobs( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateJobs with call error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateJobs(request), expectedError); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateJobs with LRO error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.BatchUpdateJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateJobs = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateJobs(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.batchUpdateJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBatchUpdateJobsProgress without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchUpdateJobsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateJobsProgress with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkBatchUpdateJobsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listJobs with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Job[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Job[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4beta1.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4beta1.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_profile_service_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_profile_service_v4beta1.ts new file mode 100644 index 0000000..c4f7f26 --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_profile_service_v4beta1.ts @@ -0,0 +1,1151 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as profileserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4beta1.ProfileServiceClient', () => { + it('has servicePath', () => { + const servicePath = profileserviceModule.v4beta1.ProfileServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = profileserviceModule.v4beta1.ProfileServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = profileserviceModule.v4beta1.ProfileServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.profileServiceStub, undefined); + await client.initialize(); + assert(client.profileServiceStub); + }); + + it('has close method', () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createProfile', () => { + it('invokes createProfile without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()); + client.innerApiCalls.createProfile = stubSimpleCall(expectedResponse); + const [response] = await client.createProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createProfile without error using callback', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()); + client.innerApiCalls.createProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProfile( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createProfile with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateProfileRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createProfile(request), expectedError); + assert((client.innerApiCalls.createProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getProfile', () => { + it('invokes getProfile without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()); + client.innerApiCalls.getProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getProfile without error using callback', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()); + client.innerApiCalls.getProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProfile( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getProfile with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getProfile(request), expectedError); + assert((client.innerApiCalls.getProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateProfile', () => { + it('invokes updateProfile without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateProfileRequest()); + request.profile = {}; + request.profile.name = ''; + const expectedHeaderRequestParams = "profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()); + client.innerApiCalls.updateProfile = stubSimpleCall(expectedResponse); + const [response] = await client.updateProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateProfile without error using callback', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateProfileRequest()); + request.profile = {}; + request.profile.name = ''; + const expectedHeaderRequestParams = "profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()); + client.innerApiCalls.updateProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProfile( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateProfile with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateProfileRequest()); + request.profile = {}; + request.profile.name = ''; + const expectedHeaderRequestParams = "profile.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateProfile(request), expectedError); + assert((client.innerApiCalls.updateProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteProfile', () => { + it('invokes deleteProfile without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteProfile(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteProfile without error using callback', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProfile( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteProfile with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteProfileRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteProfile(request), expectedError); + assert((client.innerApiCalls.deleteProfile as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('searchProfiles', () => { + it('invokes searchProfiles without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchProfilesResponse()); + client.innerApiCalls.searchProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.searchProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes searchProfiles without error using callback', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchProfilesResponse()); + client.innerApiCalls.searchProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchProfiles( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ISearchProfilesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.searchProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes searchProfiles with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.SearchProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchProfiles(request), expectedError); + assert((client.innerApiCalls.searchProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listProfiles', () => { + it('invokes listProfiles without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + ]; + client.innerApiCalls.listProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listProfiles without error using callback', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + ]; + client.innerApiCalls.listProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProfiles( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.IProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listProfiles with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listProfiles(request), expectedError); + assert((client.innerApiCalls.listProfiles as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listProfilesStream without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + ]; + client.descriptors.page.listProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Profile[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Profile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProfilesStream with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Profile[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Profile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listProfiles, request)); + assert.strictEqual( + (client.descriptors.page.listProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProfiles without error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Profile()), + ]; + client.descriptors.page.listProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4beta1.IProfile[] = []; + const iterable = client.listProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProfiles with error', async () => { + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListProfilesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4beta1.IProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new profileserviceModule.v4beta1.ProfileServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/test/gapic_tenant_service_v4beta1.ts b/owl-bot-staging/v4beta1/test/gapic_tenant_service_v4beta1.ts new file mode 100644 index 0000000..8e96faa --- /dev/null +++ b/owl-bot-staging/v4beta1/test/gapic_tenant_service_v4beta1.ts @@ -0,0 +1,1067 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as tenantserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4beta1.TenantServiceClient', () => { + it('has servicePath', () => { + const servicePath = tenantserviceModule.v4beta1.TenantServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tenantserviceModule.v4beta1.TenantServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tenantserviceModule.v4beta1.TenantServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.tenantServiceStub, undefined); + await client.initialize(); + assert(client.tenantServiceStub); + }); + + it('has close method', () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createTenant', () => { + it('invokes createTenant without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateTenantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()); + client.innerApiCalls.createTenant = stubSimpleCall(expectedResponse); + const [response] = await client.createTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTenant without error using callback', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateTenantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()); + client.innerApiCalls.createTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTenant( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ITenant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTenant with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.CreateTenantRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createTenant(request), expectedError); + assert((client.innerApiCalls.createTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getTenant', () => { + it('invokes getTenant without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()); + client.innerApiCalls.getTenant = stubSimpleCall(expectedResponse); + const [response] = await client.getTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTenant without error using callback', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()); + client.innerApiCalls.getTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTenant( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ITenant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getTenant with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.GetTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTenant(request), expectedError); + assert((client.innerApiCalls.getTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateTenant', () => { + it('invokes updateTenant without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateTenantRequest()); + request.tenant = {}; + request.tenant.name = ''; + const expectedHeaderRequestParams = "tenant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()); + client.innerApiCalls.updateTenant = stubSimpleCall(expectedResponse); + const [response] = await client.updateTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateTenant without error using callback', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateTenantRequest()); + request.tenant = {}; + request.tenant.name = ''; + const expectedHeaderRequestParams = "tenant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()); + client.innerApiCalls.updateTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTenant( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ITenant|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateTenant with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.UpdateTenantRequest()); + request.tenant = {}; + request.tenant.name = ''; + const expectedHeaderRequestParams = "tenant.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateTenant(request), expectedError); + assert((client.innerApiCalls.updateTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteTenant', () => { + it('invokes deleteTenant without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTenant = stubSimpleCall(expectedResponse); + const [response] = await client.deleteTenant(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTenant without error using callback', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteTenant = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTenant( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteTenant with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.DeleteTenantRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTenant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteTenant(request), expectedError); + assert((client.innerApiCalls.deleteTenant as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listTenants', () => { + it('invokes listTenants without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + ]; + client.innerApiCalls.listTenants = stubSimpleCall(expectedResponse); + const [response] = await client.listTenants(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTenants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTenants without error using callback', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + ]; + client.innerApiCalls.listTenants = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTenants( + request, + (err?: Error|null, result?: protos.google.cloud.talent.v4beta1.ITenant[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTenants as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listTenants with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTenants = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTenants(request), expectedError); + assert((client.innerApiCalls.listTenants as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTenantsStream without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + ]; + client.descriptors.page.listTenants.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTenantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Tenant[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Tenant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTenants, request)); + assert.strictEqual( + (client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTenantsStream with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listTenants.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTenantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.talent.v4beta1.Tenant[] = []; + stream.on('data', (response: protos.google.cloud.talent.v4beta1.Tenant) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTenants, request)); + assert.strictEqual( + (client.descriptors.page.listTenants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTenants without error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + generateSampleMessage(new protos.google.cloud.talent.v4beta1.Tenant()), + ]; + client.descriptors.page.listTenants.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.talent.v4beta1.ITenant[] = []; + const iterable = client.listTenantsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTenants with error', async () => { + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.talent.v4beta1.ListTenantsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listTenants.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTenantsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.talent.v4beta1.ITenant[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTenants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('application', () => { + const fakePath = "/rendered/path/application"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + application: "applicationValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.applicationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath("projectValue", "tenantValue", "profileValue", "applicationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromApplicationName', () => { + const result = client.matchTenantFromApplicationName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromApplicationName', () => { + const result = client.matchProfileFromApplicationName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, "applicationValue"); + assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('profile', () => { + const fakePath = "/rendered/path/profile"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + profile: "profileValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.profilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.profilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath("projectValue", "tenantValue", "profileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProfileName', () => { + const result = client.matchProjectFromProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProfileName', () => { + const result = client.matchTenantFromProfileName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchProfileFromProfileName', () => { + const result = client.matchProfileFromProfileName(fakePath); + assert.strictEqual(result, "profileValue"); + assert((client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectCompany', () => { + const fakePath = "/rendered/path/projectCompany"; + const expectedParameters = { + project: "projectValue", + company: "companyValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectCompanyPath', () => { + const result = client.projectCompanyPath("projectValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectCompanyName', () => { + const result = client.matchProjectFromProjectCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectCompanyName', () => { + const result = client.matchCompanyFromProjectCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectJob', () => { + const fakePath = "/rendered/path/projectJob"; + const expectedParameters = { + project: "projectValue", + job: "jobValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectJobPath', () => { + const result = client.projectJobPath("projectValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectJobName', () => { + const result = client.matchProjectFromProjectJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectJobName', () => { + const result = client.matchJobFromProjectJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantCompany', () => { + const fakePath = "/rendered/path/projectTenantCompany"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + company: "companyValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantCompanyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantCompanyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantCompanyPath', () => { + const result = client.projectTenantCompanyPath("projectValue", "tenantValue", "companyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantCompanyName', () => { + const result = client.matchProjectFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantCompanyName', () => { + const result = client.matchTenantFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchCompanyFromProjectTenantCompanyName', () => { + const result = client.matchCompanyFromProjectTenantCompanyName(fakePath); + assert.strictEqual(result, "companyValue"); + assert((client.pathTemplates.projectTenantCompanyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTenantJob', () => { + const fakePath = "/rendered/path/projectTenantJob"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + job: "jobValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTenantJobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTenantJobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTenantJobPath', () => { + const result = client.projectTenantJobPath("projectValue", "tenantValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTenantJobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTenantJobName', () => { + const result = client.matchProjectFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromProjectTenantJobName', () => { + const result = client.matchTenantFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromProjectTenantJobName', () => { + const result = client.matchJobFromProjectTenantJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.projectTenantJobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('tenant', () => { + const fakePath = "/rendered/path/tenant"; + const expectedParameters = { + project: "projectValue", + tenant: "tenantValue", + }; + const client = new tenantserviceModule.v4beta1.TenantServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tenantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tenantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tenantPath', () => { + const result = client.tenantPath("projectValue", "tenantValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tenantPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTenantName', () => { + const result = client.matchProjectFromTenantName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTenantFromTenantName', () => { + const result = client.matchTenantFromTenantName(fakePath); + assert.strictEqual(result, "tenantValue"); + assert((client.pathTemplates.tenantPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v4beta1/tsconfig.json b/owl-bot-staging/v4beta1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v4beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v4beta1/webpack.config.js b/owl-bot-staging/v4beta1/webpack.config.js new file mode 100644 index 0000000..f38000f --- /dev/null +++ b/owl-bot-staging/v4beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'talent', + filename: './talent.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +};