diff --git a/README.md b/README.md index 7fe0b0c..5d45b74 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# nodejs-analyticsadmin -Google Analytics Node.js client library source +Admin: Nodejs Client diff --git a/linkinator.config.json b/linkinator.config.json new file mode 100644 index 0000000..29a223b --- /dev/null +++ b/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/package.json b/package.json new file mode 100644 index 0000000..d56c9f2 --- /dev/null +++ b/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-analytics/admin", + "version": "0.1.0", + "description": "Admin client for Node.js", + "repository": "googleapis/nodejs-admin", + "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 admin", + "admin", + "analytics admin 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.6.1" + }, + "devDependencies": { + "@types/mocha": "^7.0.2", + "@types/node": "^14.0.14", + "@types/sinon": "^9.0.4", + "c8": "^7.2.0", + "gts": "^2.0.2", + "jsdoc": "^3.6.4", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.4", + "linkinator": "^2.1.1", + "mocha": "^8.0.1", + "null-loader": "^4.0.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^9.0.2", + "ts-loader": "^7.0.5", + "typescript": "^3.9.5", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.12" + }, + "engines": { + "node": ">=10.0.0" + } +} diff --git a/protos/google/analytics/admin/v1alpha/analytics_admin.proto b/protos/google/analytics/admin/v1alpha/analytics_admin.proto new file mode 100644 index 0000000..60d503a --- /dev/null +++ b/protos/google/analytics/admin/v1alpha/analytics_admin.proto @@ -0,0 +1,1344 @@ +// 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.analytics.admin.v1alpha; + +import "google/analytics/admin/v1alpha/resources.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/analytics/admin/v1alpha;admin"; +option java_multiple_files = true; +option java_outer_classname = "AnalyticsAdminProto"; +option java_package = "com.google.analytics.admin.v1alpha"; + +// Service Interface for the Analytics Admin API (App+Web). +service AnalyticsAdminService { + option (google.api.default_host) = "analyticsadmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/analytics.edit," + "https://www.googleapis.com/auth/analytics.manage.users," + "https://www.googleapis.com/auth/analytics.manage.users.readonly," + "https://www.googleapis.com/auth/analytics.readonly"; + + // Lookup for a single Account. + // Throws "Target not found" if no such account found, or if caller does not + // have permissions to access it. + rpc GetAccount(GetAccountRequest) returns (Account) { + option (google.api.http) = { + get: "/v1alpha/{name=accounts/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns all accounts accessible by the caller. + // + // Note that these accounts might not currently have App+Web properties. + // Soft-deleted (ie: "trashed") accounts are excluded by default. + // Returns an empty list if no relevant accounts are found. + rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse) { + option (google.api.http) = { + get: "/v1alpha/accounts" + }; + } + + // Marks target Account as soft-deleted (ie: "trashed") and returns it. + // + // This API does not have a method to restore soft-deleted accounts. + // However, they can be restored using the Trash Can UI. + // + // If the accounts are not restored before the expiration time, the account + // and all child resources (eg: Properties, GoogleAdsLinks, Streams, + // UserLinks) will be permanently purged. + // https://support.google.com/analytics/answer/6154772 + // + // Returns an error if the target is not found. + rpc DeleteAccount(DeleteAccountRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=accounts/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an account. + rpc UpdateAccount(UpdateAccountRequest) returns (Account) { + option (google.api.http) = { + patch: "/v1alpha/{account.name=accounts/*}" + body: "account" + }; + option (google.api.method_signature) = "account,update_mask"; + } + + // Requests a ticket for creating an account. + rpc ProvisionAccountTicket(ProvisionAccountTicketRequest) returns (ProvisionAccountTicketResponse) { + option (google.api.http) = { + post: "/v1alpha/accounts:provisionAccountTicket" + body: "*" + }; + } + + // Lookup for a single "App+Web" Property. + // + // Throws "Target not found" if no such property found, if property is not + // of the type "App+Web", or if caller does not have permissions to access it. + rpc GetProperty(GetPropertyRequest) returns (Property) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns child Properties under the specified parent Account. + // + // Only "App+Web" properties will be returned. + // Properties will be excluded if the caller does not have access. + // Soft-deleted (ie: "trashed") properties are excluded by default. + // Returns an empty list if no relevant properties are found. + rpc ListProperties(ListPropertiesRequest) returns (ListPropertiesResponse) { + option (google.api.http) = { + get: "/v1alpha/properties" + }; + } + + // Creates an "App+Web" property with the specified location and attributes. + rpc CreateProperty(CreatePropertyRequest) returns (Property) { + option (google.api.http) = { + post: "/v1alpha/properties" + body: "property" + }; + option (google.api.method_signature) = "property"; + } + + // Marks target Property as soft-deleted (ie: "trashed") and returns it. + // + // This API does not have a method to restore soft-deleted properties. + // However, they can be restored using the Trash Can UI. + // + // If the properties are not restored before the expiration time, the Property + // and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) + // will be permanently purged. + // https://support.google.com/analytics/answer/6154772 + // + // Returns an error if the target is not found, or is not an App+Web Property. + rpc DeleteProperty(DeletePropertyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=properties/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a property. + rpc UpdateProperty(UpdatePropertyRequest) returns (Property) { + option (google.api.http) = { + patch: "/v1alpha/{property.name=properties/*}" + body: "property" + }; + option (google.api.method_signature) = "property,update_mask"; + } + + // Gets information about a user's link to an account or property. + rpc GetUserLink(GetUserLinkRequest) returns (UserLink) { + option (google.api.http) = { + get: "/v1alpha/{name=accounts/*/userLinks/*}" + additional_bindings { + get: "/v1alpha/{name=properties/*/userLinks/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Gets information about multiple users' links to an account or property. + rpc BatchGetUserLinks(BatchGetUserLinksRequest) returns (BatchGetUserLinksResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=accounts/*}/userLinks:batchGet" + additional_bindings { + get: "/v1alpha/{parent=properties/*}/userLinks:batchGet" + } + }; + } + + // Lists all user links on an account or property. + rpc ListUserLinks(ListUserLinksRequest) returns (ListUserLinksResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=accounts/*}/userLinks" + additional_bindings { + get: "/v1alpha/{parent=properties/*}/userLinks" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all user links on an account or property, including implicit ones + // that come from effective permissions granted by groups or organization + // admin roles. + // + // If a returned user link does not have direct permissions, they cannot + // be removed from the account or property directly with the DeleteUserLink + // command. They have to be removed from the group/etc that gives them + // permissions, which is currently only usable/discoverable in the GA or GMP + // UIs. + rpc AuditUserLinks(AuditUserLinksRequest) returns (AuditUserLinksResponse) { + option (google.api.http) = { + post: "/v1alpha/{parent=accounts/*}/userLinks:audit" + body: "*" + additional_bindings { + post: "/v1alpha/{parent=properties/*}/userLinks:audit" + body: "*" + } + }; + } + + // Creates a user link on an account or property. + // + // If the user with the specified email already has permissions on the + // account or property, then the user's existing permissions will be unioned + // with the permissions specified in the new UserLink. + rpc CreateUserLink(CreateUserLinkRequest) returns (UserLink) { + option (google.api.http) = { + post: "/v1alpha/{parent=accounts/*}/userLinks" + body: "user_link" + additional_bindings { + post: "/v1alpha/{parent=properties/*}/userLinks" + body: "user_link" + } + }; + option (google.api.method_signature) = "parent,user_link"; + } + + // Creates information about multiple users' links to an account or property. + // + // This method is transactional. If any UserLink cannot be created, none of + // the UserLinks will be created. + rpc BatchCreateUserLinks(BatchCreateUserLinksRequest) returns (BatchCreateUserLinksResponse) { + option (google.api.http) = { + post: "/v1alpha/{parent=accounts/*}/userLinks:batchCreate" + body: "*" + additional_bindings { + post: "/v1alpha/{parent=properties/*}/userLinks:batchCreate" + body: "*" + } + }; + } + + // Updates a user link on an account or property. + rpc UpdateUserLink(UpdateUserLinkRequest) returns (UserLink) { + option (google.api.http) = { + patch: "/v1alpha/{user_link.name=accounts/*/userLinks/*}" + body: "user_link" + additional_bindings { + patch: "/v1alpha/{user_link.name=properties/*/userLinks/*}" + body: "user_link" + } + }; + option (google.api.method_signature) = "user_link"; + } + + // Updates information about multiple users' links to an account or property. + rpc BatchUpdateUserLinks(BatchUpdateUserLinksRequest) returns (BatchUpdateUserLinksResponse) { + option (google.api.http) = { + post: "/v1alpha/{parent=accounts/*}/userLinks:batchUpdate" + body: "*" + additional_bindings { + post: "/v1alpha/{parent=properties/*}/userLinks:batchUpdate" + body: "*" + } + }; + } + + // Deletes a user link on an account or property. + rpc DeleteUserLink(DeleteUserLinkRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=accounts/*/userLinks/*}" + additional_bindings { + delete: "/v1alpha/{name=properties/*/userLinks/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes information about multiple users' links to an account or property. + rpc BatchDeleteUserLinks(BatchDeleteUserLinksRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1alpha/{parent=accounts/*}/userLinks:batchDelete" + body: "*" + additional_bindings { + post: "/v1alpha/{parent=properties/*}/userLinks:batchDelete" + body: "*" + } + }; + } + + // Lookup for a single WebDataStream + // + // Throws "Target not found" if no such web data stream found, or if the + // caller does not have permissions to access it. + rpc GetWebDataStream(GetWebDataStreamRequest) returns (WebDataStream) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*/webDataStreams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a web stream on a property. + rpc DeleteWebDataStream(DeleteWebDataStreamRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=properties/*/webDataStreams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a web stream on a property. + rpc UpdateWebDataStream(UpdateWebDataStreamRequest) returns (WebDataStream) { + option (google.api.http) = { + patch: "/v1alpha/{web_data_stream.name=properties/*/webDataStreams/*}" + body: "web_data_stream" + }; + option (google.api.method_signature) = "web_data_stream,update_mask"; + } + + // Creates a web stream with the specified location and attributes. + rpc CreateWebDataStream(CreateWebDataStreamRequest) returns (WebDataStream) { + option (google.api.http) = { + post: "/v1alpha/{parent=properties/*}/webDataStreams" + body: "web_data_stream" + }; + option (google.api.method_signature) = "parent,web_data_stream"; + } + + // Returns child web data streams under the specified parent property. + // + // Web data streams will be excluded if the caller does not have access. + // Returns an empty list if no relevant web data streams are found. + rpc ListWebDataStreams(ListWebDataStreamsRequest) returns (ListWebDataStreamsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=properties/*}/webDataStreams" + }; + option (google.api.method_signature) = "parent"; + } + + // Lookup for a single IosAppDataStream + // + // Throws "Target not found" if no such iOS app data stream found, or if the + // caller does not have permissions to access it. + rpc GetIosAppDataStream(GetIosAppDataStreamRequest) returns (IosAppDataStream) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*/iosAppDataStreams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an iOS app stream on a property. + rpc DeleteIosAppDataStream(DeleteIosAppDataStreamRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=properties/*/iosAppDataStreams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an iOS app stream on a property. + rpc UpdateIosAppDataStream(UpdateIosAppDataStreamRequest) returns (IosAppDataStream) { + option (google.api.http) = { + patch: "/v1alpha/{ios_app_data_stream.name=properties/*/iosAppDataStreams/*}" + body: "ios_app_data_stream" + }; + option (google.api.method_signature) = "ios_app_data_stream,update_mask"; + } + + // Creates an iOS app data stream with the specified location and attributes. + rpc CreateIosAppDataStream(CreateIosAppDataStreamRequest) returns (IosAppDataStream) { + option (google.api.http) = { + post: "/v1alpha/{parent=properties/*}/iosAppDataStreams" + body: "ios_app_data_stream" + }; + option (google.api.method_signature) = "parent,ios_app_data_stream"; + } + + // Returns child iOS app data streams under the specified parent property. + // + // iOS app data streams will be excluded if the caller does not have access. + // Returns an empty list if no relevant iOS app data streams are found. + rpc ListIosAppDataStreams(ListIosAppDataStreamsRequest) returns (ListIosAppDataStreamsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=properties/*}/iosAppDataStreams" + }; + option (google.api.method_signature) = "parent"; + } + + // Lookup for a single AndroidAppDataStream + // + // Throws "Target not found" if no such android app data stream found, or if + // the caller does not have permissions to access it. + rpc GetAndroidAppDataStream(GetAndroidAppDataStreamRequest) returns (AndroidAppDataStream) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*/androidAppDataStreams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an android app stream on a property. + rpc DeleteAndroidAppDataStream(DeleteAndroidAppDataStreamRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=properties/*/androidAppDataStreams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an android app stream on a property. + rpc UpdateAndroidAppDataStream(UpdateAndroidAppDataStreamRequest) returns (AndroidAppDataStream) { + option (google.api.http) = { + patch: "/v1alpha/{android_app_data_stream.name=properties/*/androidAppDataStreams/*}" + body: "android_app_data_stream" + }; + option (google.api.method_signature) = "android_app_data_stream,update_mask"; + } + + // Creates an android app stream with the specified location and attributes. + rpc CreateAndroidAppDataStream(CreateAndroidAppDataStreamRequest) returns (AndroidAppDataStream) { + option (google.api.http) = { + post: "/v1alpha/{parent=properties/*}/androidAppDataStreams" + body: "android_app_data_stream" + }; + option (google.api.method_signature) = "parent,android_app_data_stream"; + } + + // Returns child android app streams under the specified parent property. + // + // Android app streams will be excluded if the caller does not have access. + // Returns an empty list if no relevant android app streams are found. + rpc ListAndroidAppDataStreams(ListAndroidAppDataStreamsRequest) returns (ListAndroidAppDataStreamsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=properties/*}/androidAppDataStreams" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the singleton enhanced measurement settings for this web stream. + // Note that the stream must enable enhanced measurement for these settings to + // take effect. + rpc GetEnhancedMeasurementSettings(GetEnhancedMeasurementSettingsRequest) returns (EnhancedMeasurementSettings) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*/webDataStreams/*/enhancedMeasurementSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the singleton enhanced measurement settings for this web stream. + // Note that the stream must enable enhanced measurement for these settings to + // take effect. + rpc UpdateEnhancedMeasurementSettings(UpdateEnhancedMeasurementSettingsRequest) returns (EnhancedMeasurementSettings) { + option (google.api.http) = { + patch: "/v1alpha/{enhanced_measurement_settings.name=properties/*/webDataStreams/*/enhancedMeasurementSettings}" + body: "enhanced_measurement_settings" + }; + option (google.api.method_signature) = "enhanced_measurement_settings,update_mask"; + } + + // Creates a FirebaseLink. + // + // Properties can have at most one FirebaseLink. + rpc CreateFirebaseLink(CreateFirebaseLinkRequest) returns (FirebaseLink) { + option (google.api.http) = { + post: "/v1alpha/{parent=properties/*}/firebaseLinks" + body: "firebase_link" + }; + option (google.api.method_signature) = "parent,firebase_link"; + } + + // Updates a FirebaseLink on a property + rpc UpdateFirebaseLink(UpdateFirebaseLinkRequest) returns (FirebaseLink) { + option (google.api.http) = { + patch: "/v1alpha/{firebase_link.name=properties/*/firebaseLinks/*}" + body: "firebase_link" + }; + option (google.api.method_signature) = "firebase_link,update_mask"; + } + + // Deletes a FirebaseLink on a property + rpc DeleteFirebaseLink(DeleteFirebaseLinkRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=properties/*/firebaseLinks/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists FirebaseLinks on a property. + // Properties can have at most one FirebaseLink. + rpc ListFirebaseLinks(ListFirebaseLinksRequest) returns (ListFirebaseLinksResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=properties/*}/firebaseLinks" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the Site Tag for the specified web stream. + // Site Tags are immutable singletons. + rpc GetGlobalSiteTag(GetGlobalSiteTagRequest) returns (GlobalSiteTag) { + option (google.api.http) = { + get: "/v1alpha/{name=properties/*/webDataStreams/*/globalSiteTag}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a GoogleAdsLink. + rpc CreateGoogleAdsLink(CreateGoogleAdsLinkRequest) returns (GoogleAdsLink) { + option (google.api.http) = { + post: "/v1alpha/{parent=properties/*}/googleAdsLinks" + body: "google_ads_link" + }; + option (google.api.method_signature) = "parent,google_ads_link"; + } + + // Updates a GoogleAdsLink on a property + rpc UpdateGoogleAdsLink(UpdateGoogleAdsLinkRequest) returns (GoogleAdsLink) { + option (google.api.http) = { + patch: "/v1alpha/{google_ads_link.name=properties/*/googleAdsLinks/*}" + body: "google_ads_link" + }; + option (google.api.method_signature) = "google_ads_link,update_mask"; + } + + // Deletes a GoogleAdsLink on a property + rpc DeleteGoogleAdsLink(DeleteGoogleAdsLinkRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=properties/*/googleAdsLinks/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists GoogleAdsLinks on a property. + rpc ListGoogleAdsLinks(ListGoogleAdsLinksRequest) returns (ListGoogleAdsLinksResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=properties/*}/googleAdsLinks" + }; + option (google.api.method_signature) = "parent"; + } + + // Get data sharing settings on an account. + // Data sharing settings are singletons. + rpc GetDataSharingSettings(GetDataSharingSettingsRequest) returns (DataSharingSettings) { + option (google.api.http) = { + get: "/v1alpha/{name=accounts/*/dataSharingSettings}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for GetAccount RPC. +message GetAccountRequest { + // Required. The name of the account to lookup. + // Format: accounts/{account} + // Example: "accounts/100" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/Account" + } + ]; +} + +// Request message for ListAccounts RPC. +message ListAccountsRequest { + // The maximum number of resources to return. The service may return + // fewer than this value, even if there are additional pages. + // If unspecified, at most 50 resources will be returned. + // The maximum value is 200; (higher values will be coerced to the maximum) + int32 page_size = 1; + + // A page token, received from a previous `ListAccounts` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListAccounts` must + // match the call that provided the page token. + string page_token = 2; + + // Whether to include soft-deleted (ie: "trashed") Accounts in the + // results. Accounts can be inspected to determine whether they are deleted or + // not. + bool show_deleted = 3; +} + +// Request message for ListAccounts RPC. +message ListAccountsResponse { + // Results that were accessible to the caller. + repeated Account accounts = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for DeleteAccount RPC. +message DeleteAccountRequest { + // Required. The name of the Account to soft-delete. + // Format: accounts/{account} + // Example: "accounts/100" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/Account" + } + ]; +} + +// Request message for UpdateAccount RPC. +message UpdateAccountRequest { + // Required. The account to update. + // The account's `name` field is used to identify the account. + Account account = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for ProvisionAccountTicket RPC. +message ProvisionAccountTicketRequest { + // The account to create. + Account account = 1; + + // Redirect URI where the user will be sent after accepting Terms of Service. + // Must be configured in Developers Console as a Redirect URI + string redirect_uri = 2; +} + +// Response message for ProvisionAccountTicket RPC. +message ProvisionAccountTicketResponse { + // The param to be passed in the ToS link. + string account_ticket_id = 1; +} + +// Request message for GetProperty RPC. +message GetPropertyRequest { + // Required. The name of the property to lookup. + // Format: properties/{property_id} + // Example: "properties/1000" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/Property" + } + ]; +} + +// Request message for ListProperties RPC. +message ListPropertiesRequest { + // Required. An expression for filtering the results of the request. + // Fields eligible for filtering are: + // `parent:`(The resource name of the parent account) or + // `firebase_project:`(The id or number of the linked firebase project). + // Some examples of filters: + // + // | Filter | Description | + // |-----------------------------|-------------------------------------------| + // | parent:accounts/123 | The account with account id: 123. | + // | firebase_project:project-id | The firebase project with id: project-id. | + // | firebase_project:123 | The firebase project with number: 123. | + string filter = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of resources to return. The service may return + // fewer than this value, even if there are additional pages. + // If unspecified, at most 50 resources will be returned. + // The maximum value is 200; (higher values will be coerced to the maximum) + int32 page_size = 2; + + // A page token, received from a previous `ListProperties` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListProperties` must + // match the call that provided the page token. + string page_token = 3; + + // Whether to include soft-deleted (ie: "trashed") Properties in the + // results. Properties can be inspected to determine whether they are deleted + // or not. + bool show_deleted = 4; +} + +// Response message for ListProperties RPC. +message ListPropertiesResponse { + // Results that matched the filter criteria and were accessible to the caller. + repeated Property properties = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for UpdateProperty RPC. +message UpdatePropertyRequest { + // Required. The property to update. + // The property's `name` field is used to identify the property to be + // updated. + Property property = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for CreateProperty RPC. +message CreatePropertyRequest { + // Required. The property to create. + // Note: the supplied property must specify its parent. + Property property = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteProperty RPC. +message DeletePropertyRequest { + // Required. The name of the Property to soft-delete. + // Format: properties/{property_id} + // Example: "properties/1000" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/Property" + } + ]; +} + +// Request message for GetUserLink RPC. +message GetUserLinkRequest { + // Required. Example format: accounts/1234/userLinks/5678 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/UserLink" + } + ]; +} + +// Request message for BatchGetUserLinks RPC. +message BatchGetUserLinksRequest { + // Required. The account or property that all user links in the request are + // for. The parent of all provided values for the 'names' field must match + // this field. + // Example format: accounts/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/UserLink" + } + ]; + + // Required. The names of the user links to retrieve. + // A maximum of 1000 user links can be retrieved in a batch. + // Format: accounts/{accountId}/userLinks/{userLinkId} + repeated string names = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/UserLink" + } + ]; +} + +// Response message for BatchGetUserLinks RPC. +message BatchGetUserLinksResponse { + // The requested user links. + repeated UserLink user_links = 1; +} + +// Request message for ListUserLinks RPC. +message ListUserLinksRequest { + // Required. Example format: accounts/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/UserLink" + } + ]; + + // The maximum number of user links to return. + // The service may return fewer than this value. + // If unspecified, at most 200 user links will be returned. + // The maximum value is 500; values above 500 will be coerced to 500. + int32 page_size = 2; + + // A page token, received from a previous `ListUserLinks` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListUserLinks` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message for ListUserLinks RPC. +message ListUserLinksResponse { + // List of UserLinks. These will be ordered stably, but in an arbitrary order. + repeated UserLink user_links = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for AuditUserLinks RPC. +message AuditUserLinksRequest { + // Required. Example format: accounts/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/UserLink" + } + ]; + + // The maximum number of user links to return. + // The service may return fewer than this value. + // If unspecified, at most 1000 user links will be returned. + // The maximum value is 5000; values above 5000 will be coerced to 5000. + int32 page_size = 2; + + // A page token, received from a previous `AuditUserLinks` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `AuditUserLinks` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message for AuditUserLinks RPC. +message AuditUserLinksResponse { + // List of AuditUserLinks. These will be ordered stably, but in an arbitrary + // order. + repeated AuditUserLink user_links = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for CreateUserLink RPC. +// +// Users can have multiple email addresses associated with their Google +// account, and one of these email addresses is the "primary" email address. +// Any of the email addresses associated with a Google account may be used +// for a new UserLink, but the returned UserLink will always contain the +// "primary" email address. As a result, the input and output email address +// for this request may differ. +message CreateUserLinkRequest { + // Required. Example format: accounts/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/UserLink" + } + ]; + + // Optional. If notify_new_user is set, then email new user that they've been given + // permissions on the resource. + bool notify_new_user = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The user link to create. + UserLink user_link = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for BatchCreateUserLinks RPC. +message BatchCreateUserLinksRequest { + // Required. The account or property that all user links in the request are for. + // This field is required. The parent field in the CreateUserLinkRequest + // messages must either be empty or match this field. + // Example format: accounts/1234 + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If notify_new_users is set, then email new users that they've been given + // permissions on the resource. + bool notify_new_users = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The requests specifying the user links to create. + // A maximum of 1000 user links can be created in a batch. + repeated CreateUserLinkRequest requests = 3; +} + +// Response message for BatchCreateUserLinks RPC. +message BatchCreateUserLinksResponse { + // The user links created. + repeated UserLink user_links = 1; +} + +// Request message for UpdateUserLink RPC. +message UpdateUserLinkRequest { + // Required. The user link to update. + UserLink user_link = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for BatchUpdateUserLinks RPC. +message BatchUpdateUserLinksRequest { + // Required. The account or property that all user links in the request are + // for. The parent field in the UpdateUserLinkRequest messages must either be + // empty or match this field. + // Example format: accounts/1234 + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The requests specifying the user links to update. + // A maximum of 1000 user links can be updated in a batch. + repeated UpdateUserLinkRequest requests = 2; +} + +// Response message for BatchUpdateUserLinks RPC. +message BatchUpdateUserLinksResponse { + // The user links updated. + repeated UserLink user_links = 1; +} + +// Request message for DeleteUserLink RPC. +message DeleteUserLinkRequest { + // Required. Example format: accounts/1234/userLinks/5678 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/UserLink" + } + ]; +} + +// Request message for BatchDeleteUserLinks RPC. +message BatchDeleteUserLinksRequest { + // Required. The account or property that all user links in the request are + // for. The parent of all values for user link names to delete must match this + // field. + // Example format: accounts/1234 + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The requests specifying the user links to update. + // A maximum of 1000 user links can be updated in a batch. + repeated DeleteUserLinkRequest requests = 2; +} + +// Request message for GetWebDataStream RPC. +message GetWebDataStreamRequest { + // Required. The name of the web data stream to lookup. + // Format: properties/{property_id}/webDataStreams/{stream_id} + // Example: "properties/123/webDataStreams/456" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/WebDataStream" + } + ]; +} + +// Request message for DeleteWebDataStream RPC. +message DeleteWebDataStreamRequest { + // Required. The name of the web data stream to delete. + // Format: properties/{property_id}/webDataStreams/{stream_id} + // Example: "properties/123/webDataStreams/456" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/WebDataStream" + } + ]; +} + +// Request message for UpdateWebDataStream RPC. +message UpdateWebDataStreamRequest { + // Required. The web stream to update. + // The `name` field is used to identify the web stream to be updated. + WebDataStream web_data_stream = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for CreateWebDataStream RPC. +message CreateWebDataStreamRequest { + // Required. The web stream to create. + WebDataStream web_data_stream = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The parent resource where this web data stream will be created. + // Format: properties/123 + string parent = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/WebDataStream" + } + ]; +} + +// Request message for ListWebDataStreams RPC. +message ListWebDataStreamsRequest { + // Required. The name of the parent property. + // For example, to list results of web streams under the property with Id + // 123: "properties/123" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/WebDataStream" + } + ]; + + // The maximum number of resources to return. + // If unspecified, at most 50 resources will be returned. + // The maximum value is 200; (higher values will be coerced to the maximum) + int32 page_size = 2; + + // A page token, received from a previous `ListWebDataStreams` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListWebDataStreams` must + // match the call that provided the page token. + string page_token = 3; +} + +// Request message for ListWebDataStreams RPC. +message ListWebDataStreamsResponse { + // Results that matched the filter criteria and were accessible to the caller. + repeated WebDataStream web_data_streams = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetIosAppDataStream RPC. +message GetIosAppDataStreamRequest { + // Required. The name of the iOS app data stream to lookup. + // Format: properties/{property_id}/iosAppDataStreams/{stream_id} + // Example: "properties/123/iosAppDataStreams/456" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/IosAppDataStream" + } + ]; +} + +// Request message for DeleteIosAppDataStream RPC. +message DeleteIosAppDataStreamRequest { + // Required. The name of the iOS app data stream to delete. + // Format: properties/{property_id}/iosAppDataStreams/{stream_id} + // Example: "properties/123/iosAppDataStreams/456" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/IosAppDataStream" + } + ]; +} + +// Request message for UpdateIosAppDataStream RPC. +message UpdateIosAppDataStreamRequest { + // Required. The iOS app stream to update. + // The `name` field is used to identify the iOS app stream to be updated. + IosAppDataStream ios_app_data_stream = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for CreateIosAppDataStream RPC. +message CreateIosAppDataStreamRequest { + // Required. The iOS app data stream to create. + IosAppDataStream ios_app_data_stream = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The parent resource where this ios app data stream will be created. + // Format: properties/123 + string parent = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/IosAppDataStream" + } + ]; +} + +// Request message for ListIosAppDataStreams RPC. +message ListIosAppDataStreamsRequest { + // Required. The name of the parent property. + // For example, to list results of app streams under the property with Id + // 123: "properties/123" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/IosAppDataStream" + } + ]; + + // The maximum number of resources to return. + // If unspecified, at most 50 resources will be returned. + // The maximum value is 200; (higher values will be coerced to the maximum) + int32 page_size = 2; + + // A page token, received from a previous `ListIosAppDataStreams` + // call. Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListIosAppDataStreams` + // must match the call that provided the page token. + string page_token = 3; +} + +// Request message for ListIosAppDataStreams RPC. +message ListIosAppDataStreamsResponse { + // Results that matched the filter criteria and were accessible to the caller. + repeated IosAppDataStream ios_app_data_streams = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetAndroidAppDataStream RPC. +message GetAndroidAppDataStreamRequest { + // Required. The name of the android app data stream to lookup. + // Format: properties/{property_id}/androidAppDataStreams/{stream_id} + // Example: "properties/123/androidAppDataStreams/456" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/AndroidAppDataStream" + } + ]; +} + +// Request message for DeleteAndroidAppDataStream RPC. +message DeleteAndroidAppDataStreamRequest { + // Required. The name of the android app data stream to delete. + // Format: properties/{property_id}/androidAppDataStreams/{stream_id} + // Example: "properties/123/androidAppDataStreams/456" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/AndroidAppDataStream" + } + ]; +} + +// Request message for UpdateAndroidAppDataStream RPC. +message UpdateAndroidAppDataStreamRequest { + // Required. The android app stream to update. + // The `name` field is used to identify the android app stream to be updated. + AndroidAppDataStream android_app_data_stream = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for CreateAndroidAppDataStream RPC. +message CreateAndroidAppDataStreamRequest { + // Required. The android app stream to create. + AndroidAppDataStream android_app_data_stream = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The parent resource where this android app data stream will be created. + // Format: properties/123 + string parent = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/AndroidAppDataStream" + } + ]; +} + +// Request message for ListAndroidAppDataStreams RPC. +message ListAndroidAppDataStreamsRequest { + // Required. The name of the parent property. + // For example, to limit results to app streams under the property with Id + // 123: "properties/123" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/AndroidAppDataStream" + } + ]; + + // The maximum number of resources to return. + // + // If unspecified, at most 50 resources will be returned. + // The maximum value is 200; (higher values will be coerced to the maximum) + int32 page_size = 2; + + // A page token, received from a previous call. Provide this to + // retrieve the subsequent page. + // When paginating, all other parameters provided to + // `ListAndroidAppDataStreams` must match the call that provided the page + // token. + string page_token = 3; +} + +// Request message for ListAndroidDataStreams RPC. +message ListAndroidAppDataStreamsResponse { + // Results that matched the filter criteria and were accessible to the caller. + repeated AndroidAppDataStream android_app_data_streams = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetEnhancedMeasurementSettings RPC. +message GetEnhancedMeasurementSettingsRequest { + // Required. The name of the settings to lookup. + // Format: + // properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings + // Example: "properties/1000/webDataStreams/2000/enhancedMeasurementSettings" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/EnhancedMeasurementSettings" + } + ]; +} + +// Request message for UpdateEnhancedMeasurementSettings RPC. +message UpdateEnhancedMeasurementSettingsRequest { + // Required. The settings to update. + // The `name` field is used to identify the settings to be updated. + EnhancedMeasurementSettings enhanced_measurement_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for CreateFirebaseLink RPC +message CreateFirebaseLinkRequest { + // Required. Format: properties/{property_id} + // Example: properties/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/FirebaseLink" + } + ]; + + // Required. The Firebase link to create. + FirebaseLink firebase_link = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateFirebaseLink RPC +message UpdateFirebaseLinkRequest { + // Required. The Firebase link to update. + FirebaseLink firebase_link = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for DeleteFirebaseLink RPC +message DeleteFirebaseLinkRequest { + // Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} + // Example: properties/1234/firebaseLinks/5678 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/FirebaseLink" + } + ]; +} + +// Request message for ListFirebaseLinks RPC +message ListFirebaseLinksRequest { + // Required. Format: properties/{property_id} + // Example: properties/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/FirebaseLink" + } + ]; +} + +// Response message for ListFirebaseLinks RPC +message ListFirebaseLinksResponse { + // List of FirebaseLinks. This will have at most one value. + repeated FirebaseLink firebase_links = 1; +} + +// Request message for GetGlobalSiteTag RPC. +message GetGlobalSiteTagRequest { + // Required. The name of the site tag to lookup. + // Note that site tags are singletons and do not have unique IDs. + // Format: properties/{property_id}/webDataStreams/{stream_id}/globalSiteTag + // Example: "properties/123/webDataStreams/456/globalSiteTag" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/GlobalSiteTag" + } + ]; +} + +// Request message for CreateGoogleAdsLink RPC +message CreateGoogleAdsLinkRequest { + // Required. Example format: properties/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/GoogleAdsLink" + } + ]; + + // Required. The GoogleAdsLink to create. + GoogleAdsLink google_ads_link = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateGoogleAdsLink RPC +message UpdateGoogleAdsLinkRequest { + // The GoogleAdsLink to update + GoogleAdsLink google_ads_link = 1; + + // The list of fields to be updated. Omitted fields will not be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for DeleteGoogleAdsLink RPC. +message DeleteGoogleAdsLinkRequest { + // Required. Example format: properties/1234/googleAdsLinks/5678 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/GoogleAdsLink" + } + ]; +} + +// Request message for ListGoogleAdsLinks RPC. +message ListGoogleAdsLinksRequest { + // Required. Example format: properties/1234 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "analyticsadmin.googleapis.com/GoogleAdsLink" + } + ]; + + // The maximum number of resources to return. + // If unspecified, at most 50 resources will be returned. + // The maximum value is 200 (higher values will be coerced to the maximum). + int32 page_size = 2; + + // A page token, received from a previous `ListGoogleAdsLinks` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListGoogleAdsLinks` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message for ListGoogleAdsLinks RPC. +message ListGoogleAdsLinksResponse { + // List of GoogleAdsLinks. + repeated GoogleAdsLink google_ads_links = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetDataSharingSettings RPC. +message GetDataSharingSettingsRequest { + // Required. The name of the settings to lookup. + // Format: accounts/{account}/dataSharingSettings + // Example: "accounts/1000/dataSharingSettings" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "analyticsadmin.googleapis.com/DataSharingSettings" + } + ]; +} diff --git a/protos/google/analytics/admin/v1alpha/resources.proto b/protos/google/analytics/admin/v1alpha/resources.proto new file mode 100644 index 0000000..79bc304 --- /dev/null +++ b/protos/google/analytics/admin/v1alpha/resources.proto @@ -0,0 +1,571 @@ +// 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.analytics.admin.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "google.golang.org/genproto/googleapis/analytics/admin/v1alpha;admin"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.analytics.admin.v1alpha"; + +// A resource message representing a Google Analytics account. +message Account { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/Account" + pattern: "accounts/{account}" + }; + + // Output only. Resource name of this account. + // Format: accounts/{account} + // Example: "accounts/100" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this account was originally created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when account payload fields were last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Human-readable display name for this account. + string display_name = 4 [(google.api.field_behavior) = REQUIRED]; + + // Country of business. Must be a non-deprecated code for a UN M.49 region. + // https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html + string country_code = 5; + + // Output only. Indicates whether this Account is soft-deleted or not. Deleted + // accounts are excluded from List results unless specifically requested. + bool deleted = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A resource message representing a Google Analytics App+Web property. +message Property { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/Property" + pattern: "properties/{property}" + }; + + // Output only. Resource name of this property. + // Format: properties/{property_id} + // Example: "properties/1000" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when the entity was originally created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when entity payload fields were last updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Resource name of this property's logical parent. + // + // Note: The Property-Moving UI can be used to change the parent. + // Format: accounts/{account} + // Example: "accounts/100" + string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. Human-readable display name for this property. + // + // The max allowed display name length is 100 UTF-16 code units. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Industry associated with this property + // Example: AUTOMOTIVE, FOOD_AND_DRINK + IndustryCategory industry_category = 6; + + // Reporting Time Zone, used as the day boundary for reports, regardless of + // where the data originates. If the time zone honors DST, Analytics will + // automatically adjust for the changes. + // + // NOTE: Changing the time zone only affects data going forward, and is not + // applied retroactively. + // + // Format: https://www.iana.org/time-zones + // Example: "America/Los_Angeles" + string time_zone = 7; + + // The currency type used in reports involving monetary values. + // + // + // Format: https://en.wikipedia.org/wiki/ISO_4217 + // Examples: "USD", "EUR", "JPY" + string currency_code = 8; + + // Output only. Indicates whether this Property is soft-deleted or not. Deleted properties + // are excluded from List results unless specifically requested. + bool deleted = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A resource message representing a Google Analytics Android app stream. +message AndroidAppDataStream { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/AndroidAppDataStream" + pattern: "properties/{property}/androidAppDataStreams/{android_app_data_stream}" + }; + + // Output only. Resource name of this Data Stream. + // Format: properties/{property_id}/androidAppDataStreams/{stream_id} + // Example: "properties/1000/androidAppDataStreams/2000" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the corresponding Android app in Firebase, if any. + // This ID can change if the Android app is deleted and recreated. + string firebase_app_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this stream was originally created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when stream payload fields were last updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The package name for the app being measured. + // Example: "com.example.myandroidapp" + string package_name = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // Human-readable display name for the Data Stream. + // + // The max allowed display name length is 255 UTF-16 code units. + string display_name = 6; +} + +// A resource message representing a Google Analytics IOS app stream. +message IosAppDataStream { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/IosAppDataStream" + pattern: "properties/{property}/iosAppDataStreams/{ios_app_data_stream}" + }; + + // Output only. Resource name of this Data Stream. + // Format: properties/{property_id}/iosAppDataStreams/{stream_id} + // Example: "properties/1000/iosAppDataStreams/2000" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the corresponding iOS app in Firebase, if any. + // This ID can change if the iOS app is deleted and recreated. + string firebase_app_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this stream was originally created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when stream payload fields were last updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The Apple App Store Bundle ID for the app + // Example: "com.example.myiosapp" + string bundle_id = 5 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED + ]; + + // Human-readable display name for the Data Stream. + // + // The max allowed display name length is 255 UTF-16 code units. + string display_name = 6; +} + +// A resource message representing a Google Analytics web stream. +message WebDataStream { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/WebDataStream" + pattern: "properties/{property}/webDataStreams/{web_data_stream}" + }; + + // Output only. Resource name of this Data Stream. + // Format: properties/{property_id}/webDataStreams/{stream_id} + // Example: "properties/1000/webDataStreams/2000" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Analytics "Measurement ID", without the "G-" prefix. + // Example: "G-1A2BCD345E" would just be "1A2BCD345E" + string measurement_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the corresponding web app in Firebase, if any. + // This ID can change if the web app is deleted and recreated. + string firebase_app_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this stream was originally created. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when stream payload fields were last updated. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Domain name of the web app being measured, or empty. + // Example: "http://www.google.com", "https://www.google.com" + string default_uri = 6 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. Human-readable display name for the Data Stream. + // + // The max allowed display name length is 100 UTF-16 code units. + string display_name = 7 [(google.api.field_behavior) = REQUIRED]; +} + +// A resource message representing a user's permissions on an Account or +// Property resource. +message UserLink { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/UserLink" + pattern: "accounts/{account}/userLinks/{user_link}" + pattern: "properties/{property}/userLinks/{user_link}" + }; + + // Example format: properties/1234/userLinks/5678 + string name = 1; + + // Email address of the user to link + string email_address = 2; + + // Roles directly assigned to this user for this account or property. + // + // Valid values: + // predefinedRoles/read + // predefinedRoles/collaborate + // predefinedRoles/edit + // predefinedRoles/manage-users + // + // Excludes roles that are inherited from a higher-level entity, group, + // or organization admin role. + // + // A UserLink that is updated to have an empty list of direct_roles will be + // deleted. + repeated string direct_roles = 3; +} + +// Read-only resource used to summarize a principal's effective roles. +message AuditUserLink { + // Example format: properties/1234/userLinks/5678 + string name = 1; + + // Email address of the linked user + string email_address = 2; + + // Roles directly assigned to this user for this entity. + // + // Format: predefinedRoles/read + // + // Excludes roles that are inherited from an account (if this is for a + // property), group, or organization admin role. + repeated string direct_roles = 3; + + // Union of all permissions a user has at this account or property (includes + // direct permissions, group-inherited permissions, etc.). + // + // Format: predefinedRoles/read + repeated string effective_roles = 4; +} + +// Singleton resource under a WebDataStream, configuring measurement of +// additional site interactions and content. +message EnhancedMeasurementSettings { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/EnhancedMeasurementSettings" + pattern: "properties/{property}/webDataStreams/{web_data_stream}/enhancedMeasurementSettings" + }; + + // Output only. Resource name of this Data Stream. + // Format: + // properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings + // Example: "properties/1000/webDataStreams/2000/enhancedMeasurementSettings" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Indicates whether Enhanced Measurement Settings will be used to + // automatically measure interactions and content on this web stream. + // + // Changing this value does not affect the settings themselves, but determines + // whether they are respected. + bool stream_enabled = 2; + + // Output only. If enabled, capture a page view event each time a page loads or the + // website changes the browser history state. + bool page_views_enabled = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If enabled, capture scroll events each time a visitor gets to the bottom of + // a page. + bool scrolls_enabled = 4; + + // If enabled, capture an outbound click event each time a visitor clicks a + // link that leads them away from your domain. + bool outbound_clicks_enabled = 5; + + // Capture events when your visitors view content on your site that has + // structured data (eg, articles, blog posts, product details screens, etc.). + bool content_views_enabled = 6; + + // If enabled, capture a view search results event each time a visitor + // performs a search on your site (based on a query parameter). + bool site_search_enabled = 7; + + // If enabled, capture a view search results event each time a visitor + // interacts with a form on your site. + bool form_interactions_enabled = 8; + + // If enabled, capture video play, progress, and complete events as visitors + // view embedded videos on your site. + bool video_engagement_enabled = 9; + + // If enabled, capture a file download event each time a link is clicked with + // a common document, compressed file, application, video, or audio extension. + bool file_downloads_enabled = 10; + + // If enabled, capture a click event each time a visitor clicks a link or + // element that has data attributes beginning with "data-ga". + bool data_tagged_element_clicks_enabled = 11; + + // If enabled, capture a page view event each time a page loads. + bool page_loads_enabled = 12; + + // If enabled, capture a page view event each time the website changes the + // browser history state. + bool page_changes_enabled = 13; + + // Capture events when your visitors view content on your site that has + // articles or blog posts. + bool articles_and_blogs_enabled = 14; + + // Capture events when your visitors view content on your site that has + // product details screens, etc. + bool products_and_ecommerce_enabled = 15; + + // Required. URL query parameters to interpret as site search parameters. + // Max length is 1024 characters. Must not be empty. + string search_query_parameter = 16 [(google.api.field_behavior) = REQUIRED]; + + // Additional URL query parameters. + // Max length is 1024 characters. + string url_query_parameter = 17; + + // Domains to exclude from measurement. Max length is 1024 characters. + string excluded_domains = 18; +} + +// A link between an App+Web property and a Firebase project. +message FirebaseLink { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/FirebaseLink" + pattern: "properties/{property}/firebaseLinks/{firebase_link}" + }; + + // Output only. Example format: properties/1234/firebaseLinks/5678 + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Firebase project resource name. When creating a FirebaseLink, you may + // provide this resource name using either a project number or project ID. + // Once this resource has been created, returned FirebaseLinks will always + // have a project_name that contains a project number. + // + // Format: 'projects/{project number}' + // Example: 'projects/1234' + string project = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Time when this FirebaseLink was originally created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Maximum user access to the App + Web property allowed to admins of + // the linked Firebase project. + MaximumUserAccess maximum_user_access = 4; +} + +// Read-only resource with the tag for sending data from a website to a +// WebDataStream. +message GlobalSiteTag { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/GlobalSiteTag" + pattern: "properties/{property}/globalSiteTag" + }; + + // Immutable. JavaScript code snippet to be pasted as the first item into the head tag of + // every webpage to measure. + string snippet = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// A link between an App+Web property and a Google Ads account. +message GoogleAdsLink { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/GoogleAdsLink" + pattern: "properties/{property}/googleAdsLinks/{google_ads_link}" + }; + + // Output only. Format: properties/{propertyId}/googleAdsLinks/{googleAdsLinkId} + // + // Note: googleAdsLinkId is not the Google Ads customer ID. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Format: properties/{propertyId} + string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Google Ads customer ID. + string customer_id = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. If true, this link is for a Google Ads manager account. + bool can_manage_clients = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Enable personalized advertising features with this integration. + // Automatically publish my Google Analytics audience lists and Google + // Analytics remarketing events/parameters to the linked Google Ads account. + // If this field is not set on create/update it will be defaulted to true. + google.protobuf.BoolValue ads_personalization_enabled = 5; + + // Output only. Email address of the user that created the link. + // An empty string will be returned if the email address can't be retrieved. + string email_address = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this link was originally created. + google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time when this link was last updated. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A resource message representing data sharing settings of a Google Analytics +// account. +message DataSharingSettings { + option (google.api.resource) = { + type: "analyticsadmin.googleapis.com/DataSharingSettings" + pattern: "accounts/{account}/dataSharingSettings" + }; + + // Output only. Resource name. + // Format: accounts/{account}/dataSharingSettings + // Example: "accounts/1000/dataSharingSettings" + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows Google support to access the data in order to help troubleshoot + // issues. + bool sharing_with_google_support_enabled = 2; + + // Allows Google sales teams that are assigned to the customer to access the + // data in order to suggest configuration changes to improve results. + // Sales team restrictions still apply when enabled. + bool sharing_with_google_assigned_sales_enabled = 3; + + // Allows any of Google sales to access the data in order to suggest + // configuration changes to improve results. + bool sharing_with_google_any_sales_enabled = 4; + + // Allows Google to use the data to improve other Google products or services. + bool sharing_with_google_products_enabled = 5; + + // Allows Google to share the data anonymously in aggregate form with others. + bool sharing_with_others_enabled = 6; +} + +// The category selected for this property, used for industry benchmarking. +enum IndustryCategory { + // Industry category unspecified + INDUSTRY_CATEGORY_UNSPECIFIED = 0; + + // Automotive + AUTOMOTIVE = 1; + + // Business and industrial markets + BUSINESS_AND_INDUSTRIAL_MARKETS = 2; + + // Finance + FINANCE = 3; + + // Healthcare + HEALTHCARE = 4; + + // Technology + TECHNOLOGY = 5; + + // Travel + TRAVEL = 6; + + // Other + OTHER = 7; + + // Arts and entertainment + ARTS_AND_ENTERTAINMENT = 8; + + // Beauty and fitness + BEAUTY_AND_FITNESS = 9; + + // Books and literature + BOOKS_AND_LITERATURE = 10; + + // Food and drink + FOOD_AND_DRINK = 11; + + // Games + GAMES = 12; + + // Hobbies and leisure + HOBBIES_AND_LEISURE = 13; + + // Home and garden + HOME_AND_GARDEN = 14; + + // Internet and telecom + INTERNET_AND_TELECOM = 15; + + // Law and government + LAW_AND_GOVERNMENT = 16; + + // News + NEWS = 17; + + // Online communities + ONLINE_COMMUNITIES = 18; + + // People and society + PEOPLE_AND_SOCIETY = 19; + + // Pets and animals + PETS_AND_ANIMALS = 20; + + // Real estate + REAL_ESTATE = 21; + + // Reference + REFERENCE = 22; + + // Science + SCIENCE = 23; + + // Sports + SPORTS = 24; + + // Jobs and education + JOBS_AND_EDUCATION = 25; + + // Shopping + SHOPPING = 26; +} + +// Maximum access settings that Firebase user receive on the linked Analytics +// property. +enum MaximumUserAccess { + // Unspecified maximum user access. + MAXIMUM_USER_ACCESS_UNSPECIFIED = 0; + + // Firebase users have no access to the Analytics property. + NO_ACCESS = 1; + + // Firebase users have Read & Analyze access to the Analytics property. + READ_AND_ANALYZE = 2; + + // Firebase users have edit access to the Analytics property, but may not + // manage the Firebase link. + EDITOR_WITHOUT_LINK_MANAGEMENT = 3; + + // Firebase users have edit access to the Analytics property and may manage + // the Firebase link. + EDITOR_INCLUDING_LINK_MANAGEMENT = 4; +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..c518d05 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,24 @@ +// 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 +// +// 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 v1alpha from './v1alpha'; +const AnalyticsAdminServiceClient = v1alpha.AnalyticsAdminServiceClient; +export {v1alpha, AnalyticsAdminServiceClient}; +export default {v1alpha, AnalyticsAdminServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/src/v1alpha/analytics_admin_service_client.ts b/src/v1alpha/analytics_admin_service_client.ts new file mode 100644 index 0000000..3271197 --- /dev/null +++ b/src/v1alpha/analytics_admin_service_client.ts @@ -0,0 +1,5064 @@ +// 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 +// +// 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 gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import * as path from 'path'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import * as gapicConfig from './analytics_admin_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service Interface for the Analytics Admin API (App+Web). + * @class + * @memberof v1alpha + */ +export class AnalyticsAdminServiceClient { + 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}; + analyticsAdminServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AnalyticsAdminServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @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. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof AnalyticsAdminServiceClient; + const servicePath = opts && opts.servicePath ? + opts.servicePath : + ((opts && opts.apiEndpoint) ? opts.apiEndpoint : + staticMembers.servicePath); + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); + opts.clientConfig = opts.clientConfig || {}; + + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the AnalyticsAdminServiceClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof AnalyticsAdminServiceClient).scopes; + 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); + + // 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}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); + this._protos = this._gaxGrpc.loadProto( + opts.fallback ? + // eslint-disable-next-line @typescript-eslint/no-var-requires + require("../../protos/protos.json") : + nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + accountPathTemplate: new this._gaxModule.PathTemplate( + 'accounts/{account}' + ), + accountUserLinkPathTemplate: new this._gaxModule.PathTemplate( + 'accounts/{account}/userLinks/{user_link}' + ), + androidAppDataStreamPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/androidAppDataStreams/{android_app_data_stream}' + ), + dataSharingSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'accounts/{account}/dataSharingSettings' + ), + enhancedMeasurementSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/webDataStreams/{web_data_stream}/enhancedMeasurementSettings' + ), + firebaseLinkPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/firebaseLinks/{firebase_link}' + ), + globalSiteTagPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/globalSiteTag' + ), + googleAdsLinkPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/googleAdsLinks/{google_ads_link}' + ), + iosAppDataStreamPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/iosAppDataStreams/{ios_app_data_stream}' + ), + propertyPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}' + ), + propertyUserLinkPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/userLinks/{user_link}' + ), + webDataStreamPathTemplate: new this._gaxModule.PathTemplate( + 'properties/{property}/webDataStreams/{web_data_stream}' + ), + }; + + // 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 = { + listAccounts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'accounts'), + listProperties: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'properties'), + listUserLinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'userLinks'), + auditUserLinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'userLinks'), + listWebDataStreams: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'webDataStreams'), + listIosAppDataStreams: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'iosAppDataStreams'), + listAndroidAppDataStreams: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'androidAppDataStreams'), + listGoogleAdsLinks: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'googleAdsLinks') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.analytics.admin.v1alpha.AnalyticsAdminService', 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.analyticsAdminServiceStub) { + return this.analyticsAdminServiceStub; + } + + // Put together the "service stub" for + // google.analytics.admin.v1alpha.AnalyticsAdminService. + this.analyticsAdminServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.analytics.admin.v1alpha.AnalyticsAdminService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.analytics.admin.v1alpha.AnalyticsAdminService, + 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 analyticsAdminServiceStubMethods = + ['getAccount', 'listAccounts', 'deleteAccount', 'updateAccount', 'provisionAccountTicket', 'getProperty', 'listProperties', 'createProperty', 'deleteProperty', 'updateProperty', 'getUserLink', 'batchGetUserLinks', 'listUserLinks', 'auditUserLinks', 'createUserLink', 'batchCreateUserLinks', 'updateUserLink', 'batchUpdateUserLinks', 'deleteUserLink', 'batchDeleteUserLinks', 'getWebDataStream', 'deleteWebDataStream', 'updateWebDataStream', 'createWebDataStream', 'listWebDataStreams', 'getIosAppDataStream', 'deleteIosAppDataStream', 'updateIosAppDataStream', 'createIosAppDataStream', 'listIosAppDataStreams', 'getAndroidAppDataStream', 'deleteAndroidAppDataStream', 'updateAndroidAppDataStream', 'createAndroidAppDataStream', 'listAndroidAppDataStreams', 'getEnhancedMeasurementSettings', 'updateEnhancedMeasurementSettings', 'createFirebaseLink', 'updateFirebaseLink', 'deleteFirebaseLink', 'listFirebaseLinks', 'getGlobalSiteTag', 'createGoogleAdsLink', 'updateGoogleAdsLink', 'deleteGoogleAdsLink', 'listGoogleAdsLinks', 'getDataSharingSettings']; + for (const methodName of analyticsAdminServiceStubMethods) { + const callPromise = this.analyticsAdminServiceStub.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 apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.analyticsAdminServiceStub; + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'analyticsadmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'analyticsadmin.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/analytics.edit', + 'https://www.googleapis.com/auth/analytics.manage.users', + 'https://www.googleapis.com/auth/analytics.manage.users.readonly', + 'https://www.googleapis.com/auth/analytics.readonly' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getAccount( + request: protos.google.analytics.admin.v1alpha.IGetAccountRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IGetAccountRequest|undefined, {}|undefined + ]>; + getAccount( + request: protos.google.analytics.admin.v1alpha.IGetAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IGetAccountRequest|null|undefined, + {}|null|undefined>): void; + getAccount( + request: protos.google.analytics.admin.v1alpha.IGetAccountRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IGetAccountRequest|null|undefined, + {}|null|undefined>): void; +/** + * Lookup for a single Account. + * Throws "Target not found" if no such account found, or if caller does not + * have permissions to access it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the account to lookup. + * Format: accounts/{account} + * Example: "accounts/100" + * @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 [Account]{@link google.analytics.admin.v1alpha.Account}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getAccount( + request: protos.google.analytics.admin.v1alpha.IGetAccountRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IGetAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IGetAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IGetAccountRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getAccount(request, options, callback); + } + deleteAccount( + request: protos.google.analytics.admin.v1alpha.IDeleteAccountRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAccountRequest|undefined, {}|undefined + ]>; + deleteAccount( + request: protos.google.analytics.admin.v1alpha.IDeleteAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAccountRequest|null|undefined, + {}|null|undefined>): void; + deleteAccount( + request: protos.google.analytics.admin.v1alpha.IDeleteAccountRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAccountRequest|null|undefined, + {}|null|undefined>): void; +/** + * Marks target Account as soft-deleted (ie: "trashed") and returns it. + * + * This API does not have a method to restore soft-deleted accounts. + * However, they can be restored using the Trash Can UI. + * + * If the accounts are not restored before the expiration time, the account + * and all child resources (eg: Properties, GoogleAdsLinks, Streams, + * UserLinks) will be permanently purged. + * https://support.google.com/analytics/answer/6154772 + * + * Returns an error if the target is not found. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Account to soft-delete. + * Format: accounts/{account} + * Example: "accounts/100" + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteAccount( + request: protos.google.analytics.admin.v1alpha.IDeleteAccountRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAccountRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteAccount(request, options, callback); + } + updateAccount( + request: protos.google.analytics.admin.v1alpha.IUpdateAccountRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IUpdateAccountRequest|undefined, {}|undefined + ]>; + updateAccount( + request: protos.google.analytics.admin.v1alpha.IUpdateAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IUpdateAccountRequest|null|undefined, + {}|null|undefined>): void; + updateAccount( + request: protos.google.analytics.admin.v1alpha.IUpdateAccountRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IUpdateAccountRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates an account. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.Account} request.account + * Required. The account to update. + * The account's `name` field is used to identify the account. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [Account]{@link google.analytics.admin.v1alpha.Account}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateAccount( + request: protos.google.analytics.admin.v1alpha.IUpdateAccountRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IUpdateAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IUpdateAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAccount, + protos.google.analytics.admin.v1alpha.IUpdateAccountRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'account.name': request.account!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAccount(request, options, callback); + } + provisionAccountTicket( + request: protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse, + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest|undefined, {}|undefined + ]>; + provisionAccountTicket( + request: protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse, + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest|null|undefined, + {}|null|undefined>): void; + provisionAccountTicket( + request: protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse, + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest|null|undefined, + {}|null|undefined>): void; +/** + * Requests a ticket for creating an account. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.Account} request.account + * The account to create. + * @param {string} request.redirectUri + * Redirect URI where the user will be sent after accepting Terms of Service. + * Must be configured in Developers Console as a Redirect URI + * @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 [ProvisionAccountTicketResponse]{@link google.analytics.admin.v1alpha.ProvisionAccountTicketResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + provisionAccountTicket( + request: protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse, + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse, + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse, + protos.google.analytics.admin.v1alpha.IProvisionAccountTicketRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.provisionAccountTicket(request, options, callback); + } + getProperty( + request: protos.google.analytics.admin.v1alpha.IGetPropertyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IGetPropertyRequest|undefined, {}|undefined + ]>; + getProperty( + request: protos.google.analytics.admin.v1alpha.IGetPropertyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IGetPropertyRequest|null|undefined, + {}|null|undefined>): void; + getProperty( + request: protos.google.analytics.admin.v1alpha.IGetPropertyRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IGetPropertyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Lookup for a single "App+Web" Property. + * + * Throws "Target not found" if no such property found, if property is not + * of the type "App+Web", or if caller does not have permissions to access it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the property to lookup. + * Format: properties/{property_id} + * Example: "properties/1000" + * @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 [Property]{@link google.analytics.admin.v1alpha.Property}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProperty( + request: protos.google.analytics.admin.v1alpha.IGetPropertyRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IGetPropertyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IGetPropertyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IGetPropertyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getProperty(request, options, callback); + } + createProperty( + request: protos.google.analytics.admin.v1alpha.ICreatePropertyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.ICreatePropertyRequest|undefined, {}|undefined + ]>; + createProperty( + request: protos.google.analytics.admin.v1alpha.ICreatePropertyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.ICreatePropertyRequest|null|undefined, + {}|null|undefined>): void; + createProperty( + request: protos.google.analytics.admin.v1alpha.ICreatePropertyRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.ICreatePropertyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an "App+Web" property with the specified location and attributes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.Property} request.property + * Required. The property to create. + * Note: the supplied property must specify its parent. + * @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 [Property]{@link google.analytics.admin.v1alpha.Property}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProperty( + request: protos.google.analytics.admin.v1alpha.ICreatePropertyRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.ICreatePropertyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.ICreatePropertyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.ICreatePropertyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.createProperty(request, options, callback); + } + deleteProperty( + request: protos.google.analytics.admin.v1alpha.IDeletePropertyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeletePropertyRequest|undefined, {}|undefined + ]>; + deleteProperty( + request: protos.google.analytics.admin.v1alpha.IDeletePropertyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeletePropertyRequest|null|undefined, + {}|null|undefined>): void; + deleteProperty( + request: protos.google.analytics.admin.v1alpha.IDeletePropertyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeletePropertyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Marks target Property as soft-deleted (ie: "trashed") and returns it. + * + * This API does not have a method to restore soft-deleted properties. + * However, they can be restored using the Trash Can UI. + * + * If the properties are not restored before the expiration time, the Property + * and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) + * will be permanently purged. + * https://support.google.com/analytics/answer/6154772 + * + * Returns an error if the target is not found, or is not an App+Web Property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Property to soft-delete. + * Format: properties/{property_id} + * Example: "properties/1000" + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProperty( + request: protos.google.analytics.admin.v1alpha.IDeletePropertyRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeletePropertyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeletePropertyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeletePropertyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteProperty(request, options, callback); + } + updateProperty( + request: protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest|undefined, {}|undefined + ]>; + updateProperty( + request: protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest|null|undefined, + {}|null|undefined>): void; + updateProperty( + request: protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.Property} request.property + * Required. The property to update. + * The property's `name` field is used to identify the property to be + * updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [Property]{@link google.analytics.admin.v1alpha.Property}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProperty( + request: protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty, + protos.google.analytics.admin.v1alpha.IUpdatePropertyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'property.name': request.property!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateProperty(request, options, callback); + } + getUserLink( + request: protos.google.analytics.admin.v1alpha.IGetUserLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IGetUserLinkRequest|undefined, {}|undefined + ]>; + getUserLink( + request: protos.google.analytics.admin.v1alpha.IGetUserLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IGetUserLinkRequest|null|undefined, + {}|null|undefined>): void; + getUserLink( + request: protos.google.analytics.admin.v1alpha.IGetUserLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IGetUserLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets information about a user's link to an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Example format: accounts/1234/userLinks/5678 + * @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 [UserLink]{@link google.analytics.admin.v1alpha.UserLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getUserLink( + request: protos.google.analytics.admin.v1alpha.IGetUserLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IGetUserLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IGetUserLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IGetUserLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getUserLink(request, options, callback); + } + batchGetUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest|undefined, {}|undefined + ]>; + batchGetUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest|null|undefined, + {}|null|undefined>): void; + batchGetUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets information about multiple users' links to an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account or property that all user links in the request are + * for. The parent of all provided values for the 'names' field must match + * this field. + * Example format: accounts/1234 + * @param {string[]} request.names + * Required. The names of the user links to retrieve. + * A maximum of 1000 user links can be retrieved in a batch. + * Format: accounts/{accountId}/userLinks/{userLinkId} + * @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 [BatchGetUserLinksResponse]{@link google.analytics.admin.v1alpha.BatchGetUserLinksResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchGetUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchGetUserLinksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.batchGetUserLinks(request, options, callback); + } + createUserLink( + request: protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest|undefined, {}|undefined + ]>; + createUserLink( + request: protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest|null|undefined, + {}|null|undefined>): void; + createUserLink( + request: protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a user link on an account or property. + * + * If the user with the specified email already has permissions on the + * account or property, then the user's existing permissions will be unioned + * with the permissions specified in the new UserLink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {boolean} [request.notifyNewUser] + * Optional. If notify_new_user is set, then email new user that they've been given + * permissions on the resource. + * @param {google.analytics.admin.v1alpha.UserLink} request.userLink + * Required. The user link to create. + * @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 [UserLink]{@link google.analytics.admin.v1alpha.UserLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createUserLink( + request: protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.ICreateUserLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.createUserLink(request, options, callback); + } + batchCreateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest|undefined, {}|undefined + ]>; + batchCreateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest|null|undefined, + {}|null|undefined>): void; + batchCreateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates information about multiple users' links to an account or property. + * + * This method is transactional. If any UserLink cannot be created, none of + * the UserLinks will be created. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account or property that all user links in the request are for. + * This field is required. The parent field in the CreateUserLinkRequest + * messages must either be empty or match this field. + * Example format: accounts/1234 + * @param {boolean} [request.notifyNewUsers] + * Optional. If notify_new_users is set, then email new users that they've been given + * permissions on the resource. + * @param {number[]} request.requests + * The requests specifying the user links to create. + * A maximum of 1000 user links 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 [BatchCreateUserLinksResponse]{@link google.analytics.admin.v1alpha.BatchCreateUserLinksResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchCreateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.batchCreateUserLinks(request, options, callback); + } + updateUserLink( + request: protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest|undefined, {}|undefined + ]>; + updateUserLink( + request: protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest|null|undefined, + {}|null|undefined>): void; + updateUserLink( + request: protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a user link on an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.UserLink} request.userLink + * Required. The user link to update. + * @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 [UserLink]{@link google.analytics.admin.v1alpha.UserLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateUserLink( + request: protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink, + protos.google.analytics.admin.v1alpha.IUpdateUserLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'user_link.name': request.userLink!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateUserLink(request, options, callback); + } + batchUpdateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest|undefined, {}|undefined + ]>; + batchUpdateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest|null|undefined, + {}|null|undefined>): void; + batchUpdateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates information about multiple users' links to an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account or property that all user links in the request are + * for. The parent field in the UpdateUserLinkRequest messages must either be + * empty or match this field. + * Example format: accounts/1234 + * @param {number[]} request.requests + * The requests specifying the user links to update. + * A maximum of 1000 user links can be updated 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 [BatchUpdateUserLinksResponse]{@link google.analytics.admin.v1alpha.BatchUpdateUserLinksResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchUpdateUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse, + protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.batchUpdateUserLinks(request, options, callback); + } + deleteUserLink( + request: protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest|undefined, {}|undefined + ]>; + deleteUserLink( + request: protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest|null|undefined, + {}|null|undefined>): void; + deleteUserLink( + request: protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a user link on an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Example format: accounts/1234/userLinks/5678 + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteUserLink( + request: protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteUserLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteUserLink(request, options, callback); + } + batchDeleteUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest|undefined, {}|undefined + ]>; + batchDeleteUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest|null|undefined, + {}|null|undefined>): void; + batchDeleteUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes information about multiple users' links to an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account or property that all user links in the request are + * for. The parent of all values for user link names to delete must match this + * field. + * Example format: accounts/1234 + * @param {number[]} request.requests + * The requests specifying the user links to update. + * A maximum of 1000 user links can be updated 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 [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchDeleteUserLinks( + request: protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IBatchDeleteUserLinksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.batchDeleteUserLinks(request, options, callback); + } + getWebDataStream( + request: protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest|undefined, {}|undefined + ]>; + getWebDataStream( + request: protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; + getWebDataStream( + request: protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Lookup for a single WebDataStream + * + * Throws "Target not found" if no such web data stream found, or if the + * caller does not have permissions to access it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the web data stream to lookup. + * Format: properties/{property_id}/webDataStreams/{stream_id} + * Example: "properties/123/webDataStreams/456" + * @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 [WebDataStream]{@link google.analytics.admin.v1alpha.WebDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getWebDataStream( + request: protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IGetWebDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getWebDataStream(request, options, callback); + } + deleteWebDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest|undefined, {}|undefined + ]>; + deleteWebDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; + deleteWebDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a web stream on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the web data stream to delete. + * Format: properties/{property_id}/webDataStreams/{stream_id} + * Example: "properties/123/webDataStreams/456" + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteWebDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteWebDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteWebDataStream(request, options, callback); + } + updateWebDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest|undefined, {}|undefined + ]>; + updateWebDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; + updateWebDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a web stream on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.WebDataStream} request.webDataStream + * Required. The web stream to update. + * The `name` field is used to identify the web stream to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [WebDataStream]{@link google.analytics.admin.v1alpha.WebDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateWebDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.IUpdateWebDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'web_data_stream.name': request.webDataStream!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateWebDataStream(request, options, callback); + } + createWebDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest|undefined, {}|undefined + ]>; + createWebDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; + createWebDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a web stream with the specified location and attributes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.WebDataStream} request.webDataStream + * Required. The web stream to create. + * @param {string} request.parent + * Required. The parent resource where this web data stream will be created. + * Format: properties/123 + * @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 [WebDataStream]{@link google.analytics.admin.v1alpha.WebDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createWebDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream, + protos.google.analytics.admin.v1alpha.ICreateWebDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.createWebDataStream(request, options, callback); + } + getIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest|undefined, {}|undefined + ]>; + getIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + getIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Lookup for a single IosAppDataStream + * + * Throws "Target not found" if no such iOS app data stream found, or if the + * caller does not have permissions to access it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the iOS app data stream to lookup. + * Format: properties/{property_id}/iosAppDataStreams/{stream_id} + * Example: "properties/123/iosAppDataStreams/456" + * @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 [IosAppDataStream]{@link google.analytics.admin.v1alpha.IosAppDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IGetIosAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getIosAppDataStream(request, options, callback); + } + deleteIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest|undefined, {}|undefined + ]>; + deleteIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + deleteIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes an iOS app stream on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the iOS app data stream to delete. + * Format: properties/{property_id}/iosAppDataStreams/{stream_id} + * Example: "properties/123/iosAppDataStreams/456" + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteIosAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteIosAppDataStream(request, options, callback); + } + updateIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest|undefined, {}|undefined + ]>; + updateIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + updateIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates an iOS app stream on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.IosAppDataStream} request.iosAppDataStream + * Required. The iOS app stream to update. + * The `name` field is used to identify the iOS app stream to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [IosAppDataStream]{@link google.analytics.admin.v1alpha.IosAppDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateIosAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'ios_app_data_stream.name': request.iosAppDataStream!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateIosAppDataStream(request, options, callback); + } + createIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest|undefined, {}|undefined + ]>; + createIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + createIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an iOS app data stream with the specified location and attributes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.IosAppDataStream} request.iosAppDataStream + * Required. The iOS app data stream to create. + * @param {string} request.parent + * Required. The parent resource where this ios app data stream will be created. + * Format: properties/123 + * @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 [IosAppDataStream]{@link google.analytics.admin.v1alpha.IosAppDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createIosAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateIosAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.createIosAppDataStream(request, options, callback); + } + getAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest|undefined, {}|undefined + ]>; + getAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + getAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Lookup for a single AndroidAppDataStream + * + * Throws "Target not found" if no such android app data stream found, or if + * the caller does not have permissions to access it. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the android app data stream to lookup. + * Format: properties/{property_id}/androidAppDataStreams/{stream_id} + * Example: "properties/123/androidAppDataStreams/456" + * @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 [AndroidAppDataStream]{@link google.analytics.admin.v1alpha.AndroidAppDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IGetAndroidAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getAndroidAppDataStream(request, options, callback); + } + deleteAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest|undefined, {}|undefined + ]>; + deleteAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + deleteAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes an android app stream on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the android app data stream to delete. + * Format: properties/{property_id}/androidAppDataStreams/{stream_id} + * Example: "properties/123/androidAppDataStreams/456" + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteAndroidAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteAndroidAppDataStream(request, options, callback); + } + updateAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest|undefined, {}|undefined + ]>; + updateAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + updateAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates an android app stream on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.AndroidAppDataStream} request.androidAppDataStream + * Required. The android app stream to update. + * The `name` field is used to identify the android app stream to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [AndroidAppDataStream]{@link google.analytics.admin.v1alpha.AndroidAppDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.IUpdateAndroidAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'android_app_data_stream.name': request.androidAppDataStream!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAndroidAppDataStream(request, options, callback); + } + createAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest|undefined, {}|undefined + ]>; + createAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; + createAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates an android app stream with the specified location and attributes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.AndroidAppDataStream} request.androidAppDataStream + * Required. The android app stream to create. + * @param {string} request.parent + * Required. The parent resource where this android app data stream will be created. + * Format: properties/123 + * @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 [AndroidAppDataStream]{@link google.analytics.admin.v1alpha.AndroidAppDataStream}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createAndroidAppDataStream( + request: protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream, + protos.google.analytics.admin.v1alpha.ICreateAndroidAppDataStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.createAndroidAppDataStream(request, options, callback); + } + getEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest|undefined, {}|undefined + ]>; + getEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>): void; + getEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Returns the singleton enhanced measurement settings for this web stream. + * Note that the stream must enable enhanced measurement for these settings to + * take effect. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the settings to lookup. + * Format: + * properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings + * Example: "properties/1000/webDataStreams/2000/enhancedMeasurementSettings" + * @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 [EnhancedMeasurementSettings]{@link google.analytics.admin.v1alpha.EnhancedMeasurementSettings}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IGetEnhancedMeasurementSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getEnhancedMeasurementSettings(request, options, callback); + } + updateEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest|undefined, {}|undefined + ]>; + updateEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates the singleton enhanced measurement settings for this web stream. + * Note that the stream must enable enhanced measurement for these settings to + * take effect. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.EnhancedMeasurementSettings} request.enhancedMeasurementSettings + * Required. The settings to update. + * The `name` field is used to identify the settings to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [EnhancedMeasurementSettings]{@link google.analytics.admin.v1alpha.EnhancedMeasurementSettings}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateEnhancedMeasurementSettings( + request: protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings, + protos.google.analytics.admin.v1alpha.IUpdateEnhancedMeasurementSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'enhanced_measurement_settings.name': request.enhancedMeasurementSettings!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEnhancedMeasurementSettings(request, options, callback); + } + createFirebaseLink( + request: protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest|undefined, {}|undefined + ]>; + createFirebaseLink( + request: protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest|null|undefined, + {}|null|undefined>): void; + createFirebaseLink( + request: protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a FirebaseLink. + * + * Properties can have at most one FirebaseLink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: properties/{property_id} + * Example: properties/1234 + * @param {google.analytics.admin.v1alpha.FirebaseLink} request.firebaseLink + * Required. The Firebase link to create. + * @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 [FirebaseLink]{@link google.analytics.admin.v1alpha.FirebaseLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createFirebaseLink( + request: protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.ICreateFirebaseLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.createFirebaseLink(request, options, callback); + } + updateFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest|undefined, {}|undefined + ]>; + updateFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest|null|undefined, + {}|null|undefined>): void; + updateFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a FirebaseLink on a property + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.FirebaseLink} request.firebaseLink + * Required. The Firebase link to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [FirebaseLink]{@link google.analytics.admin.v1alpha.FirebaseLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IFirebaseLink, + protos.google.analytics.admin.v1alpha.IUpdateFirebaseLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'firebase_link.name': request.firebaseLink!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFirebaseLink(request, options, callback); + } + deleteFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest|undefined, {}|undefined + ]>; + deleteFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest|null|undefined, + {}|null|undefined>): void; + deleteFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a FirebaseLink on a property + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} + * Example: properties/1234/firebaseLinks/5678 + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteFirebaseLink( + request: protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteFirebaseLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteFirebaseLink(request, options, callback); + } + listFirebaseLinks( + request: protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse, + protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest|undefined, {}|undefined + ]>; + listFirebaseLinks( + request: protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse, + protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest|null|undefined, + {}|null|undefined>): void; + listFirebaseLinks( + request: protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse, + protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest|null|undefined, + {}|null|undefined>): void; +/** + * Lists FirebaseLinks on a property. + * Properties can have at most one FirebaseLink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: properties/{property_id} + * Example: properties/1234 + * @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 [ListFirebaseLinksResponse]{@link google.analytics.admin.v1alpha.ListFirebaseLinksResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listFirebaseLinks( + request: protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse, + protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse, + protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse, + protos.google.analytics.admin.v1alpha.IListFirebaseLinksRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.listFirebaseLinks(request, options, callback); + } + getGlobalSiteTag( + request: protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IGlobalSiteTag, + protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest|undefined, {}|undefined + ]>; + getGlobalSiteTag( + request: protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IGlobalSiteTag, + protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest|null|undefined, + {}|null|undefined>): void; + getGlobalSiteTag( + request: protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IGlobalSiteTag, + protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest|null|undefined, + {}|null|undefined>): void; +/** + * Returns the Site Tag for the specified web stream. + * Site Tags are immutable singletons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the site tag to lookup. + * Note that site tags are singletons and do not have unique IDs. + * Format: properties/{property_id}/webDataStreams/{stream_id}/globalSiteTag + * Example: "properties/123/webDataStreams/456/globalSiteTag" + * @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 [GlobalSiteTag]{@link google.analytics.admin.v1alpha.GlobalSiteTag}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getGlobalSiteTag( + request: protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IGlobalSiteTag, + protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IGlobalSiteTag, + protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IGlobalSiteTag, + protos.google.analytics.admin.v1alpha.IGetGlobalSiteTagRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getGlobalSiteTag(request, options, callback); + } + createGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest|undefined, {}|undefined + ]>; + createGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): void; + createGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a GoogleAdsLink. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: properties/1234 + * @param {google.analytics.admin.v1alpha.GoogleAdsLink} request.googleAdsLink + * Required. The GoogleAdsLink to create. + * @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 [GoogleAdsLink]{@link google.analytics.admin.v1alpha.GoogleAdsLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.ICreateGoogleAdsLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.createGoogleAdsLink(request, options, callback); + } + updateGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest|undefined, {}|undefined + ]>; + updateGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): void; + updateGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a GoogleAdsLink on a property + * + * @param {Object} request + * The request object that will be sent. + * @param {google.analytics.admin.v1alpha.GoogleAdsLink} request.googleAdsLink + * The GoogleAdsLink to update + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. Omitted fields will not be updated. + * @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 [GoogleAdsLink]{@link google.analytics.admin.v1alpha.GoogleAdsLink}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IGoogleAdsLink, + protos.google.analytics.admin.v1alpha.IUpdateGoogleAdsLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'google_ads_link.name': request.googleAdsLink!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateGoogleAdsLink(request, options, callback); + } + deleteGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest|undefined, {}|undefined + ]>; + deleteGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): void; + deleteGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a GoogleAdsLink on a property + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Example format: properties/1234/googleAdsLinks/5678 + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteGoogleAdsLink( + request: protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.analytics.admin.v1alpha.IDeleteGoogleAdsLinkRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.deleteGoogleAdsLink(request, options, callback); + } + getDataSharingSettings( + request: protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IDataSharingSettings, + protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest|undefined, {}|undefined + ]>; + getDataSharingSettings( + request: protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.analytics.admin.v1alpha.IDataSharingSettings, + protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest|null|undefined, + {}|null|undefined>): void; + getDataSharingSettings( + request: protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest, + callback: Callback< + protos.google.analytics.admin.v1alpha.IDataSharingSettings, + protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Get data sharing settings on an account. + * Data sharing settings are singletons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the settings to lookup. + * Format: accounts/{account}/dataSharingSettings + * Example: "accounts/1000/dataSharingSettings" + * @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 [DataSharingSettings]{@link google.analytics.admin.v1alpha.DataSharingSettings}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getDataSharingSettings( + request: protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.analytics.admin.v1alpha.IDataSharingSettings, + protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.analytics.admin.v1alpha.IDataSharingSettings, + protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.analytics.admin.v1alpha.IDataSharingSettings, + protos.google.analytics.admin.v1alpha.IGetDataSharingSettingsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.getDataSharingSettings(request, options, callback); + } + + listAccounts( + request: protos.google.analytics.admin.v1alpha.IListAccountsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAccount[], + protos.google.analytics.admin.v1alpha.IListAccountsRequest|null, + protos.google.analytics.admin.v1alpha.IListAccountsResponse + ]>; + listAccounts( + request: protos.google.analytics.admin.v1alpha.IListAccountsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAccountsRequest, + protos.google.analytics.admin.v1alpha.IListAccountsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAccount>): void; + listAccounts( + request: protos.google.analytics.admin.v1alpha.IListAccountsRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAccountsRequest, + protos.google.analytics.admin.v1alpha.IListAccountsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAccount>): void; +/** + * Returns all accounts accessible by the caller. + * + * Note that these accounts might not currently have App+Web properties. + * Soft-deleted (ie: "trashed") accounts are excluded by default. + * Returns an empty list if no relevant accounts are found. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return + * fewer than this value, even if there are additional pages. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccounts` must + * match the call that provided the page token. + * @param {boolean} request.showDeleted + * Whether to include soft-deleted (ie: "trashed") Accounts in the + * results. Accounts can be inspected to determine whether they are deleted or + * not. + * @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 [Account]{@link google.analytics.admin.v1alpha.Account}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Account]{@link google.analytics.admin.v1alpha.Account} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListAccountsRequest]{@link google.analytics.admin.v1alpha.ListAccountsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListAccountsResponse]{@link google.analytics.admin.v1alpha.ListAccountsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listAccounts( + request: protos.google.analytics.admin.v1alpha.IListAccountsRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAccountsRequest, + protos.google.analytics.admin.v1alpha.IListAccountsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAccount>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAccountsRequest, + protos.google.analytics.admin.v1alpha.IListAccountsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAccount>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAccount[], + protos.google.analytics.admin.v1alpha.IListAccountsRequest|null, + protos.google.analytics.admin.v1alpha.IListAccountsResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.listAccounts(request, options, callback); + } + +/** + * Equivalent to {@link listAccounts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listAccounts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return + * fewer than this value, even if there are additional pages. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccounts` must + * match the call that provided the page token. + * @param {boolean} request.showDeleted + * Whether to include soft-deleted (ie: "trashed") Accounts in the + * results. Accounts can be inspected to determine whether they are deleted or + * not. + * @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 [Account]{@link google.analytics.admin.v1alpha.Account} on 'data' event. + */ + listAccountsStream( + request?: protos.google.analytics.admin.v1alpha.IListAccountsRequest, + options?: gax.CallOptions): + Transform{ + request = request || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAccounts.createStream( + this.innerApiCalls.listAccounts as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listAccounts}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return + * fewer than this value, even if there are additional pages. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccounts` must + * match the call that provided the page token. + * @param {boolean} request.showDeleted + * Whether to include soft-deleted (ie: "trashed") Accounts in the + * results. Accounts can be inspected to determine whether they are deleted or + * not. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listAccountsAsync( + request?: protos.google.analytics.admin.v1alpha.IListAccountsRequest, + options?: gax.CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAccounts.asyncIterate( + this.innerApiCalls['listAccounts'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listProperties( + request: protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty[], + protos.google.analytics.admin.v1alpha.IListPropertiesRequest|null, + protos.google.analytics.admin.v1alpha.IListPropertiesResponse + ]>; + listProperties( + request: protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + protos.google.analytics.admin.v1alpha.IListPropertiesResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IProperty>): void; + listProperties( + request: protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + protos.google.analytics.admin.v1alpha.IListPropertiesResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IProperty>): void; +/** + * Returns child Properties under the specified parent Account. + * + * Only "App+Web" properties will be returned. + * Properties will be excluded if the caller does not have access. + * Soft-deleted (ie: "trashed") properties are excluded by default. + * Returns an empty list if no relevant properties are found. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * Required. An expression for filtering the results of the request. + * Fields eligible for filtering are: + * `parent:`(The resource name of the parent account) or + * `firebase_project:`(The id or number of the linked firebase project). + * Some examples of filters: + * + * | Filter | Description | + * |-----------------------------|-------------------------------------------| + * | parent:accounts/123 | The account with account id: 123. | + * | firebase_project:project-id | The firebase project with id: project-id. | + * | firebase_project:123 | The firebase project with number: 123. | + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return + * fewer than this value, even if there are additional pages. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListProperties` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProperties` must + * match the call that provided the page token. + * @param {boolean} request.showDeleted + * Whether to include soft-deleted (ie: "trashed") Properties in the + * results. Properties can be inspected to determine whether they are deleted + * or not. + * @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 [Property]{@link google.analytics.admin.v1alpha.Property}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Property]{@link google.analytics.admin.v1alpha.Property} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListPropertiesRequest]{@link google.analytics.admin.v1alpha.ListPropertiesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListPropertiesResponse]{@link google.analytics.admin.v1alpha.ListPropertiesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProperties( + request: protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + protos.google.analytics.admin.v1alpha.IListPropertiesResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IProperty>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + protos.google.analytics.admin.v1alpha.IListPropertiesResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IProperty>): + Promise<[ + protos.google.analytics.admin.v1alpha.IProperty[], + protos.google.analytics.admin.v1alpha.IListPropertiesRequest|null, + protos.google.analytics.admin.v1alpha.IListPropertiesResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.listProperties(request, options, callback); + } + +/** + * Equivalent to {@link listProperties}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProperties} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * Required. An expression for filtering the results of the request. + * Fields eligible for filtering are: + * `parent:`(The resource name of the parent account) or + * `firebase_project:`(The id or number of the linked firebase project). + * Some examples of filters: + * + * | Filter | Description | + * |-----------------------------|-------------------------------------------| + * | parent:accounts/123 | The account with account id: 123. | + * | firebase_project:project-id | The firebase project with id: project-id. | + * | firebase_project:123 | The firebase project with number: 123. | + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return + * fewer than this value, even if there are additional pages. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListProperties` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProperties` must + * match the call that provided the page token. + * @param {boolean} request.showDeleted + * Whether to include soft-deleted (ie: "trashed") Properties in the + * results. Properties can be inspected to determine whether they are deleted + * or not. + * @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 [Property]{@link google.analytics.admin.v1alpha.Property} on 'data' event. + */ + listPropertiesStream( + request?: protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + options?: gax.CallOptions): + Transform{ + request = request || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProperties.createStream( + this.innerApiCalls.listProperties as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listProperties}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * Required. An expression for filtering the results of the request. + * Fields eligible for filtering are: + * `parent:`(The resource name of the parent account) or + * `firebase_project:`(The id or number of the linked firebase project). + * Some examples of filters: + * + * | Filter | Description | + * |-----------------------------|-------------------------------------------| + * | parent:accounts/123 | The account with account id: 123. | + * | firebase_project:project-id | The firebase project with id: project-id. | + * | firebase_project:123 | The firebase project with number: 123. | + * @param {number} request.pageSize + * The maximum number of resources to return. The service may return + * fewer than this value, even if there are additional pages. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListProperties` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProperties` must + * match the call that provided the page token. + * @param {boolean} request.showDeleted + * Whether to include soft-deleted (ie: "trashed") Properties in the + * results. Properties can be inspected to determine whether they are deleted + * or not. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listPropertiesAsync( + request?: protos.google.analytics.admin.v1alpha.IListPropertiesRequest, + options?: gax.CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProperties.asyncIterate( + this.innerApiCalls['listProperties'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listUserLinks( + request: protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink[], + protos.google.analytics.admin.v1alpha.IListUserLinksRequest|null, + protos.google.analytics.admin.v1alpha.IListUserLinksResponse + ]>; + listUserLinks( + request: protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + protos.google.analytics.admin.v1alpha.IListUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IUserLink>): void; + listUserLinks( + request: protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + protos.google.analytics.admin.v1alpha.IListUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IUserLink>): void; +/** + * Lists all user links on an account or property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {number} request.pageSize + * The maximum number of user links to return. + * The service may return fewer than this value. + * If unspecified, at most 200 user links will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListUserLinks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUserLinks` must + * match the call that provided the page token. + * @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 [UserLink]{@link google.analytics.admin.v1alpha.UserLink}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [UserLink]{@link google.analytics.admin.v1alpha.UserLink} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListUserLinksRequest]{@link google.analytics.admin.v1alpha.ListUserLinksRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListUserLinksResponse]{@link google.analytics.admin.v1alpha.ListUserLinksResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listUserLinks( + request: protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + protos.google.analytics.admin.v1alpha.IListUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IUserLink>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + protos.google.analytics.admin.v1alpha.IListUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IUserLink>): + Promise<[ + protos.google.analytics.admin.v1alpha.IUserLink[], + protos.google.analytics.admin.v1alpha.IListUserLinksRequest|null, + protos.google.analytics.admin.v1alpha.IListUserLinksResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.listUserLinks(request, options, callback); + } + +/** + * Equivalent to {@link listUserLinks}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listUserLinks} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {number} request.pageSize + * The maximum number of user links to return. + * The service may return fewer than this value. + * If unspecified, at most 200 user links will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListUserLinks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUserLinks` must + * match the call that provided the page token. + * @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 [UserLink]{@link google.analytics.admin.v1alpha.UserLink} on 'data' event. + */ + listUserLinksStream( + request?: protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + options?: gax.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.listUserLinks.createStream( + this.innerApiCalls.listUserLinks as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listUserLinks}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {number} request.pageSize + * The maximum number of user links to return. + * The service may return fewer than this value. + * If unspecified, at most 200 user links will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListUserLinks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUserLinks` must + * match the call that provided the page token. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listUserLinksAsync( + request?: protos.google.analytics.admin.v1alpha.IListUserLinksRequest, + options?: gax.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.listUserLinks.asyncIterate( + this.innerApiCalls['listUserLinks'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + auditUserLinks( + request: protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAuditUserLink[], + protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest|null, + protos.google.analytics.admin.v1alpha.IAuditUserLinksResponse + ]>; + auditUserLinks( + request: protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + protos.google.analytics.admin.v1alpha.IAuditUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAuditUserLink>): void; + auditUserLinks( + request: protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + protos.google.analytics.admin.v1alpha.IAuditUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAuditUserLink>): void; +/** + * Lists all user links on an account or property, including implicit ones + * that come from effective permissions granted by groups or organization + * admin roles. + * + * If a returned user link does not have direct permissions, they cannot + * be removed from the account or property directly with the DeleteUserLink + * command. They have to be removed from the group/etc that gives them + * permissions, which is currently only usable/discoverable in the GA or GMP + * UIs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {number} request.pageSize + * The maximum number of user links to return. + * The service may return fewer than this value. + * If unspecified, at most 1000 user links will be returned. + * The maximum value is 5000; values above 5000 will be coerced to 5000. + * @param {string} request.pageToken + * A page token, received from a previous `AuditUserLinks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `AuditUserLinks` must + * match the call that provided the page token. + * @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 [AuditUserLink]{@link google.analytics.admin.v1alpha.AuditUserLink}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [AuditUserLink]{@link google.analytics.admin.v1alpha.AuditUserLink} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [AuditUserLinksRequest]{@link google.analytics.admin.v1alpha.AuditUserLinksRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [AuditUserLinksResponse]{@link google.analytics.admin.v1alpha.AuditUserLinksResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + auditUserLinks( + request: protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + protos.google.analytics.admin.v1alpha.IAuditUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAuditUserLink>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + protos.google.analytics.admin.v1alpha.IAuditUserLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAuditUserLink>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAuditUserLink[], + protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest|null, + protos.google.analytics.admin.v1alpha.IAuditUserLinksResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.auditUserLinks(request, options, callback); + } + +/** + * Equivalent to {@link auditUserLinks}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link auditUserLinks} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {number} request.pageSize + * The maximum number of user links to return. + * The service may return fewer than this value. + * If unspecified, at most 1000 user links will be returned. + * The maximum value is 5000; values above 5000 will be coerced to 5000. + * @param {string} request.pageToken + * A page token, received from a previous `AuditUserLinks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `AuditUserLinks` must + * match the call that provided the page token. + * @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 [AuditUserLink]{@link google.analytics.admin.v1alpha.AuditUserLink} on 'data' event. + */ + auditUserLinksStream( + request?: protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + options?: gax.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.auditUserLinks.createStream( + this.innerApiCalls.auditUserLinks as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link auditUserLinks}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: accounts/1234 + * @param {number} request.pageSize + * The maximum number of user links to return. + * The service may return fewer than this value. + * If unspecified, at most 1000 user links will be returned. + * The maximum value is 5000; values above 5000 will be coerced to 5000. + * @param {string} request.pageToken + * A page token, received from a previous `AuditUserLinks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `AuditUserLinks` must + * match the call that provided the page token. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + auditUserLinksAsync( + request?: protos.google.analytics.admin.v1alpha.IAuditUserLinksRequest, + options?: gax.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.auditUserLinks.asyncIterate( + this.innerApiCalls['auditUserLinks'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listWebDataStreams( + request: protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream[], + protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest|null, + protos.google.analytics.admin.v1alpha.IListWebDataStreamsResponse + ]>; + listWebDataStreams( + request: protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListWebDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IWebDataStream>): void; + listWebDataStreams( + request: protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListWebDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IWebDataStream>): void; +/** + * Returns child web data streams under the specified parent property. + * + * Web data streams will be excluded if the caller does not have access. + * Returns an empty list if no relevant web data streams are found. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to list results of web streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListWebDataStreams` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWebDataStreams` must + * match the call that provided the page token. + * @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 [WebDataStream]{@link google.analytics.admin.v1alpha.WebDataStream}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [WebDataStream]{@link google.analytics.admin.v1alpha.WebDataStream} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListWebDataStreamsRequest]{@link google.analytics.admin.v1alpha.ListWebDataStreamsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListWebDataStreamsResponse]{@link google.analytics.admin.v1alpha.ListWebDataStreamsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listWebDataStreams( + request: protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListWebDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IWebDataStream>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListWebDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IWebDataStream>): + Promise<[ + protos.google.analytics.admin.v1alpha.IWebDataStream[], + protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest|null, + protos.google.analytics.admin.v1alpha.IListWebDataStreamsResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.listWebDataStreams(request, options, callback); + } + +/** + * Equivalent to {@link listWebDataStreams}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listWebDataStreams} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to list results of web streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListWebDataStreams` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWebDataStreams` must + * match the call that provided the page token. + * @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 [WebDataStream]{@link google.analytics.admin.v1alpha.WebDataStream} on 'data' event. + */ + listWebDataStreamsStream( + request?: protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + options?: gax.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.listWebDataStreams.createStream( + this.innerApiCalls.listWebDataStreams as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listWebDataStreams}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to list results of web streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListWebDataStreams` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWebDataStreams` must + * match the call that provided the page token. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listWebDataStreamsAsync( + request?: protos.google.analytics.admin.v1alpha.IListWebDataStreamsRequest, + options?: gax.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.listWebDataStreams.asyncIterate( + this.innerApiCalls['listWebDataStreams'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listIosAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream[], + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest|null, + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsResponse + ]>; + listIosAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IIosAppDataStream>): void; + listIosAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IIosAppDataStream>): void; +/** + * Returns child iOS app data streams under the specified parent property. + * + * iOS app data streams will be excluded if the caller does not have access. + * Returns an empty list if no relevant iOS app data streams are found. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to list results of app streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListIosAppDataStreams` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListIosAppDataStreams` + * must match the call that provided the page token. + * @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 [IosAppDataStream]{@link google.analytics.admin.v1alpha.IosAppDataStream}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [IosAppDataStream]{@link google.analytics.admin.v1alpha.IosAppDataStream} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListIosAppDataStreamsRequest]{@link google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListIosAppDataStreamsResponse]{@link google.analytics.admin.v1alpha.ListIosAppDataStreamsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listIosAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IIosAppDataStream>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IIosAppDataStream>): + Promise<[ + protos.google.analytics.admin.v1alpha.IIosAppDataStream[], + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest|null, + protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.listIosAppDataStreams(request, options, callback); + } + +/** + * Equivalent to {@link listIosAppDataStreams}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listIosAppDataStreams} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to list results of app streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListIosAppDataStreams` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListIosAppDataStreams` + * must match the call that provided the page token. + * @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 [IosAppDataStream]{@link google.analytics.admin.v1alpha.IosAppDataStream} on 'data' event. + */ + listIosAppDataStreamsStream( + request?: protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + options?: gax.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.listIosAppDataStreams.createStream( + this.innerApiCalls.listIosAppDataStreams as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listIosAppDataStreams}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to list results of app streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous `ListIosAppDataStreams` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListIosAppDataStreams` + * must match the call that provided the page token. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listIosAppDataStreamsAsync( + request?: protos.google.analytics.admin.v1alpha.IListIosAppDataStreamsRequest, + options?: gax.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.listIosAppDataStreams.asyncIterate( + this.innerApiCalls['listIosAppDataStreams'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listAndroidAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream[], + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest|null, + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsResponse + ]>; + listAndroidAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream>): void; + listAndroidAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream>): void; +/** + * Returns child android app streams under the specified parent property. + * + * Android app streams will be excluded if the caller does not have access. + * Returns an empty list if no relevant android app streams are found. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to limit results to app streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous call. Provide this to + * retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListAndroidAppDataStreams` must match the call that provided the page + * token. + * @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 [AndroidAppDataStream]{@link google.analytics.admin.v1alpha.AndroidAppDataStream}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [AndroidAppDataStream]{@link google.analytics.admin.v1alpha.AndroidAppDataStream} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListAndroidAppDataStreamsRequest]{@link google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListAndroidAppDataStreamsResponse]{@link google.analytics.admin.v1alpha.ListAndroidAppDataStreamsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listAndroidAppDataStreams( + request: protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream>): + Promise<[ + protos.google.analytics.admin.v1alpha.IAndroidAppDataStream[], + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest|null, + protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.listAndroidAppDataStreams(request, options, callback); + } + +/** + * Equivalent to {@link listAndroidAppDataStreams}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listAndroidAppDataStreams} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to limit results to app streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous call. Provide this to + * retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListAndroidAppDataStreams` must match the call that provided the page + * token. + * @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 [AndroidAppDataStream]{@link google.analytics.admin.v1alpha.AndroidAppDataStream} on 'data' event. + */ + listAndroidAppDataStreamsStream( + request?: protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + options?: gax.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.listAndroidAppDataStreams.createStream( + this.innerApiCalls.listAndroidAppDataStreams as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listAndroidAppDataStreams}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the parent property. + * For example, to limit results to app streams under the property with Id + * 123: "properties/123" + * @param {number} request.pageSize + * The maximum number of resources to return. + * + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @param {string} request.pageToken + * A page token, received from a previous call. Provide this to + * retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListAndroidAppDataStreams` must match the call that provided the page + * token. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listAndroidAppDataStreamsAsync( + request?: protos.google.analytics.admin.v1alpha.IListAndroidAppDataStreamsRequest, + options?: gax.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.listAndroidAppDataStreams.asyncIterate( + this.innerApiCalls['listAndroidAppDataStreams'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listGoogleAdsLinks( + request: protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.analytics.admin.v1alpha.IGoogleAdsLink[], + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest|null, + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksResponse + ]>; + listGoogleAdsLinks( + request: protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IGoogleAdsLink>): void; + listGoogleAdsLinks( + request: protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + callback: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IGoogleAdsLink>): void; +/** + * Lists GoogleAdsLinks on a property. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: properties/1234 + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200 (higher values will be coerced to the maximum). + * @param {string} request.pageToken + * A page token, received from a previous `ListGoogleAdsLinks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListGoogleAdsLinks` must + * match the call that provided the page token. + * @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 [GoogleAdsLink]{@link google.analytics.admin.v1alpha.GoogleAdsLink}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [GoogleAdsLink]{@link google.analytics.admin.v1alpha.GoogleAdsLink} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListGoogleAdsLinksRequest]{@link google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListGoogleAdsLinksResponse]{@link google.analytics.admin.v1alpha.ListGoogleAdsLinksResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listGoogleAdsLinks( + request: protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IGoogleAdsLink>, + callback?: PaginationCallback< + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksResponse|null|undefined, + protos.google.analytics.admin.v1alpha.IGoogleAdsLink>): + Promise<[ + protos.google.analytics.admin.v1alpha.IGoogleAdsLink[], + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest|null, + protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksResponse + ]>|void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as gax.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.listGoogleAdsLinks(request, options, callback); + } + +/** + * Equivalent to {@link listGoogleAdsLinks}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listGoogleAdsLinks} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: properties/1234 + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200 (higher values will be coerced to the maximum). + * @param {string} request.pageToken + * A page token, received from a previous `ListGoogleAdsLinks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListGoogleAdsLinks` must + * match the call that provided the page token. + * @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 [GoogleAdsLink]{@link google.analytics.admin.v1alpha.GoogleAdsLink} on 'data' event. + */ + listGoogleAdsLinksStream( + request?: protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + options?: gax.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.listGoogleAdsLinks.createStream( + this.innerApiCalls.listGoogleAdsLinks as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listGoogleAdsLinks}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Example format: properties/1234 + * @param {number} request.pageSize + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200 (higher values will be coerced to the maximum). + * @param {string} request.pageToken + * A page token, received from a previous `ListGoogleAdsLinks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListGoogleAdsLinks` must + * match the call that provided the page token. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listGoogleAdsLinksAsync( + request?: protos.google.analytics.admin.v1alpha.IListGoogleAdsLinksRequest, + options?: gax.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.listGoogleAdsLinks.asyncIterate( + this.innerApiCalls['listGoogleAdsLinks'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified account resource name string. + * + * @param {string} account + * @returns {string} Resource name string. + */ + accountPath(account:string) { + return this.pathTemplates.accountPathTemplate.render({ + account: account, + }); + } + + /** + * Parse the account from Account resource. + * + * @param {string} accountName + * A fully-qualified path representing Account resource. + * @returns {string} A string representing the account. + */ + matchAccountFromAccountName(accountName: string) { + return this.pathTemplates.accountPathTemplate.match(accountName).account; + } + + /** + * Return a fully-qualified accountUserLink resource name string. + * + * @param {string} account + * @param {string} user_link + * @returns {string} Resource name string. + */ + accountUserLinkPath(account:string,userLink:string) { + return this.pathTemplates.accountUserLinkPathTemplate.render({ + account: account, + user_link: userLink, + }); + } + + /** + * Parse the account from AccountUserLink resource. + * + * @param {string} accountUserLinkName + * A fully-qualified path representing account_user_link resource. + * @returns {string} A string representing the account. + */ + matchAccountFromAccountUserLinkName(accountUserLinkName: string) { + return this.pathTemplates.accountUserLinkPathTemplate.match(accountUserLinkName).account; + } + + /** + * Parse the user_link from AccountUserLink resource. + * + * @param {string} accountUserLinkName + * A fully-qualified path representing account_user_link resource. + * @returns {string} A string representing the user_link. + */ + matchUserLinkFromAccountUserLinkName(accountUserLinkName: string) { + return this.pathTemplates.accountUserLinkPathTemplate.match(accountUserLinkName).user_link; + } + + /** + * Return a fully-qualified androidAppDataStream resource name string. + * + * @param {string} property + * @param {string} android_app_data_stream + * @returns {string} Resource name string. + */ + androidAppDataStreamPath(property:string,androidAppDataStream:string) { + return this.pathTemplates.androidAppDataStreamPathTemplate.render({ + property: property, + android_app_data_stream: androidAppDataStream, + }); + } + + /** + * Parse the property from AndroidAppDataStream resource. + * + * @param {string} androidAppDataStreamName + * A fully-qualified path representing AndroidAppDataStream resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromAndroidAppDataStreamName(androidAppDataStreamName: string) { + return this.pathTemplates.androidAppDataStreamPathTemplate.match(androidAppDataStreamName).property; + } + + /** + * Parse the android_app_data_stream from AndroidAppDataStream resource. + * + * @param {string} androidAppDataStreamName + * A fully-qualified path representing AndroidAppDataStream resource. + * @returns {string} A string representing the android_app_data_stream. + */ + matchAndroidAppDataStreamFromAndroidAppDataStreamName(androidAppDataStreamName: string) { + return this.pathTemplates.androidAppDataStreamPathTemplate.match(androidAppDataStreamName).android_app_data_stream; + } + + /** + * Return a fully-qualified dataSharingSettings resource name string. + * + * @param {string} account + * @returns {string} Resource name string. + */ + dataSharingSettingsPath(account:string) { + return this.pathTemplates.dataSharingSettingsPathTemplate.render({ + account: account, + }); + } + + /** + * Parse the account from DataSharingSettings resource. + * + * @param {string} dataSharingSettingsName + * A fully-qualified path representing DataSharingSettings resource. + * @returns {string} A string representing the account. + */ + matchAccountFromDataSharingSettingsName(dataSharingSettingsName: string) { + return this.pathTemplates.dataSharingSettingsPathTemplate.match(dataSharingSettingsName).account; + } + + /** + * Return a fully-qualified enhancedMeasurementSettings resource name string. + * + * @param {string} property + * @param {string} web_data_stream + * @returns {string} Resource name string. + */ + enhancedMeasurementSettingsPath(property:string,webDataStream:string) { + return this.pathTemplates.enhancedMeasurementSettingsPathTemplate.render({ + property: property, + web_data_stream: webDataStream, + }); + } + + /** + * Parse the property from EnhancedMeasurementSettings resource. + * + * @param {string} enhancedMeasurementSettingsName + * A fully-qualified path representing EnhancedMeasurementSettings resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromEnhancedMeasurementSettingsName(enhancedMeasurementSettingsName: string) { + return this.pathTemplates.enhancedMeasurementSettingsPathTemplate.match(enhancedMeasurementSettingsName).property; + } + + /** + * Parse the web_data_stream from EnhancedMeasurementSettings resource. + * + * @param {string} enhancedMeasurementSettingsName + * A fully-qualified path representing EnhancedMeasurementSettings resource. + * @returns {string} A string representing the web_data_stream. + */ + matchWebDataStreamFromEnhancedMeasurementSettingsName(enhancedMeasurementSettingsName: string) { + return this.pathTemplates.enhancedMeasurementSettingsPathTemplate.match(enhancedMeasurementSettingsName).web_data_stream; + } + + /** + * Return a fully-qualified firebaseLink resource name string. + * + * @param {string} property + * @param {string} firebase_link + * @returns {string} Resource name string. + */ + firebaseLinkPath(property:string,firebaseLink:string) { + return this.pathTemplates.firebaseLinkPathTemplate.render({ + property: property, + firebase_link: firebaseLink, + }); + } + + /** + * Parse the property from FirebaseLink resource. + * + * @param {string} firebaseLinkName + * A fully-qualified path representing FirebaseLink resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromFirebaseLinkName(firebaseLinkName: string) { + return this.pathTemplates.firebaseLinkPathTemplate.match(firebaseLinkName).property; + } + + /** + * Parse the firebase_link from FirebaseLink resource. + * + * @param {string} firebaseLinkName + * A fully-qualified path representing FirebaseLink resource. + * @returns {string} A string representing the firebase_link. + */ + matchFirebaseLinkFromFirebaseLinkName(firebaseLinkName: string) { + return this.pathTemplates.firebaseLinkPathTemplate.match(firebaseLinkName).firebase_link; + } + + /** + * Return a fully-qualified globalSiteTag resource name string. + * + * @param {string} property + * @returns {string} Resource name string. + */ + globalSiteTagPath(property:string) { + return this.pathTemplates.globalSiteTagPathTemplate.render({ + property: property, + }); + } + + /** + * Parse the property from GlobalSiteTag resource. + * + * @param {string} globalSiteTagName + * A fully-qualified path representing GlobalSiteTag resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromGlobalSiteTagName(globalSiteTagName: string) { + return this.pathTemplates.globalSiteTagPathTemplate.match(globalSiteTagName).property; + } + + /** + * Return a fully-qualified googleAdsLink resource name string. + * + * @param {string} property + * @param {string} google_ads_link + * @returns {string} Resource name string. + */ + googleAdsLinkPath(property:string,googleAdsLink:string) { + return this.pathTemplates.googleAdsLinkPathTemplate.render({ + property: property, + google_ads_link: googleAdsLink, + }); + } + + /** + * Parse the property from GoogleAdsLink resource. + * + * @param {string} googleAdsLinkName + * A fully-qualified path representing GoogleAdsLink resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromGoogleAdsLinkName(googleAdsLinkName: string) { + return this.pathTemplates.googleAdsLinkPathTemplate.match(googleAdsLinkName).property; + } + + /** + * Parse the google_ads_link from GoogleAdsLink resource. + * + * @param {string} googleAdsLinkName + * A fully-qualified path representing GoogleAdsLink resource. + * @returns {string} A string representing the google_ads_link. + */ + matchGoogleAdsLinkFromGoogleAdsLinkName(googleAdsLinkName: string) { + return this.pathTemplates.googleAdsLinkPathTemplate.match(googleAdsLinkName).google_ads_link; + } + + /** + * Return a fully-qualified iosAppDataStream resource name string. + * + * @param {string} property + * @param {string} ios_app_data_stream + * @returns {string} Resource name string. + */ + iosAppDataStreamPath(property:string,iosAppDataStream:string) { + return this.pathTemplates.iosAppDataStreamPathTemplate.render({ + property: property, + ios_app_data_stream: iosAppDataStream, + }); + } + + /** + * Parse the property from IosAppDataStream resource. + * + * @param {string} iosAppDataStreamName + * A fully-qualified path representing IosAppDataStream resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromIosAppDataStreamName(iosAppDataStreamName: string) { + return this.pathTemplates.iosAppDataStreamPathTemplate.match(iosAppDataStreamName).property; + } + + /** + * Parse the ios_app_data_stream from IosAppDataStream resource. + * + * @param {string} iosAppDataStreamName + * A fully-qualified path representing IosAppDataStream resource. + * @returns {string} A string representing the ios_app_data_stream. + */ + matchIosAppDataStreamFromIosAppDataStreamName(iosAppDataStreamName: string) { + return this.pathTemplates.iosAppDataStreamPathTemplate.match(iosAppDataStreamName).ios_app_data_stream; + } + + /** + * Return a fully-qualified property resource name string. + * + * @param {string} property + * @returns {string} Resource name string. + */ + propertyPath(property:string) { + return this.pathTemplates.propertyPathTemplate.render({ + property: property, + }); + } + + /** + * Parse the property from Property resource. + * + * @param {string} propertyName + * A fully-qualified path representing Property resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromPropertyName(propertyName: string) { + return this.pathTemplates.propertyPathTemplate.match(propertyName).property; + } + + /** + * Return a fully-qualified propertyUserLink resource name string. + * + * @param {string} property + * @param {string} user_link + * @returns {string} Resource name string. + */ + propertyUserLinkPath(property:string,userLink:string) { + return this.pathTemplates.propertyUserLinkPathTemplate.render({ + property: property, + user_link: userLink, + }); + } + + /** + * Parse the property from PropertyUserLink resource. + * + * @param {string} propertyUserLinkName + * A fully-qualified path representing property_user_link resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromPropertyUserLinkName(propertyUserLinkName: string) { + return this.pathTemplates.propertyUserLinkPathTemplate.match(propertyUserLinkName).property; + } + + /** + * Parse the user_link from PropertyUserLink resource. + * + * @param {string} propertyUserLinkName + * A fully-qualified path representing property_user_link resource. + * @returns {string} A string representing the user_link. + */ + matchUserLinkFromPropertyUserLinkName(propertyUserLinkName: string) { + return this.pathTemplates.propertyUserLinkPathTemplate.match(propertyUserLinkName).user_link; + } + + /** + * Return a fully-qualified webDataStream resource name string. + * + * @param {string} property + * @param {string} web_data_stream + * @returns {string} Resource name string. + */ + webDataStreamPath(property:string,webDataStream:string) { + return this.pathTemplates.webDataStreamPathTemplate.render({ + property: property, + web_data_stream: webDataStream, + }); + } + + /** + * Parse the property from WebDataStream resource. + * + * @param {string} webDataStreamName + * A fully-qualified path representing WebDataStream resource. + * @returns {string} A string representing the property. + */ + matchPropertyFromWebDataStreamName(webDataStreamName: string) { + return this.pathTemplates.webDataStreamPathTemplate.match(webDataStreamName).property; + } + + /** + * Parse the web_data_stream from WebDataStream resource. + * + * @param {string} webDataStreamName + * A fully-qualified path representing WebDataStream resource. + * @returns {string} A string representing the web_data_stream. + */ + matchWebDataStreamFromWebDataStreamName(webDataStreamName: string) { + return this.pathTemplates.webDataStreamPathTemplate.match(webDataStreamName).web_data_stream; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.analyticsAdminServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v1alpha/analytics_admin_service_client_config.json b/src/v1alpha/analytics_admin_service_client_config.json new file mode 100644 index 0000000..7e62d3b --- /dev/null +++ b/src/v1alpha/analytics_admin_service_client_config.json @@ -0,0 +1,274 @@ +{ + "interfaces": { + "google.analytics.admin.v1alpha.AnalyticsAdminService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unknown_unavailable": [ + "UNKNOWN", + "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 + }, + "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c": { + "initial_retry_delay_millis": 1000, + "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": { + "GetAccount": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAccounts": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteAccount": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAccount": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ProvisionAccountTicket": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProperty": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProperties": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateProperty": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProperty": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateProperty": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetUserLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchGetUserLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListUserLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AuditUserLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateUserLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateUserLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateUserLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchUpdateUserLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteUserLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchDeleteUserLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWebDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWebDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + }, + "UpdateWebDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWebDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListWebDataStreams": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIosAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteIosAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateIosAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateIosAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListIosAppDataStreams": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAndroidAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteAndroidAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateAndroidAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateAndroidAppDataStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAndroidAppDataStreams": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetEnhancedMeasurementSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateEnhancedMeasurementSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFirebaseLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFirebaseLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFirebaseLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFirebaseLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetGlobalSiteTag": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateGoogleAdsLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateGoogleAdsLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteGoogleAdsLink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListGoogleAdsLinks": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDataSharingSettings": { + "timeout_millis": 60000, + "retry_codes_name": "unknown_unavailable", + "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c" + } + } + } + } +} diff --git a/src/v1alpha/analytics_admin_service_proto_list.json b/src/v1alpha/analytics_admin_service_proto_list.json new file mode 100644 index 0000000..731e0f1 --- /dev/null +++ b/src/v1alpha/analytics_admin_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/analytics/admin/v1alpha/analytics_admin.proto", + "../../protos/google/analytics/admin/v1alpha/resources.proto" +] diff --git a/src/v1alpha/index.ts b/src/v1alpha/index.ts new file mode 100644 index 0000000..cdc09b4 --- /dev/null +++ b/src/v1alpha/index.ts @@ -0,0 +1,19 @@ +// 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 +// +// 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 {AnalyticsAdminServiceClient} from './analytics_admin_service_client'; diff --git a/system-test/fixtures/sample/src/index.js b/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..7e1f377 --- /dev/null +++ b/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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 +// +// 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 admin = require('@google-analytics/admin'); + +function main() { + const analyticsAdminServiceClient = new admin.AnalyticsAdminServiceClient(); +} + +main(); diff --git a/system-test/fixtures/sample/src/index.ts b/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..5e9bd08 --- /dev/null +++ b/system-test/fixtures/sample/src/index.ts @@ -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 +// +// 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 {AnalyticsAdminServiceClient} from '@google-analytics/admin'; + +function main() { + new AnalyticsAdminServiceClient(); +} + +main(); diff --git a/system-test/install.ts b/system-test/install.ts new file mode 100644 index 0000000..5e4ed63 --- /dev/null +++ b/system-test/install.ts @@ -0,0 +1,49 @@ +// 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 +// +// 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('typescript consumer tests', () => { + + it('should have correct type signature for typescript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); // will throw upon error. + }); + + it('should have correct type signature for javascript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); // will throw upon error. + }); + +}); diff --git a/test/gapic_analytics_admin_service_v1alpha.ts b/test/gapic_analytics_admin_service_v1alpha.ts new file mode 100644 index 0000000..cf95322 --- /dev/null +++ b/test/gapic_analytics_admin_service_v1alpha.ts @@ -0,0 +1,5521 @@ +// 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 +// +// 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 analyticsadminserviceModule 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('v1alpha.AnalyticsAdminServiceClient', () => { + it('has servicePath', () => { + const servicePath = analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.analyticsAdminServiceStub, undefined); + await client.initialize(); + assert(client.analyticsAdminServiceStub); + }); + + it('has close method', () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + 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 analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + 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('getAccount', () => { + it('invokes getAccount without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()); + client.innerApiCalls.getAccount = stubSimpleCall(expectedResponse); + const [response] = await client.getAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAccount without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()); + client.innerApiCalls.getAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAccount( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAccount with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAccount(request), expectedError); + assert((client.innerApiCalls.getAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAccount', () => { + it('invokes deleteAccount without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAccount = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAccount without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAccount( + 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.deleteAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAccount with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAccount(request), expectedError); + assert((client.innerApiCalls.deleteAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateAccount', () => { + it('invokes updateAccount without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateAccountRequest()); + request.account = {}; + request.account.name = ''; + const expectedHeaderRequestParams = "account.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()); + client.innerApiCalls.updateAccount = stubSimpleCall(expectedResponse); + const [response] = await client.updateAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAccount without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateAccountRequest()); + request.account = {}; + request.account.name = ''; + const expectedHeaderRequestParams = "account.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()); + client.innerApiCalls.updateAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAccount( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAccount with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateAccountRequest()); + request.account = {}; + request.account.name = ''; + const expectedHeaderRequestParams = "account.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAccount(request), expectedError); + assert((client.innerApiCalls.updateAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('provisionAccountTicket', () => { + it('invokes provisionAccountTicket without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ProvisionAccountTicketRequest()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ProvisionAccountTicketResponse()); + client.innerApiCalls.provisionAccountTicket = stubSimpleCall(expectedResponse); + const [response] = await client.provisionAccountTicket(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.provisionAccountTicket as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes provisionAccountTicket without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ProvisionAccountTicketRequest()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ProvisionAccountTicketResponse()); + client.innerApiCalls.provisionAccountTicket = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.provisionAccountTicket( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IProvisionAccountTicketResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.provisionAccountTicket as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes provisionAccountTicket with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ProvisionAccountTicketRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.provisionAccountTicket = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.provisionAccountTicket(request), expectedError); + assert((client.innerApiCalls.provisionAccountTicket as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getProperty', () => { + it('invokes getProperty without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetPropertyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()); + client.innerApiCalls.getProperty = stubSimpleCall(expectedResponse); + const [response] = await client.getProperty(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getProperty without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetPropertyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()); + client.innerApiCalls.getProperty = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProperty( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IProperty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getProperty with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetPropertyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProperty = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getProperty(request), expectedError); + assert((client.innerApiCalls.getProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createProperty', () => { + it('invokes createProperty without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreatePropertyRequest()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()); + client.innerApiCalls.createProperty = stubSimpleCall(expectedResponse); + const [response] = await client.createProperty(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createProperty without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreatePropertyRequest()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()); + client.innerApiCalls.createProperty = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProperty( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IProperty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createProperty with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreatePropertyRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.createProperty = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createProperty(request), expectedError); + assert((client.innerApiCalls.createProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteProperty', () => { + it('invokes deleteProperty without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeletePropertyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteProperty = stubSimpleCall(expectedResponse); + const [response] = await client.deleteProperty(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteProperty without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeletePropertyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteProperty = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProperty( + 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.deleteProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteProperty with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeletePropertyRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProperty = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteProperty(request), expectedError); + assert((client.innerApiCalls.deleteProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateProperty', () => { + it('invokes updateProperty without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdatePropertyRequest()); + request.property = {}; + request.property.name = ''; + const expectedHeaderRequestParams = "property.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()); + client.innerApiCalls.updateProperty = stubSimpleCall(expectedResponse); + const [response] = await client.updateProperty(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateProperty without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdatePropertyRequest()); + request.property = {}; + request.property.name = ''; + const expectedHeaderRequestParams = "property.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()); + client.innerApiCalls.updateProperty = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProperty( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IProperty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateProperty with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdatePropertyRequest()); + request.property = {}; + request.property.name = ''; + const expectedHeaderRequestParams = "property.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProperty = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateProperty(request), expectedError); + assert((client.innerApiCalls.updateProperty as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getUserLink', () => { + it('invokes getUserLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetUserLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()); + client.innerApiCalls.getUserLink = stubSimpleCall(expectedResponse); + const [response] = await client.getUserLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getUserLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetUserLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()); + client.innerApiCalls.getUserLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUserLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IUserLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getUserLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetUserLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getUserLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getUserLink(request), expectedError); + assert((client.innerApiCalls.getUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchGetUserLinks', () => { + it('invokes batchGetUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchGetUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchGetUserLinksResponse()); + client.innerApiCalls.batchGetUserLinks = stubSimpleCall(expectedResponse); + const [response] = await client.batchGetUserLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchGetUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchGetUserLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchGetUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchGetUserLinksResponse()); + client.innerApiCalls.batchGetUserLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchGetUserLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IBatchGetUserLinksResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchGetUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchGetUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchGetUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchGetUserLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchGetUserLinks(request), expectedError); + assert((client.innerApiCalls.batchGetUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createUserLink', () => { + it('invokes createUserLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateUserLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()); + client.innerApiCalls.createUserLink = stubSimpleCall(expectedResponse); + const [response] = await client.createUserLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createUserLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateUserLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()); + client.innerApiCalls.createUserLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUserLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IUserLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createUserLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateUserLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createUserLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createUserLink(request), expectedError); + assert((client.innerApiCalls.createUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchCreateUserLinks', () => { + it('invokes batchCreateUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchCreateUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchCreateUserLinksResponse()); + client.innerApiCalls.batchCreateUserLinks = stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateUserLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchCreateUserLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchCreateUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchCreateUserLinksResponse()); + client.innerApiCalls.batchCreateUserLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateUserLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IBatchCreateUserLinksResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchCreateUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchCreateUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchCreateUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateUserLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateUserLinks(request), expectedError); + assert((client.innerApiCalls.batchCreateUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateUserLink', () => { + it('invokes updateUserLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateUserLinkRequest()); + request.userLink = {}; + request.userLink.name = ''; + const expectedHeaderRequestParams = "user_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()); + client.innerApiCalls.updateUserLink = stubSimpleCall(expectedResponse); + const [response] = await client.updateUserLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateUserLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateUserLinkRequest()); + request.userLink = {}; + request.userLink.name = ''; + const expectedHeaderRequestParams = "user_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()); + client.innerApiCalls.updateUserLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateUserLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IUserLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateUserLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateUserLinkRequest()); + request.userLink = {}; + request.userLink.name = ''; + const expectedHeaderRequestParams = "user_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUserLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateUserLink(request), expectedError); + assert((client.innerApiCalls.updateUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchUpdateUserLinks', () => { + it('invokes batchUpdateUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchUpdateUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchUpdateUserLinksResponse()); + client.innerApiCalls.batchUpdateUserLinks = stubSimpleCall(expectedResponse); + const [response] = await client.batchUpdateUserLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchUpdateUserLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchUpdateUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchUpdateUserLinksResponse()); + client.innerApiCalls.batchUpdateUserLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateUserLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IBatchUpdateUserLinksResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchUpdateUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchUpdateUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchUpdateUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateUserLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchUpdateUserLinks(request), expectedError); + assert((client.innerApiCalls.batchUpdateUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteUserLink', () => { + it('invokes deleteUserLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteUserLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteUserLink = stubSimpleCall(expectedResponse); + const [response] = await client.deleteUserLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteUserLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteUserLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteUserLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUserLink( + 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.deleteUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteUserLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteUserLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUserLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteUserLink(request), expectedError); + assert((client.innerApiCalls.deleteUserLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('batchDeleteUserLinks', () => { + it('invokes batchDeleteUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchDeleteUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.batchDeleteUserLinks = stubSimpleCall(expectedResponse); + const [response] = await client.batchDeleteUserLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.batchDeleteUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes batchDeleteUserLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchDeleteUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.batchDeleteUserLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteUserLinks( + 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.batchDeleteUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes batchDeleteUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.BatchDeleteUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteUserLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchDeleteUserLinks(request), expectedError); + assert((client.innerApiCalls.batchDeleteUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getWebDataStream', () => { + it('invokes getWebDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetWebDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()); + client.innerApiCalls.getWebDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.getWebDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getWebDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetWebDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()); + client.innerApiCalls.getWebDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWebDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IWebDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getWebDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetWebDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getWebDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWebDataStream(request), expectedError); + assert((client.innerApiCalls.getWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteWebDataStream', () => { + it('invokes deleteWebDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteWebDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteWebDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.deleteWebDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteWebDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteWebDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteWebDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWebDataStream( + 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.deleteWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteWebDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteWebDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWebDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteWebDataStream(request), expectedError); + assert((client.innerApiCalls.deleteWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateWebDataStream', () => { + it('invokes updateWebDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateWebDataStreamRequest()); + request.webDataStream = {}; + request.webDataStream.name = ''; + const expectedHeaderRequestParams = "web_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()); + client.innerApiCalls.updateWebDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.updateWebDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateWebDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateWebDataStreamRequest()); + request.webDataStream = {}; + request.webDataStream.name = ''; + const expectedHeaderRequestParams = "web_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()); + client.innerApiCalls.updateWebDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWebDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IWebDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateWebDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateWebDataStreamRequest()); + request.webDataStream = {}; + request.webDataStream.name = ''; + const expectedHeaderRequestParams = "web_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWebDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateWebDataStream(request), expectedError); + assert((client.innerApiCalls.updateWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createWebDataStream', () => { + it('invokes createWebDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateWebDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()); + client.innerApiCalls.createWebDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.createWebDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createWebDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateWebDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()); + client.innerApiCalls.createWebDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWebDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IWebDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createWebDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateWebDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createWebDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createWebDataStream(request), expectedError); + assert((client.innerApiCalls.createWebDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIosAppDataStream', () => { + it('invokes getIosAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetIosAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()); + client.innerApiCalls.getIosAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.getIosAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIosAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetIosAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()); + client.innerApiCalls.getIosAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIosAppDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IIosAppDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIosAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetIosAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIosAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIosAppDataStream(request), expectedError); + assert((client.innerApiCalls.getIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteIosAppDataStream', () => { + it('invokes deleteIosAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteIosAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteIosAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIosAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteIosAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteIosAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteIosAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIosAppDataStream( + 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.deleteIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteIosAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteIosAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIosAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteIosAppDataStream(request), expectedError); + assert((client.innerApiCalls.deleteIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateIosAppDataStream', () => { + it('invokes updateIosAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateIosAppDataStreamRequest()); + request.iosAppDataStream = {}; + request.iosAppDataStream.name = ''; + const expectedHeaderRequestParams = "ios_app_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()); + client.innerApiCalls.updateIosAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.updateIosAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateIosAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateIosAppDataStreamRequest()); + request.iosAppDataStream = {}; + request.iosAppDataStream.name = ''; + const expectedHeaderRequestParams = "ios_app_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()); + client.innerApiCalls.updateIosAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIosAppDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IIosAppDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateIosAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateIosAppDataStreamRequest()); + request.iosAppDataStream = {}; + request.iosAppDataStream.name = ''; + const expectedHeaderRequestParams = "ios_app_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIosAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIosAppDataStream(request), expectedError); + assert((client.innerApiCalls.updateIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createIosAppDataStream', () => { + it('invokes createIosAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateIosAppDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()); + client.innerApiCalls.createIosAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.createIosAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createIosAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateIosAppDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()); + client.innerApiCalls.createIosAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIosAppDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IIosAppDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createIosAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateIosAppDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createIosAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createIosAppDataStream(request), expectedError); + assert((client.innerApiCalls.createIosAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getAndroidAppDataStream', () => { + it('invokes getAndroidAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetAndroidAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()); + client.innerApiCalls.getAndroidAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.getAndroidAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAndroidAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetAndroidAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()); + client.innerApiCalls.getAndroidAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAndroidAppDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAndroidAppDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAndroidAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetAndroidAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAndroidAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAndroidAppDataStream(request), expectedError); + assert((client.innerApiCalls.getAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAndroidAppDataStream', () => { + it('invokes deleteAndroidAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteAndroidAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAndroidAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAndroidAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAndroidAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteAndroidAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAndroidAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAndroidAppDataStream( + 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.deleteAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAndroidAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteAndroidAppDataStreamRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAndroidAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAndroidAppDataStream(request), expectedError); + assert((client.innerApiCalls.deleteAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateAndroidAppDataStream', () => { + it('invokes updateAndroidAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateAndroidAppDataStreamRequest()); + request.androidAppDataStream = {}; + request.androidAppDataStream.name = ''; + const expectedHeaderRequestParams = "android_app_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()); + client.innerApiCalls.updateAndroidAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.updateAndroidAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateAndroidAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateAndroidAppDataStreamRequest()); + request.androidAppDataStream = {}; + request.androidAppDataStream.name = ''; + const expectedHeaderRequestParams = "android_app_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()); + client.innerApiCalls.updateAndroidAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAndroidAppDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAndroidAppDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateAndroidAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateAndroidAppDataStreamRequest()); + request.androidAppDataStream = {}; + request.androidAppDataStream.name = ''; + const expectedHeaderRequestParams = "android_app_data_stream.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAndroidAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAndroidAppDataStream(request), expectedError); + assert((client.innerApiCalls.updateAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createAndroidAppDataStream', () => { + it('invokes createAndroidAppDataStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateAndroidAppDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()); + client.innerApiCalls.createAndroidAppDataStream = stubSimpleCall(expectedResponse); + const [response] = await client.createAndroidAppDataStream(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAndroidAppDataStream without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateAndroidAppDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()); + client.innerApiCalls.createAndroidAppDataStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAndroidAppDataStream( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAndroidAppDataStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createAndroidAppDataStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateAndroidAppDataStreamRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAndroidAppDataStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAndroidAppDataStream(request), expectedError); + assert((client.innerApiCalls.createAndroidAppDataStream as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getEnhancedMeasurementSettings', () => { + it('invokes getEnhancedMeasurementSettings without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetEnhancedMeasurementSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.EnhancedMeasurementSettings()); + client.innerApiCalls.getEnhancedMeasurementSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getEnhancedMeasurementSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnhancedMeasurementSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnhancedMeasurementSettings without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetEnhancedMeasurementSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.EnhancedMeasurementSettings()); + client.innerApiCalls.getEnhancedMeasurementSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnhancedMeasurementSettings( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnhancedMeasurementSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnhancedMeasurementSettings with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetEnhancedMeasurementSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnhancedMeasurementSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnhancedMeasurementSettings(request), expectedError); + assert((client.innerApiCalls.getEnhancedMeasurementSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateEnhancedMeasurementSettings', () => { + it('invokes updateEnhancedMeasurementSettings without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateEnhancedMeasurementSettingsRequest()); + request.enhancedMeasurementSettings = {}; + request.enhancedMeasurementSettings.name = ''; + const expectedHeaderRequestParams = "enhanced_measurement_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.EnhancedMeasurementSettings()); + client.innerApiCalls.updateEnhancedMeasurementSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateEnhancedMeasurementSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEnhancedMeasurementSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateEnhancedMeasurementSettings without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateEnhancedMeasurementSettingsRequest()); + request.enhancedMeasurementSettings = {}; + request.enhancedMeasurementSettings.name = ''; + const expectedHeaderRequestParams = "enhanced_measurement_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.EnhancedMeasurementSettings()); + client.innerApiCalls.updateEnhancedMeasurementSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEnhancedMeasurementSettings( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IEnhancedMeasurementSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateEnhancedMeasurementSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateEnhancedMeasurementSettings with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateEnhancedMeasurementSettingsRequest()); + request.enhancedMeasurementSettings = {}; + request.enhancedMeasurementSettings.name = ''; + const expectedHeaderRequestParams = "enhanced_measurement_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnhancedMeasurementSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEnhancedMeasurementSettings(request), expectedError); + assert((client.innerApiCalls.updateEnhancedMeasurementSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createFirebaseLink', () => { + it('invokes createFirebaseLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateFirebaseLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.FirebaseLink()); + client.innerApiCalls.createFirebaseLink = stubSimpleCall(expectedResponse); + const [response] = await client.createFirebaseLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createFirebaseLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateFirebaseLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.FirebaseLink()); + client.innerApiCalls.createFirebaseLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFirebaseLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IFirebaseLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createFirebaseLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateFirebaseLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFirebaseLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFirebaseLink(request), expectedError); + assert((client.innerApiCalls.createFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateFirebaseLink', () => { + it('invokes updateFirebaseLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateFirebaseLinkRequest()); + request.firebaseLink = {}; + request.firebaseLink.name = ''; + const expectedHeaderRequestParams = "firebase_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.FirebaseLink()); + client.innerApiCalls.updateFirebaseLink = stubSimpleCall(expectedResponse); + const [response] = await client.updateFirebaseLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFirebaseLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateFirebaseLinkRequest()); + request.firebaseLink = {}; + request.firebaseLink.name = ''; + const expectedHeaderRequestParams = "firebase_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.FirebaseLink()); + client.innerApiCalls.updateFirebaseLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFirebaseLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IFirebaseLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFirebaseLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateFirebaseLinkRequest()); + request.firebaseLink = {}; + request.firebaseLink.name = ''; + const expectedHeaderRequestParams = "firebase_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFirebaseLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFirebaseLink(request), expectedError); + assert((client.innerApiCalls.updateFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteFirebaseLink', () => { + it('invokes deleteFirebaseLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteFirebaseLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteFirebaseLink = stubSimpleCall(expectedResponse); + const [response] = await client.deleteFirebaseLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteFirebaseLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteFirebaseLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteFirebaseLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFirebaseLink( + 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.deleteFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteFirebaseLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteFirebaseLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFirebaseLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteFirebaseLink(request), expectedError); + assert((client.innerApiCalls.deleteFirebaseLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listFirebaseLinks', () => { + it('invokes listFirebaseLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListFirebaseLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListFirebaseLinksResponse()); + client.innerApiCalls.listFirebaseLinks = stubSimpleCall(expectedResponse); + const [response] = await client.listFirebaseLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFirebaseLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFirebaseLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListFirebaseLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListFirebaseLinksResponse()); + client.innerApiCalls.listFirebaseLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFirebaseLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IListFirebaseLinksResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFirebaseLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFirebaseLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListFirebaseLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFirebaseLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFirebaseLinks(request), expectedError); + assert((client.innerApiCalls.listFirebaseLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getGlobalSiteTag', () => { + it('invokes getGlobalSiteTag without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetGlobalSiteTagRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GlobalSiteTag()); + client.innerApiCalls.getGlobalSiteTag = stubSimpleCall(expectedResponse); + const [response] = await client.getGlobalSiteTag(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getGlobalSiteTag as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getGlobalSiteTag without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetGlobalSiteTagRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GlobalSiteTag()); + client.innerApiCalls.getGlobalSiteTag = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGlobalSiteTag( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IGlobalSiteTag|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getGlobalSiteTag as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getGlobalSiteTag with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetGlobalSiteTagRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getGlobalSiteTag = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGlobalSiteTag(request), expectedError); + assert((client.innerApiCalls.getGlobalSiteTag as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createGoogleAdsLink', () => { + it('invokes createGoogleAdsLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateGoogleAdsLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()); + client.innerApiCalls.createGoogleAdsLink = stubSimpleCall(expectedResponse); + const [response] = await client.createGoogleAdsLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createGoogleAdsLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateGoogleAdsLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()); + client.innerApiCalls.createGoogleAdsLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGoogleAdsLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IGoogleAdsLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createGoogleAdsLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.CreateGoogleAdsLinkRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createGoogleAdsLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createGoogleAdsLink(request), expectedError); + assert((client.innerApiCalls.createGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateGoogleAdsLink', () => { + it('invokes updateGoogleAdsLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateGoogleAdsLinkRequest()); + request.googleAdsLink = {}; + request.googleAdsLink.name = ''; + const expectedHeaderRequestParams = "google_ads_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()); + client.innerApiCalls.updateGoogleAdsLink = stubSimpleCall(expectedResponse); + const [response] = await client.updateGoogleAdsLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateGoogleAdsLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateGoogleAdsLinkRequest()); + request.googleAdsLink = {}; + request.googleAdsLink.name = ''; + const expectedHeaderRequestParams = "google_ads_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()); + client.innerApiCalls.updateGoogleAdsLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGoogleAdsLink( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IGoogleAdsLink|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateGoogleAdsLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.UpdateGoogleAdsLinkRequest()); + request.googleAdsLink = {}; + request.googleAdsLink.name = ''; + const expectedHeaderRequestParams = "google_ads_link.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGoogleAdsLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateGoogleAdsLink(request), expectedError); + assert((client.innerApiCalls.updateGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteGoogleAdsLink', () => { + it('invokes deleteGoogleAdsLink without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteGoogleAdsLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteGoogleAdsLink = stubSimpleCall(expectedResponse); + const [response] = await client.deleteGoogleAdsLink(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteGoogleAdsLink without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteGoogleAdsLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteGoogleAdsLink = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGoogleAdsLink( + 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.deleteGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteGoogleAdsLink with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DeleteGoogleAdsLinkRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGoogleAdsLink = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteGoogleAdsLink(request), expectedError); + assert((client.innerApiCalls.deleteGoogleAdsLink as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getDataSharingSettings', () => { + it('invokes getDataSharingSettings without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetDataSharingSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DataSharingSettings()); + client.innerApiCalls.getDataSharingSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getDataSharingSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDataSharingSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getDataSharingSettings without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetDataSharingSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.analytics.admin.v1alpha.DataSharingSettings()); + client.innerApiCalls.getDataSharingSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDataSharingSettings( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IDataSharingSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getDataSharingSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getDataSharingSettings with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.GetDataSharingSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDataSharingSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDataSharingSettings(request), expectedError); + assert((client.innerApiCalls.getDataSharingSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listAccounts', () => { + it('invokes listAccounts without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + ]; + client.innerApiCalls.listAccounts = stubSimpleCall(expectedResponse); + const [response] = await client.listAccounts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAccounts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAccounts without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + ]; + client.innerApiCalls.listAccounts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAccounts( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAccount[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAccounts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAccounts with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listAccounts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAccounts(request), expectedError); + assert((client.innerApiCalls.listAccounts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAccountsStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest()); + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + ]; + client.descriptors.page.listAccounts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.Account[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.Account) => { + 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.listAccounts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAccounts, request)); + }); + + it('invokes listAccountsStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest()); + const expectedError = new Error('expected'); + client.descriptors.page.listAccounts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.Account[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.Account) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAccounts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAccounts, request)); + }); + + it('uses async iteration with listAccounts without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest());const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Account()), + ]; + client.descriptors.page.listAccounts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IAccount[] = []; + const iterable = client.listAccountsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAccounts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listAccounts with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAccountsRequest());const expectedError = new Error('expected'); + client.descriptors.page.listAccounts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAccountsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IAccount[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAccounts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listProperties', () => { + it('invokes listProperties without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + ]; + client.innerApiCalls.listProperties = stubSimpleCall(expectedResponse); + const [response] = await client.listProperties(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listProperties as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listProperties without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + ]; + client.innerApiCalls.listProperties = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProperties( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IProperty[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listProperties as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listProperties with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listProperties = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listProperties(request), expectedError); + assert((client.innerApiCalls.listProperties as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listPropertiesStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest()); + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + ]; + client.descriptors.page.listProperties.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPropertiesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.Property[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.Property) => { + 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.listProperties.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listProperties, request)); + }); + + it('invokes listPropertiesStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest()); + const expectedError = new Error('expected'); + client.descriptors.page.listProperties.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPropertiesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.Property[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.Property) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listProperties.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listProperties, request)); + }); + + it('uses async iteration with listProperties without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest());const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.Property()), + ]; + client.descriptors.page.listProperties.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IProperty[] = []; + const iterable = client.listPropertiesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listProperties.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + + it('uses async iteration with listProperties with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListPropertiesRequest());const expectedError = new Error('expected'); + client.descriptors.page.listProperties.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPropertiesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IProperty[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listProperties.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('listUserLinks', () => { + it('invokes listUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + ]; + client.innerApiCalls.listUserLinks = stubSimpleCall(expectedResponse); + const [response] = await client.listUserLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listUserLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + ]; + client.innerApiCalls.listUserLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUserLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IUserLink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listUserLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listUserLinks(request), expectedError); + assert((client.innerApiCalls.listUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listUserLinksStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + ]; + client.descriptors.page.listUserLinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listUserLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.UserLink[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.UserLink) => { + 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.listUserLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUserLinks, request)); + assert.strictEqual( + (client.descriptors.page.listUserLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listUserLinksStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listUserLinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listUserLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.UserLink[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.UserLink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listUserLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listUserLinks, request)); + assert.strictEqual( + (client.descriptors.page.listUserLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.UserLink()), + ]; + client.descriptors.page.listUserLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IUserLink[] = []; + const iterable = client.listUserLinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listUserLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listUserLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listUserLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUserLinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IUserLink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listUserLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listUserLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('auditUserLinks', () => { + it('invokes auditUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + ]; + client.innerApiCalls.auditUserLinks = stubSimpleCall(expectedResponse); + const [response] = await client.auditUserLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.auditUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes auditUserLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + ]; + client.innerApiCalls.auditUserLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.auditUserLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAuditUserLink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.auditUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes auditUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.auditUserLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.auditUserLinks(request), expectedError); + assert((client.innerApiCalls.auditUserLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes auditUserLinksStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + ]; + client.descriptors.page.auditUserLinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.auditUserLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.AuditUserLink[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.AuditUserLink) => { + 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.auditUserLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.auditUserLinks, request)); + assert.strictEqual( + (client.descriptors.page.auditUserLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes auditUserLinksStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.auditUserLinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.auditUserLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.AuditUserLink[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.AuditUserLink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.auditUserLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.auditUserLinks, request)); + assert.strictEqual( + (client.descriptors.page.auditUserLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with auditUserLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLink()), + ]; + client.descriptors.page.auditUserLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IAuditUserLink[] = []; + const iterable = client.auditUserLinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.auditUserLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.auditUserLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with auditUserLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.AuditUserLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.auditUserLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.auditUserLinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IAuditUserLink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.auditUserLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.auditUserLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listWebDataStreams', () => { + it('invokes listWebDataStreams without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + ]; + client.innerApiCalls.listWebDataStreams = stubSimpleCall(expectedResponse); + const [response] = await client.listWebDataStreams(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listWebDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listWebDataStreams without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + ]; + client.innerApiCalls.listWebDataStreams = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWebDataStreams( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IWebDataStream[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listWebDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listWebDataStreams with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listWebDataStreams = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWebDataStreams(request), expectedError); + assert((client.innerApiCalls.listWebDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listWebDataStreamsStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + ]; + client.descriptors.page.listWebDataStreams.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWebDataStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.WebDataStream[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.WebDataStream) => { + 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.listWebDataStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWebDataStreams, request)); + assert.strictEqual( + (client.descriptors.page.listWebDataStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listWebDataStreamsStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listWebDataStreams.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWebDataStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.WebDataStream[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.WebDataStream) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWebDataStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWebDataStreams, request)); + assert.strictEqual( + (client.descriptors.page.listWebDataStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listWebDataStreams without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.WebDataStream()), + ]; + client.descriptors.page.listWebDataStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IWebDataStream[] = []; + const iterable = client.listWebDataStreamsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWebDataStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listWebDataStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listWebDataStreams with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListWebDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listWebDataStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWebDataStreamsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IWebDataStream[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWebDataStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listWebDataStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listIosAppDataStreams', () => { + it('invokes listIosAppDataStreams without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + ]; + client.innerApiCalls.listIosAppDataStreams = stubSimpleCall(expectedResponse); + const [response] = await client.listIosAppDataStreams(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIosAppDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIosAppDataStreams without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + ]; + client.innerApiCalls.listIosAppDataStreams = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIosAppDataStreams( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IIosAppDataStream[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIosAppDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listIosAppDataStreams with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listIosAppDataStreams = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIosAppDataStreams(request), expectedError); + assert((client.innerApiCalls.listIosAppDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIosAppDataStreamsStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + ]; + client.descriptors.page.listIosAppDataStreams.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listIosAppDataStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.IosAppDataStream[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.IosAppDataStream) => { + 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.listIosAppDataStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIosAppDataStreams, request)); + assert.strictEqual( + (client.descriptors.page.listIosAppDataStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listIosAppDataStreamsStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listIosAppDataStreams.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listIosAppDataStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.IosAppDataStream[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.IosAppDataStream) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listIosAppDataStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listIosAppDataStreams, request)); + assert.strictEqual( + (client.descriptors.page.listIosAppDataStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIosAppDataStreams without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.IosAppDataStream()), + ]; + client.descriptors.page.listIosAppDataStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IIosAppDataStream[] = []; + const iterable = client.listIosAppDataStreamsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIosAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listIosAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIosAppDataStreams with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListIosAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listIosAppDataStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listIosAppDataStreamsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IIosAppDataStream[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIosAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listIosAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listAndroidAppDataStreams', () => { + it('invokes listAndroidAppDataStreams without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + ]; + client.innerApiCalls.listAndroidAppDataStreams = stubSimpleCall(expectedResponse); + const [response] = await client.listAndroidAppDataStreams(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAndroidAppDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAndroidAppDataStreams without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + ]; + client.innerApiCalls.listAndroidAppDataStreams = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAndroidAppDataStreams( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IAndroidAppDataStream[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAndroidAppDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAndroidAppDataStreams with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAndroidAppDataStreams = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAndroidAppDataStreams(request), expectedError); + assert((client.innerApiCalls.listAndroidAppDataStreams as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAndroidAppDataStreamsStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + ]; + client.descriptors.page.listAndroidAppDataStreams.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAndroidAppDataStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.AndroidAppDataStream[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.AndroidAppDataStream) => { + 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.listAndroidAppDataStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAndroidAppDataStreams, request)); + assert.strictEqual( + (client.descriptors.page.listAndroidAppDataStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAndroidAppDataStreamsStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAndroidAppDataStreams.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAndroidAppDataStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.AndroidAppDataStream[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.AndroidAppDataStream) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAndroidAppDataStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAndroidAppDataStreams, request)); + assert.strictEqual( + (client.descriptors.page.listAndroidAppDataStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAndroidAppDataStreams without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.AndroidAppDataStream()), + ]; + client.descriptors.page.listAndroidAppDataStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IAndroidAppDataStream[] = []; + const iterable = client.listAndroidAppDataStreamsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAndroidAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAndroidAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAndroidAppDataStreams with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListAndroidAppDataStreamsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAndroidAppDataStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAndroidAppDataStreamsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IAndroidAppDataStream[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAndroidAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAndroidAppDataStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listGoogleAdsLinks', () => { + it('invokes listGoogleAdsLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + ]; + client.innerApiCalls.listGoogleAdsLinks = stubSimpleCall(expectedResponse); + const [response] = await client.listGoogleAdsLinks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listGoogleAdsLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listGoogleAdsLinks without error using callback', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + ]; + client.innerApiCalls.listGoogleAdsLinks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGoogleAdsLinks( + request, + (err?: Error|null, result?: protos.google.analytics.admin.v1alpha.IGoogleAdsLink[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listGoogleAdsLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listGoogleAdsLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listGoogleAdsLinks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listGoogleAdsLinks(request), expectedError); + assert((client.innerApiCalls.listGoogleAdsLinks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listGoogleAdsLinksStream without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + ]; + client.descriptors.page.listGoogleAdsLinks.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listGoogleAdsLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.GoogleAdsLink[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.GoogleAdsLink) => { + 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.listGoogleAdsLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listGoogleAdsLinks, request)); + assert.strictEqual( + (client.descriptors.page.listGoogleAdsLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listGoogleAdsLinksStream with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listGoogleAdsLinks.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listGoogleAdsLinksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.analytics.admin.v1alpha.GoogleAdsLink[] = []; + stream.on('data', (response: protos.google.analytics.admin.v1alpha.GoogleAdsLink) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listGoogleAdsLinks.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listGoogleAdsLinks, request)); + assert.strictEqual( + (client.descriptors.page.listGoogleAdsLinks.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listGoogleAdsLinks without error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + generateSampleMessage(new protos.google.analytics.admin.v1alpha.GoogleAdsLink()), + ]; + client.descriptors.page.listGoogleAdsLinks.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.analytics.admin.v1alpha.IGoogleAdsLink[] = []; + const iterable = client.listGoogleAdsLinksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listGoogleAdsLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listGoogleAdsLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listGoogleAdsLinks with error', async () => { + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listGoogleAdsLinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGoogleAdsLinksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.analytics.admin.v1alpha.IGoogleAdsLink[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listGoogleAdsLinks.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listGoogleAdsLinks.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('account', () => { + const fakePath = "/rendered/path/account"; + const expectedParameters = { + account: "accountValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accountPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accountPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accountPath', () => { + const result = client.accountPath("accountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accountPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccountFromAccountName', () => { + const result = client.matchAccountFromAccountName(fakePath); + assert.strictEqual(result, "accountValue"); + assert((client.pathTemplates.accountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('accountUserLink', () => { + const fakePath = "/rendered/path/accountUserLink"; + const expectedParameters = { + account: "accountValue", + user_link: "userLinkValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accountUserLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accountUserLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accountUserLinkPath', () => { + const result = client.accountUserLinkPath("accountValue", "userLinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accountUserLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccountFromAccountUserLinkName', () => { + const result = client.matchAccountFromAccountUserLinkName(fakePath); + assert.strictEqual(result, "accountValue"); + assert((client.pathTemplates.accountUserLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserLinkFromAccountUserLinkName', () => { + const result = client.matchUserLinkFromAccountUserLinkName(fakePath); + assert.strictEqual(result, "userLinkValue"); + assert((client.pathTemplates.accountUserLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('androidAppDataStream', () => { + const fakePath = "/rendered/path/androidAppDataStream"; + const expectedParameters = { + property: "propertyValue", + android_app_data_stream: "androidAppDataStreamValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.androidAppDataStreamPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.androidAppDataStreamPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('androidAppDataStreamPath', () => { + const result = client.androidAppDataStreamPath("propertyValue", "androidAppDataStreamValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.androidAppDataStreamPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromAndroidAppDataStreamName', () => { + const result = client.matchPropertyFromAndroidAppDataStreamName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.androidAppDataStreamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAndroidAppDataStreamFromAndroidAppDataStreamName', () => { + const result = client.matchAndroidAppDataStreamFromAndroidAppDataStreamName(fakePath); + assert.strictEqual(result, "androidAppDataStreamValue"); + assert((client.pathTemplates.androidAppDataStreamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('dataSharingSettings', () => { + const fakePath = "/rendered/path/dataSharingSettings"; + const expectedParameters = { + account: "accountValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.dataSharingSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.dataSharingSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('dataSharingSettingsPath', () => { + const result = client.dataSharingSettingsPath("accountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.dataSharingSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccountFromDataSharingSettingsName', () => { + const result = client.matchAccountFromDataSharingSettingsName(fakePath); + assert.strictEqual(result, "accountValue"); + assert((client.pathTemplates.dataSharingSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('enhancedMeasurementSettings', () => { + const fakePath = "/rendered/path/enhancedMeasurementSettings"; + const expectedParameters = { + property: "propertyValue", + web_data_stream: "webDataStreamValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.enhancedMeasurementSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.enhancedMeasurementSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('enhancedMeasurementSettingsPath', () => { + const result = client.enhancedMeasurementSettingsPath("propertyValue", "webDataStreamValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.enhancedMeasurementSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromEnhancedMeasurementSettingsName', () => { + const result = client.matchPropertyFromEnhancedMeasurementSettingsName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.enhancedMeasurementSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWebDataStreamFromEnhancedMeasurementSettingsName', () => { + const result = client.matchWebDataStreamFromEnhancedMeasurementSettingsName(fakePath); + assert.strictEqual(result, "webDataStreamValue"); + assert((client.pathTemplates.enhancedMeasurementSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('firebaseLink', () => { + const fakePath = "/rendered/path/firebaseLink"; + const expectedParameters = { + property: "propertyValue", + firebase_link: "firebaseLinkValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.firebaseLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.firebaseLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('firebaseLinkPath', () => { + const result = client.firebaseLinkPath("propertyValue", "firebaseLinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.firebaseLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromFirebaseLinkName', () => { + const result = client.matchPropertyFromFirebaseLinkName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.firebaseLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFirebaseLinkFromFirebaseLinkName', () => { + const result = client.matchFirebaseLinkFromFirebaseLinkName(fakePath); + assert.strictEqual(result, "firebaseLinkValue"); + assert((client.pathTemplates.firebaseLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('globalSiteTag', () => { + const fakePath = "/rendered/path/globalSiteTag"; + const expectedParameters = { + property: "propertyValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.globalSiteTagPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.globalSiteTagPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('globalSiteTagPath', () => { + const result = client.globalSiteTagPath("propertyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.globalSiteTagPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromGlobalSiteTagName', () => { + const result = client.matchPropertyFromGlobalSiteTagName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.globalSiteTagPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('googleAdsLink', () => { + const fakePath = "/rendered/path/googleAdsLink"; + const expectedParameters = { + property: "propertyValue", + google_ads_link: "googleAdsLinkValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.googleAdsLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.googleAdsLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('googleAdsLinkPath', () => { + const result = client.googleAdsLinkPath("propertyValue", "googleAdsLinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.googleAdsLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromGoogleAdsLinkName', () => { + const result = client.matchPropertyFromGoogleAdsLinkName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.googleAdsLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchGoogleAdsLinkFromGoogleAdsLinkName', () => { + const result = client.matchGoogleAdsLinkFromGoogleAdsLinkName(fakePath); + assert.strictEqual(result, "googleAdsLinkValue"); + assert((client.pathTemplates.googleAdsLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('iosAppDataStream', () => { + const fakePath = "/rendered/path/iosAppDataStream"; + const expectedParameters = { + property: "propertyValue", + ios_app_data_stream: "iosAppDataStreamValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.iosAppDataStreamPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.iosAppDataStreamPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('iosAppDataStreamPath', () => { + const result = client.iosAppDataStreamPath("propertyValue", "iosAppDataStreamValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.iosAppDataStreamPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromIosAppDataStreamName', () => { + const result = client.matchPropertyFromIosAppDataStreamName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.iosAppDataStreamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIosAppDataStreamFromIosAppDataStreamName', () => { + const result = client.matchIosAppDataStreamFromIosAppDataStreamName(fakePath); + assert.strictEqual(result, "iosAppDataStreamValue"); + assert((client.pathTemplates.iosAppDataStreamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('property', () => { + const fakePath = "/rendered/path/property"; + const expectedParameters = { + property: "propertyValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.propertyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.propertyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('propertyPath', () => { + const result = client.propertyPath("propertyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.propertyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromPropertyName', () => { + const result = client.matchPropertyFromPropertyName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.propertyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('propertyUserLink', () => { + const fakePath = "/rendered/path/propertyUserLink"; + const expectedParameters = { + property: "propertyValue", + user_link: "userLinkValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.propertyUserLinkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.propertyUserLinkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('propertyUserLinkPath', () => { + const result = client.propertyUserLinkPath("propertyValue", "userLinkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.propertyUserLinkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromPropertyUserLinkName', () => { + const result = client.matchPropertyFromPropertyUserLinkName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.propertyUserLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchUserLinkFromPropertyUserLinkName', () => { + const result = client.matchUserLinkFromPropertyUserLinkName(fakePath); + assert.strictEqual(result, "userLinkValue"); + assert((client.pathTemplates.propertyUserLinkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('webDataStream', () => { + const fakePath = "/rendered/path/webDataStream"; + const expectedParameters = { + property: "propertyValue", + web_data_stream: "webDataStreamValue", + }; + const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webDataStreamPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.webDataStreamPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('webDataStreamPath', () => { + const result = client.webDataStreamPath("propertyValue", "webDataStreamValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.webDataStreamPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchPropertyFromWebDataStreamName', () => { + const result = client.matchPropertyFromWebDataStreamName(fakePath); + assert.strictEqual(result, "propertyValue"); + assert((client.pathTemplates.webDataStreamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWebDataStreamFromWebDataStreamName', () => { + const result = client.matchWebDataStreamFromWebDataStreamName(fakePath); + assert.strictEqual(result, "webDataStreamValue"); + assert((client.pathTemplates.webDataStreamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/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/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..6371c0f --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,64 @@ +// 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 +// +// 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: 'AnalyticsAdminService', + filename: './analytics-admin-service.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', +};